Exemple #1
0
        public static void ResetClothes(Client client)
        {
            int           client_id     = client.GetData("ID");
            PlayerClothes playerClothes = PlayerHelper.GetPlayerClothes(client);

            if (playerClothes == null)
            {
                playerClothes     = new PlayerClothes();
                playerClothes._id = client_id;
                playerClothes.Upsert();
            }

            if (playerClothes._id == client_id)
            {
                client.SetClothes(1, playerClothes.clothes_1, 0);
                client.SetClothes(2, playerClothes.clothes_2, 0);
                client.SetClothes(3, playerClothes.clothes_3, 0);
                client.SetClothes(4, playerClothes.clothes_4, 0);
                client.SetClothes(5, playerClothes.clothes_5, 0);
                client.SetClothes(6, playerClothes.clothes_6, 0);
                client.SetClothes(7, playerClothes.clothes_7, 0);
                client.SetClothes(8, playerClothes.clothes_8, 0);
                client.SetClothes(9, playerClothes.clothes_9, 0);
                client.SetClothes(10, playerClothes.clothes_10, 0);
                client.SetClothes(11, playerClothes.clothes_11, 0);
            }
        }
Exemple #2
0
 // Start is called before the first frame update
 void Start()
 {
     //player = GameObject.FindGameObjectWithTag("Player");
     _player = FindObjectOfType <PlayerClothes>();
     foreach (var item in items)
     {
         _uiScript.CreatePanelItem(item.Key, item.Value);
     }
     Cursor.visible   = false;
     Cursor.lockState = CursorLockMode.Locked;
 }
        /// <summary>
        /// Конвертация моделей в сущности
        /// </summary>
        public static List <PlayerClothes> ConvertToEntities(long accountId, IEnumerable <ClothesModel> models)
        {
            var result = new List <PlayerClothes>();

            foreach (var model in models)
            {
                var entity = new PlayerClothes {
                    AccountId  = accountId,
                    Variation  = model.Variation,
                    Slot       = model.Slot,
                    Torso      = model.Torso,
                    Undershirt = model.Undershirt,
                    Texture    = model.Texture,
                    Textures   = string.Join(",", model.Textures),
                    OnPlayer   = model.OnPlayer,
                    IsClothes  = model.IsClothes
                };
                result.Add(entity);
            }
            return(result);
        }
Exemple #4
0
        public static void OffDuty(Client client)
        {
            PlayerClothes playerClothes = PlayerHelper.GetPlayerClothes(client);

            client.SetClothes(1, playerClothes.clothes_1, 0);
            client.SetClothes(2, playerClothes.clothes_2, 0);
            client.SetClothes(3, playerClothes.clothes_3, 0);
            client.SetClothes(4, playerClothes.clothes_4, 0);
            client.SetClothes(5, playerClothes.clothes_5, 0);
            client.SetClothes(6, playerClothes.clothes_6, 0);
            client.SetClothes(7, playerClothes.clothes_7, 0);
            client.SetClothes(8, playerClothes.clothes_8, 0);
            client.SetClothes(9, playerClothes.clothes_9, 0);
            client.SetClothes(10, playerClothes.clothes_10, 0);
            client.SetClothes(11, playerClothes.clothes_11, 0);

            client.RemoveAllWeapons();

            if (client.HasData("FrakVehicle"))
            {
                Vehicle previous_vehicle = client.GetData("FrakVehicle");
                previous_vehicle.Delete();
                client.ResetData("FrakVehicle");
                client.SendNotification("Votre véhicule de faction a été supprimé!");
            }

            if (client.HasData("onduty"))
            {
                client.ResetData("onduty");
            }

            if (client.HasData("fonduty"))
            {
                client.ResetData("fonduty");
            }

            client.SendNotification("Vous n'êtes plus en service!");
        }
