@@ -212,6 +212,8 @@ LUA_FUNCTION_STATIC(VoiceData_CreateCopy)
212212static Detouring::Hook detour_SV_BroadcastVoiceData;
213213static void hook_SV_BroadcastVoiceData (IClient* pClient, int nBytes, char * data, int64 xuid)
214214{
215+ VPROF_BUDGET (" HolyLib - SV_BroadcastVoiceData" , VPROF_BUDGETGROUP_HOLYLIB);
216+
215217 if (g_pVoiceChatModule.InDebug ())
216218 Msg (" cl: %p\n bytes: %i\n data: %p\n " , pClient, nBytes, data);
217219
@@ -221,8 +223,6 @@ static void hook_SV_BroadcastVoiceData(IClient* pClient, int nBytes, char* data,
221223 return ;
222224 }
223225
224- VPROF_BUDGET (" HolyLib - SV_BroadcastVoiceData" , VPROF_BUDGETGROUP_HOLYLIB);
225-
226226 if (Lua::PushHook (" HolyLib:PreProcessVoiceChat" ))
227227 {
228228 VoiceData* pVoiceData = new VoiceData;
@@ -231,15 +231,15 @@ static void hook_SV_BroadcastVoiceData(IClient* pClient, int nBytes, char* data,
231231
232232 Util::Push_Entity ((CBaseEntity*)Util::GetPlayerByClient ((CBaseClient*)pClient));
233233 Push_VoiceData (pVoiceData);
234+ bool bHandled = false ;
234235 if (g_Lua->CallFunctionProtected (3 , 1 , true ))
235236 {
236- bool bHandled = g_Lua->GetBool (-1 );
237+ bHandled = g_Lua->GetBool (-1 );
237238 g_Lua->Pop (1 );
238- if (bHandled)
239- {
240- return ;
241- }
242239 }
240+
241+ if (bHandled)
242+ return ;
243243 }
244244
245245 detour_SV_BroadcastVoiceData.GetTrampoline <Symbols::SV_BroadcastVoiceData>()(pClient, nBytes, data, xuid);
0 commit comments