File tree Expand file tree Collapse file tree
addons/sourcemod/scripting Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44#include <sourcemod>
55#include <dhooks>
6- #include <@Forgetest/gamedatawrapper>
76
87#define PLUGIN_VERSION " 1.0"
98
@@ -16,6 +15,27 @@ public Plugin myinfo =
1615 url = " https://github.com/Target5150/MoYu_Server_Stupid_Plugins" ,
1716}
1817
18+ methodmap GameDataWrapper < GameData {
19+ public GameDataWrapper (const char [] file ) {
20+ GameData gd = new GameData (file );
21+ if (! gd ) SetFailState (" Missing gamedata \" %s \" " , file );
22+ return view_as <GameDataWrapper >(gd );
23+ }
24+ public DynamicDetour CreateDetourOrFail (
25+ const char [] name ,
26+ DHookCallback preHook = INVALID_FUNCTION ,
27+ DHookCallback postHook = INVALID_FUNCTION ) {
28+ DynamicDetour hSetup = DynamicDetour .FromConf (this , name );
29+ if (! hSetup )
30+ SetFailState (" Missing detour setup \" %s \" " , name );
31+ if (preHook != INVALID_FUNCTION && ! hSetup .Enable (Hook_Pre , preHook ))
32+ SetFailState (" Failed to pre-detour \" %s \" " , name );
33+ if (postHook != INVALID_FUNCTION && ! hSetup .Enable (Hook_Post , postHook ))
34+ SetFailState (" Failed to post-detour \" %s \" " , name );
35+ return hSetup ;
36+ }
37+ }
38+
1939public void OnPluginStart ()
2040{
2141 GameDataWrapper gd = new GameDataWrapper (" l4d_fix_prop_los" );
You can’t perform that action at this time.
0 commit comments