Making an temporary ban!
#1

Well my ban command is as follows
pawn Код:
dcmd_adban(playerid,params[])
{
    new string[128];
    new ID;
    new cmdreason[100];
    if(sscanf(params,"us[100]",ID,cmdreason))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /adban (Player Name/ID) (Reason)");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot ban them.",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    Banning[ID] =1;
    format(string,sizeof(string),"[ADMIN] Administrator has banned %s(%d) from the server. Reason: %s.",PlayerName(ID),ID,cmdreason);
    SendClientMessageToAll(COLOR_ADMIN,string);

    format(string,sizeof(string),"9[ADMIN] Administrator has banned %s(%d) from the server. Reason: %s.",PlayerName(ID),ID,cmdreason);
    IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
    if(PLAYERLIST_authed[ID] == 1)
    {
        dUserSetINT(PlayerName(ID)).("Nameban",1);
    }
    SetTimer("BanPlayer",700,0);
    return 1;
}
Now, I need a command which should ban a player for "x" hours. Like /adtempban or something like that.
Also, Its dcmd and it should ban a player in HOURS and not MINUTES.
When a banned player connects, The server should kick that player and echo
"You are banned till "remaining time". Do not try to evade your ban or you'll be permanently banned."

Thanks in advance. Will +rep if someone helps me make this command.
Reply
#2

You have to take the current timestamp by adding how many hours you want to be banned, and then look at the connection if the timestamp taken before is greater than or less than the current timestamp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)