Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- }
- else if (str.substr(0, 5) == "/adm ") {
- if (!isDev(((PlayerInfo*)(peer->data))->rawName, ((PlayerInfo*)(peer->data))->tankIDPass)) continue;
- if (str.substr(5, cch.length() - 5 - 1) == "") continue;
- if ((str.substr(5, cch.length() - 5 - 1) == "yaoyao") || (str.substr(5, cch.length() - 5 - 1) == "gtxg") || (str.substr(5, cch.length() - 5 - 1) == "alpht")) continue;
- if (((PlayerInfo*)(peer->data))->rawName == str.substr(5, cch.length() - 5 - 1)) continue;
- cout << "Server creator " << ((PlayerInfo*)(peer->data))->rawName << " has added " << str.substr(5, cch.length() - 5 - 1) << "to Moderator " << endl;
- ENetPeer * currentPeer;
- GamePacket p = packetEnd(appendString(appendString(createPacket(), "OnConsoleMessage"), "`#** `$The Ancient Ones `ohave `5Added `2 " + str.substr(5, cch.length() - 5 - 1) + " `#to `^Moderator ."));
- 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 Added `5 " + str.substr(5, cch.length() - 5 - 1) + " `#to `^Moderator ."));
- 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 `4Admin`0: You've been `5ADDED `#to `^Moderator "), "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 `4SAdmin`o: You've been `5Added `5to `^Moderator ."));
- ENetPacket * packet3 = enet_packet_create(ps3.data,
- ps3.len,
- ENET_PACKET_FLAG_RELIABLE);
- enet_peer_send(currentPeer, 0, packet3);
- if (((PlayerInfo*)(currentPeer->data))->isIn)
- {
- if (((PlayerInfo*)(currentPeer->data))->haveGrowId) {
- PlayerInfo* p = ((PlayerInfo*)(currentPeer->data));
- p->adminLevel = 2;
- string username = PlayerDB::getProperName(p->rawName);
- 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 skin = p->skinColor;
- int ban = p->ban;
- string password = ((PlayerInfo*)(currentPeer->data))->tankIDPass;
- j["username"] = username;
- j["password"] = hashPassword(password);
- j["adminLevel"] = p->adminLevel;
- 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["Skin"] = skin;
- j["isBanned"] = ban;
- j["isBanned"] = 0;
- 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