Raised This Month: $51 Target: $400
 12% 

Array index is out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-24-2015 , 10:06   Re: Array index is out of bounds
Reply With Quote #11

Quote:
Originally Posted by 11530 View Post
@Dkmuniz Please also post your declarations for the global hurts[] and vampiro[]
PHP Code:
new bool:vampiro[MAXPLAYERS+1] = {false, ...};
#define HURTSDEAD 3 // dano para matar no tubarao
new hurts[MAXPLAYERS+1]; 
Dkmuniz is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-24-2015 , 15:55   Re: Array index is out of bounds
Reply With Quote #12

I tried all bug bug continues, please one help ?
Dkmuniz is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 01-24-2015 , 16:22   Re: Array index is out of bounds
Reply With Quote #13

I dont see any client ids checks inside OnTakeDamage. You definitely should check for it, at least if(0 < iClientID <= MaxClients)
__________________
Leonardo is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-24-2015 , 16:33   Re: Array index is out of bounds
Reply With Quote #14

Quote:
Originally Posted by Leonardo View Post
I dont see any client ids checks inside OnTakeDamage. You definitely should check for it, at least if(0 < iClientID <= MaxClients)
IsValidClient Check this !
Dkmuniz is offline
splewis
Veteran Member
Join Date: Feb 2014
Location: United States
Old 01-24-2015 , 17:05   Re: Array index is out of bounds
Reply With Quote #15

Quote:
Originally Posted by Dkmuniz View Post
I tried all bug bug continues, please one help ?
You still haven't answered a very useful question.

Quote:
Originally Posted by GooseMonkey View Post
Which line is 1292?
__________________
splewis is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-24-2015 , 18:00   Re: Array index is out of bounds
Reply With Quote #16

Quote:
Originally Posted by splewis View Post
You still haven't answered a very useful question.
Line 1272 is finish off take damage !
Dkmuniz is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 01-24-2015 , 19:43   Re: Array index is out of bounds
Reply With Quote #17

Code:
else if(vampiro[attacker])
There is nothing that verifies that attacker is a valid client index.
__________________
ddhoward is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-24-2015 , 20:39   Re: Array index is out of bounds
Reply With Quote #18

Solved problem, thanks to all !
Dkmuniz is offline
Dkmuniz
Senior Member
Join Date: Jun 2013
Old 01-24-2015 , 22:40   Re: Array index is out of bounds
Reply With Quote #19

New problem :
Give this error:

Code:
L 01/25/2015 - 01:34:41: [SM]   [0]  Line 1162, zbrincar_admin.sp::OnTakeDamage()
L 01/25/2015 - 01:34:41: [SM] Native "IsClientInGame" reported: Client index 374 is invalid
Line:
PHP Code:
if(IsClientInGame(attacker) && IsClientInGame(victim)) 
Dkmuniz is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 01-24-2015 , 22:44   Re: Array index is out of bounds
Reply With Quote #20

'attacker' isn't always a player. Sometimes it's the world, or a boss, or some other non-player entity. You need to check to see if 'attacker' is a valid client.
__________________

Last edited by ddhoward; 01-24-2015 at 22:44.
ddhoward is offline
Reply



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 13:43.


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