Raised This Month: $ Target: $400
 0% 

detaching an entity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
watch
Senior Member
Join Date: Sep 2005
Old 02-25-2006 , 11:10   detaching an entity
Reply With Quote #1

The pupose of this is to allow demomen in tfc to stick their remote pipebombs to players and walls, the bit im having trouble with is detaching the entity from the player when they die. I've tried entity_set_edict(pipebomb, EV_ENT_aiment,0) but that doesnt work :O

I thought about making the pipebomb just explode but when I remove the entity and create an explosion it messes up the demoman's pipe count (they can lay up to 8) and i don't really want to have to fiddle around with pdata aswell as working out the explosion radius so it matches :(

Code:
#include <amxmodx> #include <engine> public plugin_init() {     register_plugin("stickypipes", "1.0", "watch")     register_cvar("tfc_stickypipes", "1")     register_event("DeathMsg", "death_event", "a")     register_touch("tf_gl_pipebomb", "*", "touch_pipebomb") } public touch_pipebomb(pipebomb, touch) {     if (!get_cvar_num("tfc_stickypipes"))         return PLUGIN_CONTINUE     if(is_valid_ent(touch))     {         new classname[32]         entity_get_string(touch, EV_SZ_classname, classname, 31)                 if(equal(classname, "player"))         {             // attach the pipebomb to the player             entity_set_int(pipebomb, EV_INT_movetype, MOVETYPE_FOLLOW)             entity_set_edict(pipebomb, EV_ENT_aiment, touch)                             // remove the trail from the pipebomb             message_begin(MSG_BROADCAST, SVC_TEMPENTITY)             write_byte(99)             write_short(pipebomb)             message_end()             return PLUGIN_CONTINUE         }         // if the touched entity is anything but an func_wall dont allow it to stick as the entity could move         if(!equal(classname, "func_wall"))             return PLUGIN_CONTINUE     }     // stick the pipebomb     entity_set_int(pipebomb, EV_INT_movetype, MOVETYPE_NONE)     return PLUGIN_CONTINUE } // if they die make the pipebomb fall off them otherwise it will just follow them back to spawn public death_event() {     if (!get_cvar_num("tfc_stickypipes"))         return PLUGIN_CONTINUE     new id = read_data(2)     new pipebomb = find_ent_by_class(-1, "tf_gl_pipebomb")      while(pipebomb > 0)     {         if(entity_get_edict(pipebomb, EV_ENT_aiment) == id)         {                         // deattach the entity here                     }         pipebomb = find_ent_by_class(pipebomb, "tf_gl_pipebomb")     }         return PLUGIN_CONTINUE }

thanks :)
__________________
Code:
#include <amusing_small_signiture>
watch is offline
 



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 20:21.


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