Raised This Month: $ Target: $400
 0% 

How Do I tell if a player will explode at Player_Death


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
raven_coda
Junior Member
Join Date: May 2008
Old 07-21-2008 , 15:27   How Do I tell if a player will explode at Player_Death
Reply With Quote #1

I'm trying to tell if a TF2 player will explode or not at the player_death event.

I was trying the following but the ragdoll tends to exists if the player explodes or not.
Code:
new ragdoll = GetEntPropEnt(client, Prop_Send, "m_hRagdoll");
 if (ragdoll>0)
 {
  PrintToChatAll("Ragdoll exisits:%i", ragdoll);
 }
Is there another way I can tell?
raven_coda is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 07-21-2008 , 15:51   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #2

Delay it a frame?

Code:
public Action:playerdeath(blahblah)
{
    CreateTimer(0.0, DidExplode, client);
}

public Action:DidExplode(Handle:timer, any:client)
{
    new ragdoll = GetEntPropEnt(client, Prop_Send, "m_hRagdoll");
    if (ragdoll > 0)
    {
        PrintToChatAll("Ragdoll exisits:%i", ragdoll);
    }
}
__________________
Greyscale is offline
raven_coda
Junior Member
Join Date: May 2008
Old 07-21-2008 , 16:12   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #3

nah, I tried that. I put it off half a sec but ragdoll still exists.
raven_coda is offline
Kigen
BANNED
Join Date: Feb 2008
Old 07-21-2008 , 17:15   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #4

Isn't explosion based on how much damage the player took?
Kigen is offline
raven_coda
Junior Member
Join Date: May 2008
Old 07-21-2008 , 17:24   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #5

Kigen, I looked it up and according to the wiki you gib if killed by an explosive. So maybe I can go about it that way. I'll look at the attackers weapon and if it's a rocket, Demo's grenade, Sticky bomb, or level 3 sentry.

The only problem with that is I don't know how to tell if the sentry was level 3. Any ideas?
raven_coda is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-21-2008 , 18:04   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #6

You might be able to get the level of the sentry using the m_nDefaultUpgradeLevel datamap offset.
bl4nk is offline
raven_coda
Junior Member
Join Date: May 2008
Old 07-21-2008 , 18:21   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #7

@bl4nk but how do I get the entity that is the sentry that killed the player?

Right now I get
GetClientOfUserId(GetEventInt(event, "userid"));
GetClientOfUserId(GetEventInt(event, "attacker"));

GetEventString(event, "weapon", weaponName, sizeof(weaponName));

Is it possible to find the sentry entity by knowing it's owner?

I'm starting to think I'm making this harder then it needs to be.
raven_coda is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-21-2008 , 18:36   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #8

Look at the weapon name, and if they player is killed by the sentry, use something like this:
PHP Code:
new bool:foundentity;
while ((
entity FindEntityByClassname("obj_sentrygun")) != -1)
{
    if (
GetEntDataEnt2(entityFindSendPropInfo("CBaseObject""m_hBuilder") == client)
    {
        
found true;
        break;
    }
}

if (
found)
{
    
// Sentry gun owned by 'client' was found

bl4nk is offline
raven_coda
Junior Member
Join Date: May 2008
Old 07-22-2008 , 19:20   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #9

How do I check the m_nDefaultUpgradeLevel?

I tried

GetEntProp(entity, Prop_Send, "m_nDefaultUpgradeLevel");

but apparently that's not right as it gives me

"GetEntProp" reported Property m_nDefaultUpgradeLevel not found (entity 227/obj_sentrygun)

Am I just doing it wrong?
raven_coda is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-22-2008 , 20:54   Re: How Do I tell if a player will explode at Player_Death
Reply With Quote #10

Prop_Data
bl4nk 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 06:31.


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