Raised This Month: $ Target: $400
 0% 

Error: Must be assigned to an array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 06-01-2009 , 06:14   Error: Must be assigned to an array
Reply With Quote #1

PHP Code:
new const WEAPONLVLS[][] = { """""""4""""10""""1""5",
            
"""""""2""""6""6",
            
"""""""3""",
            
"8""9)""1""""""",
            
"4""9""""7" }

//...
static lvls
lvls 
WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)]
        
if(
g_playerlevel[id] == lvls || g_playerlevel[id] >= lvls)
       
len += formatex(menu[len], charsmax(menu) - len"\r%d.\r %s \y(Nivel %d)^n"weap-WPN_STARTID+1WEAPONNAMES[ArrayGetCell(g_primary_weaponidsweap)], WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)])
else
       
len += formatex(menu[len], charsmax(menu) - len"\r%d.\d %s (Nivel %d)^n"weap-WPN_STARTID+1WEAPONNAMES[ArrayGetCell(g_primary_weaponidsweap)], WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)]) 
Error: Must be assigned to an array on line 3248

what is the problem?
__________________
alan_el_more is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-01-2009 , 07:07   Re: Error: Must be assigned to an array
Reply With Quote #2

weapon lvls are strings...

Code:
static lvls[2]
lvls = WEAPONLVLS[ArrayGetCell(g_primary_weaponids, weap)]
also, replace %d with %s

or remove the "" and one [] from the initial array and place 0 where you don't want a level
__________________
Hunter-Digital is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 06-01-2009 , 07:38   Re: Error: Must be assigned to an array
Reply With Quote #3

PHP Code:
new const WEAPONLVLS[] = { "0""0""0""4""0""10""0""1""5",
            
"0""0""0""2""0""6""6",
            
"""0""0""3""0",
            
"8""9""1""0""0""0",
            
"4""9""0""7" }

//...

static lvls[2]
lvls[2] = WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)]
        
if(
g_playerlevel[id] == lvls || g_playerlevel[id] >= lvls)
       
len += formatex(menu[len], charsmax(menu) - len"\r%d.\r %s \y(Nivel %d)^n"weap-WPN_STARTID+1WEAPONNAMES[ArrayGetCell(g_primary_weaponidsweap)], WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)])
else
        
len += formatex(menu[len], charsmax(menu) - len"\r%d.\d %s (Nivel %d)^n"weap-WPN_STARTID+1WEAPONNAMES[ArrayGetCell(g_primary_weaponidsweap)], WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)]) 
Is that correct?
__________________
alan_el_more is offline
crazyeffect
Veteran Member
Join Date: Jul 2008
Location: Belgium
Old 06-01-2009 , 08:09   Re: Error: Must be assigned to an array
Reply With Quote #4

Try it out
__________________
crazyeffect is offline
Send a message via MSN to crazyeffect
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-01-2009 , 08:55   Re: Error: Must be assigned to an array
Reply With Quote #5

Why use a string to store integers?
__________________
Bugsy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 06-01-2009 , 10:25   Re: Error: Must be assigned to an array
Reply With Quote #6

no, the const in your first post with the rest of the code in your later post will work, but those are strings, you should do it like this:
PHP Code:
new const WEAPONLVLS[] = {0004010015,
            
0002066,
            
00030,
            
891000,
            
4907}
 
//...
 
static lvls
lvls 
WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)]
 
if(
g_playerlevel[id] == lvls || g_playerlevel[id] >= lvls)
       
len += formatex(menu[len], charsmax(menu) - len"\r%d.\r %d \y(Nivel %d)^n"weap-WPN_STARTID+1WEAPONNAMES[ArrayGetCell(g_primary_weaponidsweap)], WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)])
else
        
len += formatex(menu[len], charsmax(menu) - len"\r%d.\d %d (Nivel %d)^n"weap-WPN_STARTID+1WEAPONNAMES[ArrayGetCell(g_primary_weaponidsweap)], WEAPONLVLS[ArrayGetCell(g_primary_weaponidsweap)]) 
__________________
Hunter-Digital is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 06-02-2009 , 09:18   Re: Error: Must be assigned to an array
Reply With Quote #7

thanks Hunter-Digital for the help, works great!!!
__________________
alan_el_more 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 13:57.


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