Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (str.substr(0, 6) == "/mute ") {
- if (!canUse(((PlayerInfo*)(peer->data))->rawName, ((PlayerInfo*)(peer->data))->tankIDPass))break;
- if (str.substr(6, cch.length() - 6 - 1) == "") continue;
- if (((PlayerInfo*)(peer->data))->rawName == str.substr(6, cch.length() - 6 - 1)) continue;
- 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;
- cout << "Server operator " << ((PlayerInfo*)(peer->data))->rawName << " has muted " << str.substr(6, cch.length() - 6 - 1) << "." << endl;
- ENetPeer * currentPeer;
- 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!)"));
- 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(6, cch.length() - 6 - 1) || ((PlayerInfo*)(currentPeer->data))->displayName == str.substr(6, cch.length() - 6 - 1)) {
- if (((PlayerInfo*)(currentPeer->data))->haveGrowId == false) continue;
- GamePacket ps = packetEnd(appendString(appendString(createPacket(), "OnConsoleMessage"), "`#** `$The Ancient Ones `ohave used `#mute `oon `2" + str.substr(6, cch.length() - 6 - 1) + "`o! `#**"));
- ENetPacket * packet = enet_packet_create(ps.data,
- ps.len,
- ENET_PACKET_FLAG_RELIABLE);
- enet_peer_send(currentPeer, 0, packet);
- 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 ban = p->ban;
- 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["isMuted"] = 1;
- j["isBanned"] = ban;
- j["Level"] = level;
- j["adminLevel"] = 0;
- j["password"] = hashPassword(password);
- j["username"] = username;
- o << j << std::endl;
- }
- delete ps.data;
- }
- enet_peer_send(currentPeer, 0, packet);
- //enet_host_flush(server);
- }
- delete p.data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement