Advertisement
Juantlo

Untitled

Oct 8th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 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. if (((PlayerInfo*)(peer->data))->haveGrowId) {
  25.  
  26. PlayerInfo* p = ((PlayerInfo*)(peer->data));
  27.  
  28. string username = PlayerDB::getProperName(p->rawName);
  29.  
  30. std::ifstream od("players/" + username + ".json");
  31. if (od.is_open()) {
  32. }
  33.  
  34. std::ofstream o("players/" + username + ".json");
  35. if (!o.is_open()) {
  36. cout << GetLastError() << endl;
  37. _getch();
  38. }
  39. json j;
  40.  
  41. int clothback = p->cloth_back;
  42. int clothhand = p->cloth_hand;
  43. int clothface = p->cloth_face;
  44. int clothhair = p->cloth_hair;
  45. int clothfeet = p->cloth_feet;
  46. int clothpants = p->cloth_pants;
  47. int clothneck = p->cloth_necklace;
  48. int clothshirt = p->cloth_shirt;
  49. int clothmask = p->cloth_mask;
  50.  
  51. string password = ((PlayerInfo*)(peer->data))->tankIDPass;
  52. j["username"] = username;
  53. j["password"] = hashPassword(password);
  54. j["adminLevel"] = 0;
  55. j["ClothBack"] = clothback;
  56. j["ClothHand"] = clothhand;
  57. j["ClothFace"] = clothface;
  58. j["ClothShirt"] = clothshirt;
  59. j["ClothPants"] = clothpants;
  60. j["ClothNeck"] = clothneck;
  61. j["ClothHair"] = clothhair;
  62. j["ClothFeet"] = clothfeet;
  63. j["ClothMask"] = clothmask;
  64.  
  65.  
  66. o << j << std::endl;
  67. }
  68.  
  69. //enet_host_flush(server);
  70. delete p3.data;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement