28.01.2012, 07:23
This is my ban check, take a look over it.
PHP код:
//This is on playerconnect
new query[200], ip[16];
GetPlayerName(playerid, pname, sizeof pname);
GetPlayerIp(playerid, ip, 16);
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(playerid, COLOR_SILVER, "You are banned from this server");
TogglePlayerControllable(playerid, 0);
Kick(playerid);
}
mysql_free_result();