コード例 #1
0
        public void OnClientEvent(Client client, string eventName, params object[] arguments)
        {
            List <SpawnPosition> spawnList;

            switch (eventName)
            {
            case "SpawnMove":
                if (!client.hasData("spawnlist"))
                {
                    return;
                }
                spawnList = client.getData("spawnlist");
                API.moveEntityPosition(client, spawnList[(int)arguments[0]].Position, 1000);
                API.triggerClientEvent(client, "SpawnMovePed");
                client.rotation = new Vector3(0, 0, 0);
                break;

            case "SpawnSelected":
                if (!client.hasData("spawnlist"))
                {
                    return;
                }
                spawnList = client.getData("spawnlist");
                API.triggerClientEvent(client, "SpawnMenu_Close");
                client.rotation = spawnList[(int)arguments[0]].Rotation;
                spawnList.Clear();
                client.resetData("spawnlist");
                CharacterService.ShowPlayerHUD(client, true);
                client.dimension = 0;
                if (!client.hasData("player"))
                {
                    return;
                }
                Player player = client.getData("player");
                if (player.Character.OnDuty)
                {
                    if (player.Character.Faction != FactionType.Citizen)
                    {
                        switch (player.Character.Faction)
                        {
                        case FactionType.Police:
                            PoliceService.SetOnDuty(client, true);
                            break;

                        case FactionType.EMS:
                            EMSService.SetOnDuty(client, true);
                            break;
                        }
                    }
                    else
                    {
                        player.Character.OnDuty = false;
                    }
                }
                CharacterService.GivePlayerWeapons(client);
                break;
            }
        }
コード例 #2
0
        private void CheckDoors(Client client, Player player)
        {
            if (client.position.DistanceTo(new Vector3(460.1322, -990.9448, 30.6896)) <= 2)
            {
                if (client.hasSyncedData("onduty"))
                {
                    PoliceService.SetOnDuty(client, false);
                }
                else
                {
                    PoliceService.SetOnDuty(client, true);
                }
                return;
            }

            if (client.position.DistanceTo(new Vector3(434.6926, -981.8649, 30.71322)) <= 1)             // Mission Row Main Doors
            {
                DoorService.ToggleDoorState(19);
                if (DoorService.ToggleDoorState(18))
                {
                    API.sendNotificationToPlayer(client, "~r~Locked ~w~Door");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~g~Unlocked ~w~Door");
                }
                return;
            }

            if (client.position.DistanceTo(new Vector3(464.3711, -983.8344, 43.69287)) <= 1)             // Mission Row Top Door
            {
                if (DoorService.ToggleDoorState(27))
                {
                    API.sendNotificationToPlayer(client, "~r~Locked ~w~Door");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~g~Unlocked ~w~Door");
                }
                return;
            }

            if (client.position.DistanceTo(new Vector3(463.7195, -992.5253, 24.91487)) <= 1)             // Mission Row Main Cell Door
            {
                if (DoorService.ToggleDoorState(26))
                {
                    API.sendNotificationToPlayer(client, "~r~Locked ~w~Door");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~g~Unlocked ~w~Door");
                }
                return;
            }

            if (client.position.DistanceTo(new Vector3(464.1983, -1003.415, 24.91487)) <= 1)             // Mission Row Back Cell Door (Not Working)
            {
                if (DoorService.ToggleDoorState(20))
                {
                    API.sendNotificationToPlayer(client, "~r~Locked ~w~Door");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~g~Unlocked ~w~Door");
                }
                return;
            }

            if (client.position.DistanceTo(new Vector3(462.0896, -993.7011, 24.91486)) <= 1)             // Mission Row Cell Door Right
            {
                if (!player.Character.OnDuty)
                {
                    return;
                }
                if (DoorService.ToggleDoorState(23))
                {
                    API.sendNotificationToPlayer(client, "~r~Locked ~w~Door");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~g~Unlocked ~w~Door");
                }
                return;
            }

            if (client.position.DistanceTo(new Vector3(462.0993, -998.6472, 24.91486)) <= 1)             // Mission Row Cell Door Middle
            {
                if (!player.Character.OnDuty)
                {
                    return;
                }
                if (DoorService.ToggleDoorState(24))
                {
                    API.sendNotificationToPlayer(client, "~r~Locked ~w~Door");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~g~Unlocked ~w~Door");
                }
                return;
            }

            if (client.position.DistanceTo(new Vector3(462.2214, -1002.128, 24.91486)) <= 1)             // Mission Row Cell Door Left
            {
                if (!player.Character.OnDuty)
                {
                    return;
                }
                if (DoorService.ToggleDoorState(25))
                {
                    API.sendNotificationToPlayer(client, "~r~Locked ~w~Door");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~g~Unlocked ~w~Door");
                }
                return;
            }

            if (client.position.DistanceTo(new Vector3(468.6248, -1014.067, 26.38638)) <= 1)             // Mission Row Back Doors
            {
                if (DoorService.ToggleDoorState(20))
                {
                    API.sendNotificationToPlayer(client, "~r~Locked ~w~Door");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~g~Unlocked ~w~Door");
                }
                DoorService.ToggleDoorState(21);
                return;
            }
            return;
        }