AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   about removing entity. (https://forums.alliedmods.net/showthread.php?t=162419)

Jacob 07-18-2011 21:18

about removing entity.
 
when an entity has been created

PHP Code:

new ent_a create_entity("info_target"

how to remove this entity(ent_a) automatically after a certain time(e.g 20 seconds).
thx!

Exolent[jNr] 07-18-2011 21:37

Re: about removing entity.
 
Code:
set_task(20.0, "TaskRemoveEntity", ent_a) // .. public TaskRemoveEntity(ent) {     if(is_valid_ent(ent))     {         remove_entity(ent)     } }
or
Code:
entity_set_int(ent_a, EV_INT_flags, (get_entity_flags(ent_a) | FL_KILLME)) entity_set_float(ent_a, EV_FL_nextthink, (get_gametime() + 20.0))

Jacob 07-18-2011 23:33

Re: about removing entity.
 
thank you Exolent. i have tested the method 1 before,it caused the server to shut down.

Tirant 07-19-2011 06:12

Re: about removing entity.
 
Method 1 didn't work? What error did it give you? Method 1 is as simple as it gets.

Jacob 07-19-2011 20:08

Re: about removing entity.
 
Quote:

Originally Posted by Tirant (Post 1513676)
Method 1 didn't work? What error did it give you? Method 1 is as simple as it gets.

i tested the method1 many times, it caused my server to shut down.

wrecked_ 07-19-2011 20:40

Re: about removing entity.
 
Post your code here.

Jacob 07-19-2011 21:57

Re: about removing entity.
 
Quote:

Originally Posted by wrecked_ (Post 1514228)
Post your code here.

solved. Exolent's second method is ok.
plugin is "Healthkit on dead body" by tuty.

Tirant 07-19-2011 23:17

Re: about removing entity.
 
There is no reason why the first method shouldn't work, unless there is some problem with the task.


All times are GMT -4. The time now is 14:31.

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