Hi, I'm having the following error:
Quote:
L 03/18/2011 - 11:14:52: [AMXX] Displaying debug trace (plugin "jailbreak_leet.amxx")
L 03/18/2011 - 11:14:52: [AMXX] Run time error 4: index out of bounds
L 03/18/2011 - 11:14:52: [AMXX] [0] jailbreak_leet.sma::hook_death (line 228)
L 03/18/2011 - 11:17:18: [AMXX] Displaying debug trace (plugin "jailbreak_leet.amxx")
L 03/18/2011 - 11:17:18: [AMXX] Run time error 4: index out of bounds
L 03/18/2011 - 11:17:18: [AMXX] [0] jailbreak_leet.sma::logevent_round_start (line 173)
|
PHP Code:
new bool:g_player_is_leader[33];
PHP Code:
register_event("DeathMsg", "hook_death", "a");
PHP Code:
register_logevent("logevent_round_start", 2, "1=Round_Start");
PHP Code:
public logevent_round_start()
{
new iPlayers[32];
new iNum;
get_players(iPlayers,iNum,"ace","CT");
g_player_is_leader[iPlayers[random(iNum - 1)]] = true; // !!! Index out of bounds here !!! (line 173)
}
hook_death has got the same code and the same error so I won't post it here.
Please tell me what's wrong with my code, when there is 1 CT the function logevent_round_start() doesn't run and when there are 2 CTs it chooses the CT with the first ID.
Basically I need it to choose a random CT and set g_player_is_leader[ id of the chosen CT ] to true.
__________________