GetPlayerCountry(playerid, country[], size = sizeof(country)); GetPlayerRegion(playerid, region[], size = sizeof(region)); GetPlayerCity(playerid, city[], size = sizeof(city)); GetPlayerISP(playerid, isp[], size = sizeof(isp)); GetPlayerTimezone(playerid, timezone[], size = sizeof(timezone)); GetPlayerZipcode(playerid, zipcode[], size = sizeof(zipcode));
public OnLookupComplete(playerid){
return 1;
}
|
Hi, I'd like to know whats the difference between this Script and Whitetigers GeoIP Plugin?
|
|
Is this accurate to detect players city/country/region? seems like the API is down
|
new pCountry[50];
GetPlayerCountry(playerid, pCountry, sizeof pCountry);
printf("The player whose ID is %d is from %s", playerid, pCountry);
[02/06/2016 12:08:35] [join] xxxxxxx has joined the server (4:93.87.xxx.xxx)
[02/06/2016 12:08:35] [debug] Server crashed while executing GM.amx
[02/06/2016 12:08:35] [debug] AMX backtrace:
[02/06/2016 12:08:35] [debug] #0 native CallLocalFunction () from samp-server.exe
[02/06/2016 12:08:35] [debug] #1 000212b8 in public HTTP_OnLookupResponse (index=4, response=200, data[]=@007c125c "{"as":"AS8400 TELEKOM SRBIJA a.d.","city":"Belgrade","country":"Serbia","country...") at E:\Grand Theft Auto Server\pawno\include\ipl.inc:65
[02/06/2016 12:08:35] [debug] Native backtrace:
[02/06/2016 12:08:35] [debug] #0 0047467c in ?? () from samp-server.exe
[02/06/2016 12:08:35] [debug] #1 004010b6 in ?? () from samp-server.exe
[02/06/2016 12:08:35] [debug] #2 74e762ca in ?? () from plugins\crashdetect.dll
[02/06/2016 12:08:35] [debug] #3 74e78b28 in ?? () from plugins\crashdetect.dll
[02/06/2016 12:08:35] [debug] #4 74e709c7 in ?? () from plugins\crashdetect.dll
[02/06/2016 12:08:35] [debug] #5 74e7631a in ?? () from plugins\crashdetect.dll
[02/06/2016 12:08:35] [debug] #6 72c051b9 in ?? () from plugins\streamer.dll
[02/06/2016 12:08:35] [debug] #7 00480cd0 in ?? () from samp-server.exe
[02/06/2016 12:08:35] [debug] #8 004912c7 in ?? () from samp-server.exe
public HTTP_OnLookupResponse(index, response, data[])
{
new pos = -1;
if (!IsPlayerConnected(index)) return 0;
else if (response == 200)
{
if (strfind(data, "Reserved", true) != -1 || strlen(data) < 15)
{
return 0;
}
else
{
new country[MAX_COUNTRY_NAME],region[MAX_COUNTRY_NAME],city[MAX_COUNTRY_NAME],isp[MAX_COUNTRY_NAME];
if ((pos = strfind(data, "\"country\":")) != -1)
{
pos = pos + 11;
strmid(country, data, pos, strfind(data, "\"", true, pos), MAX_COUNTRY_NAME);
}
if ((pos = strfind(data, "\"regionName\":")) != -1)
{
pos = pos + 14;
strmid(region, data, pos, strfind(data, "\"", true, pos), MAX_COUNTRY_NAME);
}
if ((pos = strfind(data, "\"city\":")) != -1)
{
pos = pos + 8;
strmid(city, data, pos, strfind(data, "\"", true, pos), MAX_COUNTRY_NAME);
}
if ((pos = strfind(data, "\"isp\":")) != -1)
{
pos = pos + 7;
strmid(isp, data, pos, strfind(data, "\"", true, pos), MAX_COUNTRY_NAME);
}
if (pos != -1)
{
strpack(g_asLookupData[index][e_LookupCountry], country, MAX_COUNTRY_NAME char);
strpack(g_asLookupData[index][e_LookupRegion], region, MAX_COUNTRY_NAME char);
strpack(g_asLookupData[index][e_LookupCity], city, MAX_COUNTRY_NAME char);
strpack(g_asLookupData[index][e_LookupISP], isp, MAX_COUNTRY_NAME char);
CallLocalFunction("OnLookupComplete", "dssss", index, country, region, city, isp);
}
}
}
return 0;
}
|
Код:
[02/06/2016 12:08:35] [join] xxxxxxx has joined the server (4:93.87.xxx.xxx)
[02/06/2016 12:08:35] [debug] Server crashed while executing GM.amx
[02/06/2016 12:08:35] [debug] AMX backtrace:
[02/06/2016 12:08:35] [debug] #0 native CallLocalFunction () from samp-server.exe
[02/06/2016 12:08:35] [debug] #1 000212b8 in public HTTP_OnLookupResponse (index=4, response=200, data[]=@007c125c "{"as":"AS8400 TELEKOM SRBIJA a.d.","city":"Belgrade","country":"Serbia","country...") at E:\Grand Theft Auto Server\pawno\include\ipl.inc:65
[02/06/2016 12:08:35] [debug] Native backtrace:
[02/06/2016 12:08:35] [debug] #0 0047467c in ?? () from samp-server.exe
[02/06/2016 12:08:35] [debug] #1 004010b6 in ?? () from samp-server.exe
[02/06/2016 12:08:35] [debug] #2 74e762ca in ?? () from plugins\crashdetect.dll
[02/06/2016 12:08:35] [debug] #3 74e78b28 in ?? () from plugins\crashdetect.dll
[02/06/2016 12:08:35] [debug] #4 74e709c7 in ?? () from plugins\crashdetect.dll
[02/06/2016 12:08:35] [debug] #5 74e7631a in ?? () from plugins\crashdetect.dll
[02/06/2016 12:08:35] [debug] #6 72c051b9 in ?? () from plugins\streamer.dll
[02/06/2016 12:08:35] [debug] #7 00480cd0 in ?? () from samp-server.exe
[02/06/2016 12:08:35] [debug] #8 004912c7 in ?? () from samp-server.exe
|
[18:26:41] [GoldenScripter] Has Joined The Server | [IP: [Hidden]] | [Country:Unknown] | [City: Unknown]
//Connect With IP Country City
GetPlayerCountry(playerid, Country, sizeof(Country));
GetPlayerCity(playerid,City, sizeof(City));
GetPlayerName(playerid, plname, sizeof(plname));
GetPlayerIp(playerid, plip, sizeof(plip));
format(connected,sizeof(connected),"[%s] Has Joined The Server | [IP: %s] | [Country:%s] | [City: %s]",plname,plip,Country,City);
SendClientMessageToAll(COLOR_GREEN,connected);