AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Proper use of remove_task function (https://forums.alliedmods.net/showthread.php?t=276154)

Krtola 12-16-2015 07:09

Proper use of remove_task function
 
PHP Code:

public Event_DeathMsg( )
{
        new 
iVictim read_data);
    
        static 
Float:flOriginiCoords ];
        
peviVictimpev_originflOrigin );
    
        new 
iEnt engfuncEngFunc_CreateNamedEntityengfuncEngFunc_AllocString"info_target" ) );
    
    
/* --| Modify the origin a little bit. This is calculated to be set on floor */
        
flOrigin] -= 36
    
        
engfuncEngFunc_SetOriginiEntflOrigin );
    
        if( !
pev_validiEnt ) )
        {
        return 
PLUGIN_HANDLED;
        }
    
        
set_peviEntpev_classnamegMedKitClassname );
        
engfuncEngFunc_SetModeliEntszModelKit );
        
dllfuncDLLFunc_SpawniEnt );
        
set_peviEntpev_solidSOLID_BBOX );
        
set_peviEntpev_movetypeMOVETYPE_TOSS );
        
engfuncEngFunc_SetSizeiEntFloat:{ -23.160000, -13.660000, -0.050000 }, Float:{ 11.47000012.7800006.720000 } );
        
engfuncEngFunc_DropToFlooriEnt );
    
    
set_renderingiEntkRenderFxGlowShell255255255kRenderFxNone27 )
        
        
set_task(12.0"delete_entity"iVictim)
    
        return 
PLUGIN_HANDLED;
}

public 
delete_entity(iVictim)
{
        new 
iEntity FM_NULLENT

    
while( ( iEntity find_ent_by_classiEntitygMedKitClassname ) ) )
    {
        
engfuncEngFunc_RemoveEntityiEntity )
    }    


Where is proper to add remove_task(iVictim),in public delete_entity(iVictim) or public Event_DeathMsg( ) ?

Depresie 12-16-2015 07:12

Re: Proper use of remove_task function
 
please, tell us what you are trying to do, so we can realy help you...

Krtola 12-16-2015 07:30

Re: Proper use of remove_task function
 
Quote:

Originally Posted by Depresie (Post 2372885)
please, tell us what you are trying to do, so we can realy help you...

When a player dies create the entity on the ground and when alive player touches that entite he get HP,and that entity is removed.

What I'm trying to do:entity will be deleted if nobody takes him next 12 seconds-counting the time of its creation.

Depresie 12-16-2015 07:49

Re: Proper use of remove_task function
 
mhmm, then you have to set the task on the entity... not on the player...

Krtola 12-16-2015 08:11

Re: Proper use of remove_task function
 
Quote:

Originally Posted by Depresie (Post 2372897)
mhmm, then you have to set the task on the entity... not on the player...

Yes you are right,thanks.
But where to put remove_task?

fysiks 12-16-2015 09:16

Re: Proper use of remove_task function
 
Quote:

Originally Posted by Krtola (Post 2372900)
Yes you are right,thanks.
But where to put remove_task?

When the player touches the entity.

Depresie 12-16-2015 09:39

Re: Proper use of remove_task function
 
you remove it at disconnect, and when he touches the entity

Krtola 12-16-2015 11:49

Re: Proper use of remove_task function
 
fysiks & Depresie:

In the situation that the player does not touch the entity,and after 12 seconds entity is deleted?In this situation we do not need remove task ?

Depresie 12-16-2015 11:59

Re: Proper use of remove_task function
 
what for since the task is completed?

Krtola 12-16-2015 12:05

Re: Proper use of remove_task function
 
Quote:

Originally Posted by Depresie (Post 2372965)
what for since the task is completed?

Ok,thanks.


All times are GMT -4. The time now is 18:01.

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