pawn Код:
CMD:warn(playerid,params[])
{
if(PlayerInfo[playerid][Admin] >= 2)
{
new id, reason[69];
if(sscanf(params,"us[69]",id,reason) ) return SendClientMessage(playerid,COLOR_RED,"USUAGE: /warn [id] [reason]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_BLUE,"Player is not connected.!");
else
{
#if KICK_MAX_WARN == true
new name[MAX_PLAYER_NAME], playername[MAX_PLAYER_NAME];
new string[256], strings[256];
GetPlayerName(id,playername,sizeof(playername));
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"You warned warn you %s for reason: %s",playername,reason[0]);
format(string,sizeof(strings),"%s warned you for reason: %s",name,reason[0]);
SendClientMessage(playerid,COLOR_YELLOW,string);
SendClientMessage(id,COLOR_BLUE,strings);
Warn[id]++;
if(Warn[id] >= MAX_WARN_FOR_KICK)
{
format(string,sizeof(string),"%s is now kicked ( to much warnings)",playername);
SendClientMessageToAll(COLOR_GREEN,string);
Kick(id);
}
#endif
#if BAN_MAX_WARN == true
new name[MAX_PLAYER_NAME], playername[MAX_PLAYER_NAME];
new string[256], strings[256];
GetPlayerName(id,playername,sizeof(playername));
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"You warned %s {reason: %s}",playername,reason[0]);
format(string,sizeof(strings),"%s warned you {reason: %s}",name,reason[0]);
SendClientMessage(playerid,COLOR_YELLOW,string);
SendClientMessage(id,COLOR_BLUE,strings);
Warn[id]++;
if(Warn[id] >= MAX_WARN_FOR_BAN)
{
format(string,sizeof(string),"%s is now banned ( to much warnings)",playername);
SendClientMessageToAll(COLOR_GREEN,string);
Ban(id);
}
#endif
}
}
else SendClientMessage(playerid,COLOR_RED,"You need to be an Admin!");
return 1;
}