/ban command (rep)
#1

Hello I want an /ban command
That allows other admins to ban each other
example: /ban (playerid) (hours) (days) (reason)

And when the hours and day are up, the banned player gets unbanned.

Command please?
I'll Rep you.
Reply
#2

do this


pawn Код:
CMD:ban(playerid,params[])
{
     new id,time;
     if(sscanf(params"uds[50]",id,time,params)) return SendClientMessage(playerid,0xFFFFFFAA,"< Usage >  /ban [ name ] [ time / days ] [reason]");
     if(!IsPlayerConnected(playerid,0xFFFFFFAA,"Player not connected");
     {
          // The rest will be made the script is too long
     }
   
}
this is untested
Reply
#3

PHP код:
command(banplayeridparams[])
{
    new 
idreason[128], string[128];
    if(
sscanf(params"uz"idreason))
    {
        if(
Player[playerid][AdminLevel] >= 2)
        {
            
SendClientMessage(playeridWHITE"SYNTAX: /ban [playerid] [reason]");
        }
    }
    else
    {
        if(
Player[playerid][AdminLevel] >= 2)
        {
            if(
IsPlayerConnectedEx(id))
            {
                if(
Player[id][AdminLevel] >= Player[playerid][AdminLevel])
                {
                    
SendClientMessage(playeridWHITE"You do not have the authority to do that (higher rank, or the same).");
                }
                else
                {
                    if(
strlen(reason) >= 1)
                    {
                        new 
hourminuteseconddayyearmonth;
                        
gettime(hourminutesecond);
                        
getdate(yearmonthday);
                        
format(stringsizeof(string), "You have been banned for %s."reason);
                        
SendClientMessage(idGREYstring);
                        
Ban(id);
                    }
                    else
                    {
                        
SendClientMessage(playeridWHITE"SYNTAX: /ban [playerid] [reason]");
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridWHITE"That player is not connected or isn't logged in.");
                return 
1;
            }
        }
    }
    return 
1;

Reply
#4

you can also use like this

pawn Код:
if(id == INVALID_PLAYER_ID) //scanf support this.
instead of

pawn Код:
if(IsPlayerConnected(id))
Reply
#5

oh yheaa i forgot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)