MessageBox + Welcome text + Commands help + Ban
#3

I will give a try to ban command ..
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;
}
Replace variables with your own.
Reply


Messages In This Thread
MessageBox + Welcome text + Commands help + Ban - by SEnergy - 28.07.2012, 05:06
Re: MessageBox + Welcome text + Commands help + Ban - by [KHK]Khalid - 28.07.2012, 05:17
Re: MessageBox + Welcome text + Commands help + Ban - by [MM]RoXoR[FS] - 28.07.2012, 05:59

Forum Jump:


Users browsing this thread: 1 Guest(s)