SQL Timers.
#1

Hello there, I am creating a temporary banning system.

I would like to know, how could I set it so then the SQL system automatically set's a player's banned status to 0 when it's at the date the Admin entered? EG:

pawn Код:
command(tban, playerid, params[])
{
    if(AdminLevel[playerid] >= 1)
    {
        new id, day, month, year, reason[128], string[256];
        if(sscanf(params, "uddds[128]", id, day, month, year, reason)) return SendClientMessage(playerid, WHITE, "Server: /tban [playerid/name] [day] [month] [year] [reason]");
        {
            //The SQL stuff here.
            format(string, sizeof(string), "Administrator %s has Temporarily Banned %s. [Reason: %s]", pName(playerid), pName(id), reason);
            SendClientMessageToAll(RED, string);
            PlayerBanned[id] = 2;
            SaveStats(id);
            Kick(id);
        }
    }
    else return SendClientMessage(playerid, GREY, "This command is for Administrators only.");
    return 1;
}
Thank you all for the help that you give me,

regards: iGetty.
Reply
#2

A tutorial on unix timestamps. Useful for anything 'temporary'.

https://sampforum.blast.hk/showthread.php?tid=254915
Reply
#3

If you're using MySQL:

Do a check on OnPlayerConnect and delete the row if you're using a table for bans. To mention, visit VincentDunn's link.
Reply
#4

Thanks guys!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)