lundi 18 juillet 2016

Detect Country

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

Code:

    GetPlayerIp(playerid,IP,sizeof(IP));
    if(strlen(IP)<1) return 1;
    format(req, sizeof(req),"http://ift.tt/29VHW6N",IP);
    HTTP(playerid, HTTP_GET, req,"","GEOIP_HTTPREQUEST");

And this will send the connect message

Code:

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;
}

Let's block ads! (Why?)



Detect Country

Aucun commentaire:

Enregistrer un commentaire