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



anti-cheat - Bogdan1992 - 27.01.2012

Hi, i have this function for weapon checking. Well sometimes works good but, today i saw that it didn't save the IP from player. Actually 40 players banned and only 7 or 8 it shows the IP.
So do you know what is happening here.


PHP код:
//I have this at OnGameModeInit
SetTimer("WeaponCheck",2000,1);
public 
WeaponCheck()
{
    new 
IP[20], query[500];
    for ( new 
0MAX_PLAYERSi++) {
        if(!
IsPlayerConnected(i)) continue;
        if( 
PlayerInfo[i][pAdmin] > ) continue;
        if( 
WeaponGiven[i] == ) continue;
        if( 
Logged[i] == ) {
            
GetPlayerNameipnamesizeofpname ));
            
GetPlayerIpiIP20 );
            if(
GetPlayerWeapon(i) >= && GetPlayerWeapon(i) <= 45) {
                
format(querysizeof(query), "SELECT * FROM `Banned` WHERE `User` LIKE '%s' OR `IP` LIKE '%s' LIMIT 1"pnameIP);
                
mysql_query(query);
                
mysql_store_result();
                if(
mysql_num_rows() >= 1) {
                    
format(querysizeof(query), "UPDATE `Banned` SET IP='%s' WHERE `User` LIKE '%s'"IPpname);
                    
mysql_query(query);
                    
SendClientMessage(iCOLOR_SILVER"You are banned from this server");
                }
                else{
                       
formatmystringsizeof mystring"Admin-Log: %s has been banned for weapon hack(%s)."pnameIP);
                       
SendAdminMessageCOLOR_REDmystring );
                       
format(querysizeof(query), "INSERT INTO `Banned` (`User`, `Banned By` , `Reason`, `IP`) VALUES ('%s', 'Steve' ,'WEAPON HACK', '%s')"pnameIP);
                    
mysql_query(query);
                }
                
TogglePlayerControllable(i,0);
                   
Kick(i);
            }
        }
    }
    return 
1;




Re: anti-cheat - Bogdan1992 - 28.01.2012

bump