14.09.2012, 15:17
try using this
pawn Код:
COMMAND:warn(playerid, params[])
{
if(pInfo[playerid][padmin] == 0)
{
SendClientMessage(playerid, COLOR_RED, "You do not have permission to use that command!");
return 1;
}
// Our player is an admin and has the rights to use this command, so parse the parameters
new giveplayerid, reason[32];
if(sscanf(params, "us[128]", giveplayerid, reason))
{
SendClientMessage(playerid, COLOR_DBLUE, "Correct Usage: /warn [PlayerID] [Reason]");
return 1;
}
// Check if the given player ID/name is connected/found
if(giveplayerid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_RED, "This player is not connected!");
return 1;
}
new giveplayer[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, pname, sizeof(pname));
warned[giveplayerid] ++;
if(warned[giveplayerid] == 3)
{
new str[128];
format(str, sizeof(str), "AdmCMD: %s was kicked by %s for: %s [3/3 warnings]", giveplayer, pname, reason);
}
else
{
new str[128];
format(str, sizeof(str), "AdmCMD: %s was warned by %s for: %s [%d/3 warnings]", giveplayer, pname, reason, warned[giveplayerid]);
Kick(giveplayerid);
}
SendClientMessageToAll(COLOR_RED, str);
return 1;
}