Raised This Month: $ Target: $400
 0% 

is_hostage_alive(ent)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-11-2009 , 03:42   is_hostage_alive(ent)
Reply With Quote #1

I have ent id of hostage.. I wanna to check is he alive.. whats the best way?

Note: I'm checking that in somethink like fw_preHostageRespawn

maybe that's why this doesn't work:
PHP Code:
if(pev(ent,pev_deadflag)!=DEAD_NO
PHP Code:
if(!pev(ent,pev_health)) 

Last edited by Empowers; 04-11-2009 at 03:58.
Empowers is offline
Send a message via ICQ to Empowers
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-11-2009 , 03:51   Re: is_hostage_alive(ent)
Reply With Quote #2

Check pev_health, i'm sure it should be more than 0
__________________
xPaw is offline
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-11-2009 , 03:51   Re: is_hostage_alive(ent)
Reply With Quote #3

thx, will try
Empowers is offline
Send a message via ICQ to Empowers
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-11-2009 , 03:59   Re: is_hostage_alive(ent)
Reply With Quote #4

I updated the post. Doesn't work
Empowers is offline
Send a message via ICQ to Empowers
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-11-2009 , 04:00   Re: is_hostage_alive(ent)
Reply With Quote #5

And there is the question will Ham_Killed hook hostage death?

Last edited by Empowers; 04-11-2009 at 04:09.
Empowers is offline
Send a message via ICQ to Empowers
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-11-2009 , 04:03   Re: is_hostage_alive(ent)
Reply With Quote #6

Hook the forward in post and not pre.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-11-2009 , 04:05   Re: is_hostage_alive(ent)
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
Hook the forward in post and not pre.
I need to SUPERCEDE it in some cases. Also I need check was hostage alive before respawn, but not after it had respawned..
Empowers is offline
Send a message via ICQ to Empowers
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-11-2009 , 04:39   Re: is_hostage_alive(ent)
Reply With Quote #8

PHP Code:
stock bool:is_hostage_aliveiEntity ) {
    if( !
pev_validiEntity ) )
        return 
false;
    
    new 
szClassname32 ];
    
peviEntitypev_classnameszClassname31 );
    
    if( !
equalszClassname"hostage_entity" ) )
        return 
false;
    
    if( 
peviEntitypev_health ) > )
        return 
true;
    
    return 
false;

not tested.
__________________
xPaw is offline
Empowers
BANNED
Join Date: Feb 2009
Location: Ukraine
Old 04-11-2009 , 04:49   Re: is_hostage_alive(ent)
Reply With Quote #9

Man I was doing the same.. Just I think hostages HP is restored before respawn, so I need some other way to check that..
Empowers is offline
Send a message via ICQ to Empowers
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-11-2009 , 05:04   Re: is_hostage_alive(ent)
Reply With Quote #10

Dont know how you tryed but it worked pefect for me.
PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init() {
    
register_clcmd"say /host""cmdLol" );
}

public 
cmdLolid ) {
    if( 
is_hostage_alive155 ) )    // hardcoding indexes not save, just did for test, it was hostage for me @ cs_assualt, maxplayers 5.
        
client_print0print_chat"Hostage is alive." );
    else
        
client_print0print_chat"Hostage is dead." );
}

stock bool:is_hostage_aliveiEntity ) {
    if( !
pev_validiEntity ) )
        return 
false;
    
    new 
szClassname32 ];
    
peviEntitypev_classnameszClassname31 );
    
    if( !
equalszClassname"hostage_entity" ) )
        return 
false;
    
    if( 
peviEntitypev_health ) > )
        return 
true;
    
    return 
false;

__________________
xPaw 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 02:19.


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