samp.ban and temporary banning -
GameOvr - 03.07.2020
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?
Re: samp.ban and temporary banning -
Symon - 03.07.2020
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.
Re: samp.ban and temporary banning -
GameOvr - 03.07.2020
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
Re: samp.ban and temporary banning -
Symon - 03.07.2020
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.
Re: samp.ban and temporary banning -
DRIFT_HUNTER - 03.07.2020
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
Re: samp.ban and temporary banning -
GameOvr - 04.07.2020
Thank you so much for both of you!
Another timer xD
Re: samp.ban and temporary banning -
Symon - 04.07.2020
Quote:
Originally Posted by GameOvr
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.
Re: samp.ban and temporary banning -
GameOvr - 04.07.2020
Quote:
Originally Posted by Symon
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
Re: samp.ban and temporary banning -
Kwarde - 04.07.2020
Quote:
Originally Posted by GameOvr
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 exбct 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.
Re: samp.ban and temporary banning -
GameOvr - 04.07.2020
Thanks for the ideas.. REP for all