Advertisement
Guest User

Untitled

a guest
Nov 10th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1.  
  2. else if (str.substr(0, 5) == "/ban ") {
  3. if (!isSuperAdmin(((PlayerInfo*)(peer->data))->rawName, ((PlayerInfo*)(peer->data))->tankIDPass))break;
  4. if (str.substr(5, cch.length() - 5 - 1) == "") continue;
  5. if (((PlayerInfo*)(peer->data))->rawName == str.substr(5, cch.length() - 5 - 1)) continue;
  6. if ((str.substr(5, cch.length() - 5 - 1) == "dark") || (str.substr(5, cch.length() - 5 - 1) == "juantlo") || (str.substr(5, cch.length() - 5 - 1) == "legend") || (str.substr(5, cch.length() - 5 - 1) == "hadi") || (str.substr(5, cch.length() - 5 - 1) == "FocusedSG") || (str.substr(5, cch.length() - 5 - 1) == "QueenieSG") || (str.substr(5, cch.length() - 5 - 1) == "focusedsg") || (str.substr(5, cch.length() - 5 - 1) == "queeniesg")) continue;
  7.  
  8. cout << "Server operator " << ((PlayerInfo*)(peer->data))->rawName << " has banned " << str.substr(5, cch.length() - 5 - 1) << "." << endl;
  9.  
  10. ENetPeer * currentPeer;
  11.  
  12. GamePacket p = packetEnd(appendString(appendString(createPacket(), "OnConsoleMessage"), "`#** `$The Ancient Ones `ohave `4banned `2" + str.substr(5, cch.length() - 5 - 1) + " `#** `o(`4/rules `oto see the rules!)"));
  13. for (currentPeer = server->peers;
  14. currentPeer < &server->peers[server->peerCount];
  15. ++currentPeer)
  16. {
  17. if (currentPeer->state != ENET_PEER_STATE_CONNECTED)
  18. continue;
  19. ENetPacket * packet = enet_packet_create(p.data,
  20. p.len,
  21. ENET_PACKET_FLAG_RELIABLE);
  22.  
  23. if (((PlayerInfo*)(currentPeer->data))->rawName == str.substr(5, cch.length() - 5 - 1)) {
  24. if (((PlayerInfo*)(currentPeer->data))->haveGrowId == false) continue;
  25. GamePacket ps = packetEnd(appendString(appendString(createPacket(), "OnConsoleMessage"), "`#** `$The Ancient Ones `ohave used `#Ban `oon `2" + str.substr(5, cch.length() - 5 - 1) + "`o! `#**"));
  26. ENetPacket * packet = enet_packet_create(ps.data,
  27. ps.len,
  28. ENET_PACKET_FLAG_RELIABLE);
  29. enet_peer_send(currentPeer, 0, packet);
  30.  
  31. GamePacket ps2 = packetEnd(appendInt(appendString(appendString(appendString(appendString(createPacket(), "OnAddNotification"), "interface/atomic_button.rttex"), "`0Warning from `4System`0: You've been `4BANNED `0from Private Server for 730 days"), "audio/hub_open.wav"), 0));
  32. ENetPacket * packet2 = enet_packet_create(ps2.data,
  33. ps2.len,
  34. ENET_PACKET_FLAG_RELIABLE);
  35. enet_peer_send(currentPeer, 0, packet2);
  36. GamePacket ps3 = packetEnd(appendString(appendString(createPacket(), "OnConsoleMessage"), "`oWarning from `4System`o: You've been `4BANNED `ofrom Private Server for 730 days"));
  37. ENetPacket * packet3 = enet_packet_create(ps3.data,
  38. ps3.len,
  39. ENET_PACKET_FLAG_RELIABLE);
  40. enet_peer_send(currentPeer, 0, packet3);
  41. if (((PlayerInfo*)(currentPeer->data))->haveGrowId) {
  42.  
  43. PlayerInfo* p = ((PlayerInfo*)(currentPeer->data));
  44.  
  45. string username = PlayerDB::getProperName(p->rawName);
  46.  
  47. std::ifstream od("players/" + username + ".json");
  48. if (od.is_open()) {
  49. }
  50.  
  51. std::ofstream o("players/" + username + ".json");
  52. if (!o.is_open()) {
  53. cout << GetLastError() << endl;
  54. _getch();
  55. }
  56. json j;
  57.  
  58. int clothback = p->cloth_back;
  59. int clothhand = p->cloth_hand;
  60. int clothface = p->cloth_face;
  61. int clothhair = p->cloth_hair;
  62. int clothfeet = p->cloth_feet;
  63. int clothpants = p->cloth_pants;
  64. int clothneck = p->cloth_necklace;
  65. int clothshirt = p->cloth_shirt;
  66. int clothmask = p->cloth_mask;
  67. int level = p->level;
  68. //int puncheffect = p->puncheffect;
  69. string password = ((PlayerInfo*)(currentPeer->data))->tankIDPass;
  70.  
  71. j["ClothBack"] = clothback;
  72. j["ClothHand"] = clothhand;
  73. j["ClothFace"] = clothface;
  74. j["ClothShirt"] = clothshirt;
  75. j["ClothPants"] = clothpants;
  76. j["ClothNeck"] = clothneck;
  77. j["ClothHair"] = clothhair;
  78. j["ClothFeet"] = clothfeet;
  79. j["ClothMask"] = clothmask;
  80.  
  81. j["isBanned"] = 1;
  82. j["Level"] = level;
  83. //j["puncheffect"] = puncheffect;
  84.  
  85. j["adminLevel"] = 0;
  86. j["password"] = hashPassword(password);
  87. j["username"] = username;
  88.  
  89.  
  90. o << j << std::endl;
  91. }
  92. delete ps.data;
  93. enet_peer_disconnect_later(currentPeer, 0);
  94.  
  95. }
  96.  
  97. enet_peer_send(currentPeer, 0, packet);
  98.  
  99. //enet_host_flush(server);
  100. }
  101. delete p.data;
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement