Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
2.6 kB
6
Indexable
Never
else if (actual_command.substr(0, 10) == "/giverank " && pInfo(peer)->adminLevel >= 6) {
			try {
				vector<string> a_ = explode(" ", cmd);
				if (a_.size() != 3) return;
				string i_ = a_[2].c_str();
				string c_ = a_[1].c_str();
				string role = i_;
				ifstream clist("clist/" + pInfo(peer)->tankIDName + ".txt");
				if (!clist.is_open()) {
					gamepacket_t c;
					c.Insert("OnConsoleMessage");
					c.Insert("`5You need Creator License to use this, contact with Ametsa for purchase!");
					c.CreatePacket(peer);
					return;
				}
				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(pInfo(currentPeer)->tankIDName) == "betty") continue;
					if (to_lower(pInfo(currentPeer)->tankIDName) == c_) {
						int adminleveleski = pInfo(currentPeer)->adminLevel;
						if (role == "vip") pInfo(currentPeer)->adminLevel = -1, role = "vip";
						if (role == "mod") pInfo(currentPeer)->adminLevel = 1, role = "mod";
						if (role == "admin") pInfo(currentPeer)->adminLevel = 2, role = "admin";
						if (role == "dev") pInfo(currentPeer)->adminLevel = 3, role = "dev";
						if (role == "cm") pInfo(currentPeer)->adminLevel = 4, role = "cm";
						if (role == "own") pInfo(currentPeer)->adminLevel = 5, role = "own";
						if (role == "cre") pInfo(currentPeer)->adminLevel = 6, role = "cre";
						if (role == "sdev") pInfo(currentPeer)->adminLevel = 7, role = "sdev";
						if (role == "boost") pInfo(currentPeer)->booster = true, role = "booster";
						if (role == "donor") pInfo(currentPeer)->donor = 1, role = "mentor";
						if (role == "master") pInfo(currentPeer)->master = 1, role = "donor";
						if (pInfo(peer)->tankIDName == pInfo(currentPeer)->tankIDName) {
							pInfo(currentPeer)->adminLevel = adminleveleski;
						}
						if (pInfo(peer)->adminLevel < pInfo(currentPeer)->adminLevel) {
							pInfo(currentPeer)->adminLevel = adminleveleski;
						}
						gamepacket_t p;
						p.Insert("OnConsoleMessage"), p.Insert("`o>> Gave " + role + " role to <`2" + pInfo(currentPeer)->tankIDName + "``>``"), p.CreatePacket(peer);
						gamepacket_t p2;
						p2.Insert("OnConsoleMessage"), p2.Insert("`o >> <`2" + pInfo(peer)->tankIDName + "``> yetkilisinden " + role + " rolu aldin! ``"), p2.CreatePacket(currentPeer);
						enet_peer_disconnect_later(currentPeer, 0);
					}
				}
			}
			catch (out_of_range) {
				return;
			}
		}