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:
public _am_get_player_arena
( iPlugin, iParams
)
{
if( iParams != 1 || ( g_iGame == Game_Waiting ) )
return -1;
return g_ePlayerData
[ get_param( 1 ) ][ Player_Arena
];
}
Either way, this is (kind of) the right way to do it:
Quote:
Originally Posted by By.King
You should test the incoming number first for error.
public arenaname( id )
{
client_print_color(id, id, "%d", am_get_player_arena(id));
}
|
I would suggest this:
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:
register_logevent( "ev_RoundStart", 2, "1=Round_Start" );
Quote:
Originally Posted by mrspeak
Well you can't print am_get_player_arena with %d cuz it's a string.. it prints like "arena%s= arena1" for example..
|
am_get_player_arena() will return an integer between 0 and 15.
__________________