28.07.2012, 05:59
I will give a try to ban command ..
Replace variables with your own.
pawn Код:
CMD:ban(playerid,params[])
{
if(pInfo[playerid][pAdmin]<2) return SendClientMessage(playerid,-1,"You aint allowed to use this");
new targetid, time, reason[50];
if(sscanf(params,"uI(0)s[50]",targetid,time,reason)) return SendClientMessage(playerid,-1,"Correct Usage : /ban id time reason");
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Invalid Id");
if(time<0) return SendClientMessage(playerid,-1,"Time can not be negatie");
pInfo[targetid][Banned] = 1;
new msg[200];
format(msg,sizeof(msg),"You have banned %d for %s (time : %d)",targetid,reason,time);
SendClientMessage(playerid,-1,msg);
format(msg,sizeof(msg),"You have been banned by %d for %s (time : %d)",playerid,reason,time);
SendClientMessage(targetid,-1,msg);
if(time != 0) SetTimerEx("unban",time * 60 * 1000,false,"i",targetid);
Kick(targetid);
return 1;
}
forward unban(playerid);
public unban(playerid)
{
//Open Player File
pInfo[playerid][Banned] = 0;
//Close file
return 1;
}