AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   find dead target (https://forums.alliedmods.net/showthread.php?t=75241)

whosyourdaddy 08-01-2008 18:41

find dead target
 
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.

padilha007 08-01-2008 19:33

Re: find dead target
 
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



whosyourdaddy 08-01-2008 20:56

Re: find dead target
 
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
    }
}


hleV 08-02-2008 15:51

Re: find dead target
 
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
        
}




All times are GMT -4. The time now is 05:28.

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