Raised This Month: $ Target: $400
 0% 

[SOLVED] Error: Index out of bounds (function get_players)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mabaclu
Senior Member
Join Date: Jun 2010
Location: Portugal
Old 03-18-2011 , 07:24   [SOLVED] Error: Index out of bounds (function get_players)
Reply With Quote #1

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.
__________________

Last edited by mabaclu; 03-18-2011 at 08:15. Reason: Added [SOLVED] in title
mabaclu is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:39.


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