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

Solved How to hook molotov touch (explosion)?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 02-21-2019 , 09:43   How to hook molotov touch (explosion)?
Reply With Quote #1

Hi,

I need to catch a moment of explosion and get molotov entity coordinates.

This code work for "pipe_bomb_projectile", but doesn't trigger for "weapon_molotov" (only "other" touch raise in some cases).

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public void OnEntityCreated(int entity, const char[] classname)
{
        
PrintToChatAll("Entity created: %s"classname);
    
        if(
StrEqual(classname"weapon_molotov"))
        
//if(StrEqual(classname, "pipe_bomb_projectile"))
        
{
            
SDKHook(entitySDKHook_StartTouchOnTouch);
        }
}

public 
void OnTouch(int entityint other)
{
    if (!
other)
    {
        
PrintToChatAll("touched");
    }
    else {
        
PrintToChatAll("Other touch");
    }
    
SDKUnhook(entitySDKHook_StartTouchOnTouch);

btw, what is mean "other" parameter?

Possibly, I could use HookSingleEntityOutput, but I can't see in valve dev. any docs about the list of output names. Any help?

Also, maybe, I could use OnEntityDestroyed, but I need somehow check the reason why molotov is destroyed to ensure it is happen due to explosion.

It is also, an "inferno" entity created after explosion, so as a final walkaround I could use its origin. However, it is required that I check inferno spawned due to molotov explosion.

Thanks.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 02-22-2019 at 10:34.
Dragokas 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:08.


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