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")
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
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
PHP Code:
/** * 2008 - Modified by Nicholas Hastings (psychonic) for used with HLstatsX Community Edition * http://www.hlxcommunity.com * * HLstatsX - AMX Mod X plugin to display ingame messages * http://www.hlstatsx.com/ * Copyright (C) 2007-2008 TTS Oetzel & Goerz GmbH * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
new g_msgSayText new g_msgTeamInfo new g_HLstatsX_MainMenu new g_HLstatsX_AutoMenu new g_HLstatsX_EventsMenu new Array:g_HLstatsX_ColorArray
new ct_player_color = -1 new ts_player_color = -1 new message_cache[192] new parsed_message_cache[192] new cached_color_index
new logmessage_ignore[512] new display_menu_keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9
new TeamNames[][] = { "", "TERRORIST", "CT", "SPECTATOR" }
public plugin_init() { register_plugin("HLstatsX CE Ingame Plugin", VERSION, "psychonic") register_srvcmd("hlx_amx_psay", "hlx_amx_psay", 0, "<name or #userid><colored><message> - sends private message") register_srvcmd("hlx_amx_bulkpsay", "hlx_amx_bulkpsay", 0, "<userid list><message> - sends private message to many") register_srvcmd("hlx_amx_psay2", "hlx_amx_psay2", 0, "<name or #userid><colored><message> - sends green colored private message") register_srvcmd("hlx_amx_say", "hlx_amx_say", 0, "<message> - sends message to all players") register_srvcmd("hlx_amx_csay", "hlx_amx_csay", 0, "<message> - sends center hud message to all players") register_srvcmd("hlx_amx_hint", "hlx_amx_hint", 0, "<name or #userid><message> - sends hint message") register_srvcmd("hlx_amx_msay", "hlx_amx_msay", 0, "<delay><userid><message> - displays advanced information") register_srvcmd("hlx_amx_browse", "hlx_amx_browse", 0, "<userid><url> - displays internal browser") register_srvcmd("hlx_amx_swap", "hlx_amx_swap", 0, "<userid> - swaps players to the opposite team")
new team_index = get_team_index(team) if (team_index > -1) { if (strcmp(team, "CT") == 0) { ct_player_color = -1 } else if (strcmp(team, "TERRORIST") == 0) { ts_player_color = -1 }
new max_clients = get_maxplayers() for(new i = 1; i <= max_clients; i++) { new player_index = i if (is_user_connected(player_index)) { static player_team[16] get_user_team(player_index, player_team, 15)
stock color_all_players(message[192]) { new color_index = -1 ArrayClear(g_HLstatsX_ColorArray)
new lowest_matching_pos = 192 new lowest_matching_pos_client = -1
new max_clients = get_maxplayers() for(new i = 1; i <= max_clients; i++) {
new client = i if (is_user_connected(client)) { static client_name[192] get_user_name(client, client_name, 191) new message_pos = contain(message, client_name) if (message_pos > -1) { if (lowest_matching_pos > message_pos) { lowest_matching_pos = message_pos lowest_matching_pos_client = client } new TempPlayerColorArray[1] TempPlayerColorArray[0] = client ArrayPushArray(g_HLstatsX_ColorArray, TempPlayerColorArray) } } }
new size = ArraySize(g_HLstatsX_ColorArray) for (new i = 0; i < size; i++) { new temp_player_array[1] ArrayGetArray(g_HLstatsX_ColorArray, i, temp_player_array) new temp_client = temp_player_array[0] if (temp_client == lowest_matching_pos_client) { new temp_color_index = color_player(1, temp_client, message) color_index = temp_color_index } else { color_player(0, temp_client, message) } } ArrayClear(g_HLstatsX_ColorArray)
return color_index }
public client_kill() {
new killer_id = read_data(1) new victim_id = read_data(2) new is_headshot = read_data(3) new weapon[32] read_data(4, weapon, 31)
if ((killer_id > 0) && (is_user_connected(killer_id))) {
new suicide = 0 if (killer_id == victim_id) { suicide = 1 }
static killer_name[32], killer_team[16], killer_authid[32] new killer_userid = get_user_userid(killer_id)
get_user_name(killer_id, killer_name, 31) get_user_team(killer_id, killer_team, 15) get_user_authid(killer_id, killer_authid, 31) new killer_origin[3] get_user_origin (killer_id, killer_origin) new headshot_logentry[16] = ""
if (suicide == 0) { if ((victim_id > 0) && (is_user_connected(victim_id))) { static victim_name[32], victim_team[16], victim_authid[32] new victim_userid = get_user_userid(victim_id)
stock ExplodeString( Output[][], Max, Size, Input[], Delimiter ) { new Idx, l = strlen(Input), Len; do Len += (1 + copyc( Output[Idx], Size, Input[Len], Delimiter )); while( (Len < l) && (++Idx < Max) ) return Idx; }
psay (client_id[], is_colored, client_message[192]) { new client = str_to_num(client_id)
if (client > 0) { new Players[32] new player_count, temp_player_index, player_index get_players(Players, player_count, "ch") for (temp_player_index = 0; temp_player_index < player_count; temp_player_index++) { new player = Players[temp_player_index] new temp_user_id = get_user_userid(player) if (temp_user_id == client) { player_index = player break } }
if ((player_index > 0) && (!is_user_bot(player_index)) && (is_user_connected(player_index))) { new color_index = player_index
if (client > 0) { new Players[32] new player_count, temp_player_index, player_index get_players(Players, player_count, "ch") for (temp_player_index = 0; temp_player_index < player_count; temp_player_index++) { new player = Players[temp_player_index] new temp_user_id = get_user_userid(player) if (temp_user_id == client) { player_index = player break } }
if ((player_index > 0) && (!is_user_bot(player_index)) && (is_user_connected(player_index))) { new color_index = player_index
if (client > 0) { new Players[32] new player_count, temp_player_index, player_index get_players(Players, player_count, "ch") for (temp_player_index = 0; temp_player_index < player_count; temp_player_index++) { new player = Players[temp_player_index] new temp_user_id = get_user_userid(player) if (temp_user_id == client) { player_index = player break } }
if ((player_index > 0) && (!is_user_bot(player_index)) && (is_user_connected(player_index))) { new color3[] = {255, 128, 0} new Float:verpos = 0.80
static handler_param[32] read_argv(3, handler_param, 31) new ignore_param = 0 new need_handler = 0 if (strcmp(handler_param, "1") == 0) { need_handler = 1 ignore_param = 1 } if (strcmp(handler_param, "0") == 0) { need_handler = 0 ignore_param = 1 }
static message[1024] new userid new Players[32] new player_count, player_index get_players(Players, player_count, "ch") for (player_index = 0; player_index < player_count; player_index++) { new player = Players[player_index] new temp_user_id = get_user_userid(player) if (temp_user_id == raw_user_id) { userid = player break } }
read_args(message, 1023)
new find_pattern[] = "#" new find_pos = strfind(message, find_pattern) new text_pos = find_pos + strlen(name) + 2 if (ignore_param == 1) { text_pos += 3 }
static message[1024] new userid new Players[32] new player_count, player_index get_players(Players, player_count, "ch") for (player_index = 0; player_index < player_count; player_index++) { new player = Players[player_index] new temp_user_id = get_user_userid(player) if (temp_user_id == raw_user_id) { userid = player break } }
read_args(message, 1023)
new find_pattern[] = "#" new find_pos = strfind(message, find_pattern)
if (client > 0) { new userid = 0 new Players[32] new player_count, player_index get_players(Players, player_count, "h") for (player_index = 0; player_index < player_count; player_index++) { new player = Players[player_index] new temp_user_id = get_user_userid(player) if (temp_user_id == client) { userid = player break } }