Detect Country - 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: Detect Country (
/showthread.php?tid=612512)
Detect Country -
MayaEU - 18.07.2016
Hi, i have this that should detect the country, but its not working properly..
i'd be glad if it could just say "United States" instead of all the other text ((US) Oregon,Beaverton)
i have this on onplayerconnect
pawn Код:
GetPlayerIp(playerid,IP,sizeof(IP));
if(strlen(IP)<1) return 1;
format(req, sizeof(req),"geoip.cybernieve.com/?IP=%s",IP);
HTTP(playerid, HTTP_GET, req,"","GEOIP_HTTPREQUEST");
And this will send the connect message
pawn Код:
forward GEOIP_HTTPREQUEST(playerid, response_code, location[]);
public GEOIP_HTTPREQUEST(playerid, response_code, location[]) // The GEO-IP Callback.
{
new string[128];
if(response_code == 200) {
new Pname[64];
GetPlayerName(playerid,Pname,sizeof(Pname));
format(string, sizeof(string), "* %s has connected to the server. (%s) (%s)",Pname,PlayerIP[playerid],location);
if(!IsPlayerNPC(playerid))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] & ADMIN_GATE)
{
SendClientMessage(i, COLOR_YELLOW, string);
return 1;
}
}
}
}
return 1;
}
Re: Detect Country -
FuNkYTheGreat - 18.07.2016
try this include because this include only shows Country.
https://sampforum.blast.hk/showthread.php?tid=337304
Re: Detect Country -
MayaEU - 19.07.2016
Quote:
Originally Posted by FuNkYTheGreat
|
Anyone got that include? link is broken
Re: Detect Country -
GuyB790 - 19.07.2016
You can send the ip to be looked up at some GeoIP service with an HTTP request.
Re: Detect Country -
MayaEU - 19.07.2016
Quote:
Originally Posted by GuyB790
You can send the ip to be looked up at some GeoIP service with an HTTP request.
|
Do you know where?
Re: Detect Country -
Zeus666 - 19.07.2016
https://sampforum.blast.hk/showthread.php?tid=85969