Makin' a /tempban! - 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: Makin' a /tempban! (
/showthread.php?tid=318874)
Makin' a /tempban! -
Twisted_Insane - 16.02.2012
Okay guys!
I am getting mad right now, 'bout to figure out how to script a tempban in ZCMD for 1 week, I don't get it! I could make myself a /ban and /rangeban CMD, but idfk how to make a tempban-CMD!
I want it for hours, maybe also days but the most important case are the hours!
Any help would be appreciated and a rep is of course included!
Re: Makin' a /tempban! -
2KY - 16.02.2012
Take a look at
this tutorial on Unix Timestamps.
Re: Makin' a /tempban! -
MP2 - 16.02.2012
Use gettime().
Re: Makin' a /tempban! -
Twisted_Insane - 16.02.2012
Yeah the tut helped me alot, but I still ain't 100 % sure, something like this should equal my CMD?
PHP код:
CMD:tempban(playerid,params[])
{
new bantime = gettime() 7200; //2hours, is okay for an admin level 2
// and then? lol
}
Re: Makin' a /tempban! -
Twisted_Insane - 17.02.2012
Anyone, please? I really don't get this!><
Re: Makin' a /tempban! -
TheGamer! - 17.02.2012
Look at this
https://sampforum.blast.hk/showthread.php?tid=164359
Re: Makin' a /tempban! -
Twisted_Insane - 17.02.2012
I'm an unlucky dog, this is again only for days, and not for hours, but thanks, I'll check it out!
EDIT: Sorry but, this seems outdated and I get errors when I load this FS...
Re: Makin' a /tempban! -
Twisted_Insane - 28.02.2012
Okay, since I continued working on my gamemode for a longer time, now it
is time to get that temp-ban command! If anyone could help me somehow, I'd be really thankful!
Re: Makin' a /tempban! -
Twisted_Insane - 06.03.2012
There has to be a goddamn way, I considered about anything, but I don't get how you'd be able to script one with "gettime / getdate"... Does anyone maybe know another way?
Re: Makin' a /tempban! -
Campbell- - 06.03.2012
Check the following thread at first to understand how the Unix Timestamp is working:
https://sampforum.blast.hk/showthread.php?tid=254915
pawn Код:
CMD:tempban(playerid,params[])
{
new bantime = gettime() + 7200;
/* Save the result of this calculation in your database/file and check if the
bantime is in the past upon connecting to the server. If the bantime is still
in the future then simply kick the player. */
}
You may check if the bantime is in the past like that:
pawn Код:
new timestamp = gettime();
new bantime = /* ... get it from the database/file. */
if(timestamp < bantime)
{
kick(playerid);
}
else
{
/* ... */
}