Skip to content

Commit

Permalink
use public interface wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Monera committed Sep 16, 2023
1 parent 2e7173b commit 038153e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "public-interface-wrapper"]
path = public-interface-wrapper
url = https://github.com/foolishservers/sourcemod-public-interface-wrapper.git
1 change: 1 addition & 0 deletions public-interface-wrapper
2 changes: 1 addition & 1 deletion scripting/ez/load.sp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public Action SvrCmd_EZLoad(int args)
{
if(args != 1)
{
PrintToServer("Usage: sm_ezload (string)");
PrintToServer("Usage: sm_ezload <string>: Load plugins whose path starts with given substring");
return Plugin_Handled;
}

Expand Down
2 changes: 1 addition & 1 deletion scripting/ez/unload.sp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public Action SvrCmd_EZUnload(int args)
{
if(args != 1)
{
PrintToServer("Usage: sm_ezunload (string)");
PrintToServer("Usage: sm_ezunload <string>: Unload plugins whose path starts with given substring");
return Plugin_Handled;
}

Expand Down
2 changes: 1 addition & 1 deletion scripting/eztools.sp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <adt>
#include <regex>

#include "pluginsyswrapper"
#include "publicinterfacewrapper"

#pragma newdecls required
#pragma semicolon 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#if defined _pluginsyswrapper_included_
#if defined _publicinterfacewrapper_included_
#endinput
#endif
#define _pluginsyswrapper_included_
#define _publicinterfacewrapper_included_

public Extension __ext_pluginsyswrapper =
public Extension __ext_publicinterfacewrapper =
{
name = "PluginSys Wrapper",
file = "pluginsyswrapper.ext",
file = "publicinterfacewrapper.ext",
autoload = 1,
required = 1,
};
Expand Down Expand Up @@ -70,4 +70,46 @@ stock bool UnloadPlugin(Handle handle)
{
HandleError err;
return UnloadPluginEx(handle, err);
}
}

/**
* Adds a function to a private forward's call list.
*
* @note Cannot be used during an incomplete call.
*
* @param name Name of global forward.
* @param plugin Handle of the plugin that contains the function.
* Pass INVALID_HANDLE to specify the calling plugin.
* @param func Function to add to forward.
* @return True on success, false otherwise.
* @error Invalid global forward name, invalid or corrupt plugin handle, or invalid function.
*/
native bool AddToGlobalForward(const char[] name, Handle plugin, Function func);

/**
* Removes a function from a private forward's call list.
*
* @note Only removes one instance.
* @note Functions will be removed automatically if their parent plugin is unloaded.
*
* @param name Name of global forward.
* @param plugin Handle of the plugin that contains the function.
* Pass INVALID_HANDLE to specify the calling plugin.
* @param func Function to remove from forward.
* @return True on success, false otherwise.
* @error Invalid global forward name, invalid or corrupt plugin handle, or invalid function.
*/
native bool RemoveFromGlobalForward(const char[] name, Handle plugin, Function func);

/**
* Removes all instances of a plugin from a private forward's call list.
*
* @note Functions will be removed automatically if their parent plugin is unloaded.
*
* @param name Name of global forward.
* @param plugin Handle of the plugin to remove instances of.
* Pass INVALID_HANDLE to specify the calling plugin.
* @return Number of functions removed from forward.
* @error Invalid global forward name, invalid or corrupt plugin handle.
*/
native int RemoveAllFromGlobalForward(const char[] name, Handle plugin);

0 comments on commit 038153e

Please sign in to comment.