Run time error 4: "Array index out of bounds"
#2

killerid may or may not be a valid (connected) player.

Quote:
Important Note: You MUST check whether killerid is valid (NOT INVALID_PLAYER_ID) before using it in an array, as it will cause the OnPlayerDeath script to crash (not the entire script). This is because INVALID_PLAYER_ID is defined as 65535, and if an array only has 'MAX_PLAYERS' elements, e.g. 500, you're trying to access an index that is above 499, which is out of bounds.

Before using killerid in an array [], you need to check if it's not INVALID_PLAYER_ID (65535).
Reply


Messages In This Thread
Run time error 4: "Array index out of bounds" - by AntonioCroatia - 01.02.2014, 14:10
Re: Run time error 4: "Array index out of bounds" - by Konstantinos - 01.02.2014, 14:14
Re: Run time error 4: "Array index out of bounds" - by AntonioCroatia - 01.02.2014, 14:32
Re: Run time error 4: "Array index out of bounds" - by Konstantinos - 01.02.2014, 14:36
Re: Run time error 4: "Array index out of bounds" - by AntonioCroatia - 01.02.2014, 14:42

Forum Jump:


Users browsing this thread: 1 Guest(s)