AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with array (its not a n00b question) (https://forums.alliedmods.net/showthread.php?t=83772)

Speed! 01-15-2009 00:43

Problem with array (its not a n00b question)
 
I have this
PHP Code:

new const WEAPONPRICES[][] = { """0""""0""""0""""0""0",
"""0""0""0""0""0""0",
"0""0""0""0""0",
"150""0""0""0""""0",
"0""0""""0" 

when i use this, it works
PHP Code:

        static weapon
        weapon 
get_weaponid(g_primary_items[weap])
        
client_print(idprint_console"%s"WEAPONPRICES[weapon]) 

but if i do this

PHP Code:

        static weapon
        weapon 
get_weaponid(g_primary_items[weap])
        static 
price
        price 
WEAPONPRICES[weapon

it says

Quote:

Error: Must be assigned to an array on line (doesent matter what line)
plz help

danielkza 01-15-2009 01:07

Re: Problem with array (its not a n00b question)
 
You're creating an array of strings. Each string in another array. 'static price' IS NOT an array, then you CANT assign an array of chars (a string) to it.

You should store the weapon prices as cells (no quotes in the values, and a single dimension ([] instead of [][]), then use %d instead of %s in client_print.

Speed! 01-15-2009 01:38

Re: Problem with array (its not a n00b question)
 
Quote:

Originally Posted by danielkza (Post 744427)
You're creating an array of strings. Each string in another array. 'static price' IS NOT an array, then you CANT assign an array of chars (a string) to it.

You should store the weapon prices as cells (no quotes in the values, and a single dimension ([] instead of [][]), then use %d instead of %s in client_print.

thank you very much with my n00b erorr LOL


All times are GMT -4. The time now is 01:41.

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