Raised This Month: $51 Target: $400
 12% 

[SNIPPET] Kill Entity in Seconds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FoxMulder
Senior Member
Join Date: Jan 2009
Location: Orlando, FL
Old 06-09-2010 , 10:20   [SNIPPET] Kill Entity in Seconds
Reply With Quote #1

"Cleanly" removing an entity.
Instead of creating timers (createTimer) to remove an entity this just fires the kill event from the entity's event queue. Using this you don't have to have a separate timer doing multiple checks on the entity when you want to remove it.

I saw something like this implemented in a plugin long time ago and forgot which one it was.

PHP Code:
public killEntityIn(entityFloat:seconds)
{
    if(
IsValidEdict(entity))
    {
        
// send "kill" event to the event queue
        
new String:addoutput[64];
        
Format(addoutputsizeof(addoutput), "OnUser1 !self:kill::%f:1",seconds);
        
SetVariantString(addoutput);
        
AcceptEntityInput(entity"AddOutput");
        
AcceptEntityInput(entity"FireUser1");
    }

__________________
FoxMulder is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 06-12-2010 , 14:33   Re: [SNIPPET] Kill Entity in Seconds
Reply With Quote #2

forgot all about that method, thanks for that, will be useful in the future.
blodia is offline
exvel
SourceMod Donor
Join Date: Jun 2006
Location: Russia
Old 06-19-2010 , 11:30   Re: [SNIPPET] Kill Entity in Seconds
Reply With Quote #3

Wow, brilliant idea!
__________________
For admins: My plugins

For developers: Colors library
exvel is offline
Send a message via ICQ to exvel
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:47.


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