Advertisement
Guest User

Untitled

a guest
Oct 11th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 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 email = 0;
  42. int passwordverify = 0;
  43. int clothback = p->cloth_back;
  44. int clothhand = p->cloth_hand;
  45. int clothface = p->cloth_face;
  46. int clothhair = p->cloth_hair;
  47. int clothfeet = p->cloth_feet;
  48. int clothpants = p->cloth_pants;
  49. int clothneck = p->cloth_necklace;
  50. int clothshirt = p->cloth_shirt;
  51. int clothmask = p->cloth_mask;
  52.  
  53. string password = ((PlayerInfo*)(peer->data))->tankIDPass;
  54. j["ClothBack"] = clothback;
  55. j["ClothHand"] = clothhand;
  56. j["ClothFace"] = clothface;
  57. j["ClothShirt"] = clothshirt;
  58. j["ClothPants"] = clothpants;
  59. j["ClothNeck"] = clothneck;
  60. j["ClothHair"] = clothhair;
  61. j["ClothFeet"] = clothfeet;
  62. j["ClothMask"] = clothmask;
  63. j["adminLevel"] = 0;
  64. j["email"] = email;
  65. j["passwordverify"] = passwordverify;
  66. j["password"] = hashPassword(password);
  67. j["username"] = username;
  68.  
  69.  
  70. o << j << std::endl;
  71. }
  72.  
  73. //enet_host_flush(server);
  74. delete p3.data;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement