Advertisement
FocusedSG

Untitled

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