Raised This Month: $ Target: $400
 0% 

find dead target


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 08-01-2008 , 18:41   find dead target
Reply With Quote #1

how can i do something on a dead target. like for example on war3 when i use an ultimate how can i check if the enemy is dead.
whosyourdaddy is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 08-01-2008 , 19:33   Re: find dead target
Reply With Quote #2

humnn.... Try this:

PHP Code:
public plugin_init()
{
register_event("DeathMsg",     "event_death",     "a")

PHP Code:
public event_death()
{
g_hasdeath[id] == true

And put a commando.

PHP Code:
if(g_hasdeath[id] == true ) {
Your command

Or

PHP Code:
    new body find_dead_body(id)
    if(!
fm_is_valid_ent(body))
    {

    } 
PHP Code:
stock find_dead_body(id)
{
    static 
Float:origin[3]
    
pev(idpev_originorigin)
    
    new 
ent
    
static classname[32]    
    while((
ent fm_find_ent_in_sphere(entoriginget_pcvar_float(cvar_revival_dis))) != 0
    {
        
pev(entpev_classnameclassname31)
        if(
equali(classname"fake_corpse") && fm_is_ent_visible(ident))
            return 
ent
    
}
    return 
0


Last edited by padilha007; 08-01-2008 at 19:37.
padilha007 is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 08-01-2008 , 20:56   Re: find dead target
Reply With Quote #3

wow that seems really complicated.. i found an easier way tho

Code:
new players[32], numberofplayers;
get_players( players, numberofplayers, "a" );
new i, iTargetID;
 
for ( i = 0; i < numberofplayers; i++ )
{
  iTargetID = players[i];
    if(!is_user_alive(target))
    {
        //code
    }
}
whosyourdaddy is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 08-02-2008 , 15:51   Re: find dead target
Reply With Quote #4

PHP Code:
new players[32], pNum
get_players
(playerspNum"b"// Don't return alive players
 
for (new 0pNumi++)
{
        new 
id players[i]
 
        if (
is_user_connected(id)) // Check if this dead player is connected
        
{
                
// Something
        
}

Or:
PHP Code:
for (new id 1id <= get_maxplayers(); id++)
{
        if (
is_user_connected(id) && !is_user_alive(id)) // Is player connected and dead
        
{
                
// Something
        
}

__________________
hleV 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 05:28.


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