Exemple #5
0
        public static void OffDuty(Client client)
        {
            PlayerClothes playerClothes = PlayerHelper.GetPlayerClothes(client);

            client.SetClothes(1, playerClothes.clothes_1, 0);
            client.SetClothes(2, playerClothes.clothes_2, 0);
            client.SetClothes(3, playerClothes.clothes_3, 0);
            client.SetClothes(4, playerClothes.clothes_4, 0);
            client.SetClothes(5, playerClothes.clothes_5, 0);
            client.SetClothes(6, playerClothes.clothes_6, 0);
            client.SetClothes(7, playerClothes.clothes_7, 0);
            client.SetClothes(8, playerClothes.clothes_8, 0);
            client.SetClothes(9, playerClothes.clothes_9, 0);
            client.SetClothes(10, playerClothes.clothes_10, 0);
            client.SetClothes(11, playerClothes.clothes_11, 0);

            client.RemoveAllWeapons();

            if (client.HasData("FrakVehicle"))
            {
                Vehicle previous_vehicle = client.GetData("FrakVehicle");
                previous_vehicle.Delete();
                client.ResetData("FrakVehicle");
                client.SendNotification("Dein Fraktionsfahrzeug wurde gelöscht!");
            }

            if (client.HasData("onduty"))
            {
                client.ResetData("onduty");
            }

            if (client.HasData("fonduty"))
            {
                client.ResetData("fonduty");
            }

            client.SendNotification("Du bist nun nicht mehr im Dienst!");
        }
    public void Start()
    {
        //get spriterenderer components of each character part
        //(use these .sprite attributes to set sprites)
        SpriteRenderer BodySprite    = PlayerBody.GetComponent <SpriteRenderer>();
        SpriteRenderer EyesSprite    = PlayerEyes.GetComponent <SpriteRenderer>();
        SpriteRenderer MouthSprite   = PlayerMouth.GetComponent <SpriteRenderer>();
        SpriteRenderer HairSprite    = PlayerHair.GetComponent <SpriteRenderer>();
        SpriteRenderer ClothesSprite = PlayerClothes.GetComponent <SpriteRenderer>();
        SpriteRenderer HatSprite     = PlayerHat.GetComponent <SpriteRenderer>();
        SpriteRenderer AnimalSprite  = PlayerAnimal.GetComponent <SpriteRenderer>();

        //check all parts
        //body
        switch (PlayerPrefs.GetInt("PlayerBody", 0))
        {
        case (0):
            BodySprite.sprite = Body1;
            break;

        case (1):
            BodySprite.sprite = Body2;
            break;

        case (2):
            BodySprite.sprite = Body3;
            break;

        case (3):
            BodySprite.sprite = Body4;
            break;
        }

        //eyes
        switch (PlayerPrefs.GetInt("PlayerEyes", 0))
        {
        case (0):
            EyesSprite.sprite = Eyes1;
            break;

        case (1):
            EyesSprite.sprite = Eyes2;
            break;

        case (2):
            EyesSprite.sprite = Eyes3;
            break;

        case (3):
            EyesSprite.sprite = Eyes4;
            break;
        }

        //mouth
        switch (PlayerPrefs.GetInt("PlayerMouth", 0))
        {
        case (0):
            MouthSprite.sprite = Mouth1;
            break;

        case (1):
            MouthSprite.sprite = Mouth2;
            break;
        }

        //hair
        switch (PlayerPrefs.GetInt("PlayerHair", 0))
        {
        case (0):
            HairSprite.sprite = Hair1;
            break;

        case (1):

            break;
        }

        //clothes
        switch (PlayerPrefs.GetInt("PlayerClothes", 0))
        {
        case (0):
            ClothesSprite.sprite = Robe1Red;
            break;

        case (1):
            ClothesSprite.sprite = Robe1Blue;
            break;

        case (2):
            ClothesSprite.sprite = Robe1Green;
            break;

        case (3):
            ClothesSprite.sprite = Robe1Grey;
            break;

        case (4):
            ClothesSprite.sprite = Robe1Orange;
            break;

        case (5):
            ClothesSprite.sprite = Robe1Purple;
            break;

        case (6):
            ClothesSprite.sprite = Robe2Red;
            break;

        case (7):
            ClothesSprite.sprite = Robe2Blue;
            break;

        case (8):
            ClothesSprite.sprite = Robe2Green;
            break;

        case (9):
            ClothesSprite.sprite = Robe2Grey;
            break;

        case (10):
            ClothesSprite.sprite = Robe2Orange;
            break;

        case (11):
            ClothesSprite.sprite = Robe2Purple;
            break;

        case (12):
            ClothesSprite.sprite = Robe3Red;
            break;

        case (13):
            ClothesSprite.sprite = Robe3Blue;
            break;

        case (14):
            ClothesSprite.sprite = Robe3Green;
            break;

        case (15):
            ClothesSprite.sprite = Robe3Grey;
            break;

        case (16):
            ClothesSprite.sprite = Robe3Orange;
            break;

        case (17):
            ClothesSprite.sprite = Robe3Purple;
            break;

        case (18):
            ClothesSprite.sprite = Clothes1;
            break;
        }

        //hat
        switch (PlayerPrefs.GetInt("PlayerHat", 0))
        {
        case (0):
            HatSprite.sprite = Hat1;
            break;

        case (1):

            break;
        }

        //animal
        switch (PlayerPrefs.GetInt("PlayerAnimal", 0))
        {
        case (0):
            AnimalSprite.sprite = Bunny;
            break;

        case (1):
            AnimalSprite.sprite = Turtle;
            break;
        }
    }
