[Include] Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[])
#1

Ip Locator 1.1
What does it do?

Quite simple, it adds a callback that gets called just after a player connects. The players country and city are sent to a the callback as two strings. The data is retrieved from this site http://www.hostip.info/

When a player connects a HTTP get request is sent with the players ip to the site above, when the site responds OnRetrieveIpLocation will be called. (after everything in OnPlayerConnect)


Example FS
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <iploc>

public OnFilterScriptInit()
{
    return 1;
}

public OnRetrieveIpLocation(playerid, country[])
{

    new
        szStr[ 64 ];

    GetPlayerName( playerid, szStr, MAX_PLAYER_NAME );

    format( szStr, sizeof( szStr ), "<SERVER> Welcome %s to the server. From %s", szStr, country );

    SendClientMessageToAll( -1, szStr );

}

public OnPlayerConnect( playerid )
{
    return 1;
}
NOTE: If an ip isn't stored on that site it's country will be "Private country" (this happens with localhost too). I could also add lat/lon but i thought that would be pretty pointless.

If anyone spots any bugs please point them out and ill try fix em.

UPDATE 1.1
  • Code re-written much more efficient and should hopefully work on linux.
  • Callback no longer has city argument, it was too inaccurate on all free sites i could find.
Download: http://dl.dropbox.com/u/76608104/iploc1.1.inc

Alternative:
If this isn't what your after try slices plugin free GeoIp filterscript.
Slices plugin free GeoIp: https://sampforum.blast.hk/showthread.php?tid=190699
Reply


Messages In This Thread
OnRetrieveIpLocation(playerid, country[]) (1.1) - by iggy1 - 25.04.2012, 19:57
Respuesta: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by [DOG]irinel1996 - 25.04.2012, 20:03
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Edvin - 25.04.2012, 20:34
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Niko_boy - 26.04.2012, 15:12
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by TheArcher - 26.04.2012, 15:22
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by InfinityCOD - 26.04.2012, 15:44
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by iggy1 - 26.04.2012, 16:12
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Niko_boy - 26.04.2012, 16:16
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by iggy1 - 26.04.2012, 16:18
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Niko_boy - 26.04.2012, 16:45
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by iggy1 - 26.04.2012, 16:50
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Niko_boy - 27.04.2012, 12:11
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Slice - 27.04.2012, 12:16
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by iggy1 - 27.04.2012, 12:21
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by xXitsgodzillaXx - 27.04.2012, 12:52
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Awankz - 27.04.2012, 12:56
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Michael@Belgium - 27.04.2012, 15:50
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by iggy1 - 27.04.2012, 18:22
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Michael@Belgium - 27.04.2012, 19:01
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by iggy1 - 27.04.2012, 19:09
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Niko_boy - 28.04.2012, 02:33
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Michael@Belgium - 28.04.2012, 09:59
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by James Coral - 28.04.2012, 11:22
Respuesta: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Manuel7284 - 28.04.2012, 13:44
Re: Respuesta: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by iggy1 - 28.04.2012, 16:10
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by FalconX - 30.04.2012, 13:27
Respuesta: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Dovahkiin96 - 08.07.2012, 09:54
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by iggy1 - 08.07.2012, 17:38
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Dovahkiin96 - 09.07.2012, 06:58
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Dovahkiin96 - 09.07.2012, 07:03
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by AhmadKing - 19.02.2013, 18:28
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by RuthlessThuG - 19.02.2013, 21:46
Re: Ip Locator Adds Callback OnRetrieveIpLocation(playerid, country[], city[]) - by Juvanii - 21.06.2014, 17:41

Forum Jump:


Users browsing this thread: 1 Guest(s)