04.07.2014, 23:22
I was just editing a /gethere command I made when I (for some reason) realized I cannot think of a way to check if the targetid's admin level is higher than the playerid's admin level when using this command, so that the lower leveled admins cannot teleport higher leveled admins to them.
That's the code I've come up with. Basically I was asking if anyone could give me an example (Doesn't necessarily have to be my code, just an example so I can learn).
Код:
CMD:gethere(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2) { new targetid, naot[128], sendername[MAX_PLAYER_NAME]; if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "/gethere [playerid/partofname]"); new Float:Tpos[3]; if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not online!"); GetPlayerPos(playerid, Tpos[0], Tpos[1], Tpos[2]); SetPlayerPos(targetid, Tpos[0], Tpos[1], Tpos[2]); GetPlayerName(playerid, sendername, sizeof(sendername)); format(naot, sizeof(naot), "You have been teleported by admin %s!", sendername); SendClientMessage(targetid, -1, naot); GetPlayerName(targetid, sendername, sizeof(sendername)); format(naot, sizeof(naot), "You have teleported %s to you.", sendername); SendClientMessage(playerid, -1, naot); } return 1; }