Exemple #7
0
        public static void Respawn(Client client)
        {
            PlayerClothes playerClothes = PlayerHelper.GetPlayerClothes(client);
            PlayerInfo    playerInfo    = PlayerHelper.GetPlayerStats(client);

            if (playerClothes == null)
            {
                playerClothes     = new PlayerClothes();
                playerClothes._id = playerInfo._id;
                playerClothes.Upsert();
            }

            client.SetClothes(1, playerClothes.clothes_1, 0);
            client.SetClothes(2, playerClothes.clothes_2, 0);
            client.SetClothes(3, playerClothes.clothes_3, 0);
            client.SetClothes(4, playerClothes.clothes_4, 0);
            client.SetClothes(5, playerClothes.clothes_5, 0);
            client.SetClothes(6, playerClothes.clothes_6, 0);
            client.SetClothes(7, playerClothes.clothes_7, 0);
            client.SetClothes(8, playerClothes.clothes_8, 0);
            client.SetClothes(9, playerClothes.clothes_9, 0);
            client.SetClothes(10, playerClothes.clothes_10, 0);
            client.SetClothes(11, playerClothes.clothes_11, 0);

            if (client.HasData("FrakVehicle"))
            {
                Vehicle previous_vehicle = client.GetData("FrakVehicle");
                previous_vehicle.Delete();
                client.ResetData("FrakVehicle");
                client.SendNotification("Votre véhicule de faction a été supprimé!");
            }

            if (client.HasData("onduty"))
            {
                client.ResetData("onduty");
                client.SendNotification("Vous n'êtes plus en service!");
            }

            if (client.HasData("fonduty"))
            {
                client.ResetData("fonduty");
                client.SendNotification("Vous n'êtes plus en service!");
            }

            if (playerInfo.jail == 1)
            {
                TimeSpan ts = TimeSpan.FromMilliseconds(playerInfo.jailtime);

                client.Position = playerInfo.GetLastTempLocation();
                client.RemoveAllWeapons();

                if (playerInfo.wantedlevel == 1)
                {
                    playerInfo.jailtime += 60000;
                }
                else if (playerInfo.wantedlevel == 2)
                {
                    playerInfo.jailtime += 120000;
                }
                else if (playerInfo.wantedlevel == 3)
                {
                    playerInfo.jailtime += 180000;
                }
                else if (playerInfo.wantedlevel == 4)
                {
                    playerInfo.jailtime += 240000;
                }
                else if (playerInfo.wantedlevel == 5)
                {
                    playerInfo.jailtime += 300000;
                }
                else if (playerInfo.wantedlevel >= 6)
                {
                    playerInfo.jailtime += 360000;
                }

                playerInfo.wantedlevel = 0;
                playerInfo.cuff        = 0;
                playerInfo.Update();

                NAPI.ClientEvent.TriggerClientEvent(client, "JailTrue");
                client.SendNotification("[~b~LSPD~w~]: S'il vous plaît ne vous déconnectez pas ou vous serez assis à nouveau pendant si longtemps!");

                client.SendNotification($"[~b~LSPD~w~]: Vous êtes assis pour ~r~{ts.Minutes}~w~ Minutes.");

                NAPI.Task.Run(() =>
                {
                    NAPI.ClientEvent.TriggerClientEvent(client, "JailFalse");
                    client.SendNotification("[~b~LSPD~w~]: Vous êtes libre maintenant!");
                    playerInfo.jail     = 0;
                    playerInfo.jailtime = 0;
                    playerInfo.Update();
                    Respawn(client);
                }, delayTime: playerInfo.jailtime);
            }
            else
            {
                client.Position = playerInfo.GetLastPlayerLocation();
            }

            EventTriggers.Update_Wanteds(client);
            EventTriggers.Update_Money(client);
            EventTriggers.Update_Bank(client);

            client.SendNotification("~g~Vous etes réapparu!");
        }
