24.11.2017, 11:24
Код:
CMD:warn(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Insufficient Permissions!"); new PID, str[128], reason[64], name[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "Usage: /Warn [playerid] [reason]"); if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!"); playerWarn[PID] ++; GetPlayerName(playerid, Adminname, sizeof(Adminname)); GetPlayerName(PID, name, sizeof(name)); format(str, sizeof str, "Admin %s has warned %s, Reason: %s. [Warning %i/3]", Adminname, PID, reason, playerWarn[PID]); SendClientMessageToAll(COLOR_RED, str); format(str, sizeof str, "Admin %s has warned %s, Reason: %s. [Warning %i/3]", Adminname, PID, reason, playerWarn[PID]); SendClientMessageToAll(COLOR_RED, str); if(playerWarn[PID] > 2) { format(str, sizeof str, "%s has been kicked by server 3 warnings, Reason [%s].", name, reason); SendClientMessageToAll(COLOR_RED, str); SendClientMessage(PID, COLOR_RED, "You were warned three times and got kicked!"); Kick(PID); } return 1; }
Admin %s has warned %s, Reason: %s. [Warning %i/3]
Admin %s has warned %s, Reason: %s. [Warning %i/3]
Or:
%s has been kicked by server 3 warnings, Reason [%s]
%s has been kicked by server 3 warnings, Reason [%s]
I need to put the 'ClientMessage' out of the loop, anyone knows how?