SA-MP Forums Archive
/ostats error REP+ - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /ostats error REP+ (/showthread.php?tid=640553)



/ostats error REP+ - Filbert - 04.09.2017

PHP код:
const MAX_COUNTRY_NAME 45;
native GetCountryName(const ipaddress[], country[], size sizeof country);
GetPlayerCountryName(playerid)
{
    new 
ip[34], country[MAX_COUNTRY_NAME];
    
GetPlayerIp(playeridipsizeof(ip));
    new 
ret GetCountryName(ipcountrysizeof(country));
    if(!
ret)
        
format(countrysizeof(country), "Private IP");
    return 
country;

PHP код:
format(tmpsizeof(tmp), "{FFFFFF}IP: {00FF00}%s {FFFFFF} || {FFFFFF}Country: {00FF00}%s\n"dini_Get(file,"IP"), GetPlayerCountryName(dini_Get(file,"IP"))); strcat(stringtmp); 
Код:
D:\Data\SAMP Servers\SATDM\Gamemodes\SATDM~Beta.pwn(20949) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: /ostats error REP+ - Kane - 04.09.2017

Код:
GetPlayerCountryName(dini_Get(file,"IP")));
You're using the IP to grab their country but GetPlayerCountryName() uses playerid.


Re: /ostats error REP+ - Filbert - 04.09.2017

So, what should I do?


Re: /ostats error REP+ - Kane - 04.09.2017

Make a second function for IPs.

PHP код:
GetPlayerCountryName(ip[]) 

    new 
country[MAX_COUNTRY_NAME]; 
    new 
ret GetCountryName(ipcountrysizeof(country)); 
    if(!
ret
        
format(countrysizeof(country), "Private IP"); 
    return 
country