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

Method OnUserMessage

core/smn_usermsgs.cpp:306–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304void MsgListenerWrapper::OnUserMessage(int msg_id, protobuf::Message *msg, IRecipientFilter *pFilter)
305#else
306void MsgListenerWrapper::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter)
307#endif
308{
309 cell_t res;
310 Handle_t hndl;
311 size_t size = _FillInPlayers(g_MsgPlayers, pFilter);
312
313#ifdef USE_PROTOBUF_USERMESSAGES
314 hndl = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), NULL, g_pCoreIdent, NULL);
315#else
316 g_ReadBitBuf.StartReading(bf->GetBasePointer(), bf->GetNumBytesWritten());
317 hndl = g_ReadBufHandle;
318#endif
319
320 m_Hook->PushCell(msg_id);
321 m_Hook->PushCell(hndl);
322 m_Hook->PushArray(g_MsgPlayers, size);
323 m_Hook->PushCell(size);
324 m_Hook->PushCell(pFilter->IsReliable());
325 m_Hook->PushCell(pFilter->IsInitMessage());
326 m_Hook->Execute(&res);
327
328#ifdef USE_PROTOBUF_USERMESSAGES
329 HandleSecurity sec;
330 sec.pIdentity = g_pCoreIdent;
331 handlesys->FreeHandle(hndl, &sec);
332#endif
333}
334
335#ifdef USE_PROTOBUF_USERMESSAGES
336ResultType MsgListenerWrapper::InterceptUserMessage(int msg_id, protobuf::Message *msg, IRecipientFilter *pFilter)

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