Помогите разобраться с GeoIP
#2

Можешь использовать это:

Code:
OnPlayerConnect:
    new pip[16],str[124];

    GetPlayerIp(playerid, pip, 16);

    format(str, sizeof(str),"api.ipinfodb.com/v3/ip-country/?key=e865d96b7c0266c2b999598ec728386193141fa7dde10af5696615f5a1b3cae1&ip=%s",pip);
    HTTP(playerid, HTTP_GET, str, "", "getPlayerCountry");

В конец мода:
forward getPlayerCountry(index, response_code, data[]);
public getPlayerCountry(index, response_code, data[])
{
    if(response_code == 200)
    {
    	new buffer[84],str[42],country[20];

        format(buffer, sizeof(buffer), "%s", data);

        strmid(str, buffer, 4, strlen(buffer));
        strmid(country, str, strfind(str, ";", true) + 4, strlen(buffer));

        format(pData[index][pCountry], 20, "%s", country);
    }
    else format(pData[index][pCountry], 5, "moon");
	return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)