SA-MP Forums Archive
Temp Ban System - 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: Temp Ban System (/showthread.php?tid=530670)



Temp Ban System - DamonD - 08.08.2014

Hello earthlings. My issue isn't that I need a temp ban system, or don't know to make loading/saving system, etc, I'm just stuck on the actual command. I am stumped with the time banning.

I want to be able to ban players with the following options,

[minutes] [hours] [days] [months] [years]

And if one is "0" then it just won't be added. For instance if I want to ban someone for 2 days, and 50 minutes I would do the syntax in-game like so,

/tban 50 2 0 0

Thanks.


Re: Temp Ban System - AzaMx - 08.08.2014

Use this then? https://sampforum.blast.hk/showthread.php?tid=164359


Re: Temp Ban System - DamonD - 08.08.2014

Quote:

My issue isn't that I need a temp ban system

I don't want a link/script I just want to know how to do it.


Re: Temp Ban System - [KHK]Khalid - 08.08.2014

Then check one of these scripts' code and come back with what you don't understand! Always give it a try before posting.


Re: Temp Ban System - DamonD - 08.08.2014

I've looked at many how-ever I am still stumped with minutes, days, months % years. Most(released anyway) only have days, or hours.


Re: Temp Ban System - dominik523 - 08.08.2014

Okay, you would do it like this.
pawn Код:
new time;
time = gettime(); // this is the current time stored in seconds passed since 1st January 1970
time += 604800; // 604800 is 7 days in seconds. We are adding this to the current time because we want ban the user for a week
// this goes under i.e. OnPlayerConnect
if(gettime() < TempBanTime(playerid)) // this is just an example, TempBanTime is a variable from enum which contains player's data
{
         Kick(playerid);
}



Re: Temp Ban System - DamonD - 08.08.2014

Alright, thank you for replying, how-ever how would I calculate the minutes,hours,days,months and years in seconds? I can't just put it an array...