02.07.2012, 09:54
I just made this:
It should be something as that, I think.
I used two IPs for testing, one of them was my IP. I inserted them in the DB with INET_ATON format. If you want to extract them you can use INET_NTOA to 'decrypt' them.
pawn Код:
COMMAND:test(playerid, params[])
{
new query[128], user, ip_s[16];
if(sscanf(params,"d",user)) return 1;
GetPlayerIp(user,ip_s,16);
format(query, 128, "SELECT * FROM ips WHERE ip=INET_ATON('%s') LIMIT 1",ip_s);
mysql_query(query), mysql_store_result();
if(mysql_num_rows())
{
Ban(user);
} else SendClientMessage(playerid,-1,"The IP of this player wasn't found in the database.");
mysql_free_result();
return 1;
}
I used two IPs for testing, one of them was my IP. I inserted them in the DB with INET_ATON format. If you want to extract them you can use INET_NTOA to 'decrypt' them.