couple bugs on Ban System
#1

Hello there, I am experiencing 2 bugs with my ban system
First, since I use strfind, if for example the banned player is "John" and I connect using the name "Johnny"
it marks me as a banned player, how can I prevent this ?

Second, I have 3 triggers under OnPlayerConnect
First: if both playername and playerip exist in the ban file
Second: if only the playername exist in the ban file
Third: if only the player ip exist in the ban file

So, I wanted to ban the IP of a person who logs into a banned account
Code:
PHP Code:
new cdate[3];
            
getdate(cdate[2], cdate[1], cdate[0]);
            
format(stringsizeof(string), "%s|The Server|Ban Evasion(%s)|%i|%i|%i"RPIP(playerid), RPN(playerid), cdate[0], cdate[1], cdate[2]);
            
fwrite(filestring);
            
fclose(file);
            
SetTimerEx("DelayedKick"1000"i"playerid);
            return 
1
I tested it, it doesn't save the IP properly
Thanks in advice
Reply
#2

1. Use strcmp and its length parameter.
2. What is RPIP and RPN? What do these two functions actually do?
Reply
#3

Quote:
Originally Posted by [KHK]Khalid
View Post
1. Use strcmp and its length parameter.
2. What is RPIP and RPN? What do these two functions actually do?
Alright problem number 1 solver, thanks

Second problem:

ReturnPlayerIP
ReturnPlayerName

Explanation:
Player "John" is banned, and his IP Address is 1.1.1.1

IP Address 2.2.2.2 is connecting to the server using the name "John"

IP Address 2.2.2.2 is added to the banned list for Ban Evasion

Got it ?
Reply
#4

I have made some editions to the code, the problem was I used io_readwrite instead of io_append

This is my new code, but now it lets me connect with the name of the banned player (I tried connecting with the banned name)

PHP Code:
sscanf(buf"p<|>s[24]s[24]s[128]iii"banmsg[0], banmsg[1], banreasondate[0], date[1], date[2]);
            if(
strcmp(banmsg[0], RPN(playerid), falsestrlen(RPN(playerid))))
            {
                
SendClientMessage(playeridCOLOR_RED"----------- Ban Information -----------");
                
format(stringsizeof(string), "{42EB00}The username {FF0000}%s {42EB00}is banned from this server."banmsg[0]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
format(stringsizeof(string), "{42EB00}You have been banned by {FF0000}%s {42EB00}for {FF0000}%s."banmsg[1], banreason);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
format(string ,sizeof(string), "{42EB00}The date of banning is {FF0000}%i{42EB00}/{FF0000}%i{42EB00}/{FF0000}%i"date[0], date[1], date[2]);
                
SendClientMessage(playeridCOLOR_WHITEstring);
                
SendClientMessage(playeridCOLOR_WHITE"{42EB00}If you feel that you have been banned wrongly, contact an Administrator.");
                
SendClientMessage(playeridCOLOR_RED"---------------------------------------");
                
getdate(date[2], date[1], date[0]);
                
format(stringsizeof(string), "%s|The Server|Ban Evasion(%s)|%i|%i|%i"RPIP(playerid), RPN(playerid), date[0], date[1], date[2]);
                
fclose(file);
                
file fopen("bans.cfg"io_append);
                
fwrite(filestring);
                
fclose(file);
                
SetTimerEx("DelayedKick"1000"i"playerid);
                return 
1;
            } 
Thanks in advance
Reply
#5

Shouldn't it be

pawn Code:
if(!strcmp(banmsg[0], RPN(playerid), false, strlen(RPN(playerid))))
Reply
#6

Quote:
Originally Posted by [KHK]Khalid
View Post
Shouldn't it be

pawn Code:
if(!strcmp(banmsg[0], RPN(playerid), false, strlen(RPN(playerid))))
Can you punch me in the face please ? -__-

+repped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)