AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   notify when grenade goes off (https://forums.alliedmods.net/showthread.php?t=3251)

47 07-01-2004 08:10

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

... besides using set_task on "fire in the hole"

Ryan 07-01-2004 09:53

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 :)

47 07-01-2004 18:05

ah, thank you much

TGK 07-09-2004 09:43

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

thanks!

Johnny got his gun 07-09-2004 11:10

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.

TGK 07-09-2004 16:27

Perfect thats the info i needed thanks. HLSDK is the devil to read i deleted it =p

Dygear 07-09-2004 18:46

Bah, HL's SDK is like a maze

Ryan 07-09-2004 23:52

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 :)


All times are GMT -4. The time now is 14:42.

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