Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.0 kB
1
Indexable
Never
else if (actual_command.substr(0, 6) == "/alts " && pInfo(peer)->adminLevel >= 2) {

string target = cmd.substr(6, cmd.length() - 6).c_str();

string path_ = "players/" + target +"";
json r_;
ifstream f_(path_, ifstream::binary);
if (f_.fail()) return;
f_ >> r_;
f_.close();

string p_ip = r_["ip"], p_mac = r_["mac"], p_rid = r_["rid"], player = "";

for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) {

			if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL) continue;
			
			if (pInfo(currentPeer)->ip == p_ip)
			{
			player += pInfo(currentPeer)->tankIDName + "\n";
			}
			else if (pInfo(currentPeer)->rid = p_rid) {
			player += pInfo(currentPeer)->tankIDName + "\n";
			}
			else if (pInfo(currentPeer)->mac = p_mac) {
			player += pInfo(currentPeer)->tankIDName + "\n";
			}
			}
			gamepacket_t b;
			b.Insert("OnConsoleMessage");
			for (int i = 0; i < player.size(); i++) {
			b.Insert(player);
			}
			b.CreatePacket(peer);
			
			}