SQL Timers. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQL Timers. (
/showthread.php?tid=353010)
SQL Timers. -
iGetty - 21.06.2012
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.
Re: SQL Timers. -
ReneG - 21.06.2012
A tutorial on unix timestamps. Useful for anything 'temporary'.
https://sampforum.blast.hk/showthread.php?tid=254915
Re: SQL Timers. -
Lorenc_ - 21.06.2012
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.
Re: SQL Timers. -
iGetty - 21.06.2012
Thanks guys!