SA-MP Forums Archive
Correct way to check for ban evaders - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Correct way to check for ban evaders (/showthread.php?tid=548404)



Correct way to check for ban evaders - Rick. - 29.11.2014

I store bans in a table in my sqlite database like this.


Checking if the account is banned is easy because the other values don't matter. But if there is a ban set for a certain range, serial and ISP the player should only get banned for evading if all information matches. I have no idea how to properly check for this and I would appreciate it if someone could give me some tips.


Re: Correct way to check for ban evaders - Lawbringer - 14.12.2014

You could use the SQL LIKE statement to select rows which have a similar IP address to ones that are banned, then do additional checks from there to see if the person is evading a ban?

SAMP doesn't use a serial system, so IP banning is the closest you're going to get.

Код:
// Check IP Ban Evading by comparing the IP to similar banned IPs
// Assumes you have the IP of the player stored as "Player[playerid][pIP]"
new ipp[12]; format(ipp,12,"%s",Player[playerid][pIP]);
new sql[128]; format(sql,128,"SELECT * FROM bans WHERE ip LIKE %%s",ipp);
new DBResult:res = db_query(db_handle,sql);

// At this point it will basically have a set of bans for which the first 12 characters of the IP are the same.
if(db_num_rows(res) > 0)
{
// Additional checks for IP Ban Evading
}