27.01.2012, 20:49
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.
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 i = 0; i < MAX_PLAYERS; i++) {
if(!IsPlayerConnected(i)) continue;
if( PlayerInfo[i][pAdmin] > 0 ) continue;
if( WeaponGiven[i] == 1 ) continue;
if( Logged[i] == 1 ) {
GetPlayerName( i, pname, sizeof( pname ));
GetPlayerIp( i, IP, 20 );
if(GetPlayerWeapon(i) >= 1 && GetPlayerWeapon(i) <= 45) {
format(query, sizeof(query), "SELECT * FROM `Banned` WHERE `User` LIKE '%s' OR `IP` LIKE '%s' LIMIT 1", pname, IP);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() >= 1) {
format(query, sizeof(query), "UPDATE `Banned` SET IP='%s' WHERE `User` LIKE '%s'", IP, pname);
mysql_query(query);
SendClientMessage(i, COLOR_SILVER, "You are banned from this server");
}
else{
format( mystring, sizeof mystring, "Admin-Log: %s has been banned for weapon hack(%s).", pname, IP);
SendAdminMessage( COLOR_RED, mystring );
format(query, sizeof(query), "INSERT INTO `Banned` (`User`, `Banned By` , `Reason`, `IP`) VALUES ('%s', 'Steve' ,'WEAPON HACK', '%s')", pname, IP);
mysql_query(query);
}
TogglePlayerControllable(i,0);
Kick(i);
}
}
}
return 1;
}