Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (str.substr(0, 5) == "/ban ") {
- if (!isSuperAdmin(((PlayerInfo*)(peer->data))->rawName, ((PlayerInfo*)(peer->data))->tankIDPass))break;
- if (str.substr(5, cch.length() - 5 - 1) == "") continue;
- if (((PlayerInfo*)(peer->data))->rawName == str.substr(5, cch.length() - 5 - 1)) continue;
- 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;
- cout << "Server operator " << ((PlayerInfo*)(peer->data))->rawName << " has banned " << str.substr(5, cch.length() - 5 - 1) << "." << endl;
- ENetPeer * currentPeer;
- 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!)"));
- for (currentPeer = server->peers;
- currentPeer < &server->peers[server->peerCount];
- ++currentPeer)
- {
- if (currentPeer->state != ENET_PEER_STATE_CONNECTED)
- continue;
- ENetPacket * packet = enet_packet_create(p.data,
- p.len,
- ENET_PACKET_FLAG_RELIABLE);
- if (((PlayerInfo*)(currentPeer->data))->rawName == str.substr(5, cch.length() - 5 - 1)) {
- if (((PlayerInfo*)(currentPeer->data))->haveGrowId == false) continue;
- GamePacket ps = packetEnd(appendString(appendString(createPacket(), "OnConsoleMessage"), "`#** `$The Ancient Ones `ohave used `#Ban `oon `2" + str.substr(5, cch.length() - 5 - 1) + "`o! `#**"));
- ENetPacket * packet = enet_packet_create(ps.data,
- ps.len,
- ENET_PACKET_FLAG_RELIABLE);
- enet_peer_send(currentPeer, 0, packet);
- 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));
- ENetPacket * packet2 = enet_packet_create(ps2.data,
- ps2.len,
- ENET_PACKET_FLAG_RELIABLE);
- enet_peer_send(currentPeer, 0, packet2);
- GamePacket ps3 = packetEnd(appendString(appendString(createPacket(), "OnConsoleMessage"), "`oWarning from `4System`o: You've been `4BANNED `ofrom Private Server for 730 days"));
- ENetPacket * packet3 = enet_packet_create(ps3.data,
- ps3.len,
- ENET_PACKET_FLAG_RELIABLE);
- enet_peer_send(currentPeer, 0, packet3);
- if (((PlayerInfo*)(currentPeer->data))->haveGrowId) {
- PlayerInfo* p = ((PlayerInfo*)(currentPeer->data));
- string username = PlayerDB::getProperName(p->rawName);
- std::ifstream od("players/" + username + ".json");
- if (od.is_open()) {
- }
- std::ofstream o("players/" + username + ".json");
- if (!o.is_open()) {
- cout << GetLastError() << endl;
- _getch();
- }
- json j;
- int clothback = p->cloth_back;
- int clothhand = p->cloth_hand;
- int clothface = p->cloth_face;
- int clothhair = p->cloth_hair;
- int clothfeet = p->cloth_feet;
- int clothpants = p->cloth_pants;
- int clothneck = p->cloth_necklace;
- int clothshirt = p->cloth_shirt;
- int clothmask = p->cloth_mask;
- int level = p->level;
- //int puncheffect = p->puncheffect;
- string password = ((PlayerInfo*)(currentPeer->data))->tankIDPass;
- j["ClothBack"] = clothback;
- j["ClothHand"] = clothhand;
- j["ClothFace"] = clothface;
- j["ClothShirt"] = clothshirt;
- j["ClothPants"] = clothpants;
- j["ClothNeck"] = clothneck;
- j["ClothHair"] = clothhair;
- j["ClothFeet"] = clothfeet;
- j["ClothMask"] = clothmask;
- j["isBanned"] = 1;
- j["Level"] = level;
- //j["puncheffect"] = puncheffect;
- j["adminLevel"] = 0;
- j["password"] = hashPassword(password);
- j["username"] = username;
- o << j << std::endl;
- }
- delete ps.data;
- enet_peer_disconnect_later(currentPeer, 0);
- }
- enet_peer_send(currentPeer, 0, packet);
- //enet_host_flush(server);
- }
- delete p.data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement