Raised This Month: $ Target: $400
 0% 

Error: Array sizes do not match


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 03-31-2011 , 14:14   Error: Array sizes do not match
Reply With Quote #1

what am i doing wrong here? And could anyone fix that for me... just get one error when i try to compile:

Code:
Error: Array sizes do not match, or destination array is too small on line 27
PHP Code:
public client_putinserver(id)
{
    new 
Country[4], Ip[21]
    
get_user_ip(idIpcharsmax(Ip))
    
geoip_countryIpCountry );
    new 
name[32], szCountry[4], szIP[21
    
get_user_ip(idszIPcharsmax(szIP)) 
    
geoip_code2szIPszCountry );
    
get_user_name(idname31
    
    new 
szAuth[35];
    
get_user_authid(idszAuthcharsmax(szAuth));
    
    if( 
equal(szAuth"STEAM_0:0:39679185"))
    {
        
ColorChat(0RED"%s^x01 %s^x03 [%s]^x04 %s^x01 Has connected from^x04 %s"ClanTagCLMsgszCountrynameCountry)
    }
    else
    {
        
ColorChat(0RED"%s^x01 %s^x03 [%s]^x04 %s^x01 Has connected from^x04 %s"ClanTagIsUserAdmin(id) ? "Admin" "Player"szCountrynameCountry);
    }


Last edited by FlyingHorse; 03-31-2011 at 14:17.
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-31-2011 , 14:54   Re: Error: Array sizes do not match
Reply With Quote #2

We need to know what line 27 is.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 03-31-2011 , 15:10   Re: Error: Array sizes do not match
Reply With Quote #3

Quote:
Originally Posted by Emp` View Post
We need to know what line 27 is.

geoip_code2( szIP, szCountry );
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 03-31-2011 , 16:36   Re: Error: Array sizes do not match
Reply With Quote #4

your array is to small like include said...

PHP Code:
Max name is 45 characters
try to add 45 on your array
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 03-31-2011 , 17:22   Re: Error: Array sizes do not match
Reply With Quote #5

Quote:
Originally Posted by tuty View Post
your array is to small like include said...

PHP Code:
Max name is 45 characters
try to add 45 on your array
My english sucsk.. dont understand very good. could anyone fix that for me?..
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
bibu
Veteran Member
Join Date: Sep 2010
Old 03-31-2011 , 17:30   Re: Error: Array sizes do not match
Reply With Quote #6

My god -.-'

szCountry[45]
bibu is offline
FlyingHorse
Senior Member
Join Date: Apr 2010
Location: Under your bed.
Old 03-31-2011 , 17:34   Re: Error: Array sizes do not match
Reply With Quote #7

tried but still doesnt work .. same error as before

PHP Code:
public client_putinserver(id)
{
    new 
Country[4], Ip[21]
    
get_user_ip(idIpcharsmax(Ip))
    
geoip_countryIpCountry );
    new 
name[32], szCountry[45], szIP[21
    
get_user_ip(idszIPcharsmax(szIP));
    
geoip_code2szIPszCountry );
    
get_user_name(idname31
    
    new 
szAuth[35];
    
get_user_authid(idszAuthcharsmax(szAuth));
    
    if( 
equal(szAuth"STEAM_0:0:39679185"))
    {
        
ColorChat(0RED"%s^x01 %s^x03 [%s]^x04 %s^x01 Has connected from^x04 %s"ClanTagCLMsgszCountrynameCountry)
    }
    
    else
    {
        
ColorChat(0RED"%s^x01 %s^x03 [%s]^x04 %s^x01 Has connected from^x04 %s"ClanTagIsUserAdmin(id) ? "Admin" "Player"szCountrynameCountry);
    }

i have one that shows 2 character country and one that shows the full name of it.. and ive never done that before in the same mesasge

Last edited by FlyingHorse; 03-31-2011 at 17:45.
FlyingHorse is offline
Send a message via Skype™ to FlyingHorse
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 03-31-2011 , 18:49   Re: Error: Array sizes do not match
Reply With Quote #8

Quote:
Originally Posted by tuty View Post
your array is to small like include said...

PHP Code:
Max name is 45 characters
try to add 45 on your array
That is actually completely wrong.

If we look at geoip_code2, you can see that the second parameter has a declared array size (3). You need to pass an array for the second parameter that has that same array size.

@FlyingHorse: szCountry[3]
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-31-2011 , 19:00   Re: Error: Array sizes do not match
Reply With Quote #9

geoip_code2() takes an array size of 3.
Also, geoip_country() can give a result up to 45 characters, so you should increase your array size.

Code:
public client_putinserver(id)
{
    new Country[46], Ip[21]
    get_user_ip(id, Ip, charsmax(Ip))
    geoip_country( Ip, Country, 45 );
    new name[32], szCountry[3], szIP[21] 
    get_user_ip(id, szIP, charsmax(szIP)) 
    geoip_code2( szIP, szCountry );
    get_user_name(id, name, 31) 
    
    new szAuth[35];
    get_user_authid(id, szAuth, charsmax(szAuth));
    
    if( equal(szAuth, "STEAM_0:0:39679185"))
    {
        ColorChat(0, RED, "%s^x01 %s^x03 [%s]^x04 %s^x01 Has connected from^x04 %s", ClanTag, CLMsg, szCountry, name, Country)
    }
    else
    {
        ColorChat(0, RED, "%s^x01 %s^x03 [%s]^x04 %s^x01 Has connected from^x04 %s", ClanTag, IsUserAdmin(id) ? "Admin" : "Player", szCountry, name, Country);
    }
}
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 14:41.


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