Raised This Month: $ Target: $400
 0% 

How to get a entity(NPC) health?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-10-2011 , 09:26   Re: How to get a entity(NPC) health?
Reply With Quote #1

You could use pev(ent, pev_health) since it returns an integer value, so you avoid using floatround() native.
__________________
hleV is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 08-10-2011 , 09:39   Re: How to get a entity(NPC) health?
Reply With Quote #2

Quote:
Originally Posted by hleV View Post
You could use pev(ent, pev_health) since it returns an integer value, so you avoid using floatround() native.
pev health is a float also.. its get/set_user_health int value
Doc-Holiday is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-10-2011 , 09:47   Re: How to get a entity(NPC) health?
Reply With Quote #3

Quote:
Originally Posted by Doc-Holiday View Post
pev health is a float also.. its get/set_user_health int value
Code:
pev(ent, pev_health)
will return an integer value.
__________________
hleV is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 08-10-2011 , 09:50   Re: How to get a entity(NPC) health?
Reply With Quote #4

Quote:
Originally Posted by hleV View Post
Code:
pev(ent, pev_health)

will return an integer value.
it takes a float but returns an int?? interesting.
Doc-Holiday is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-10-2011 , 10:03   Re: How to get a entity(NPC) health?
Reply With Quote #5

Quote:
Originally Posted by Doc-Holiday View Post
it takes a float but returns an int?? interesting.
pev() returns integer values.
To get the float value, you have to pass another parameter to get the float value by-ref.
When you leave out that extra parameter and try to access a float pev value, then it is returned as an integer.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 08-10-2011 , 10:05   Re: How to get a entity(NPC) health?
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
pev() returns integer values.
To get the float value, you have to pass another parameter to get the float value by-ref.
When you leave out that extra parameter and try to access a float pev value, then it is returned as an integer.
good to know all the pev/set_pev stuff is new to me as i get deeper into teh scripting.
Doc-Holiday 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 03:28.


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