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



Ban system with mysql - Cezar98 - 24.10.2018

Hello! How can i make /ban system with days, exemple: if today i have banned someone for 10 days, the next day ban will be 9 days and same with next days


Re: Ban system with mysql - ReD_HunTeR - 24.10.2018

https://sampforum.blast.hk/showthread.php?tid=549574


Re: Ban system with mysql - Cezar98 - 24.10.2018

Quote:
Originally Posted by ReD_HunTeR
Посмотреть сообщение
With days not hours.


Re: Ban system with mysql - Infin1ty - 24.10.2018

Use that tutorial but then accept the input as days rather than hours. You can then multiply the value they input by 24 and you'll have a ban system that bans by days.


Re: Ban system with mysql - Calisthenics - 24.10.2018

Create a column for expiration with datatype TIMESTAMP.

pawn Код:
// in command /ban
new targetid, days, reason[33];
if (sscanf(params, "rds[32]", targetid, days, reason)) ...

mysql_format(..., "INSERT INTO ... (..., expiration) VALUES (..., TIMESTAMPADD(DAYS, %d, NOW())", ..., days);
TIMESTAMPADD function adds N days to current date and time: https://dev.mysql.com/doc/refman/8.0...n_timestampadd

Few extra information you may need:
https://dev.mysql.com/doc/refman/8.0...unix-timestamp
https://dev.mysql.com/doc/refman/8.0..._from-unixtime
https://dev.mysql.com/doc/refman/8.0..._timestampdiff


Re: Ban system with mysql - HoussemKeyCo - 25.10.2018

In your MySQL table, create a column with data type timestamp, and when you ban some player, calculate the days using the days seconds * days banned.
When a player that is banned joins, check if their ban expired or not, if its not then kick them with the reason and the unban date, if it expired then remove the ban from the table and let them join..