L L4D2node

ent_setpos

0x00641550 · 540 bytes · __cdecl

_ZL10ent_setposRK8CCommand

Decompiled

undefined (1 param)

/* ent_setpos(CCommand const&) */

void ent_setpos(CCommand *param_1)

{
  byte *pbVar1;
  int *piVar2;
  char cVar3;
  CBasePlayer *pCVar4;
  uint uVar5;
  CBaseEntity *this;
  char *pcVar6;
  byte *pbVar7;
  float fVar8;
  double dVar9;
  float local_28;
  float local_24;
  float local_20;
  
  if (*(int *)(*(int *)(sv_cheats + 0x1c) + 0x30) == 0) {
    return;
  }
  pCVar4 = (CBasePlayer *)UTIL_GetCommandClient();
  if (pCVar4 == (CBasePlayer *)0x0) {
    return;
  }
  cVar3 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4);
  if (cVar3 == '\0') {
    return;
  }
  if (*(int *)param_1 < 4) {
    ClientPrint(pCVar4,2,"Usage:  ent_setpos index x y <optional z>\n",(char *)0x0,(char *)0x0,
                (char *)0x0,(char *)0x0);
    return;
  }
  uVar5 = V_atoi(*(char **)(param_1 + 0x40c));
  pbVar1 = *(byte **)(gpGlobals + 0x58);
  if (uVar5 < 0x800) {
    if (pbVar1 == (byte *)0x0) goto LAB_006416f7;
    pbVar7 = pbVar1 + uVar5 * 0x10;
    if ((pbVar1[uVar5 * 0x10] & 2) != 0) goto LAB_006416ec;
  }
  else {
    if (pbVar1 == (byte *)0x0) goto LAB_006416f7;
LAB_006416ec:
    pbVar7 = pbVar1;
    if ((*pbVar1 & 2) != 0) goto LAB_006416f7;
  }
  piVar2 = *(int **)(pbVar7 + 0xc);
  if ((piVar2 != (int *)0x0) &&
     (this = (CBaseEntity *)(**(code **)(*piVar2 + 0x18))(piVar2), this != (CBaseEntity *)0x0)) {
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this);
    }
    pcVar6 = "";
    fVar8 = *(float *)(this + 0x2e8);
    if (2 < *(int *)param_1) {
      pcVar6 = *(char **)(param_1 + 0x410);
    }
    dVar9 = strtod(pcVar6,(char **)0x0);
    pcVar6 = "";
    local_28 = (float)dVar9;
    if (3 < *(int *)param_1) {
      pcVar6 = *(char **)(param_1 + 0x414);
    }
    dVar9 = strtod(pcVar6,(char **)0x0);
    local_24 = (float)dVar9;
    if (*(int *)param_1 == 5) {
      dVar9 = strtod(*(char **)(param_1 + 0x418),(char **)0x0);
      fVar8 = (float)dVar9;
    }
    local_20 = fVar8;
    CBaseEntity::SetAbsOrigin(this,(Vector *)&local_28);
    return;
  }
LAB_006416f7:
  pcVar6 = (char *)UTIL_VarArgs("ent_setpos no entity %d\n",uVar5);
  ClientPrint(pCVar4,2,pcVar6,(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)