Raised This Month: $32 Target: $400
 8% 

Run time error 4: index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-20-2021 , 05:45   Re: Run time error 4: index out of bounds
Reply With Quote #11

Well depending on the logs you provided

Quote:
DeathMsg Debug 8 -1
You're getting victim id -1 which is an invalid player id, DeathMsg should be only called when a victim dies, seems like you've a 3rd party plugin incorrectly sending the deathmsg to some of the players
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-20-2021 , 11:15   Re: Run time error 4: index out of bounds
Reply With Quote #12

You can also add the filtering to your DeathMsg event hook and leave your eDeath() event as it was.

register_event("DeathMsg", "eDeath", "a", "1>0, "1<33", "2>0", "2<33")

But I'd find the source of the problem and correct it there, which is what Natsheh is getting at.
__________________
Bugsy is offline
Unzy
Junior Member
Join Date: Apr 2017
Old 11-20-2021 , 13:07   Re: Run time error 4: index out of bounds
Reply With Quote #13

Hmmm... im using bots on my server, could that be the cause of the invalid player ID?

I also force them on the same team, cauz its a humans vs bots server. And humans can't join the bot's team.

But hey, i dont see no error log anymore! That's what was most important to me lol

-X-
__________________
Unzy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-20-2021 , 16:55   Re: Run time error 4: index out of bounds
Reply With Quote #14

No, bots and players can only have a player index between 1 and 32. The only way to get the player index to be -1 is if some other plugin is creating a fake/custom deathmsg, and setting the player id for the message to -1.

The fact that your error is not happening anymore does not mean it's fixed. You may now be missing functionality in your plugin since the code will not be triggered for the problematic scenario, which you may expect it to. I would check all of your other 3rd party plugins and look for deathmsg creation, specifically with a player id being set to -1.
__________________
Bugsy 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 01:23.


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