SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/01/2020, 06:53 PM   #1
XoMoX
Big Clucker
 
Join Date: Nov 2018
Posts: 53
Reputation: 0
Default HELP WITH MYSQL TEMP BAN

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
__________________
𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧
MY WORKS

Vehicle /lock /unlock and /givekeys system:https://forum.sa-mp.com/showthread.php?p=4152748#post4152748
XoMoX is offline   Reply With Quote
Old 10/01/2020, 07:29 PM   #2
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: HELP WITH MYSQL TEMP BAN

The syntax is correct, it is scheduled 1 minute after the query execution. Make sure event scheduler is enabled.
__________________
Calisthenics is offline   Reply With Quote
Old 10/01/2020, 07:35 PM   #3
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: HELP WITH MYSQL TEMP BAN

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.
Joe Staff is offline   Reply With Quote
Old 10/01/2020, 07:49 PM   #4
XoMoX
Big Clucker
 
Join Date: Nov 2018
Posts: 53
Reputation: 0
Default Re: HELP WITH MYSQL TEMP BAN

How can i fix it if its not removing the name on the data base
__________________
𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧
MY WORKS

Vehicle /lock /unlock and /givekeys system:https://forum.sa-mp.com/showthread.php?p=4152748#post4152748
XoMoX is offline   Reply With Quote
Old 10/01/2020, 07:53 PM   #5
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: HELP WITH MYSQL TEMP BAN

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.
__________________
Calisthenics is offline   Reply With Quote
Old 10/01/2020, 07:56 PM   #6
XoMoX
Big Clucker
 
Join Date: Nov 2018
Posts: 53
Reputation: 0
Default Re: HELP WITH MYSQL TEMP BAN

Also how to enable the event thinggy
__________________
𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧
MY WORKS

Vehicle /lock /unlock and /givekeys system:https://forum.sa-mp.com/showthread.php?p=4152748#post4152748
XoMoX is offline   Reply With Quote
Old 10/01/2020, 08:00 PM   #7
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: HELP WITH MYSQL TEMP BAN

Open my.ini/my.cnf and add in [mysqld] section:
pawn Code:
[mysqld]
event_scheduler=on
__________________
Calisthenics is offline   Reply With Quote
Old 10/01/2020, 09:35 PM   #8
Radless
Little Clucker
 
Join Date: Jul 2019
Posts: 48
Reputation: 3
Default Re: HELP WITH MYSQL TEMP BAN

I don't know what you mean, you want a temporary ban system?
Radless is online now   Reply With Quote
Old 11/01/2020, 12:41 AM   #9
XoMoX
Big Clucker
 
Join Date: Nov 2018
Posts: 53
Reputation: 0
Default Re: HELP WITH MYSQL TEMP BAN

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
__________________
𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧
MY WORKS

Vehicle /lock /unlock and /givekeys system:https://forum.sa-mp.com/showthread.php?p=4152748#post4152748
XoMoX is offline   Reply With Quote
Old 11/01/2020, 12:53 AM   #10
XoMoX
Big Clucker
 
Join Date: Nov 2018
Posts: 53
Reputation: 0
Default Re: HELP WITH MYSQL TEMP BAN

now if i create an event manually its not creating it says succesfully but as soon as i refresh the site its not there
__________________
𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧.𝓧𝓸𝓶𝓸𝓧
MY WORKS

Vehicle /lock /unlock and /givekeys system:https://forum.sa-mp.com/showthread.php?p=4152748#post4152748
XoMoX is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Temp Ban Command Mysql [+REP] arlindi Scripting Help 26 26/04/2015 01:26 PM
Temp Ban Command Mysql [+REP] arlindi Scripting Help 6 09/04/2015 01:41 PM
MySQL temp banning. PaulDinam Scripting Help 0 30/03/2013 11:44 AM
Question about Temp Banning (MySQL) Dokins Scripting Help 8 23/01/2012 10:27 PM
[MAKE] Temp ban and Temp mute. Larsey123IsMe Help Archive 12 20/02/2011 02:43 AM


All times are GMT. The time now is 08:26 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.