HELP WITH MYSQL TEMP BAN
#1

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

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

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

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

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

Also how to enable the event thinggy
Reply
#7

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)