Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [RemoteEvent("CreateSkin")]
- public void CreateCharacterEvent(Client player, string playerName, int playerAge, int playerSex, string skinJson)
- {
- NAPI.Util.ConsoleOutput("CreateCharEvent 1");
- AccountModel playerModel = new AccountModel();
- SkinModel skinModel = NAPI.Util.FromJson<SkinModel>(skinJson);
- NAPI.Util.ConsoleOutput("CreateCharEvent 2");
- playerModel.realName = playerName;
- playerModel.age = playerAge;
- playerModel.sex = playerSex;
- NAPI.Util.ConsoleOutput("CreateCharEvent 3");
- // Apply the skin to the character
- player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
- Customization.ApplyPlayerCustomization(player, skinModel, playerSex);
- NAPI.Util.ConsoleOutput("CreateCharEvent 4");
- Task.Factory.StartNew(() =>
- {
- int playerId = Database.CreatePlayerSkin(player, playerModel, skinModel);
- if (playerId > 0)
- {
- InitializePlayerData(player);
- player.Transparency = 255;
- player.SetData(EntityData.PLAYER_NAME, playerName);
- player.SetData(EntityData.PLAYER_SEX, playerSex);
- NAPI.Util.ConsoleOutput("CreateCharEvent 5");
- player.TriggerEvent("characterCreatedSuccessfully");
- NAPI.Util.ConsoleOutput("CreateCharEvent 6");
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement