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

Solved pev(ent, pev_health) return 0.0


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-17-2018 , 13:33   pev(ent, pev_health) return 0.0
Reply With Quote #1

PHP Code:
RegisterHam(Ham_TakeDamage"func_breakable""fw_Object_TakeDamage")

public 
fw_Object_TakeDamage(entweaponkillerdmg)
{
    new 
health pev(ent,pev_health); 
    if (
health dmg <= 0.0)
    {
        
client_print(killerprint_chat"Ent: %i"ent)
        
client_print(killerprint_chat"Ent HP: %.f"health)
        return 
HAM_IGNORED;
    }
    return 
HAM_IGNORED;

I tried to hook the "func_breakable" entity when it destroyed but the health return always 0.0.
did I missed something? is there other way to hook it?
__________________
My plugin:

Last edited by Celena Luna; 07-17-2018 at 14:26.
Celena Luna is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-17-2018 , 14:02   Re: pev(ent, pev_health) return 0.0
Reply With Quote #2

Code:
Float:health

Anyway, Ham_Killed should work, right ?

Also, second parameter is not a weapon, while the dmg parameter is also a float.
__________________
stuff

Last edited by maqi; 07-17-2018 at 14:05.
maqi is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 07-17-2018 , 14:19   Re: pev(ent, pev_health) return 0.0
Reply With Quote #3

Quote:
Originally Posted by hzqst View Post
Func_breakable won't be killed unless you remove it using FL_KILLME or map flags(kill after trigger)
It just disappears when strength goes to 0
Also, I just lazy to change the parameter.
It should be
PHP Code:
fw_Object_TakeDamage(victiminflictorattackerFloat:dmgdamagebtis
EDIT: OK, it work now. Used pev wrong way
PHP Code:
public fw_Object_TakeDamage(VictimInflictorAttackerFloat:DamageDamageBits)
{
    static 
Float:Healthpev(Victimpev_healthHealth)
    
client_print(Attackerprint_chat"Ent: %i"Victim)
    
client_print(Attackerprint_chat"Ent HP: %.f"Health)

__________________
My plugin:

Last edited by Celena Luna; 07-17-2018 at 14:26.
Celena Luna is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-19-2018 , 09:35   Re: pev(ent, pev_health) return 0.0
Reply With Quote #4

Second parameter is the entity that inflicted the damage, so it can be weapon entity too.
__________________








CrazY. 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 04:25.


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