mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 22:35:37 +03:00
Added request at13457 from harbu.
This commit is contained in:
parent
0600e3357c
commit
de5eb6924a
@ -2783,6 +2783,32 @@ static cell AMX_NATIVE_CALL amx_mkdir(AMX *amx, cell *params)
|
||||
#endif
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL find_plugin_byfile(AMX *amx, cell *params)
|
||||
{
|
||||
typedef int (*STRCOMPARE)(const char*, const char*);
|
||||
|
||||
STRCOMPARE func;
|
||||
|
||||
if (params[2])
|
||||
{
|
||||
func = stricmp;
|
||||
} else {
|
||||
func = strcmp;
|
||||
}
|
||||
|
||||
int len, i=0;
|
||||
char *file = get_amxstring(amx, params[1], 0, len);
|
||||
|
||||
for (CPluginMngr::iterator iter = g_plugins.begin(); iter; ++iter)
|
||||
{
|
||||
if ( (func)((*iter).getName(), file) == 0 )
|
||||
return i;
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO amxmod_Natives[] = {
|
||||
{ "client_cmd", client_cmd },
|
||||
{ "client_print", client_print },
|
||||
@ -2793,6 +2819,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
|
||||
{ "engclient_cmd", engclient_cmd },
|
||||
{ "engclient_print", engclient_print },
|
||||
{ "find_player", find_player },
|
||||
{ "find_plugin_byfile", find_plugin_byfile },
|
||||
{ "force_unmodified", force_unmodified },
|
||||
{ "format_time", format_time},
|
||||
{ "get_clcmd", get_clcmd},
|
||||
|
@ -756,9 +756,6 @@
|
||||
<File
|
||||
RelativePath="..\CQueue.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\CRList.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\CString.h">
|
||||
</File>
|
||||
|
@ -260,3 +260,5 @@ enum {
|
||||
#define AMX_FLAG_LINEOPS (1<<5) /* line ops are parsed by the JIT [loadtime only flag] */
|
||||
#define AMX_FLAG_BROWSE (1<<14) /* browsing/relocating or executing */
|
||||
#define AMX_FLAG_RELOC (1<<15) /* jump/call addresses relocated */
|
||||
|
||||
#define INVALID_PLUGIN_ID -1
|
||||
|
@ -677,4 +677,7 @@ native require_module(const module[]);
|
||||
native is_amd64_server();
|
||||
|
||||
/* Returns 0 on success, like the POSIX specification */
|
||||
native mkdir(const dirname[]);
|
||||
native mkdir(const dirname[]);
|
||||
|
||||
/* Returns plugin id searched by file/name. Returns INVALID_PLUGIN_ID on failure. */
|
||||
native find_plugin_byfile(const filename[], ignoreCase=1);
|
Loading…
Reference in New Issue
Block a user