Add getter for Event.BroadcastDisabled (#946)
In a pre-hook, the hook param is not reliable if multiple plugins have hooked the same event.
This commit is contained in:
@@ -438,6 +438,22 @@ static cell_t sm_SetEventBroadcast(IPluginContext *pContext, const cell_t *param
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t sm_GetEventBroadcast(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
HandleError err;
|
||||
EventInfo *pInfo;
|
||||
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
|
||||
|
||||
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), &sec, (void **)&pInfo))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
|
||||
}
|
||||
|
||||
return pInfo->bDontBroadcast;
|
||||
}
|
||||
|
||||
REGISTER_NATIVES(gameEventNatives)
|
||||
{
|
||||
{"HookEvent", sm_HookEvent},
|
||||
@@ -471,6 +487,7 @@ REGISTER_NATIVES(gameEventNatives)
|
||||
{"Event.SetFloat", sm_SetEventFloat},
|
||||
{"Event.SetString", sm_SetEventString},
|
||||
{"Event.BroadcastDisabled.set", sm_SetEventBroadcast},
|
||||
{"Event.BroadcastDisabled.get", sm_GetEventBroadcast},
|
||||
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user