OnRconLogin
#1

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;

Reply
#2

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

Thanks
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)