01.02.2012, 22:08
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",ip, password);
new pip[16];
for ( new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerIp(i, pip, sizeof(pip));
GetPlayerName( i, Nam, sizeof Nam );
if(!strcmp(ip, pip, true))
{
format( mystring, sizeof mystring, "Admin-Log: %s has banned by tring to loggin on rcon.", Nam );
SendAdminMessage( COLOR_RED, mystring );
new query[400];
new time = gettime();
getdate(Year, Month, Day);
format(mystring, sizeof(mystring), "%02d/%02d/%d", Day, Month, Year);
format(query, sizeof(query), "INSERT INTO `Banned` (`User`, `Banned By`, `Reason`, `Time` ,`Date` , `IP`) VALUES ('%s', 'Steve' , 'RCON BAN','%d' ,'%d' ,'%s')", Nam, time, mystring, pip);
mysql_query(query);
SendClientMessage( i, COLOR_SILVER, "You have been banned from this server." );
TogglePlayerControllable(i,false);
Kick(i);
mysql_store_result();
}
}
}
return 1;
}