PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <orpheu>
#include <fakemeta>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
new OrpheuFunction:HandleSGDetonateFunc
HandleSGDetonateFunc = OrpheuGetFunction("SG_Detonate", "CGrenade")
OrpheuRegisterHook(HandleSGDetonateFunc, "OnSGDetonate", OrpheuHookPre)
}
public OnSGDetonate(ent)
{
client_print(pev(ent,pev_owner), print_chat, "It works")
}
A simple test plugin which is tested and working.
To block the explosion and to remove the nade just do as below:
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <orpheu>
#include <fakemeta>
#include <engine>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
new OrpheuFunction:HandleSGDetonateFunc
HandleSGDetonateFunc = OrpheuGetFunction("SG_Detonate", "CGrenade")
OrpheuRegisterHook(HandleSGDetonateFunc, "OnSGDetonate", OrpheuHookPre)
}
public OrpheuHookReturn:OnSGDetonate(ent)
{
client_print(pev(ent,pev_owner), print_chat, "It works")
remove_entity(ent)
return OrpheuSupercede
}
Your plugin will crash the server because you must supercede the function after removing the nade. But the message should work. Also no reason to use
static.
Run
orpheu config command into your server console and look into addons/amxmodx/logs. You should see something like
Code:
Parsing folder "CGrenade" started
Parsing file "SG_Detonate" started
Searching for name "?SG_Detonate@CGrenade@@QAEXXZ"... FOUND
Parsing file "SG_Detonate" ended
You need to go to addons/amxmodx/configs/orpheu/functions, create a folder called CGrenade, inside it a file without any extension called SG_Detonate and after that copy the content from the post above( the one with the signature ).
__________________