AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved error 032: array index out of bounds (variable "color3") (https://forums.alliedmods.net/showthread.php?t=313263)

Mordekay 01-03-2019 03:42

error 032: array index out of bounds (variable "color3")
 
1 Attachment(s)
I'm trying to compile the amxx plugin against amxx 1.9 and this is the error message I get:
Code:

AMX Mod X Compiler 1.9.0.5235
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

Header size:          2800 bytes
Code size:            29328 bytes
Data size:            50832 bytes
Stack/heap size:      16384 bytes
Total requirements:  99344 bytes
Done.
AMX Mod X Compiler 1.9.0.5235
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

hlstatsx_commands_cstrike.sma(865) : error 032: array index out of bounds (variable "color3")
hlstatsx_commands_cstrike.sma(926) : error 032: array index out of bounds (variable "color3")

2 Errors.
Could not locate output file compiled/hlstatsx_commands_cstrike.amx (compile failed).

How to fix this?

NomisCZ 01-03-2019 04:44

Re: error 032: array index out of bounds (variable "color3")
 
Hi,
this section is only for Sourcemod plugins.

-> AMX: https://forums.alliedmods.net/forumdisplay.php?f=3

Mordekay 01-03-2019 04:56

Re: error 032: array index out of bounds (variable "color3")
 
This section is for everything related to hlxstats, so i'm in the correct section.

NomisCZ 01-04-2019 08:40

Re: error 032: array index out of bounds (variable "color3")
 
Maybe there is a problem with array declaration. In Pawn documentation is example:
PHP Code:

new Numbers[4] = {0,1,2,3}
So new color3[0][] = {255255255is probably wrong

Try to rewrite line 862 to:

PHP Code:

new color3[3] = {255255255}; 

and line 865 to:
PHP Code:

set_hudmessage(color3[0], color3[1], color3[2], -1.0verpos06.06.00.50.15, -1

PHP Code:

public hlx_amx_csay(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
static message[192]
    
read_args(message191)
    
remove_quotes(message)
    
    new 
color3[3] = {255255255}
    new 
Float:verpos 0.3
    
    set_hudmessage
(color3[0], color3[1], color3[2], -1.0verpos06.06.00.50.15, -1)
    
show_hudmessage(0"%s"message)

    return 
PLUGIN_HANDLED



Mordekay 01-04-2019 17:23

Re: error 032: array index out of bounds (variable "color3")
 
Still does not compile:
Code:

AMX Mod X Compiler 1.9.0.5235
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

hlstatsx_commands_cstrike.sma(926) : error 032: array index out of bounds (variable "color3")

1 Error.
Could not locate output file compiled/hlstatsx_commands_cstrike.amx (compile failed).


iceeedr 01-05-2019 19:20

Re: error 032: array index out of bounds (variable "color3")
 
Code:

new color3[0][] = {255, 255, 255}
to

Code:

new color3[3] = {255, 255, 255}
Then on code use color3[0], color3[1], color3[2]

Or if you're out of patience, change color3 [] [] by, 255, 255, 255 manually.

Mordekay 01-06-2019 03:35

Re: error 032: array index out of bounds (variable "color3")
 
Sorry, i'm not out of patience, but i have no idea what you are talking about as i have no idea about scripting at all.
I have replaced the line you posted and tried to compile, it failed. Then i changed the line
Code:

set_hudmessage(color3[0][0], color3[0][1], color3[0][2], -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, -1)
to
Code:

set_hudmessage(color3[[0], color3[1], color3[2], -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, -1)
which gives me this
Code:

AMX Mod X Compiler 1.9.0.5235
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

hlstatsx_commands_cstrike.sma(926) : error 032: array index out of bounds (variable "color3")

1 Error.
Could not locate output file compiled/hlstatsx_commands_cstrike.amx (compile failed).

As said: I have no idea about coding, so a complete list of lines and how to change them is needed and greatly appreciated.

fysiks 01-06-2019 03:51

Re: error 032: array index out of bounds (variable "color3")
 
The problem seems to be that the original color3 array is declared with a size of zero (i.e. it doesn't exist) which apparently is fixed by the older compiler.

Since you don't know about coding, the easiest way to fix this is to go back to the original and change this:

Code:

new color3[0][]
to this:

Code:

new color3[1][]

Note that this part was poorly coded originally and there is a better solution but since you're unfamiliar with coding this should be the easiest change for you to make and it should function correctly.

P.S. I have not tested with the AMX Mod X 1.9.0 compiler since I'm not using that version.

Mordekay 01-06-2019 04:05

Re: error 032: array index out of bounds (variable "color3")
 
If i change it like this in the original .sma I got this:
Code:

AMX Mod X Compiler 1.9.0.5235
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2013 AMX Mod X Team

hlstatsx_commands_cstrike.sma(862) : error 018: initialization data exceeds declared size
hlstatsx_commands_cstrike.sma(862) : warning 215: expression has no effect
hlstatsx_commands_cstrike.sma(862) : warning 215: expression has no effect
hlstatsx_commands_cstrike.sma(862) : error 001: expected token: ";", but found "}"
hlstatsx_commands_cstrike.sma(862) : warning 209: function "hlx_amx_csay" should return a value
hlstatsx_commands_cstrike.sma(865) : error 021: symbol already defined: "set_hudmessage"
hlstatsx_commands_cstrike.sma(868) : error 010: invalid function or declaration
hlstatsx_commands_cstrike.sma(926) : error 032: array index out of bounds (variable "color3")
hlstatsx_commands_cstrike.sma(865) : warning 203: symbol is never used: "verpos"

5 Errors.
Could not locate output file compiled/hlstatsx_commands_cstrike.amx (compile failed).


HamletEagle 01-06-2019 05:35

Re: error 032: array index out of bounds (variable "color3")
 
Spoiler


All times are GMT -4. The time now is 22:35.

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