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

GeoipCountry should not be given a country name. Please ask a question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jmm66332
Junior Member
Join Date: Jul 2017
Old 03-28-2018 , 12:32   GeoipCountry should not be given a country name. Please ask a question
Reply With Quote #1

I have sourced this source but it does not. I'll ask you a question.
and Country name is not saved.

public Login(Client)
{
if(GeoipCountry(ip, country, sizeof(country)) == false)
{
Format(country, sizeof(country), "unknow");
}
PrintToChatAll("\x03Country : %s", country);
}

Last edited by jmm66332; 03-28-2018 at 12:34.
jmm66332 is offline
_GamerX
AlliedModders Donor
Join Date: Jun 2011
Location: Fun Server
Old 03-28-2018 , 14:09   Re: GeoipCountry should not be given a country name. Please ask a question
Reply With Quote #2

PHP Code:
    char IP[15];
    
GetClientIP(clientIPsizeof(IP), true);
    if(!
GeoipCountry(IPcountry[client], sizeof country))
        
country[client] = "Unknown Country"
__________________
_GamerX is offline
Send a message via ICQ to _GamerX Send a message via Skype™ to _GamerX
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 03-28-2018 , 18:05   Re: GeoipCountry should not be given a country name. Please ask a question
Reply With Quote #3

Quote:
Originally Posted by _GamerX View Post
PHP Code:
    char IP[15];
    
GetClientIP(clientIPsizeof(IP), true);
    if(!
GeoipCountry(IPcountry[client], sizeof country))
        
country[client] = "Unknown Country"
You have to use strcopy:
PHP Code:
strcopy(country[client], sizeof(country[]), "Unknown Country"); 
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 03-28-2018 , 21:41   Re: GeoipCountry should not be given a country name. Please ask a question
Reply With Quote #4

If you have a static array, you do not have to use strcopy.
Fyren is offline
jmm66332
Junior Member
Join Date: Jul 2017
Old 03-29-2018 , 03:38   Re: GeoipCountry should not be given a country name. Please ask a question
Reply With Quote #5

Quote:
Originally Posted by _GamerX View Post
PHP Code:
    char IP[15];
    
GetClientIP(clientIPsizeof(IP), true);
    if(!
GeoipCountry(IPcountry[client], sizeof country))
        
country[client] = "Unknown Country"


new String:country[45]
new String:ip[16];
GetClientIP(Client, ip, sizeof(ip), true);

if(!GeoipCountry(ip, country, sizeof(country)))
{
Format(country, sizeof(country), "unknow");
}
PrintToChatAll("\x03Country: %s", country);

I've done what you told me, but I still do not save the country.

Last edited by jmm66332; 03-29-2018 at 03:39.
jmm66332 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-29-2018 , 03:44   Re: GeoipCountry should not be given a country name. Please ask a question
Reply With Quote #6

Quote:
Originally Posted by _GamerX View Post
PHP Code:
    char IP[15];
    
GetClientIP(clientIPsizeof(IP), true);
    if(!
GeoipCountry(IPcountry[client], sizeof country))
        
country[client] = "Unknown Country"
You must define the char array. Also there's a left paratensis missing after sizeof. (sourcemod api: Gets the full country name. (max length of output string is 45))
char country[MAXPLAYERS+1][45];

Last edited by Visual77; 03-29-2018 at 04:02.
Visual77 is offline
jmm66332
Junior Member
Join Date: Jul 2017
Old 03-29-2018 , 04:00   Re: GeoipCountry should not be given a country name. Please ask a question
Reply With Quote #7

I have made the declaration again but it is not going .. still the country is not floating.
new String:ip[16];
GetClientIP(Client, ip, sizeof(ip), true);
public OnClientPutInServer(Client)
{
if(!GeoipCountry(ip, country[Client], sizeof(country)))
{
country[Client] = "unknow";
}
PrintToChatAll("\x03Country: %s", country);
}

Last edited by jmm66332; 03-29-2018 at 04:01.
jmm66332 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 03-29-2018 , 05:37   Re: GeoipCountry should not be given a country name. Please ask a question
Reply With Quote #8

I think the problem is the client must be returning "loopback". That should prevent GeoipCountry from properly saving the client's country name to the designated string.

Last edited by DarkDeviL; 03-29-2018 at 12:49. Reason: Use the Report Post, rather than replying to or otherwise getting involved in flame wars
cravenge is offline
Reply


Thread Tools
Display Modes

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 06:54.


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