16.11.2010, 10:41
(
Последний раз редактировалось Slice; 12.05.2014 в 14:52.
)
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
Functions
Country Indexes
See this link: http://slice.pastebay.org/109849
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
- Compile and load geoip.pwn.
- Put geoip.inc in your PAWN include folder.
- Put #include <geoip> at the top of any PAWN script you want to use the functions in.
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." );
}
}
pawn Код:
GetPlayerCountryIndex( playerid ); // Example: 19
GetPlayerCountryName( playerid ); // Example: Sweden
GetPlayerCountryCode( playerid ); // Example: SE
See this link: http://slice.pastebay.org/109849