Added FindFlagChar native. (bug 3776, r=dvander)
This commit is contained in:
parent
f439cad46c
commit
5d5400a9ac
@ -42,7 +42,7 @@ using namespace SourceMod;
|
||||
* Add 1 to the RHS of this expression to bump the intercom file
|
||||
* This is to prevent mismatching core/logic binaries
|
||||
*/
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 14)
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 15)
|
||||
|
||||
#if defined SM_LOGIC
|
||||
class IVEngineServer
|
||||
|
@ -507,6 +507,22 @@ static cell_t FindFlagByChar(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t FindFlagChar(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
cell_t *addr;
|
||||
pContext->LocalToPhysAddr(params[2], &addr);
|
||||
|
||||
char flagchar;
|
||||
if (!adminsys->FindFlagChar((AdminFlag)params[1], &flagchar))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
*addr = (cell_t)flagchar;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t ReadFlagString(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *flag;
|
||||
@ -563,6 +579,7 @@ REGISTER_NATIVES(adminNatives)
|
||||
{"CreateAuthMethod", CreateAuthMethod},
|
||||
{"FindFlagByName", FindFlagByName},
|
||||
{"FindFlagByChar", FindFlagByChar},
|
||||
{"FindFlagChar", FindFlagChar},
|
||||
{"ReadFlagString", ReadFlagString},
|
||||
{"GetAdmGroupImmunityLevel",GetAdmGroupImmunityLevel},
|
||||
{"SetAdmGroupImmunityLevel",SetAdmGroupImmunityLevel},
|
||||
|
@ -516,6 +516,15 @@ native bool:FindFlagByName(const String:name[], &AdminFlag:flag);
|
||||
*/
|
||||
native bool:FindFlagByChar(c, &AdminFlag:flag);
|
||||
|
||||
/**
|
||||
* Finds a flag char by a gived admin flag.
|
||||
*
|
||||
* @param flag Flag to look up.
|
||||
* @param c Variable to store flag char.
|
||||
* @return True on success, false if not found.
|
||||
*/
|
||||
native bool:FindFlagChar(AdminFlag:flag, &c);
|
||||
|
||||
/**
|
||||
* Converts a string of flag characters to a bit string.
|
||||
*
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <IShareSys.h>
|
||||
|
||||
#define SMINTERFACE_ADMINSYS_NAME "IAdminSys"
|
||||
#define SMINTERFACE_ADMINSYS_VERSION 5
|
||||
#define SMINTERFACE_ADMINSYS_VERSION 6
|
||||
|
||||
/**
|
||||
* @file IAdminSystem.h
|
||||
@ -717,6 +717,15 @@ namespace SourceMod
|
||||
const char *cmd,
|
||||
FlagBits flags,
|
||||
bool override_only) =0;
|
||||
|
||||
/**
|
||||
* @brief Reads a flag as the corresponding character.
|
||||
*
|
||||
* @param flag Flag to look up.
|
||||
* @param c Variable to store flag char.
|
||||
* @return True on success, false if not found.
|
||||
*/
|
||||
virtual bool FindFlagChar(AdminFlag flag, char *c);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user