03.04.2009, 23:52
Quote:
Originally Posted by Jeff_Maxwell
Quote:
|
I think you want that if player has X warns he gets autoban?
pawn Код:
if(!strcmp(cmd,"/warn",true))
{
if(PlayerInfo[playerid][pAdmin]<2) return SendClientMessage(playerid,COLOR_GREY,"You are not authorized.");
cmd=strtok(cmdtext, idx);
new otherplayer = ReturnUser(cmd);
if(!strlen(cmd)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
if(otherplayer == playerid) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn yourself !");
if(PlayerInfo[otherplayer][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "You can't warn Admins!");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
idx++;
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
PlayerInfo[otherplayer][pWarns] ++;
if(PlayerInfo[otherplayer][pWarns]>5) // If he has more than 5 warnings.
{
format(string,sizeof(string),"AdmCmd: %s autobanned. (5 warnings",giveplayer);
SendClientMessageToAll(COLOR_LIGHTRED,string);
return Ban(id);
}
format(string, sizeof(string), "%s was warned by Administrator %s, Reason: (%s)", giveplayer, sendername, PlayerInfo[playerid][pWarns], (result));
return SendClientMessageToAll(COLOR_RED, string);
}
