Advertisement
Guest User

Untitled

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