Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. [RemoteEvent("CreateSkin")]
  2. public void CreateCharacterEvent(Client player, string playerName, int playerAge, int playerSex, string skinJson)
  3. {
  4. NAPI.Util.ConsoleOutput("CreateCharEvent 1");
  5. AccountModel playerModel = new AccountModel();
  6. SkinModel skinModel = NAPI.Util.FromJson<SkinModel>(skinJson);
  7. NAPI.Util.ConsoleOutput("CreateCharEvent 2");
  8. playerModel.realName = playerName;
  9. playerModel.age = playerAge;
  10. playerModel.sex = playerSex;
  11. NAPI.Util.ConsoleOutput("CreateCharEvent 3");
  12. // Apply the skin to the character
  13. player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel);
  14. Customization.ApplyPlayerCustomization(player, skinModel, playerSex);
  15. NAPI.Util.ConsoleOutput("CreateCharEvent 4");
  16. Task.Factory.StartNew(() =>
  17. {
  18. int playerId = Database.CreatePlayerSkin(player, playerModel, skinModel);
  19.  
  20. if (playerId > 0)
  21. {
  22. InitializePlayerData(player);
  23. player.Transparency = 255;
  24. player.SetData(EntityData.PLAYER_NAME, playerName);
  25. player.SetData(EntityData.PLAYER_SEX, playerSex);
  26. NAPI.Util.ConsoleOutput("CreateCharEvent 5");
  27. player.TriggerEvent("characterCreatedSuccessfully");
  28. NAPI.Util.ConsoleOutput("CreateCharEvent 6");
  29. }
  30. });
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement