SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 20/06/2016, 02:23 AM   #1
NeXoR
Gangsta
 
Join Date: Jun 2013
Posts: 577
Reputation: 20
Default couple bugs on Ban System

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
NeXoR is offline   Reply With Quote
Old 20/06/2016, 02:47 AM   #2
[KHK]Khalid
Gangsta
 
[KHK]Khalid's Avatar
 
Join Date: Jan 2012
Location: Alexandria, Egypt
Posts: 854
Reputation: 136
Default Re: couple bugs on Ban System

1. Use strcmp and its length parameter.
2. What is RPIP and RPN? What do these two functions actually do?
[KHK]Khalid is offline   Reply With Quote
Old 20/06/2016, 03:10 AM   #3
NeXoR
Gangsta
 
Join Date: Jun 2013
Posts: 577
Reputation: 20
Default Re: couple bugs on Ban System

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 ?
NeXoR is offline   Reply With Quote
Old 20/06/2016, 03:27 AM   #4
NeXoR
Gangsta
 
Join Date: Jun 2013
Posts: 577
Reputation: 20
Default Re: couple bugs on Ban System

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
NeXoR is offline   Reply With Quote
Old 20/06/2016, 03:38 AM   #5
[KHK]Khalid
Gangsta
 
[KHK]Khalid's Avatar
 
Join Date: Jan 2012
Location: Alexandria, Egypt
Posts: 854
Reputation: 136
Default Re: couple bugs on Ban System

Shouldn't it be

pawn Code:
if(!strcmp(banmsg[0], RPN(playerid), false, strlen(RPN(playerid))))
[KHK]Khalid is offline   Reply With Quote
Old 20/06/2016, 03:43 AM   #6
NeXoR
Gangsta
 
Join Date: Jun 2013
Posts: 577
Reputation: 20
Default Re: couple bugs on Ban System

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
NeXoR 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
[FilterScript] [FS] AFK SYSTEM NO BUGS HaiderABbas Filterscripts 4 28/06/2013 12:06 PM
My system bugs... Stefand Scripting Help 5 24/05/2013 10:11 PM
A Couple of Bugs Zach7 Scripting Help 3 27/08/2012 10:48 AM
Couple of bugs which could help me Dunoman77 Scripting Help 6 11/08/2012 07:04 AM
[UNSOLVED]My admin system has a couple of errors which im not sure of... Lorenc_ Help Archive 5 21/01/2010 04:42 AM


All times are GMT. The time now is 08:26 AM.


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