SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 03/07/2020, 06:53 PM   #1
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 296
Reputation: 9
Default samp.ban and temporary banning

Hello guys,

When some one gets ban i transfer his ip range to samp.ban so he cant connect again with that range but samp.ban even doesnt even allow server to call OnPlayerConnect for the banned player when connecting... so the problem is if the ban is a temporary one, how can i unban him?

What i did before is.. Instead of using samp.ban i used a seperate table for banned ranges in the database so when player connects I can check weather his ban is expired.. but still I wanna use this samp.ban as cheaters still can affect the server if i used that server side method.

Is there any callback or smth which respond this connection?
__________________
GameOvr is offline   Reply With Quote
Old 03/07/2020, 07:18 PM   #2
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 924
Reputation: 89
Default Re: samp.ban and temporary banning

I found using the samp.ban is a more effective way to ban cheaters and "isolate" them from the server. In my old CNR server i had multiple attacks from kids and adding their IP to samp.ban resolved the situation as they can't even connect.

My suggestion is to merge your ban system with default samp.ban file, i mean when banning an IP from server side, use "banip XXX.XXX.XXX" after that, so it gets banned in both places and you'll have to not worry about anything anymore.

Eventually, if you want to unban an IP, if you have a command like /unbanip, you can use unbanip and reloadbans rcon command after to flush samp.ban file.

If you're worried about OnPlayerConnect, you can try to use fread to read samp.ban file (never tried tbh) and check if that IP is banned.
Symon is offline   Reply With Quote
Old 03/07/2020, 07:25 PM   #3
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 296
Reputation: 9
Default Re: samp.ban and temporary banning

Yeah, thanks for the reply! thats the reason im switching to samp.ban but the problem is I cant check weather any temporary ban is expired. I mean like if i ban a player for 3 days i save that timestamp but as I use samp.ban there's no way to compare that timestamp with the current timestamp.

So... is it impossible? that making temporary bans along with samp.ban
__________________
GameOvr is offline   Reply With Quote
Old 03/07/2020, 08:58 PM   #4
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 924
Reputation: 89
Default Re: samp.ban and temporary banning

No it's not possible. However i suggest you to use samp.ban as a method to block attackers/flooders, just ban their IP. For "normal" bans you can use your server side ban system.

If you have a temporary ban system a workaround that i can only think is when the ban time expires just use unbanip and reloadbans to unban that IP.
Symon is offline   Reply With Quote
Old 03/07/2020, 09:18 PM   #5
DRIFT_HUNTER
High-roller
 
Join Date: Oct 2009
Posts: 2,151
Reputation: 215
Default Re: samp.ban and temporary banning

Use database for bans, but also ban them on samp sever (samp.ban). Check for expired bans every few minutes and when ban expires also unban that ip on samp server (i think you can just call rcon command from server).

EDIT: fixed stupid typo
DRIFT_HUNTER is offline   Reply With Quote
Old 04/07/2020, 12:36 AM   #6
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 296
Reputation: 9
Default Re: samp.ban and temporary banning

Thank you so much for both of you!
Another timer xD
__________________
GameOvr is offline   Reply With Quote
Old 04/07/2020, 01:44 AM   #7
Symon
Gangsta
 
Symon's Avatar
 
Join Date: Apr 2019
Location: Italy
Posts: 924
Reputation: 89
Default Re: samp.ban and temporary banning

Quote:
Originally Posted by GameOvr View Post
Thank you so much for both of you!
Another timer xD
You don't need to create another timer, just add unbanip and reloadbans rcon commands when you unban the player after the ban expires.
Symon is offline   Reply With Quote
Old 04/07/2020, 09:00 AM   #8
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 296
Reputation: 9
Default Re: samp.ban and temporary banning

Quote:
Originally Posted by Symon View Post
You don't need to create another timer, just add unbanip and reloadbans rcon commands when you unban the player after the ban expires.
Actually you didnt get me, how can i unban him at the exact time when he is in samp.ban? That's my problem
__________________
GameOvr is offline   Reply With Quote
Old 04/07/2020, 11:47 AM   #9
Kwarde
High-roller
 
Kwarde's Avatar
 
Join Date: Nov 2009
Location: The Netherlands
Posts: 2,740
Reputation: 1686
Default Re: samp.ban and temporary banning

Quote:
Originally Posted by GameOvr View Post
Actually you didnt get me, how can i unban him at the exact time when he is in samp.ban? That's my problem
To unban him at the exct timestamp is nearly impossible. This would have to be achieved by using a timer, and you don't want to check for expired bans every second.
Keep in mind that SAMP is single threaded and thus can only do one thing at a time.
You're better off checking every few minutes (eg. every 30 minutes) to see if there are expired bans.
__________________
When the opportunity presents itself to flip-a da table, uh, you flip-a da table.

Discord: Kwarde#8009
Kwarde is offline   Reply With Quote
Old 04/07/2020, 01:27 PM   #10
GameOvr
Huge Clucker
 
GameOvr's Avatar
 
Join Date: Jun 2018
Posts: 296
Reputation: 9
Default Re: samp.ban and temporary banning

Thanks for the ideas.. REP for all
__________________
GameOvr 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
Prevent samp fron banning localhost / a ip iLearner Scripting Help 3 18/12/2016 06:52 PM
[FilterScript] Temporary banning (SQLite) - Easy to use and it works! __ Filterscripts 17 27/03/2013 07:35 PM
Temporary Name Xlithan Scripting Help 10 17/01/2013 06:24 AM
VIP Temporary help! RyanPetersons Scripting Help 1 03/10/2012 11:27 AM
[HELP]Temporary ban? KeyWay Help Archive 1 13/06/2009 08:50 AM


All times are GMT. The time now is 05:07 AM.


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