index out of bounds
Hello there,
I'm getting "Index out of bounds" here and i don't get it why.. i think i'm blind... Code:
if( g_szNumbers[ am_get_player_arena( id ) ] >= 1 && !is_user_bot( id ))Code:
#pragma semicolon 1error: Code:
L 11/06/2020 - 14:16:22: [AMXX] Displaying debug trace (plugin "arenaname.amxx", version " ") |
Re: index out of bounds
new gotname[ MAX_PLAYERS + 1 ];
|
Re: index out of bounds
Quote:
EDIT: here is the error Code:
if( g_szNumbers[ am_get_player_arena( id ) ] >= 1 && !is_user_bot( id )) |
Re: index out of bounds
You should test the incoming number first for error.
public arenaname( id ) { client_print_color(id, id, "%d", am_get_player_arena(id)); } |
Re: index out of bounds
Quote:
That's also why i'm using it with g_szNumbers[ ]. I mean... if i print it w/ %s as a string it show the number of the arena. The plugin it works without problems its just spamming that over and over. Doesn't that work like that? |
Re: index out of bounds
You should can do str_to_num(am_get_player_arena(id))
|
Re: index out of bounds
Your array is one dimension when it needs to be two (the second one is because your array contains strings, which are also arrays).
The reason you get index out of bounds is this: Code:
Either way, this is (kind of) the right way to do it: Quote:
1. On player_putinserver(), using regex to strip away the arena number part (if such exists). 2. Hooking namechange and again using regex, stripping away arena number part (if exists), reset name with arena number. Don't forget to hook the round start because that's where it is set in the arena plugin. Make sure your plugin is loaded after the arena plugin or add a delay on the register event. Otherwise you will always be 1 round behind. Code:
Quote:
|
Re: index out of bounds
Quote:
|
| All times are GMT -4. The time now is 00:32. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.