MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / InterceptUserMessage

Method InterceptUserMessage

core/smn_usermsgs.cpp:338–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336ResultType MsgListenerWrapper::InterceptUserMessage(int msg_id, protobuf::Message *msg, IRecipientFilter *pFilter)
337#else
338ResultType MsgListenerWrapper::InterceptUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter)
339#endif
340{
341 Handle_t hndl;
342 cell_t res = static_cast<cell_t>(Pl_Continue);
343 size_t size = _FillInPlayers(g_MsgPlayers, pFilter);
344
345#ifdef USE_PROTOBUF_USERMESSAGES
346 hndl = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), NULL, g_pCoreIdent, NULL);
347#else
348 g_ReadBitBuf.StartReading(bf->GetBasePointer(), bf->GetNumBytesWritten());
349 hndl = g_ReadBufHandle;
350#endif
351
352 m_Intercept->PushCell(msg_id);
353 m_Intercept->PushCell(hndl);
354 m_Intercept->PushArray(g_MsgPlayers, size);
355 m_Intercept->PushCell(size);
356 m_Intercept->PushCell(pFilter->IsReliable());
357 m_Intercept->PushCell(pFilter->IsInitMessage());
358 m_Intercept->Execute(&res);
359
360#ifdef USE_PROTOBUF_USERMESSAGES
361 HandleSecurity sec;
362 sec.pIdentity = g_pCoreIdent;
363 handlesys->FreeHandle(hndl, &sec);
364#endif
365
366 return static_cast<ResultType>(res);
367}
368
369void MsgListenerWrapper::OnPostUserMessage(int msg_id, bool sent)
370{

Callers 1

OnMessageEnd_PreMethod · 0.45

Calls 7

PushCellMethod · 0.80
PushArrayMethod · 0.80
FreeHandleMethod · 0.80
CreateHandleMethod · 0.45
IsReliableMethod · 0.45
IsInitMessageMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected