Hi i know this is an old topic, but i tried to make it.
PHP Code:
getcountry(player

    
//self = admin 
    //player = who u want to know 
    
ip player getip(); 
    
ip_parts = []; 
    
part 0
    
ip_parts[part] = ""
    
prev_found 0
    for(
0ip.sizei++) 
    { 
        if(
ip[i] != "."
            
ip_parts[part] += ip[i]; 
        else 
        { 
            
part++; 
            
ip_parts[part] = ""
        } 
    } 
    
multi 1
    
num 0
    for(
ip_parts.size 1>= 0i--) 
    { 
        
num += int(ip_parts[i]) * multi
        
multi *= 256
    } 
    
args = []; 
    
args[0] = player
    
maps\mp\gametypes\_mysql::asyncQuery("SELECT country FROM countries WHERE ip < " num " ORDER BY ip DESC LIMIT 1", ::showLocationargs); 


showlocation(rowsargs

    if(!
isdefined(args[0])) 
    return; 
    if(
isdefined(rows) && isdefined(rows[0]) && isdefined(rows[0]["country"])) 
    
self iprintln(args[0].name " is from " rows[0]["country"]); 
    
self iprintln("test"); 

Then when i added a case "country" , i try to !country 0, server crashes giving me this error.
PHP Code:
script runtime errorpotential infinite loop in script killing thread
with developer 1
PHP Code:
******* script runtime error *******
undefined is not an entity: (file 'maps/mp/gametypes/_callbacksetup.gsc'line 214)
    
ip player getIP();
         *
called from:
(
file 'maps/mp/gametypes/_callbacksetup.gsc'line 1739)
    
thread getcountry();
           *
started from:
(
file 'maps/mp/gametypes/_callbacksetup.gsc'line 926)
CodeCallback_PlayerCommand(args)

I'm working with april 2014 countries list. Any help ?