Raised This Month: $32 Target: $400
 8% 

player country (geoip)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-16-2018 , 18:00   player country (geoip)
Reply With Quote #1

Hello, I'm trying to get player's country with geoip but it's not working, it's always returning 0. Besides, I'm using amxx 1.9.0 (latest)

Code:
public client_putinserver(this) {     if (is_user_bot(this))         return;     if (is_user_hltv(this))         return;     new szName[32], szCountry[32], szIp[32];     get_user_name(this, szName, charsmax(szName));     get_user_ip(this, szIp, charsmax(szIp), 1);     if (geoip_country_ex(szIp, szCountry, charsmax(szCountry)) == 0)         copy(szCountry, charsmax(szCountry), "N/A");     client_print(0, print_chat, "Player %s has connected (%s).", szName, szCountry); }
__________________









Last edited by CrazY.; 12-16-2018 at 18:05.
CrazY. is offline
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 12-16-2018 , 20:06   Re: player country (geoip)
Reply With Quote #2

Try this

PHP Code:
public client_putinserver(this)
{
    if (
is_user_bot(this))
        return;

    if (
is_user_hltv(this))
        return;

new 
szName[32], szCountry[46], szIp[17];
   
    
get_user_name(thisszNamecharsmax(szName));
    
get_user_ip(thisszIpcharsmax(szIp));
    
geoip_country(szIpszCountrycharsmax(szCountry));
   
    if(!
strlen(szCountry)) szCountry "N/A";
    
    
client_print(0print_chat"Player %s has connected (%s)."szNameszCountry);

__________________

Last edited by SomewhereLost; 12-16-2018 at 20:09.
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-17-2018 , 07:47   Re: player country (geoip)
Reply With Quote #3

geoip_country it's deprecated in amxx 1.9.0.
__________________








CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-17-2018 , 09:28   Re: player country (geoip)
Reply With Quote #4

Show meta list.

And server operating system.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-17-2018 , 10:26   Re: player country (geoip)
Reply With Quote #5

https://wiki.alliedmods.net/AMX_Mod_...se_Notes#GeoIP
__________________
klippy is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-19-2018 , 17:59   Re: player country (geoip)
Reply With Quote #6

Apparently it is working now.
__________________








CrazY. is offline
LondoN
Senior Member
Join Date: Dec 2015
Location: Roman, Romania.
Old 12-20-2018 , 05:11   Re: player country (geoip)
Reply With Quote #7

public client_putinserver ( Player )
{
if ( is_user_bot ( Player ) || is_user_hltv ( Player ) )
return;

new Name [ 32 ], Country [ 32 ], IP [ 16 ];
get_user_name ( id, Name, charsmax ( Name ) );
get_user_ip ( id, IP, charsmax ( IP ), 1 );
geoip_country ( IP, Country, charsmax ( Country ) );

client_print ( 0, print_chat, "Player %s joined from %s", !strlen ( Country ) ? "N/A" : Country );
}

cam simplify the strlen.
__________________
LondoN is offline
eat1k
Senior Member
Join Date: Apr 2018
Old 12-22-2018 , 14:57   Re: player country (geoip)
Reply With Quote #8

P.S. You may to not use get_user_name() when you have "%n" (AMXX >= 1.8.3).
Code:
client_print_color(0, print_team_default, "^1Name: ^4%n", id);
__________________

Last edited by eat1k; 12-22-2018 at 14:59.
eat1k is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-22-2018 , 15:15   Re: player country (geoip)
Reply With Quote #9

If I didn't misunderstand, this will output player name. Cool, I didn't know, thank you.
__________________








CrazY. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode