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

How would OnTakeDamageAlive have entity out of bounds?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
canadianp
Junior Member
Join Date: Mar 2011
Old 09-14-2018 , 11:27   How would OnTakeDamageAlive have entity out of bounds?
Reply With Quote #1

int g_cEXPREF[MAXPLAYERS + 1] = { -1, ... };

## Another function ##
int ExplosionIndex = CreateEntityByName("env_explosion");
g_cEXPREF[client] = EntIndexToEntRef(ExplosionIndex);
##

# Here I'm checking that an explosion is equal to a Ref I set to the client array earlier during creation of the explosion entity. So I'm checking that THIS explosion is the same one set earlier

public Action OnTakeDamageAlive(int iVictim, int &iAttacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3])
{
int iRef = EntIndexToEntRef(inflictor);

if(iRef == g_cEXPREF[iAttacker])
....
}

It's throwing this:

L 09/11/2018 - 0614: [SM] Exception reported: Array index out-of-bounds (index 87, limit 66)

canadianp is offline
canadianp
Junior Member
Join Date: Mar 2011
Old 09-14-2018 , 11:31   Re: How would OnTakeDamageAlive have entity out of bounds?
Reply With Quote #2

Ohhhhhh. It's something OTHER than a player doing damage. So the iAttacker is an object entity. I just need to do a IsPlayer check?
canadianp is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 09-14-2018 , 11:36   Re: How would OnTakeDamageAlive have entity out of bounds?
Reply With Quote #3

Quote:
Originally Posted by canadianp View Post
int g_cEXPREF[MAXPLAYERS + 1] = { -1, ... };

## Another function ##
int ExplosionIndex = CreateEntityByName("env_explosion");
g_cEXPREF[client] = EntIndexToEntRef(ExplosionIndex);
##

# Here I'm checking that an explosion is equal to a Ref I set to the client array earlier during creation of the explosion entity. So I'm checking that THIS explosion is the same one set earlier

public Action OnTakeDamageAlive(int iVictim, int &iAttacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3])
{
int iRef = EntIndexToEntRef(inflictor);

if(iRef == g_cEXPREF[iAttacker])
....
}

It's throwing this:

L 09/11/2018 - 0614: [SM] Exception reported: Array index out-of-bounds (index 87, limit 66)

iAttacker = entity that attacked is responsible for attacking iVictim (iAttacker > 1 && iAttacker < 2049)
inflictor = entity that was used to attack iVictim (inflictor > 1 && inflictor < 2049) or -1 if there was no inflictor sometimes pops up for me



Someone murdered a person is the inflictor responsible and goes to jail or does the person holding it?
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux 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 18:32.


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