pawn Код:
new warned[MAX_PLAYERS];
//ZCMD and sscanf
CMD:warn(playerid,params[])
{
new playeridex;
if(sscanf(params,"%u%s[129]",playeridex,params)) return SendClientMessage(playerid,0xFFFFFF,"Usage: /warn <playerid> <reason>")
new string[128],string1[MAX_PLAYER_NAME];
GetPlayerName(playeridex,string,sizeof(string));
GetPlayerName(playerid,string1,sizeof(string1));
warned[playeridex]++;
format(string,sizeof(string),"%s has been warned by %s. Reason: %s",string,string1,params);
SendClientMessageToAll(0xFFFFFF,string)
if(warned[playerid] == 5)
{
Kick(playeridex);
format(string,sizeof(string),"%s has been kicked for having too much warn.",string);
SendClientMessageToAll(0xFFFFFF,string)
}
return 1;
}
CMD:unwarn(playerid,params[])
{
new playeridex;
if(sscanf(params,"%u%s[129]",playeridex,params)) return SendClientMessage(playerid,0xFFFFFF,"Usage: /unwarn <playerid> <reason>")
new string[128],string1[MAX_PLAYER_NAME];
GetPlayerName(playeridex,string,sizeof(string));
GetPlayerName(playerid,string1,sizeof(string1));
warned[playeridex]--;
format(string,sizeof(string),"%s has been unwarned by %s. Reason: %s",string,string1,params);
SendClientMessageToAll(0xFFFFFF,string)
return 1;
}