Raised This Month: $ Target: $400
 0% 

notify when grenade goes off


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
47
Junior Member
Join Date: Jul 2004
Old 07-01-2004 , 08:10   notify when grenade goes off
Reply With Quote #1

is it posible to get notified when an he grenade goes off in cs?

... besides using set_task on "fire in the hole"
47 is offline
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 07-01-2004 , 09:53  
Reply With Quote #2

yep

Code:
    register_event( "23", "Ev_Grenade", "a", "1=3", "6=25" );

Code:
public Ev_Grenade( ) {     // GRENADE EXPLOSION     // read_data(1) = 3     (TE_EXPLOSION)     // read_data(6) = 25    (scale in 0.1's)     // ..     return PLUGIN_HANDLED; }

Event "23" is called on every SVC_TEMPENTITY, and the arguments are the write_byte/string/etc commands associated with tempentities.

The scale of the grenade TE_EXPLOSION just happens to be 25, and there may be other TE_EXPLOSION events in cs (which i havent found yet) or possibly even custom maps that might possibly throw this off, but it would be very rare. I use this code in my breakable doors plugin.

Hope this helps
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
47
Junior Member
Join Date: Jul 2004
Old 07-01-2004 , 18:05  
Reply With Quote #3

ah, thank you much
47 is offline
TGK
Junior Member
Join Date: Jul 2004
Old 07-09-2004 , 09:43  
Reply With Quote #4

As a followon to this question, is there a way to tell the exact xyz postion of where a grenade detonates?

thanks!
TGK is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 07-09-2004 , 11:10  
Reply With Quote #5

Well, get HL SDK and it tells you this about the mentioned temp entity:

Code:
#define	TE_EXPLOSION		3		// additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// coord coord coord (position) 
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
// byte (flags)
Params 2, 3 and 4 would contain the coordinate.
Johnny got his gun is offline
TGK
Junior Member
Join Date: Jul 2004
Old 07-09-2004 , 16:27  
Reply With Quote #6

Perfect thats the info i needed thanks. HLSDK is the devil to read i deleted it =p
TGK is offline
Dygear
SourceMod Donor
Join Date: Apr 2004
Location: Levittown, NY
Old 07-09-2004 , 18:46  
Reply With Quote #7

Bah, HL's SDK is like a maze
__________________
Dygear is offline
Send a message via AIM to Dygear Send a message via MSN to Dygear Send a message via Skype™ to Dygear
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 07-09-2004 , 23:52  
Reply With Quote #8

as long as you open it up in a good compiler you can jump to function/class definitions really easily, which is where everything begins
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
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 14:42.


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