Exemple #8
0
        public static void Respawn(Client client)
        {
            PlayerClothes playerClothes = PlayerHelper.GetPlayerClothes(client);
            PlayerInfo    playerInfo    = PlayerHelper.GetPlayerStats(client);

            if (playerClothes == null)
            {
                playerClothes     = new PlayerClothes();
                playerClothes._id = playerInfo._id;
                playerClothes.Upsert();
            }

            client.SetClothes(1, playerClothes.clothes_1, 0);
            client.SetClothes(2, playerClothes.clothes_2, 0);
            client.SetClothes(3, playerClothes.clothes_3, 0);
            client.SetClothes(4, playerClothes.clothes_4, 0);
            client.SetClothes(5, playerClothes.clothes_5, 0);
            client.SetClothes(6, playerClothes.clothes_6, 0);
            client.SetClothes(7, playerClothes.clothes_7, 0);
            client.SetClothes(8, playerClothes.clothes_8, 0);
            client.SetClothes(9, playerClothes.clothes_9, 0);
            client.SetClothes(10, playerClothes.clothes_10, 0);
            client.SetClothes(11, playerClothes.clothes_11, 0);

            if (client.HasData("FrakVehicle"))
            {
                Vehicle previous_vehicle = client.GetData("FrakVehicle");
                previous_vehicle.Delete();
                client.ResetData("FrakVehicle");
                client.SendNotification("Dein Fraktionsfahrzeug wurde gelöscht!");
            }

            if (client.HasData("onduty"))
            {
                client.ResetData("onduty");
                client.SendNotification("Du bist nun nicht mehr im Dienst!");
            }

            if (client.HasData("fonduty"))
            {
                client.ResetData("fonduty");
                client.SendNotification("Du bist nun nicht mehr im Dienst!");
            }

            if (playerInfo.jail == 1)
            {
                TimeSpan ts = TimeSpan.FromMilliseconds(playerInfo.jailtime);

                client.Position = playerInfo.GetLastTempLocation();
                client.RemoveAllWeapons();

                if (playerInfo.wantedlevel == 1)
                {
                    playerInfo.jailtime += 60000;
                }
                else if (playerInfo.wantedlevel == 2)
                {
                    playerInfo.jailtime += 120000;
                }
                else if (playerInfo.wantedlevel == 3)
                {
                    playerInfo.jailtime += 180000;
                }
                else if (playerInfo.wantedlevel == 4)
                {
                    playerInfo.jailtime += 240000;
                }
                else if (playerInfo.wantedlevel == 5)
                {
                    playerInfo.jailtime += 300000;
                }
                else if (playerInfo.wantedlevel >= 6)
                {
                    playerInfo.jailtime += 360000;
                }

                playerInfo.wantedlevel = 0;
                playerInfo.cuff        = 0;
                playerInfo.Update();

                NAPI.ClientEvent.TriggerClientEvent(client, "JailTrue");
                client.SendNotification("[~b~LSPD~w~]: Bitte logge dich nicht aus sonst sitzt du wieder so lange!");

                client.SendNotification($"[~b~LSPD~w~]: Du sitzt für ~r~{ts.Minutes}~w~ Minuten.");

                NAPI.Task.Run(() =>
                {
                    NAPI.ClientEvent.TriggerClientEvent(client, "JailFalse");
                    client.SendNotification("[~b~LSPD~w~]: Du bist nun frei!");
                    playerInfo.jail     = 0;
                    playerInfo.jailtime = 0;
                    playerInfo.Update();
                    Respawn(client);
                }, delayTime: playerInfo.jailtime);
            }
            else
            {
                client.Position = playerInfo.GetLastPlayerLocation();
            }

            EventTriggers.Update_Wanteds(client);
            EventTriggers.Update_Money(client);
            EventTriggers.Update_Bank(client);

            client.SendNotification("~g~Du wurdest respawnt!");
        }