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



Ban system. - budelis - 03.09.2011

Hi all.I try to do my self ban system like that:

Код:
/ban [playerid] [time] [reason]
Ok,I ban my self for 5 min.Then i come to server,and i get message you are banned for 5min,and it no change,it always be 5min.Then maybe need to set timer or something


Re: Ban system. - Jack_Leslie - 03.09.2011

Maybe you need to show us the command.


Re: Ban system. - Kingunit - 03.09.2011

Indeed - without code we can't do much.


Re: Ban system. - budelis - 03.09.2011

Here when player gets banned:

pawn Код:
new Query[90];
format(Query, sizeof(Query),"UPDATE `playerdata` SET `BanTime` = '%d' WHERE `Name` = '%s'",banTime*60,PlayerName(pID));
mysql_query(Query);
Kick(pID);



Re: Ban system. - DRIFT_HUNTER - 03.09.2011

You need to get current time when player banned and + how long you want it to be banned
Save it to file or MySql (i think you use MySql)and when player connects you check is the current time (time at connect) bigger than a banned time


Re: Ban system. - Soumi - 03.09.2011

I don't know if this will work but try it
pawn Код:
//When the player is banned put this:
new Hour, Minute, Second, BannedTime;
gettime(Hour, Minute, Second);
#pragma unsed Second
#pragma unsed Minute
BannedTime = Hour + 24; //This will make the player banned for 1 day, (P.S: change the 24 with your [time] variable)
//And finally save "BannedTime" and when player attempts to log in into his banned account, load his saved data, check if BannedTime is higher than the current server time using gettime. if it's smaller kick the player.