Raised This Month: $27 Target: $400
 6% 

Is it possible to hook the grenade explode event?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 04-27-2010 , 17:08   Is it possible to hook the grenade explode event?
Reply With Quote #1

I had an idea that requires it.
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Silencer123
Veteran Member
Join Date: Jul 2006
Location: Germany (GMT+1)
Old 04-27-2010 , 17:12   Re: Is it possible to hook the grenade explode event?
Reply With Quote #2

Include:
#include <hamsandwich>

In plugin_init():
RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")

Somewhere else:
public fw_ThinkGrenade(entity) {
// [...]
}

Taken from: http://forums.alliedmods.net/showthread.php?t=74905
Found in 10 Seconds with the Forums' search function. D;
Note that the above is not the whole secret. Conduct your own research on the plugin linked to above. ;)
__________________
EAT YOUR VEGGIES

Last edited by Silencer123; 04-27-2010 at 17:15.
Silencer123 is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 04-27-2010 , 17:28   Re: Is it possible to hook the grenade explode event?
Reply With Quote #3

And that is the explosion? Like, if i client_print(hihi) will it print exactly at the explosion?

I did search, and i swear, i found nothing useful. I searched keywords "hooking grenade explosion" because i knew there was a dumb limit to the search thing.
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 04-27-2010 , 17:33   Re: Is it possible to hook the grenade explode event?
Reply With Quote #4

Test it.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-27-2010 , 17:44   Re: Is it possible to hook the grenade explode event?
Reply With Quote #5

You may want to verify/test if that also hooks C4 explosion. IIRC, they have the same classname. I could be wrong but it cant hurt to test.
__________________
Bugsy is online now
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 04-27-2010 , 17:59   Re: Is it possible to hook the grenade explode event?
Reply With Quote #6

Is it the code or is my hlds hating me for using it again?
Attached Files
File Type: sma Get Plugin or Get Source (ouch.sma - 688 views - 677 Bytes)
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME

Last edited by r4ndomz; 04-27-2010 at 18:06.
r4ndomz is offline
Send a message via Skype™ to r4ndomz
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-27-2010 , 18:58   Re: Is it possible to hook the grenade explode event?
Reply With Quote #7

1. You can't use get_user_origin() with a non-player entity.
2. Cache get_maxplayers() in a global variable and retrieve the value on plugin_init().
3. Player indexes are from 1->maxplayers, not 0->(maxplayers - 1).
4. No need to check is_user_connected() since is_user_alive() checks if player is connected.
5. Don't create variables inside loops.
6. Cache the radius at the top of the function so you don't retrieve it for every player.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
r4ndomz
Senior Member
Join Date: Jul 2009
Location: The Hood
Old 04-27-2010 , 19:11   Re: Is it possible to hook the grenade explode event?
Reply With Quote #8

Quote:
Originally Posted by Exolent[jNr] View Post
1. You can't use get_user_origin() with a non-player entity.
Then how do i get the origin? Im multitasking and i dont have that much time left.
__________________
HideNSeek bug fixed here:http://forums.alliedmods.net/showpos...&postcount=951

PM me if you want a nice HideNSeek shop
NEED PLUGIN TESTERS PM ME
r4ndomz is offline
Send a message via Skype™ to r4ndomz
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 04-27-2010 , 19:16   Re: Is it possible to hook the grenade explode event?
Reply With Quote #9

Code:
new Float:origin[3] pev( ent, pev_origin, origin )
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT

Last edited by wrecked_; 04-27-2010 at 19:50.
wrecked_ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-27-2010 , 19:17   Re: Is it possible to hook the grenade explode event?
Reply With Quote #10

That method uses a Float, wrecked.

Float: origin[ 3 ]
__________________

Last edited by Bugsy; 04-27-2010 at 19:23.
Bugsy is online now
Reply


Thread Tools
Display Modes

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 13:10.


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