AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   String Array? (https://forums.alliedmods.net/showthread.php?t=75592)

chuckySTAR 08-08-2008 16:30

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

Code:

new String:argsarr[3][] = {player, msg, motdTitle}
Pls help

danielkza 08-08-2008 16:32

Re: String Array?
 
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"



Exolent[jNr] 08-08-2008 16:36

Re: String Array?
 
Quote:

Originally Posted by danielkza (Post 666603)
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" }

AntiBots 08-08-2008 16:40

Re: String Array?
 
Is the same with letters?

PHP Code:

new MyArray[][] =
{
    
"a",
    
"b",
    
"c"


</SPAN></DIV>

Exolent[jNr] 08-08-2008 16:41

Re: String Array?
 
yes

Arkshine 08-08-2008 16:41

Re: String Array?
 
Sure. You can write all what you want into a string. ^^

AntiBots 08-08-2008 16:41

Re: String Array?
 
Quote:

Originally Posted by X-olent (Post 666610)
yes

Thank :D

chuckySTAR 08-08-2008 16:45

Re: String Array?
 
i get
erro 008: must be a constant expression; assumend zero
with
new argsarr[][] = {player, msg, motdTitle}

danielkza 08-08-2008 16:58

Re: String Array?
 
Quote:

Originally Posted by chuckySTAR (Post 666615)
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

chuckySTAR 08-08-2008 17:06

Re: String Array?
 
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}


All times are GMT -4. The time now is 05:32.

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