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

Method PlayerRunCmdPost

extensions/sdktools/hooks.cpp:384–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384void CHookManager::PlayerRunCmdPost(CUserCmd *ucmd, IMoveHelper *moveHelper)
385{
386 if (!ucmd)
387 {
388 RETURN_META(MRES_IGNORED);
389 }
390
391 if (m_usercmdsPostFwd->GetFunctionCount() == 0)
392 {
393 RETURN_META(MRES_IGNORED);
394 }
395
396 CBaseEntity *pEntity = META_IFACEPTR(CBaseEntity);
397
398 if (!pEntity)
399 {
400 RETURN_META(MRES_IGNORED);
401 }
402
403 edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
404
405 if (!pEdict)
406 {
407 RETURN_META(MRES_IGNORED);
408 }
409
410 int client = IndexOfEdict(pEdict);
411 cell_t vel[3] = { sp_ftoc(ucmd->forwardmove), sp_ftoc(ucmd->sidemove), sp_ftoc(ucmd->upmove) };
412 cell_t angles[3] = { sp_ftoc(ucmd->viewangles.x), sp_ftoc(ucmd->viewangles.y), sp_ftoc(ucmd->viewangles.z) };
413 cell_t mouse[2] = { ucmd->mousedx, ucmd->mousedy };
414
415 m_usercmdsPostFwd->PushCell(client);
416 m_usercmdsPostFwd->PushCell(ucmd->buttons);
417 m_usercmdsPostFwd->PushCell(ucmd->impulse);
418 m_usercmdsPostFwd->PushArray(vel, 3);
419 m_usercmdsPostFwd->PushArray(angles, 3);
420 m_usercmdsPostFwd->PushCell(ucmd->weaponselect);
421 m_usercmdsPostFwd->PushCell(ucmd->weaponsubtype);
422 m_usercmdsPostFwd->PushCell(ucmd->command_number);
423 m_usercmdsPostFwd->PushCell(ucmd->tick_count);
424 m_usercmdsPostFwd->PushCell(ucmd->random_seed);
425 m_usercmdsPostFwd->PushArray(mouse, 2);
426 m_usercmdsPostFwd->Execute();
427
428 RETURN_META(MRES_IGNORED);
429}
430
431void CHookManager::NetChannelHook(int client)
432{

Callers

nothing calls this directly

Calls 5

IndexOfEdictFunction · 0.85
GetFunctionCountMethod · 0.80
PushCellMethod · 0.80
PushArrayMethod · 0.80
ExecuteMethod · 0.45

Tested by

no test coverage detected