Raised This Month: $ Target: $400
 0% 

Solved [L4D2] Hook grenade throw ( HookEvent("weapon_fire" doesn't work )


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-06-2018 , 09:10   [L4D2] Hook grenade throw ( HookEvent("weapon_fire" doesn't work )
Reply With Quote #1

I want to hook the moment where a player successfully throws a grenade. If you swap your slot right before the grenade is thrown, the event will be falsely called. How to go over it?

Last edited by eyal282; 01-06-2018 at 11:29. Reason: SOLVED
eyal282 is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 01-06-2018 , 09:48   Re: [L4D2] Hook grenade throw ( HookEvent("weapon_fire" doesn't work )
Reply With Quote #2

Use onentitycreated from sdkhooks and check for projectile in class name and use m_hThrower to get the Player not sure if its prop_send or prop_data
xerox8521 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-06-2018 , 10:22   Re: [L4D2] Hook grenade throw ( HookEvent("weapon_fire" doesn't work )
Reply With Quote #3

Quote:
Originally Posted by xerox8521 View Post
Use onentitycreated from sdkhooks and check for projectile in class name and use m_hThrower to get the Player not sure if its prop_send or prop_data
GetEntPropEnt, right? Doesn't work.

Edit: SOLVED!

PHP Code:
#include <sdkhooks>

public OnEntityCreated(entity, const String:Classname[])
{
    if(
StrEqual(Classname"molotov_projectile") || StrEqual(Classname"pipe_bomb_projectile") || StrEqual(Classname"vomitjar_projectile"))
    {
        
SDKHook(entitySDKHook_SpawnPostSpawnPost_Grenade)
    }
}

public 
SpawnPost_Grenade(entity)
{
    
SDKUnhook(entitySDKHook_SpawnPostSpawnPost_Grenade);
    
    new 
thrower GetEntPropEnt(entityProp_Send"m_hOwnerEntity");


Last edited by eyal282; 01-06-2018 at 15:36.
eyal282 is offline
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 22:47.


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