SA-MP Forums Archive
HELP WITH MYSQL TEMP BAN - 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: HELP WITH MYSQL TEMP BAN (/showthread.php?tid=671747)



HELP WITH MYSQL TEMP BAN - XoMoX - 10.01.2020

Hi can i request for help for my temp ban im using event scheduler but it wont unban automaticaly but if you guys can suggest or give some temp ban scripts it would be good or can you help me with this
PHP Code:
CMD:ban(playeridparams[])
{
    if(
Player[playerid][Admin] >= 2)
    {
        new
            
query[256],
            
ip[16],
            
reason[50],
            
string[64]
        ;
        new 
banner[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], target;
        
GetPlayerName(playeridbannersizeof(banner));
        
GetPlayerName(targetPlayerNamesizeof(PlayerName));
        
GetPlayerIp(targetipsizeof(ip));
        if(
sscanf(params"rs[50]"targetreason)) return SendClientMessage(playerid,0xAA3333AA,"USAGE:/ban(Name)(reason)");
        
mysql_format(MySQL:mysqlquerysizeof(query), "INSERT INTO `bans`(`player`, `ip`, `admin`,`reason`) VALUES('%s', '%e', '%e', '%s')"targetipbannerreason);
        
mysql_tquery(MySQL:mysqlquery"""");
        
mysql_format(MySQL:mysqlquery256"DROP EVENT IF EXISTS `%e`"target);
        
mysql_tquery(MySQL:mysqlquery"""");
        
mysql_format(MySQL:mysqlquerysizeof(query), "CREATE EVENT `%e` ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 Minute DO DELETE FROM `bans` WHERE `bans`.`player` = '%e'"targettarget);
        
mysql_tquery(MySQL:mysqlquery"""");
        
format(stringsizeof(string), "ADMIN BAN:%s has been banned reason: %s"targetreason);
        
SendClientMessageToAll(0xFF22EE00string);
    }
    return 
1;

thanks


Re: HELP WITH MYSQL TEMP BAN - Calisthenics - 10.01.2020

The syntax is correct, it is scheduled 1 minute after the query execution. Make sure event scheduler is enabled.


Re: HELP WITH MYSQL TEMP BAN - Joe Staff - 10.01.2020

Also make sure you're unbanning the IP from the samp server.
Just because it was removed from the database, does not mean they're unbanned.


Re: HELP WITH MYSQL TEMP BAN - XoMoX - 10.01.2020

How can i fix it if its not removing the name on the data base


Re: HELP WITH MYSQL TEMP BAN - Calisthenics - 10.01.2020

Quote:
Originally Posted by XoMoX
View Post
How can i fix it if its not removing the name on the data base
Execute
pawn Code:
SHOW VARIABLES WHERE VARIABLE_NAME = 'event_scheduler'
and post the output.


Re: HELP WITH MYSQL TEMP BAN - XoMoX - 10.01.2020

Also how to enable the event thinggy


Re: HELP WITH MYSQL TEMP BAN - Calisthenics - 10.01.2020

Open my.ini/my.cnf and add in [mysqld] section:
pawn Code:
[mysqld]
event_scheduler=on



Re: HELP WITH MYSQL TEMP BAN - Radless - 10.01.2020

I don't know what you mean, you want a temporary ban system?


Re: HELP WITH MYSQL TEMP BAN - XoMoX - 11.01.2020

Quote:
Originally Posted by Calisthenics
View Post
Execute
pawn Code:
SHOW VARIABLES WHERE VARIABLE_NAME = 'event_scheduler'
and post the output.
its says
event_scheduler
ON


Re: HELP WITH MYSQL TEMP BAN - XoMoX - 11.01.2020

now if i create an event manually its not creating it says succesfully but as soon as i refresh the site its not there