[FilterScript] Plugin-free GeoIP
#1

hey,
This will provide functionality to get what country a player is from. You can get the country name, code, and index (you can use the index and match it against a bunch of constants, example below).
No plug-ins, databases, or anything needed!

What you have to do
  1. Compile and load geoip.pwn.
  2. Put geoip.inc in your PAWN include folder.
  3. Put #include <geoip> at the top of any PAWN script you want to use the functions in.
Example usage
pawn Код:
#include <a_samp>
#include <geoip>

public OnGeoipUpdate( playerid )
{
    new
        message[ 32 + MAX_COUNTRY_NAME ]
    ;
   
    format( message, sizeof( message ), "Did I hear you're from %s?", GetPlayerCountryName( playerid ) );
   
    SendClientMessage( playerid, -1, message );
   
    switch ( GetPlayerCountryIndex( playerid ) )
    {
        case COUNTRY_SE: SendClientMessage( playerid, -1, "Vдlkommen." );
        case COUNTRY_HR: SendClientMessage( playerid, -1, "Bok." );
        case COUNTRY_RU: SendClientMessage( playerid, -1, "zdravstvuyte." );
        case COUNTRY_NL: SendClientMessage( playerid, -1, "Hoi." );
        case COUNTRY_RO: SendClientMessage( playerid, -1, "Salut." );
        case COUNTRY_BE: SendClientMessage( playerid, -1, "Goedenmiddag." );
        case COUNTRY_AU: SendClientMessage( playerid, -1, "G'day mate." );
        case COUNTRY_IN: SendClientMessage( playerid, -1, "Namaste." );
        case COUNTRY_US: SendClientMessage( playerid, -1, "What's up." );
        case COUNTRY_GB: SendClientMessage( playerid, -1, "Wotcha." );
        case COUNTRY_DE: SendClientMessage( playerid, -1, "Guten tag." );
       
        default: SendClientMessage( playerid, -1, "Welcome." );
    }
}
Functions
pawn Код:
GetPlayerCountryIndex( playerid ); // Example: 19
GetPlayerCountryName( playerid ); // Example: Sweden
GetPlayerCountryCode( playerid ); // Example: SE
Country Indexes
See this link: http://slice.pastebay.org/109849
Reply


Messages In This Thread
Plugin-free GeoIP - by Slice - 16.11.2010, 10:41
Re : Plugin-free GeoIP - by Hip-hop - 16.11.2010, 10:59
Re: Plugin-free GeoIP - by Slice - 16.11.2010, 11:00
Re: Re : Plugin-free GeoIP - by Gavibro - 16.11.2010, 11:18
Re: Plugin-free GeoIP - by mmrk - 16.11.2010, 11:42
Re: Plugin-free GeoIP - by MicroD - 16.11.2010, 11:50
Re: Plugin-free GeoIP - by Slice - 16.11.2010, 11:57
Re: Plugin-free GeoIP - by mmrk - 16.11.2010, 12:09
Re: Plugin-free GeoIP - by Slice - 16.11.2010, 12:11
Re: Plugin-free GeoIP - by Zh3r0 - 16.11.2010, 12:18
Re: Plugin-free GeoIP - by Skaizo - 16.11.2010, 12:28
Re: Plugin-free GeoIP - by SkizzoTrick - 16.11.2010, 12:50
Re: Plugin-free GeoIP - by Tr1viUm - 16.11.2010, 12:53
Re: Plugin-free GeoIP - by Scenario - 16.11.2010, 12:58
Re: Plugin-free GeoIP - by MicroD - 16.11.2010, 13:04
Re: Plugin-free GeoIP - by Slice - 16.11.2010, 14:27
Re: Plugin-free GeoIP - by playbox12 - 16.11.2010, 14:36
Re: Plugin-free GeoIP - by [H]265 - 16.11.2010, 14:36
Re: Plugin-free GeoIP - by Slice - 16.11.2010, 15:52
Re: Plugin-free GeoIP - by playbox12 - 16.11.2010, 16:18
Re : Plugin-free GeoIP - by Hip-hop - 16.11.2010, 16:42
Re: Plugin-free GeoIP - by Rock18 - 16.11.2010, 17:55
Re: Plugin-free GeoIP - by IstuntmanI - 22.12.2010, 15:53
Re: Plugin-free GeoIP - by Zh3r0 - 22.12.2010, 16:16
Re: Plugin-free GeoIP - by Lady Cucumber - 22.12.2010, 16:41
Re: Plugin-free GeoIP - by kurta999 - 02.02.2011, 19:45
Re: Re : Plugin-free GeoIP - by mineralo - 21.05.2013, 13:35
Re: Plugin-free GeoIP - by Donboo - 06.03.2015, 18:30
Re: Plugin-free GeoIP - by rajeevkrao - 20.07.2017, 11:54
Re: Plugin-free GeoIP - by Crystallize - 20.07.2017, 12:15

Forum Jump:


Users browsing this thread: 1 Guest(s)