Raised This Month: $ Target: $400
 0% 

Array must be indexed...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 12-23-2019 , 09:51   Array must be indexed...
Reply With Quote #1

Code:
PHP Code:
public HudHPColor(Float:a, &Float:b, &Float:c)
{
    static 
r[3], g[3], b[3]
    
get_pcvar_string(g_msg_colorsr2)
    
    
strbreak(rg9b2)
    
str_to_float(r)
    
str_to_float(g)
    
str_to_float(b)

Error:
PHP Code:
plugin.sma(49 -- 50) : error 033: array must be indexed (variable "r")
plugin.sma(50 -- 51) : error 033: array must be indexed (variable "g")
plugin.sma(51 -- 52) : error 033: array must be indexed (variable "b")
plugin.sma(51 -- 52) : fatal error 107too many error messages on one line 
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
thEsp
BANNED
Join Date: Aug 2017
Old 12-23-2019 , 11:33   Re: Array must be indexed...
Reply With Quote #2

Jeez...
You are creating 3 (static) array variables and trying to use them independently without an index.
Just for the sake of record, what are you really trying to achieve?
thEsp is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-23-2019 , 12:49   Re: Array must be indexed...
Reply With Quote #3

It's pretty clear, split a string of the form "r g b"("255 255 255" for example) in integers representing the r g b channels value for the color.

You should assign str_to_float(*) to a/b/c, not r/g/b.
__________________

Last edited by HamletEagle; 12-23-2019 at 12:50.
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-23-2019 , 18:19   Re: Array must be indexed...
Reply With Quote #4

thEsp, he's probably setting HUD color using a string cvar "255 0 0", or something, and needs the individual values.

Shadows Adi, consider using argparse
__________________
Bugsy is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 12-24-2019 , 11:56   Re: Array must be indexed...
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
thEsp, he's probably setting HUD color using a string cvar "255 0 0", or something, and needs the individual values.
[/URL]
something like this..
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 12-24-2019 , 11:56   Re: Array must be indexed...
Reply With Quote #6

Quote:
Originally Posted by thEsp View Post
Jeez...
You are creating 3 (static) array variables and trying to use them independently without an index.
Just for the sake of record, what are you really trying to achieve?
yeap, I want that Nobel, ty.=)))
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 12-24-2019 at 11:56.
Shadows Adi 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 19:36.


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