SA-MP Forums Archive
rangeban - 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: rangeban (/showthread.php?tid=296095)



rangeban - Unknown123 - 09.11.2011

pawn Код:
stock isPlayerRangebanned(playerid)
{
    new string[81];
    Format(string, "SELECT * FROM `rangebanned` WHERE `ipaddress` = '%s'", splitip(PlayerIP(playerid)));
    mysql_query(string);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        mysql_free_result();
        return 1;
    }
    mysql_free_result();
    return 0;
}
how can i edit this to it check more ip?

now:

if your ip = 192.168.1.1
Then splitip return 192.168*
And if your rangebanned it will return "true" and give u ban message where isPlayerRangebanned

if ip 192.168* is banned, and a playe with ip 192.167.1.1 (return 192.167*) join, then it will return "false" and no ban message so i want it to loop like:

(-10 and +10)
Loop this ip: 192.168*

192.158*
192.159*
.....
.....
192.166*
192.167*
192.168*
192.169*
192.170*
.....
.....
192.174*
192.178*

if ip loaded from mysql mach with some of the looped ips then it will return true


Re: rangeban - MP2 - 09.11.2011

It's very hard to understand exactly what you need help with, could you try elaborating? Are you trying to make a rangeban system, is there a problem with it?


Re: rangeban - Unknown123 - 09.11.2011

i try to make a rangeban system yes. it works almost fine but i check more ips. i have range banned same guy

range banned:
50.60*
50.59*

but i want something to loop throght the last sumbers so i dont need to ban him more

pawn Код:
//IP_FROM_MYSQL = 192.168*
//CURRENT_PLAYER_IP = 192.172*
Loop(IP_FROM_MYSQL -10 then +10)
{
    //IP_FROM_MYSQL -10 start))
    //IP_FROM_MYSQL: 192.158*
    //IP_FROM_MYSQL: 192.159*
    //IP_FROM_MYSQL: 192.160*
    //IP_FROM_MYSQL: 192.161*
    //IP_FROM_MYSQL: 192.162*
    //IP_FROM_MYSQL: 192.163*
    //IP_FROM_MYSQL: 192.164*
    //IP_FROM_MYSQL: 192.165*
    //IP_FROM_MYSQL: 192.166*
    //IP_FROM_MYSQL: 192.167*
    //IP_FROM_MYSQL: 192.168*
    //IP_FROM_MYSQL: 192.169*
    //IP_FROM_MYSQL: 192.170*
    //IP_FROM_MYSQL: 192.171*
    //IP_FROM_MYSQL: 192.172*
    if(IP_FROM_MYSQL = CURRENT_PLAYER_IP))
    {
        //kick player
    }
    //If ip didnt match it would continue
}