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

weaponbox traceattack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-24-2018 , 08:41   weaponbox traceattack
Reply With Quote #1

Hello, I'm trying to hook TraceAttack of weaponbox entities, to be more specific, C4 backpack. I tried to work with its size, pev->takedamage and pev->solid, but it's not working.

Spoiler
__________________









Last edited by CrazY.; 12-24-2018 at 08:49.
CrazY. is offline
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
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-24-2018 , 14:35   Re: weaponbox traceattack
Reply With Quote #3

Here is the way you catch when you spawn with the bomb.
PHP Code:
register_logevent("fw_got_theBomb"3"2=Spawned_With_The_Bomb")

public 
fw_got_theBomb()
{
    new 
sName[32], sText[64]
    
read_logargv(0sTextcharsmax(sText))
    
parse_loguser(sTextsNamecharsmax(sName))
    
    new 
id get_user_index(sName)
    
        

__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 12-24-2018 at 14:36.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 03:20.


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