Raised This Month: $ Target: $400
 0% 

Trigger Bomb Detonation in CS


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AndraX2000
Member
Join Date: Mar 2006
Location: 39°57' N 83°14' W
Old 12-19-2007 , 13:46   Trigger Bomb Detonation in CS
Reply With Quote #1

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.
__________________
Get maps at http://www.counter-strike-maps.net
Shoot me at:

AndraX2000 is offline
AndraX2000
Member
Join Date: Mar 2006
Location: 39°57' N 83°14' W
Old 12-19-2007 , 15:07   Re: Trigger Bomb Detonation in CS
Reply With Quote #2

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.
__________________
Get maps at http://www.counter-strike-maps.net
Shoot me at:

AndraX2000 is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 12-19-2007 , 15:11   Re: Trigger Bomb Detonation in CS
Reply With Quote #3

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.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-19-2007 , 15:11   Re: Trigger Bomb Detonation in CS
Reply With Quote #4

Quote:
Originally Posted by AndraX2000 View Post
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
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 12-22-2007 , 08:28   Re: Trigger Bomb Detonation in CS
Reply With Quote #5

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.
VEN is offline
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 17:24.


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