L L4D2node

setpos_player

0x00643930 · 529 bytes · __cdecl

_ZL13setpos_playerRK8CCommand

Decompiled

undefined (1 param)

/* setpos_player(CCommand const&) */

void setpos_player(CCommand *param_1)

{
  char cVar1;
  CBasePlayer *pCVar2;
  long lVar3;
  CBaseEntity *this;
  char *pcVar4;
  uint uVar5;
  float fVar6;
  double dVar7;
  float local_18;
  float local_14;
  float local_10;
  
  if (*(int *)(*(int *)(sv_cheats + 0x1c) + 0x30) == 0) {
    return;
  }
  pCVar2 = (CBasePlayer *)UTIL_GetCommandClient();
  if (pCVar2 != (CBasePlayer *)0x0) {
    cVar1 = (**(code **)(*(int *)pCVar2 + 0x16c))(pCVar2);
    if (cVar1 != '\0') {
      if (*(int *)param_1 < 4) {
        ClientPrint(pCVar2,2,"Usage:  setpos player_index x y <z optional>\n",(char *)0x0,
                    (char *)0x0,(char *)0x0,(char *)0x0);
      }
      else {
        lVar3 = strtol(*(char **)(param_1 + 0x40c),(char **)0x0,10);
        this = (CBaseEntity *)UTIL_PlayerByIndex(lVar3);
        if (this != (CBaseEntity *)0x0) {
          cVar1 = (**(code **)(*(int *)this + 0x16c))(this);
          if (cVar1 != '\0') {
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition(this);
            }
            pcVar4 = "";
            fVar6 = *(float *)(this + 0x2e8);
            if (2 < *(int *)param_1) {
              pcVar4 = *(char **)(param_1 + 0x410);
            }
            dVar7 = strtod(pcVar4,(char **)0x0);
            pcVar4 = "";
            local_18 = (float)dVar7;
            if (3 < *(int *)param_1) {
              pcVar4 = *(char **)(param_1 + 0x414);
            }
            dVar7 = strtod(pcVar4,(char **)0x0);
            local_14 = (float)dVar7;
            if (*(int *)param_1 == 5) {
              dVar7 = strtod(*(char **)(param_1 + 0x418),(char **)0x0);
              fVar6 = (float)dVar7;
            }
            local_10 = fVar6;
            CBaseEntity::SetAbsOrigin(this,(Vector *)&local_18);
            uVar5 = (**(code **)(*(int *)this + 0x7a0))(this,0);
            cVar1 = TestEntityPosition(this,uVar5);
            if (cVar1 == '\0') {
              ClientPrint((CBasePlayer *)this,2,
                          "setpos into world, use noclip to unstick yourself!\n",(char *)0x0,
                          (char *)0x0,(char *)0x0,(char *)0x0);
            }
          }
        }
      }
    }
  }
  return;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)