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

Getting an entitie's health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 06-27-2009 , 00:29   Getting an entitie's health
Reply With Quote #1

How would I return an entity's health? (not a player)
__________________
almcaeobtac is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 06-27-2009 , 03:06   Re: Getting an entitie's health
Reply With Quote #2

Code:
/**
 * Sets an entity's health
 *
 * @param entity    Entity index.
 * @param amount    Health amount.
 * @noreturn
 * @error            Invalid entity index, or lack of mod compliance.
 */
stock SetEntityHealth(entity, amount)
Grr I realize that says "Set", but there should be a Get function.

That file is somewhat incomplete. It's missing:

SetEntityFlags()
GetEntityRenderFx()
GetEntityRenderColor()
GetEntityHealth()
SetClientButtons()

I will file a bug report for that. For now, look at SetEntityHealth and use the same offset but GetEntProp instead of SetEntProp (GetEntProp is a native you can see in entity.inc)
__________________
Greyscale is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 06-27-2009 , 04:19   Re: Getting an entitie's health
Reply With Quote #3

GetEntProp(ent, Prop_Send, "m_iHealth");
bl4nk is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 06-27-2009 , 04:50   Re: Getting an entitie's health
Reply With Quote #4

Or that, although GetEntityHealth would support other mods, and read offsets from SM's gamedata file.

Status on the issue here: https://bugs.alliedmods.net/show_bug.cgi?id=3878
__________________
Greyscale is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 06-28-2009 , 00:05   Re: Getting an entitie's health
Reply With Quote #5

Thanks guys
__________________
almcaeobtac is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 07-21-2009 , 14:27   Re: Getting an entitie's health
Reply With Quote #6

It doesn't work :/
__________________
almcaeobtac 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 20:00.


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