SA-MP Forums Archive
It shows me the wrong information - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: It shows me the wrong information (/showthread.php?tid=157113)



It shows me the wrong information - nuriel8833 - 05.07.2010

PHP код:
format(Stringsizeof(String), "(ID:%d | Ping: %d | IP: %s | Country: %s)",playerid,GetPlayerPing(playerid),IP,Country); 
Lets see what is wrong:
ID - Okay
Ping - it always says 128 or 256.While my ping is actually 10-50
IP - it shows my only 1 number - usually 56
Country - while im actually from Israel,it always telling me something else (Italy,Norway,Spain,Turkey etc..) and im not using any proxy or something

Full script:
PHP код:
   new Country[256],Name[256],IP[256];
   
CleanChat(playerid);
   
GetPlayerName(playeridNamesizeof(Name));
   
GetPlayerCountry(playerid,Country);
   
GetPlayerIp(playeridIPsizeof(IP));
   
format(Stringsizeof(String), "(ID:%d | Ping: %d | IP: %s | Country: %s)",playerid,GetPlayerPing(playerid),IP,Country);
    
SendClientMessage(playeridCOLOR_JString); 
So what is the problem?


Re: It shows me the wrong information - nuriel8833 - 06.07.2010

bump,please help


Re: It shows me the wrong information - Miikkel - 06.07.2010

I think you have to use %d for the IP

The rest I can't realy help you with as I never used thoose functions.


Re: It shows me the wrong information - Matthias_ - 06.07.2010

@Mikkel: No, IP is a string (it contains dots).

Hmm, as for the country function, that's not built in so that might be bugged.
GetPlayerIp should work fine though, try making the size of the string smaller.


Re: It shows me the wrong information - nuriel8833 - 06.07.2010

And how to so?
Ps - here is the country function:
Edit: no,still doesnt work
PHP код:
GetPlayerCountry(playerid,Country[256]){
       new 
IPAddress[256];
       new 
a,b,c,d,ipf;
       new 
File:IPFile;
       new 
Text[256],start,end;
       
GetPlayerIp(playerid,IPAddress,sizeof(IPAddress));
       
GetParams(IPAddress);
       
a=strval(Params[0]);
       
b=strval(Params[1]);
       
c=strval(Params[2]);
       
d=strval(Params[3]);
       if(
a==127 && b==&& c==&& d==1){
           
format(Country,sizeof(Country),"Localhost");
           return 
1;
       }
       
ipf = (16777216*a) + (65536*b) + (256*c) + d;
       if(!
fexist("CountriesIPs/IPLIST.csv")) return SendClientMessage(playerid,0xFF0000FF,"Country file not found.");
       
IPFile=fopen("CountriesIPs/IPLIST.csv",io_read);
       
fread(IPFile,Text,sizeof(Text),false);
    while(
strlen(Text)>0){
        
GetFileData(Text);
        
start=strval(FileData[0]);
        
end=strval(FileData[1]);
        if(
ipf>=start && ipf<=end){
            
format(Country,sizeof(Country),"%s(%s)",FileData[6],FileData[5]);
            
fclose(IPFile);
            return 
1;
        }
        
fread(IPFile,Text,sizeof(Text),false);
    }
    
fclose(IPFile);
    return 
1;




Re: It shows me the wrong information - nuriel8833 - 07.07.2010

Buuuuump


Re: It shows me the wrong information - dice7 - 07.07.2010

If it gives you the wrong country, then your IPLIST.csv file is wrong. Just use that GEOip plugin


Re: It shows me the wrong information - nuriel8833 - 15.07.2010

Quote:
Originally Posted by dice7
Посмотреть сообщение
If it gives you the wrong country, then your IPLIST.csv file is wrong. Just use that GEOip plugin
I solved that problem,apperently some IPs were incorrect,now what about the other strings?