diff --git a/core/smn_events.cpp b/core/smn_events.cpp index 605adaf2..16ffad93 100644 --- a/core/smn_events.cpp +++ b/core/smn_events.cpp @@ -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(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} }; diff --git a/plugins/include/events.inc b/plugins/include/events.inc index d7d799a1..3601d59a 100644 --- a/plugins/include/events.inc +++ b/plugins/include/events.inc @@ -56,6 +56,7 @@ typeset EventHook // this event has set the hook mode EventHookMode_PostNoCopy. // @param name String containing the name of the event. // @param dontBroadcast True if event was not broadcast to clients, false otherwise. + // May not correspond to the real value. Use the property BroadcastDisabled. // @return Ignored for post hooks. Plugin_Handled will block event if hooked as pre. /// function Action (Event event, const char[] name, bool dontBroadcast); @@ -160,6 +161,7 @@ methodmap Event < Handle // or HookEventEx callbacks. property bool BroadcastDisabled { public native set(bool dontBroadcast); + public native get(); } } @@ -337,4 +339,4 @@ native void GetEventName(Handle event, char[] name, int maxlength); * @param dontBroadcast True to disable broadcasting, false otherwise. * @error Invalid Handle. */ -native void SetEventBroadcast(Handle event, bool dontBroadcast); +native void SetEventBroadcast(Handle event, bool dontBroadcast); \ No newline at end of file