Raised This Month: $51 Target: $400
 12% 

confusing output from array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadow Of Death
Senior Member
Join Date: Jun 2005
Old 11-12-2011 , 14:49   confusing output from array
Reply With Quote #1

i try to put server informations in a array.
but the output confuse me.

PHP Code:
new server_address[2];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /test","test")
    
    
get_cvar_string("ip"server_address[0], 32);
    
get_cvar_string("port"server_address[1], 32);
}

public 
test()
{
    
server_cmd("say IP: %s"server_address[0]);
    
server_cmd("say Port: %s"server_address[1]);
    return 
PLUGIN_CONTINUE;

the output is
Code:
 IP: l27015
 Port: 27015
the port is correct but not the ip what i do wrong? o.0
__________________
Shadow Of Death is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-12-2011 , 14:55   Re: confusing output from array
Reply With Quote #2

new server_address[ 2 ][ 33 ]

Use that
__________________

Last edited by Bugsy; 11-12-2011 at 14:55.
Bugsy is offline
Shadow Of Death
Senior Member
Join Date: Jun 2005
Old 11-12-2011 , 14:59   Re: confusing output from array
Reply With Quote #3

Ok thx it work...
can you describe it too for me? ^^
__________________
Shadow Of Death is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-12-2011 , 15:11   Re: confusing output from array
Reply With Quote #4

You were reading both things into the same string.

Server was read into the string starting at the first position.
"the server"

Then you read port into the same string starting at second position which was overwriting most of the server and showing you the first letter of the server then port for server and port is correct since you read and retrieved both from second position.
"t27015"
"27015"
__________________

Last edited by Bugsy; 11-12-2011 at 15:19.
Bugsy 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 17:23.


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