Example #1
0
        public void SetCharacterIntoCreatorEvent(Client player)
        {
            // Change player's skin
            NAPI.Player.SetPlayerSkin(player, PedHash.FreemodeMale01);

            // Remove clothes
            player.SetClothes(11, 15, 0);
            player.SetClothes(3, 15, 0);
            player.SetClothes(8, 15, 0);

            // Remove all the tattoos
            Customization.RemovePlayerTattoos(player);

            // Set player's position
            player.Transparency = 255;
            player.Rotation     = new Vector3(0.0f, 0.0f, 180.0f);
            player.Position     = new Vector3(152.3787f, -1000.644f, -99f);
        }
Example #2
0
        public void LoadCharacterEvent(Client player, string name)
        {
            Task.Factory.StartNew(() =>
            {
                PlayerModel playerModel = Database.LoadCharacterInformationByName(name);
                SkinModel skinModel     = Database.GetCharacterSkin(playerModel.id);

                // Load player's model
                player.Name = playerModel.realName;
                player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
                NAPI.Player.SetPlayerSkin(player, playerModel.sex == 0 ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);

                LoadCharacterData(player, playerModel);
                Customization.ApplyPlayerCustomization(player, skinModel, playerModel.sex);
                Customization.ApplyPlayerClothes(player);
                Customization.ApplyPlayerTattoos(player);

                // Update last selected character
                Database.UpdateLastCharacter(player.SocialClubName, playerModel.id);
            });
        }
Example #3
0
        public void SetCharacterIntoCreatorEvent(Client player)
        {
            // Change player's skin
            NAPI.Player.SetPlayerSkin(player, PedHash.FreemodeMale01);

            // Remove clothes
            player.SetClothes(11, 15, 0);
            player.SetClothes(3, 15, 0);
            player.SetClothes(8, 15, 0);

            // Remove all the tattoos
            Customization.RemovePlayerTattoos(player);

            // Set player's position
            player.Transparency = 255;
            player.Rotation     = new Vector3(0.0f, 0.0f, 180.0f);
            player.Position     = new Vector3(402.9364f, -996.7154f, -99.00024f);

            // Force the player's animation
            player.PlayAnimation("amb@world_human_hang_out_street@female_arms_crossed@base", "base", (int)Constants.AnimationFlags.Loop);
        }
Example #4
0
        public void CreateCharacterEvent(Client player, string playerName, int playerAge, int playerSex, string skinJson)
        {
            PlayerModel playerModel = new PlayerModel();
            SkinModel   skinModel   = NAPI.Util.FromJson <SkinModel>(skinJson);

            playerModel.realName = playerName;
            playerModel.age      = playerAge;
            playerModel.sex      = playerSex;

            // Apply the skin to the character
            player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
            Customization.ApplyPlayerCustomization(player, skinModel, playerSex);

            Task.Factory.StartNew(() =>
            {
                NAPI.Task.Run(() =>
                {
                    int playerId = Database.CreateCharacter(player, playerModel, skinModel);

                    if (playerId > 0)
                    {
                        Character.InitializePlayerData(player);
                        player.Transparency = 255;
                        player.SetData(EntityData.PLAYER_SQL_ID, playerId);
                        player.SetData(EntityData.PLAYER_NAME, playerName);
                        player.SetData(EntityData.PLAYER_AGE, playerAge);
                        player.SetData(EntityData.PLAYER_SEX, playerSex);
                        player.SetData(EntityData.PLAYER_SPAWN_POS, new Vector3(-136.0034f, 6198.949f, 32.38448f));
                        player.SetData(EntityData.PLAYER_SPAWN_ROT, new Vector3(0.0f, 0.0f, 180.0f));

                        Database.UpdateLastCharacter(player.SocialClubName, playerId);

                        player.TriggerEvent("characterCreatedSuccessfully");
                    }
                });
            });
        }