Raised This Month: $ Target: $400
 0% 

Proper use of remove_task function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 12-16-2015 , 07:09   Proper use of remove_task function
Reply With Quote #1

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( ) ?
Krtola is offline
Send a message via Skype™ to Krtola
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-16-2015 , 07:12   Re: Proper use of remove_task function
Reply With Quote #2

please, tell us what you are trying to do, so we can realy help you...
__________________
Depresie is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 12-16-2015 , 07:30   Re: Proper use of remove_task function
Reply With Quote #3

Quote:
Originally Posted by Depresie View Post
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.
Krtola is offline
Send a message via Skype™ to Krtola
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-16-2015 , 07:49   Re: Proper use of remove_task function
Reply With Quote #4

mhmm, then you have to set the task on the entity... not on the player...
__________________
Depresie is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 12-16-2015 , 08:11   Re: Proper use of remove_task function
Reply With Quote #5

Quote:
Originally Posted by Depresie View Post
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?
Krtola is offline
Send a message via Skype™ to Krtola
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-16-2015 , 09:16   Re: Proper use of remove_task function
Reply With Quote #6

Quote:
Originally Posted by Krtola View Post
Yes you are right,thanks.
But where to put remove_task?
When the player touches the entity.
__________________
fysiks is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-16-2015 , 09:39   Re: Proper use of remove_task function
Reply With Quote #7

you remove it at disconnect, and when he touches the entity
__________________
Depresie is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-16-2015 , 20:50   Re: Proper use of remove_task function
Reply With Quote #8

The task should be for the entity, not the player. In which case, you wouldn't need to worry about the player disconnecting. And, it would fix the issue mentioned by Chihuahuax.
__________________
fysiks is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 12-16-2015 , 11:49   Re: Proper use of remove_task function
Reply With Quote #9

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 ?

Last edited by Krtola; 12-16-2015 at 11:49.
Krtola is offline
Send a message via Skype™ to Krtola
Depresie
Veteran Member
Join Date: Nov 2013
Old 12-16-2015 , 11:59   Re: Proper use of remove_task function
Reply With Quote #10

what for since the task is completed?
__________________
Depresie 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 18:01.


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