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



OnRconLogin - Bogdan1992 - 01.02.2012

Well how can i fix this thing. After someone trys to login with rcon and fails should add in my table just 1 name, but it inserts that name like 9 times or something like that.

PHP код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(!
success)
    {
        
printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ippassword);
        new 
pip[16];
        for ( new 
0MAX_PLAYERSi++)
        {
            
GetPlayerIp(ipipsizeof(pip));
            
GetPlayerNameiNamsizeof Nam );
            if(!
strcmp(ippiptrue))
            {
                 
formatmystringsizeof mystring"Admin-Log: %s has banned by tring to loggin on rcon."Nam );
                
SendAdminMessageCOLOR_REDmystring );
                new 
query[400];
                new 
time gettime();
                
getdate(YearMonthDay);
                
format(mystringsizeof(mystring), "%02d/%02d/%d"DayMonthYear);
                
format(querysizeof(query), "INSERT INTO `Banned` (`User`, `Banned By`, `Reason`, `Time` ,`Date` , `IP`) VALUES ('%s', 'Steve' , 'RCON BAN','%d' ,'%d' ,'%s')"Namtimemystringpip);
                
mysql_query(query);
                
SendClientMessageiCOLOR_SILVER"You have been banned from this server." );
                
TogglePlayerControllable(i,false);
                
Kick(i);
                
mysql_store_result();
            }
        }
    }
    return 
1;




Re: OnRconLogin - DRIFT_HUNTER - 01.02.2012

pawn Код:
if(strcmp(ip, pip) == 0)
And add check IsPlayerConnected or use foreach include


Re: OnRconLogin - Bogdan1992 - 01.02.2012

Thanks


Re: OnRconLogin - Snowman12 - 01.02.2012

printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password); not needed. SA:MP auto prints it.