Makin' a /tempban!
#1

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!
Reply
#2

Take a look at this tutorial on Unix Timestamps.
Reply
#3

Use gettime().
Reply
#4

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

Reply
#5

Anyone, please? I really don't get this!><
Reply
#6

Look at this
https://sampforum.blast.hk/showthread.php?tid=164359
Reply
#7

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...
Reply
#8

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!
Reply
#9

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?
Reply
#10

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
{
     /* ... */
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)