Raised This Month: $ Target: $400
 0% 

Problem with array (its not a n00b question)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Speed!
BANNED
Join Date: Jan 2009
Old 01-15-2009 , 00:43   Problem with array (its not a n00b question)
Reply With Quote #1

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
Speed! is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 01-15-2009 , 01:07   Re: Problem with array (its not a n00b question)
Reply With Quote #2

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.
__________________

Community / No support through PM
danielkza is offline
Speed!
BANNED
Join Date: Jan 2009
Old 01-15-2009 , 01:38   Re: Problem with array (its not a n00b question)
Reply With Quote #3

Quote:
Originally Posted by danielkza View Post
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
Speed! 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 01:41.


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