L L4D2node

CBaseClient::SetName

0x000f7720 · 523 bytes · __thiscall

_ZN11CBaseClient7SetNameEPKc

Decompiled

undefined (2 params)

/* CBaseClient::SetName(char const*) */

void __thiscall CBaseClient::SetName(CBaseClient *this,char *param_1)

{
  CBaseClient *pCVar1;
  CBaseClient CVar2;
  char cVar3;
  int iVar4;
  CBaseClient *pCVar5;
  char *pcVar6;
  int iVar7;
  int in_GS_OFFSET;
  int local_58;
  char local_40 [32];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pCVar1 = this + 0x3c;
  iVar4 = V_strncmp(param_1,(char *)pCVar1,0x20);
  if (iVar4 != 0) {
    CVar2 = (CBaseClient)*param_1;
    pCVar5 = pCVar1;
    if (CVar2 != (CBaseClient)0x0) {
LAB_000f7793:
      do {
        param_1 = param_1 + 1;
        if ((CVar2 != (CBaseClient)0x7e) && (CVar2 != (CBaseClient)0x25)) {
          if ((CVar2 == (CBaseClient)0x23) && (pCVar5 == pCVar1)) {
            CVar2 = (CBaseClient)*param_1;
            if (CVar2 == (CBaseClient)0x0) break;
            goto LAB_000f7793;
          }
          *pCVar5 = CVar2;
          pCVar5 = pCVar5 + 1;
        }
        CVar2 = (CBaseClient)*param_1;
        if ((CVar2 == (CBaseClient)0x0) || (this + 0x5b <= pCVar5)) break;
      } while( true );
    }
    *pCVar5 = (CBaseClient)0x0;
    iVar4 = _V_strlen((char *)pCVar1);
    if (iVar4 < 1) {
      V_snprintf((char *)pCVar1,0x20,"unnamed");
    }
    local_58 = 1;
    do {
      for (iVar4 = 0; iVar7 = (**(code **)(**(int **)(this + 0xb8) + 0x20))(*(int **)(this + 0xb8)),
          iVar4 < iVar7; iVar4 = iVar4 + 1) {
        pCVar5 = (CBaseClient *)
                 (**(code **)(**(int **)(this + 0xb8) + 0x1c))(*(int **)(this + 0xb8),iVar4);
        cVar3 = (**(code **)(*(int *)pCVar5 + 0x80))(pCVar5);
        if ((cVar3 != '\0') && (pCVar5 != this + 4)) {
          pcVar6 = (char *)(**(code **)(*(int *)pCVar5 + 0x48))(pCVar5);
          iVar7 = _V_stricmp(pcVar6,(char *)pCVar1);
          if (iVar7 == 0) break;
        }
      }
      iVar7 = (**(code **)(**(int **)(this + 0xb8) + 0x20))(*(int **)(this + 0xb8));
      if (iVar7 <= iVar4) goto LAB_000f78a7;
      pCVar5 = pCVar1;
      if (((this[0x3c] == (CBaseClient)0x28) &&
          (pCVar5 = this + 0x3f, this[0x3e] != (CBaseClient)0x29)) &&
         (pCVar5 = this + 0x40, this[0x3f] != (CBaseClient)0x29)) {
        pCVar5 = pCVar1;
      }
      V_snprintf(local_40,0x20,"(%d)%-.*s",local_58,0x1c,pCVar5);
      V_strncpy((char *)pCVar1,local_40,0x20);
      local_58 = local_58 + 1;
    } while( true );
  }
LAB_000f78d9:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
LAB_000f78a7:
  KeyValues::SetString(*(KeyValues **)(this + 0xb0),"name",(char *)pCVar1);
  (**(code **)(**(int **)(this + 0xb8) + 0xc0))(*(int **)(this + 0xb8),*(undefined4 *)(this + 0x30))
  ;
  goto LAB_000f78d9;
}

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)