Saving players ip (Custom ban system)
#1

Hello community,

i recently found out, that when I ban player regullary, it does not show him any information except "Server closed the connection", when he logs in.

I wanted to show him some information, such as reason and a way, he can get unban, so i started thinking.

I structured idea in my head, that i would not really ban the player, i would just kick him, each time he connects i would check if he is banned, if yes, i would show him message, and one second after that i would kick him again.

The problem is, i did this on account, i made variable using y_ini, that i saved to account. The variable is called pBan.

So i declared a new variable "pBan" in my enumerator of variables for my saving system, and used it in /ban command, like this:

PHP код:
    PlayerInfo[targetid][pBan] = 1;
    
SetTimerEx("BanPlayer"2000false"i"targetid); 
When player got banned, i set the variable on 1, launched timer on 2 seconds, so he can get a message, that he got banned. In function of the timer, i did this:

PHP код:
forward BanPlayer(playerid);
public 
BanPlayer(playerid)
{
    
Kick(playerid);

So i kicked player out.

Keep in mind, that players pBan, is now set on 1.

When player connected (in OnPlayerConnect), i checked, whether his pBan is set to 1, and shown a message:

... well this is what i wanted, than i realised, that to show him this message, he needs to log in to his account, so the value of pBan can be loaded.

So i realised, that this ban will only work per account, so player can simply just create new account and roll rule-abuse again.

Here I am asking you guys a question. Could you support me with some of your ideas, how could i prevent player from joining again from the same IP, while not completely banning him, since I want to show him custom message.

I thought about function GetPlayerIp, but i did not realise to understand, how could i merge these functions together, since I created variable, that loads after player logs in... i did not even come up with idea, how to save variable, so player does not need to login... perhaps new file?

I let you guys decide, for any help, I will be MUCH MORE than thankful.
Reply
#2

I recommend to use RogueDrifter's AKA system to catch banevader - multiaccounters.
https://sampforum.blast.hk/showthread.php?tid=646136
Reply
#3

I checked it out, but I really do not want to mess up with these MySQL things, i rather just stay here, on y_ini land, where i feel comfortable and know, how to control things. MySQL for me now is a whole new unopened world, that I feel will get lost. I dont even know how to manage database, i guess it needs some kind of extern web system, such as phpmyadmin, that i do not have available.
Reply
#4

Quote:
Originally Posted by MrakBuster
Посмотреть сообщение
I checked it out, but I really do not want to mess up with these MySQL things, i rather just stay here, on y_ini land, where i feel comfortable and know, how to control things. MySQL for me now is a whole new unopened world, that I feel will get lost. I dont even know how to manage database, i guess it needs some kind of extern web system, such as phpmyadmin, that i do not have available.
That script is not MySQL. it is Y-INI
Reply
#5

Quote:
Originally Posted by MrakBuster
Посмотреть сообщение
I checked it out, but I really do not want to mess up with these MySQL things, i rather just stay here, on y_ini land, where i feel comfortable and know, how to control things. MySQL for me now is a whole new unopened world, that I feel will get lost. I dont even know how to manage database, i guess it needs some kind of extern web system, such as phpmyadmin, that i do not have available.
Quote:
Originally Posted by jasperschellekens
Посмотреть сообщение
That script is not MySQL. it is Y-INI
That actually uses dini lol or dini2 that's ur choice. But i recommend dini2 by gammix its fast and decent.
Link to dini2: https://sampforum.blast.hk/showthread.php?tid=611399
You can also convert it to y_ini easily, it's literally 95 lines lol.
Reply
#6

Your entire idea is correct and I’ll further guide you.

I think you should a timer when the player connects to load their stats right? Since you’re using Y_ini data should be stored into files, you should then create a separate file by the name Bans and store players name, ip, ban date etc. when they connect and data is being loaded you should check if they were any records in the ban file to match the current connecting player. Functions like Strcmp would be great in checking IPs.
Reply
#7

well if u dont want to use these guy's created cool system, than create it by yourself, you must save banned IPs in one file and than load it, gl.
Reply
#8

Mugalito: You are totally right, however I am about joining the adventure of making it, I beleive there are people, that are going to support me doing it, anyways I highly appreciate all of you include Rogue for helping, but I will make it on my own. Learning constantly, thats what I want.

So...

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Your entire idea is correct and I’ll further guide you.

I think you should a timer when the player connects to load their stats right? Since you’re using Y_ini data should be stored into files, you should then create a separate file by the name Bans and store players name, ip, ban date etc. when they connect and data is being loaded you should check if they were any records in the ban file to match the current connecting player. Functions like Strcmp would be great in checking IPs.
Nice, I will more than welcome your help.

So, if I understood right, I need to make it somehow like this?

- When I ban player -> create file, save his IP into it (I guess i need GetPlayerIp)
- When the banned player tries to connect, compare his IP with IP i save to string with strcmp (?)
- If the comparison gets right (his IP is on list of banned ones - in the file) i kick him out

If you confirm, I am hoppin on it
Reply
#9

Quote:
Originally Posted by MrakBuster
Посмотреть сообщение
So, if I understood right, I need to make it somehow like this?

- When I ban player -> create file, save his IP into it (I guess i need GetPlayerIp)
- When the banned player tries to connect, compare his IP with IP i save to string with strcmp (?)
- If the comparison gets right (his IP is on list of banned ones - in the file) i kick him out

If you confirm, I am hoppin on it
yes, that's right. u can also create one file and write all of the banned IPs here (with names included later for unban)
Reply
#10

Quote:
Originally Posted by MrakBuster
Посмотреть сообщение
Mugalito: You are totally right, however I am about joining the adventure of making it, I beleive there are people, that are going to support me doing it, anyways I highly appreciate all of you include Rogue for helping, but I will make it on my own. Learning constantly, thats what I want.

So...



Nice, I will more than welcome your help.

So, if I understood right, I need to make it somehow like this?

- When I ban player -> create file, save his IP into it (I guess i need GetPlayerIp)
- When the banned player tries to connect, compare his IP with IP i save to string with strcmp (?)
- If the comparison gets right (his IP is on list of banned ones - in the file) i kick him out

If you confirm, I am hoppin on it
But do you realise some people may have dynamic ip adres and some players may have the same
Ip? Eg internet cafй.

If you still want to ban an ip. Create a file banned ips when you ban a player and Check if the ip is in that file onplayerconnect. If ip is there, kick player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)