Command for checking who is registered on that ip
#1

Hello.
I wanna make a irc command (!checkip), and when i put in a IP, it should display every username that uses that IP.
Right now, it only displays 1 user, but i want it to show EVERY player that has that ip.
This is my code:

PHP код:
//the command
IRCCMD:checkip(botidchannel[], user[], host[], params[])
{
if(!
IsEchoChannel(channel)) return iNoticeuserIRC_WRONG_CHANNEL);
new 
query[128],temp_ip[40];
if(
sscanf(params"s"temp_ip)) return iEchoUse("!checkip [ IP ADRESS ]");
format(query,sizeof(query),"SELECT * FROM user WHERE regip ='%s'",temp_ip);
mysql_function_query(dbhandle,query,true,"CheckIp","s",temp_ip);
return 
1;

PHP код:
//the public
forward CheckIp(temp_ip[]);
public 
CheckIp(temp_ip[])
{
    new 
num_rows,num_fields;
    
cache_get_data(num_rows,num_fields,dbhandle);
    if(
num_rows==0)
    {
    return 
iEchoUse("That ip adress isn't found in our database!");
    }
    else
    {
    new 
string[128],temp_username[35];
    
cache_get_field_content(0"username"temp_username);
    
format(string,sizeof(string),"%s",temp_username);
       
iEcho(string);
    return 
true;
    }

Reply


Messages In This Thread
Command for checking who is registered on that ip - by justjamie - 23.05.2016, 09:38
Re: Command for checking who is registered on that ip - by Konstantinos - 23.05.2016, 09:40
Re: Command for checking who is registered on that ip - by justjamie - 23.05.2016, 09:42

Forum Jump:


Users browsing this thread: 1 Guest(s)