L L4D2node

setpos

0x00643b50 · 478 bytes · __cdecl

_ZL6setposRK8CCommand

Decompiled

undefined (1 param)

/* setpos(CCommand const&) */

void setpos(CCommand *param_1)

{
  char cVar1;
  CBaseEntity *this;
  char *pcVar2;
  uint uVar3;
  float fVar4;
  double dVar5;
  float local_18;
  float local_14;
  float local_10;
  
  if (*(int *)(*(int *)(sv_cheats + 0x1c) + 0x30) == 0) {
    return;
  }
  this = (CBaseEntity *)UTIL_GetCommandClient();
  if (this == (CBaseEntity *)0x0) {
    return;
  }
  cVar1 = (**(code **)(*(int *)this + 0x16c))(this);
  if (cVar1 == '\0') {
    return;
  }
  if (*(int *)param_1 < 3) {
    ClientPrint((CBasePlayer *)this,2,"Usage:  setpos x y <z optional>\n",(char *)0x0,(char *)0x0,
                (char *)0x0,(char *)0x0);
    return;
  }
  if (((byte)this[0x14d] & 8) == 0) {
    fVar4 = *(float *)(this + 0x2e8);
  }
  else {
    CBaseEntity::CalcAbsolutePosition(this);
    pcVar2 = "";
    fVar4 = *(float *)(this + 0x2e8);
    if (*(int *)param_1 < 2) goto LAB_00643bb8;
  }
  pcVar2 = *(char **)(param_1 + 0x40c);
LAB_00643bb8:
  dVar5 = strtod(pcVar2,(char **)0x0);
  pcVar2 = "";
  local_18 = (float)dVar5;
  if (2 < *(int *)param_1) {
    pcVar2 = *(char **)(param_1 + 0x410);
  }
  dVar5 = strtod(pcVar2,(char **)0x0);
  local_14 = (float)dVar5;
  if (*(int *)param_1 == 4) {
    dVar5 = strtod(*(char **)(param_1 + 0x414),(char **)0x0);
    fVar4 = (float)dVar5;
  }
  local_10 = fVar4;
  CBaseEntity::SetAbsOrigin(this,(Vector *)&local_18);
  uVar3 = (**(code **)(*(int *)this + 0x7a0))(this,0);
  cVar1 = TestEntityPosition(this,uVar3);
  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)