added amb1289 - FindPluginByNumber
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401804
This commit is contained in:
parent
63d301c4c7
commit
6ba2593738
@ -585,6 +585,18 @@ static cell_t GetExtensionFileStatus(IPluginContext *pContext, const cell_t *par
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t FindPluginByNumber(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
CPlugin *pPlugin = g_PluginSys.GetPluginByOrder(params[1]);
|
||||
|
||||
if (pPlugin == NULL)
|
||||
{
|
||||
return BAD_HANDLE;
|
||||
}
|
||||
|
||||
return pPlugin->GetMyHandle();
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(coreNatives)
|
||||
{
|
||||
{"AutoExecConfig", AutoExecConfig},
|
||||
@ -607,6 +619,7 @@ REGISTER_NATIVES(coreNatives)
|
||||
{"LogToFile", LogToFile},
|
||||
{"LogToFileEx", LogToFileEx},
|
||||
{"GetExtensionFileStatus", GetExtensionFileStatus},
|
||||
{"FindPluginByNumber", FindPluginByNumber},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -266,6 +266,18 @@ native bool:IsPluginDebugging(Handle:hndl);
|
||||
*/
|
||||
native bool:GetPluginInfo(Handle:plugin, PluginInfo:info, String:buffer[], maxlength);
|
||||
|
||||
/**
|
||||
* Finds a plugin by its order in the list from the "plugins list" server
|
||||
* "sm" command. You should not use this function to loop through all plugins,
|
||||
* use the iterator instead. Looping through all plugins using this native
|
||||
* is O(n^2), whereas using the iterator is O(n).
|
||||
*
|
||||
* @param order_num Number of the plugin as it appears in "sm plugins list".
|
||||
* @return Plugin Handle on success, INVALID_HANDLE if no plugin
|
||||
* matches the given number.
|
||||
*/
|
||||
native Handle:FindPluginByNumber(order_num);
|
||||
|
||||
/**
|
||||
* Causes the plugin to enter a failed state. An error will be thrown and
|
||||
* the plugin will be paused until it is unloaded or reloaded.
|
||||
|
Loading…
Reference in New Issue
Block a user