Raised This Month: $ Target: $400
 0% 

weaponbox traceattack


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-24-2018 , 11:49   Re: weaponbox traceattack
Reply With Quote #2

I found it was not working only when I was spawned with the C4 (or I used the /C4 command), while if another player was spawned with it, the hook worked as expected. I attributed this to who may be set as the owner of the entity. To fix this, when the model is set, set pev_owner to 0 and now it works either way. There may be other ways to fix the issue, but this works.

Code:
public pfnSetModel_Post(this, const szModel[]) {     if (!FClassnameIs(this, "weaponbox"))         return;     new pitem = cs_get_weaponbox_item(this);     if (pitem == 0)         return;     if (get_ent_data(pitem, "CBasePlayerItem", "m_iId") != CSW_C4)         return;     set_pev(this, pev_solid, SOLID_BBOX);     set_pev(this, pev_takedamage, DAMAGE_AIM);         set_task( 0.1 , "DelaySetOwner" , this );         engfunc(EngFunc_SetSize, this, Float:{ -1.0, -1.0, -1.0 }, Float:{ 1.0, 1.0, 1.0 }); } public DelaySetOwner( this ) {     set_pev( this , pev_owner , 0 ); }
__________________

Last edited by Bugsy; 12-24-2018 at 11:50.
Bugsy 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 07:31.


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