AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Trigger Bomb Detonation in CS (https://forums.alliedmods.net/showthread.php?t=64616)

AndraX2000 12-19-2007 13:46

Trigger Bomb Detonation in CS
 
Is there a way to cause a planted bomb to detonate? I am working on a dead-man's switch plugin. If the player who planted the bomb is killed, I want to trigger the bomb to explode.

AndraX2000 12-19-2007 15:07

Re: Trigger Bomb Detonation in CS
 
I found the answer in http://forums.alliedmods.net/showthread.php?t=40164

Code:
new bombent = fm_find_ent_by_model(-1, "grenade", "models/w_c4.mdl"); set_pdata_float(bombent, 100, get_gametime());

fm_find_ent_by_model comes from Fakemeta Utilities: http://forums.alliedmods.net/showthread.php?t=28284

If I'm interpreting this correctly, offset 100 is the gametime at which the bomb explodes. The above code triggers a "natural" explosion by setting offset 100 to the current gametime.

Alka 12-19-2007 15:11

Re: Trigger Bomb Detonation in CS
 
I don't know if with get_gametime() works, but with this is working...
Code:

set_pdata_float(*Ent, 100, 0.0);
No, you must set it to 0.0, to trigger the explosion.

ConnorMcLeod 12-19-2007 15:11

Re: Trigger Bomb Detonation in CS
 
Quote:

Originally Posted by AndraX2000 (Post 564977)
If I'm interpreting this correctly, offset 100 is the gametime at which the bomb explodes. The above code triggers a "natural" explosion by setting offset 100 to the current gametime.

Yes

VEN 12-22-2007 08:28

Re: Trigger Bomb Detonation in CS
 
Quote:

I don't know if with get_gametime() works, but with this is working...
Code:
set_pdata_float(*Ent, 100, 0.0);
The reason is that game mod do "if val <= gametime" check. So the both methods are valid though your is more efficient but such code may cause more confusion for those who are not familiar with exact usage of this offest. That's why i specified current gametime value for offset - self-explanatory.


All times are GMT -4. The time now is 11:00.

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