AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Detect C4 creation/spawn (https://forums.alliedmods.net/showthread.php?t=82452)

ConnorMcLeod 12-23-2008 15:43

Detect C4 creation/spawn
 
Does someone know how to detect c4 creation (not weapon_c4, planted c4 that has classname "grenade") ?
I don't want to hook FM_SetModel and i don't want to retrieve c4 index when logevent/sound/textmsg is fired.
Ham_Spawn ("grenade") doesn't detect it, FM_CreateNamedEntity is not fired.
FM_CreateEntity is fired but well, entity is not valid yet.

Exolent[jNr] 12-23-2008 15:47

Re: Detect C4 creation/spawn
 
What do you mean by creation?
When it is first created when the map starts?
When it is given to the player at round start?
When it is planted on the ground?

ConnorMcLeod 12-23-2008 15:51

Re: Detect C4 creation/spawn
 
Quote:

Originally Posted by 'Exolent[jNr
When it is planted on the ground?

This one, post updated.

Exolent[jNr] 12-23-2008 16:25

Re: Detect C4 creation/spawn
 
Have you tried FM_Spawn?

ConnorMcLeod 12-23-2008 17:45

Re: Detect C4 creation/spawn
 
Sure.

Also, Ham_Item_Kill ("weapon_c4") is fired even after the c4 model has been set.

Exolent[jNr] 12-23-2008 18:07

Re: Detect C4 creation/spawn
 
Did FM_Spawn work or not? I couldn't tell from "sure". :?

ConnorMcLeod 12-23-2008 18:15

Re: Detect C4 creation/spawn
 
No.

Exolent[jNr] 12-23-2008 18:25

Re: Detect C4 creation/spawn
 
After doing some testing, FM_SetModel was the best method that I used.
Why don't you want to use FM_SetModel?

danielkza 12-23-2008 18:51

Re: Detect C4 creation/spawn
 
Quote:

Originally Posted by Exolent[jNr] (Post 732227)
After doing some testing, FM_SetModel was the best method that I used.
Why don't you want to use FM_SetModel?

Probably cause it's called very often, but I see no other way of doing this. Maybe a Ham version of SetModel only for the proper entity class would reduce the possible overhead, but I couldn't find it in ham_const.inc.

ConnorMcLeod 12-24-2008 03:09

Re: Detect C4 creation/spawn
 
Quote:

Originally Posted by danielkza (Post 732244)
Probably cause it's called very often

Exactly.


All times are GMT -4. The time now is 09:06.

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