Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. void sendClothes(ENetPeer* peer)
  2. {
  3. ENetPeer * currentPeer;
  4. GamePacket p3 = packetEnd(appendFloat(appendIntx(appendFloat(appendFloat(appendFloat(appendString(createPacket(), "OnSetClothing"),((PlayerInfo*)(peer->data))->cloth_hair, ((PlayerInfo*)(peer->data))->cloth_shirt, ((PlayerInfo*)(peer->data))->cloth_pants), ((PlayerInfo*)(peer->data))->cloth_feet, ((PlayerInfo*)(peer->data))->cloth_face, ((PlayerInfo*)(peer->data))->cloth_hand), ((PlayerInfo*)(peer->data))->cloth_back, ((PlayerInfo*)(peer->data))->cloth_mask, ((PlayerInfo*)(peer->data))->cloth_necklace), ((PlayerInfo*)(peer->data))->skinColor), 0.0f, 0.0f, 0.0f));
  5. for (currentPeer = server->peers;
  6. currentPeer < &server->peers[server->peerCount];
  7. ++currentPeer)
  8. {
  9. if (currentPeer->state != ENET_PEER_STATE_CONNECTED)
  10. continue;
  11. if (isHere(peer, currentPeer))
  12. {
  13.  
  14. memcpy(p3.data + 8, &(((PlayerInfo*)(peer->data))->netID), 4); // ffloor
  15. ENetPacket * packet3 = enet_packet_create(p3.data,
  16. p3.len,
  17. ENET_PACKET_FLAG_RELIABLE);
  18.  
  19. enet_peer_send(currentPeer, 0, packet3);
  20. }
  21.  
  22. }
  23.  
  24.  
  25. if (((PlayerInfo*)(peer->data))->haveGrowId) {
  26.  
  27. PlayerInfo* p = ((PlayerInfo*)(peer->data));
  28.  
  29. string username = PlayerDB::getProperName(p->rawName);
  30.  
  31. std::ofstream o("players/" + username + ".json");
  32. if (!o.is_open()) {
  33. cout << GetLastError() << endl;
  34. _getch();
  35. }
  36. json j;
  37.  
  38. int clothback = p->cloth_back;
  39. int clothhand = p->cloth_hand;
  40. int clothface = p->cloth_face;
  41. int clothhair = p->cloth_hair;
  42. int clothfeet = p->cloth_feet;
  43. int clothpants = p->cloth_pants;
  44. int clothneck = p->cloth_necklace;
  45. int clothshirt = p->cloth_shirt;
  46. int clothmask = p->cloth_mask;
  47. int level = p->level;
  48.  
  49. int gem = p->gem;
  50. int ban = p->ban;
  51. //int puncheffect = p->puncheffect;
  52.  
  53. string password = ((PlayerInfo*)(peer->data))->tankIDPass;
  54. j["username"] = username;
  55. j["password"] = hashPassword(password);
  56. j["adminLevel"] = 0;
  57. j["ClothBack"] = clothback;
  58. j["ClothHand"] = clothhand;
  59. j["ClothFace"] = clothface;
  60. j["ClothShirt"] = clothshirt;
  61. j["ClothPants"] = clothpants;
  62. j["ClothNeck"] = clothneck;
  63. j["ClothHair"] = clothhair;
  64. j["ClothFeet"] = clothfeet;
  65. j["ClothMask"] = clothmask;
  66. j["Level"] = level;
  67.  
  68. //j["puncheffect"] = puncheffect;
  69. j["isBanned"] = ban;
  70.  
  71. o << j << std::endl;
  72. }
  73. //enet_host_flush(server);
  74. delete p3.data;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement