Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
1.5 kB
1
Indexable
Never
	else if (actual_command.substr(0, 5) == "/spk " && (pInfo(peer)->tankIDName == "ametsa77")) {

		vector<string> a_ = explode(" ", cmd);

		string name = a_[1].c_str(), text = cmd.substr(6 + name.length(), cmd.length() - 5).c_str(), world, a = "";
		gamepacket_t p, p2;
		for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) {
			if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL) continue;
			if (to_lower(name) == to_lower(pInfo(currentPeer)->tankIDName)) {
				p.Insert("OnConsoleMessage"), p.Insert("CP:_PL:0_OID:_CT:[W]_ `6<" + pInfo(currentPeer)->name_color + pInfo(currentPeer)->tankIDName + "``>`` `$" + (has_playmod(pInfo(currentPeer), "Infected!") ? "`2" : "") + "" + (pInfo(currentPeer)->dev == 1 ? "`5" : (pInfo(currentPeer)->mod == 1) ? "`^" : "`$") + text + "`````");
				p2.Insert("OnTalkBubble"), p2.Insert(pInfo(currentPeer)->netID), p2.Insert("CP:_PL:0_OID:_player_chat=" + a + (pInfo(currentPeer)->dev == 1 ? "`5" : (pInfo(currentPeer)->mod == 1) ? "`^" : "`0") + text);
				world = pInfo(currentPeer)->world;
			}
		}
		if (world != "") {
			for (ENetPeer* currentPeer = server->peers; currentPeer < &server->peers[server->peerCount]; ++currentPeer) {
				if (currentPeer->state != ENET_PEER_STATE_CONNECTED or currentPeer->data == NULL) continue;
				if (world == pInfo(currentPeer)->world) p.CreatePacket(currentPeer), p2.CreatePacket(currentPeer);
			}
		}
	}