Skip to content

Instantly share code, notes, and snippets.

@oscar-broman
Created April 11, 2012 10:44
Show Gist options
  • Save oscar-broman/2358590 to your computer and use it in GitHub Desktop.
Save oscar-broman/2358590 to your computer and use it in GitHub Desktop.
diff --git a/y_dohooks.inc b/y_dohooks.inc
index 0adf841..b39ed71 100644
--- a/y_dohooks.inc
+++ b/y_dohooks.inc
@@ -62,6 +62,7 @@ Changelog:
#include <YSI\internal\y_version>
#include <a_samp>
#include <YSI\y_debug>
+#include <YSI\y_stringhash>
#include <YSI\y_amx>
@@ -120,6 +121,10 @@ static stock
YSI_g_sCallbackData[ALS][E_FUNC_HOOK_DATA],
YSI_g_sLastFoundIndex;
+Hooks_Blank_Return1N() return -1;
+Hooks_Blank_Return0 () return 0;
+Hooks_Blank_Return1 () return 1;
+
Hooks_RedirectPublic(from[], to[])
{
P:4("Hooks_RedirectPublic called: \"%s\", \"%s\"", from, to);
@@ -144,7 +149,29 @@ Hooks_RedirectPublic(from[], to[])
// it, however, the callback will no longer exist (unless PAWN
// buffers callbacks in an efficient structure, which is possible).
// UPDATE: Clearly not.
- AMX_Write(addr, -1);
+
+ switch (YHash(from))
+ {
+ case _H(O,n,P,l,a,y,e,r,C,o,m,m,a,n,d,T,e,x,t):
+ {
+ #emit CONST.pri Hooks_Blank_Return0
+ #emit STOR.S.pri pointer
+ }
+
+ case _H(O,n,P,l,a,y,e,r,C,o,m,m,a,n,d,P,e,r,f,o,r,m,e,d):
+ {
+ #emit CONST.pri Hooks_Blank_Return1N
+ #emit STOR.S.pri pointer
+ }
+
+ default:
+ {
+ #emit CONST.pri Hooks_Blank_Return1
+ #emit STOR.S.pri pointer
+ }
+ }
+
+ AMX_Write(addr, pointer);
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment