09.02.2018, 00:31
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:
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:
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.
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", 2000, false, "i", targetid);
PHP код:
forward BanPlayer(playerid);
public BanPlayer(playerid)
{
Kick(playerid);
}
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.