Raised This Month: $ Target: $400
 0% 

String Array?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
chuckySTAR
Member
Join Date: Mar 2008
Old 08-08-2008 , 16:30   String Array?
Reply With Quote #1

Hey,
i need an string array, but its not working :/

Code:
new String:argsarr[3][] = {player, msg, motdTitle}
Pls help
chuckySTAR is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 08-08-2008 , 16:32   Re: String Array?
Reply With Quote #2

First, arrays may only be initialized with constant values. Also, you must specifiy the last dimension's size. Something like this would work fine:
PHP Code:
stock const MyArray[][32] =
{
    
"1",
    
"2",
    
"3"

danielkza is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-08-2008 , 16:36   Re: String Array?
Reply With Quote #3

Quote:
Originally Posted by danielkza View Post
First, arrays may only be initialized with constant values. Also, you must specifiy the last dimension's size.
This is not true.
You can do:

Code:
new MyArray[][] = {     "1",     "2",     "3" }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 08-08-2008 , 16:40   Re: String Array?
Reply With Quote #4

Is the same with letters?

PHP Code:
new MyArray[][] =
{
    
"a",
    
"b",
    
"c"

</SPAN></DIV>
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-08-2008 , 16:41   Re: String Array?
Reply With Quote #5

yes
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-08-2008 , 16:41   Re: String Array?
Reply With Quote #6

Sure. You can write all what you want into a string. ^^
__________________
Arkshine is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 08-08-2008 , 16:41   Re: String Array?
Reply With Quote #7

Quote:
Originally Posted by X-olent View Post
yes
Thank
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
chuckySTAR
Member
Join Date: Mar 2008
Old 08-08-2008 , 16:45   Re: String Array?
Reply With Quote #8

i get
erro 008: must be a constant expression; assumend zero
with
new argsarr[][] = {player, msg, motdTitle}
chuckySTAR is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 08-08-2008 , 16:58   Re: String Array?
Reply With Quote #9

Quote:
Originally Posted by chuckySTAR View Post
i get
erro 008: must be a constant expression; assumend zero
with
new argsarr[][] = {player, msg, motdTitle}
As I told you, the values must be constant expressions. That means:

1-)Literal strings
2-)Defines
3-)const variables
danielkza is offline
chuckySTAR
Member
Join Date: Mar 2008
Old 08-08-2008 , 17:06   Re: String Array?
Reply With Quote #10

I also tried that, but then i also get errors:
amxbans/cmdBan.inl(564) : error 029: invalid expression, assumed zero
amxbans/cmdBan.inl(564) : warning 215: expression has no effect
amxbans/cmdBan.inl(564) : error 001: expected token: ";", but found "const"
amxbans/cmdBan.inl(564) : error 001: expected token: "=", but found "["
amxbans/cmdBan.inl(564) : fatal error 107: too many error messages on one line

stock const argsarr[][] = {player, msg, motdTitle}
chuckySTAR 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 05:32.


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