L L4D2node

CBasePlayer::ClientCommand

0x007b8540 · 2021 bytes · __thiscall

_ZN11CBasePlayer13ClientCommandERK8CCommand

Decompiled

undefined (2 params)

/* CBasePlayer::ClientCommand(CCommand const&) */

undefined4 __thiscall CBasePlayer::ClientCommand(CBasePlayer *this,CCommand *param_1)

{
  int *piVar1;
  char cVar2;
  int iVar3;
  undefined4 uVar4;
  long lVar5;
  undefined4 *puVar6;
  int iVar7;
  undefined4 uVar8;
  CBasePlayer *this_00;
  char *pcVar9;
  double dVar10;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  undefined4 local_20;
  
  pcVar9 = "";
  if (0 < *(int *)param_1) {
    pcVar9 = *(char **)(param_1 + 0x408);
  }
  iVar3 = _V_stricmp(pcVar9,"vehicleRole");
  if (iVar3 == 0) {
    if (*(int *)param_1 != 2) {
      return 0;
    }
    uVar4 = (**(code **)(*(int *)this + 0x4fc))(this);
    if ((char)uVar4 == '\0') {
      return 1;
    }
    pcVar9 = "";
    if (1 < *(int *)param_1) {
      pcVar9 = *(char **)(param_1 + 0x40c);
    }
    lVar5 = strtol(pcVar9,(char **)0x0,10);
    puVar6 = (undefined4 *)(**(code **)(*(int *)this + 0x500))(this);
    if (puVar6 == (undefined4 *)0x0) {
      return 1;
    }
    iVar3 = (**(code **)*puVar6)(puVar6,lVar5);
    if (iVar3 != 0) {
      return 1;
    }
    (**(code **)(*(int *)this + 0x6a0))(this,&vec3_origin,&vec3_angle);
    (**(code **)(*(int *)this + 0x69c))(this,puVar6,lVar5);
    return uVar4;
  }
  uVar4 = HandleVoteCommands(this,param_1);
  if ((char)uVar4 != '\0') {
    return 1;
  }
  iVar3 = _V_stricmp(pcVar9,"spectate");
  if (iVar3 == 0) {
    iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    if (iVar3 == 1) {
      return 1;
    }
    ConVarRef::ConVarRef((ConVarRef *)&local_28,"mp_allowspectators");
    cVar2 = ConVarRef::IsValid((ConVarRef *)&local_28);
    if (((cVar2 != '\0') && (*(int *)((int)local_24 + 0x30) == 0)) &&
       (this[0x1ca4] == (CBasePlayer)0x0)) {
      ClientPrint(this,4,"#Cannot_Be_Spectator",(char *)0x0,(char *)0x0,(char *)0x0,(char *)0x0);
      return 1;
    }
    if (this[0x104] != (CBasePlayer)0x2) {
      (**(code **)(*(int *)this + 0x770))(this,0,0);
    }
    (**(code **)(*(int *)this + 0x5c4))(this,1);
    (**(code **)(*(int *)this + 0x194))(this,1);
    (**(code **)(*(int *)this + 0x638))(this,6);
    return 1;
  }
  iVar3 = _V_stricmp(pcVar9,"spec_mode");
  if (iVar3 != 0) {
    iVar3 = _V_stricmp(pcVar9,"spec_next");
    if (iVar3 == 0) {
      iVar7 = (**(code **)(*(int *)this + 0x648))(this);
      iVar3 = *(int *)this;
      if (3 < iVar7) {
        iVar3 = (**(code **)(iVar3 + 0x658))(this,0);
joined_r0x007b88f1:
        if (iVar3 == 0) {
          return 1;
        }
        (**(code **)(*(int *)this + 0x64c))(this,iVar3);
        return 1;
      }
    }
    else {
      iVar3 = _V_stricmp(pcVar9,"spec_prev");
      if (iVar3 != 0) {
        iVar3 = _V_stricmp(pcVar9,"spec_player");
        if (iVar3 == 0) {
          iVar3 = (**(code **)(*(int *)this + 0x648))(this);
          if (iVar3 < 4) {
            return 1;
          }
          if (*(int *)param_1 != 2) {
            return 1;
          }
          lVar5 = strtol(*(char **)(param_1 + 0x40c),(char **)0x0,10);
          if (lVar5 == 0) {
            pcVar9 = "";
            if (1 < *(int *)param_1) {
              pcVar9 = *(char **)(param_1 + 0x40c);
            }
            uVar4 = UTIL_PlayerByName(pcVar9);
          }
          else {
            uVar4 = UTIL_PlayerByIndex(lVar5);
          }
          uVar8 = (**(code **)(*(int *)this + 0x664))(this,uVar4);
          if ((char)uVar8 == '\0') {
            return 1;
          }
          (**(code **)(*(int *)this + 0x64c))(this,uVar4);
          return uVar8;
        }
        iVar3 = _V_stricmp(pcVar9,"spec_goto");
        if (iVar3 != 0) {
          iVar3 = _V_stricmp(pcVar9,"playerperf");
          if (iVar3 != 0) {
            return uVar4;
          }
          if (*(int *)(this + 0x30) == 0) {
            iVar3 = 0;
          }
          else {
            iVar3 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          if (1 < *(int *)param_1) {
            iVar7 = V_atoi(*(char **)(param_1 + 0x40c));
            iVar3 = *(int *)(gpGlobals + 0x14);
            if (iVar7 <= iVar3) {
              if (*(int *)param_1 < 2) {
                pcVar9 = "";
              }
              else {
                pcVar9 = *(char **)(param_1 + 0x40c);
              }
              iVar3 = V_atoi(pcVar9);
              if (iVar3 < 1) {
                iVar3 = 1;
              }
              else {
                if (*(int *)param_1 < 2) {
                  pcVar9 = "";
                }
                else {
                  pcVar9 = *(char **)(param_1 + 0x40c);
                }
                iVar3 = V_atoi(pcVar9);
              }
            }
          }
          iVar7 = -1;
          if (2 < *(int *)param_1) {
            iVar7 = V_atoi(*(char **)(param_1 + 0x410));
            if (iVar7 < 2) {
              iVar7 = 1;
            }
            else {
              pcVar9 = "";
              if (2 < *(int *)param_1) {
                pcVar9 = *(char **)(param_1 + 0x410);
              }
              iVar7 = V_atoi(pcVar9);
            }
          }
          this_00 = (CBasePlayer *)UTIL_PlayerByIndex(iVar3);
          if (this_00 != (CBasePlayer *)0x0) {
            DumpPerfToRecipient(this_00,this,iVar7);
            return 1;
          }
          return 1;
        }
        iVar3 = (**(code **)(*(int *)this + 0x648))(this);
        if ((iVar3 != 3) && (iVar3 = (**(code **)(*(int *)this + 0x648))(this), iVar3 != 6)) {
          return 1;
        }
        if (*(int *)param_1 != 6) {
          return 1;
        }
        dVar10 = strtod(*(char **)(param_1 + 0x40c),(char **)0x0);
        pcVar9 = "";
        local_34 = (float)dVar10;
        if (2 < *(int *)param_1) {
          pcVar9 = *(char **)(param_1 + 0x410);
        }
        dVar10 = strtod(pcVar9,(char **)0x0);
        pcVar9 = "";
        local_30 = (float)dVar10;
        if (3 < *(int *)param_1) {
          pcVar9 = *(char **)(param_1 + 0x414);
        }
        dVar10 = strtod(pcVar9,(char **)0x0);
        pcVar9 = "";
        local_2c = (float)dVar10;
        if (4 < *(int *)param_1) {
          pcVar9 = *(char **)(param_1 + 0x418);
        }
        dVar10 = strtod(pcVar9,(char **)0x0);
        pcVar9 = "";
        local_28 = (float)dVar10;
        if (5 < *(int *)param_1) {
          pcVar9 = *(char **)(param_1 + 0x41c);
        }
        dVar10 = strtod(pcVar9,(char **)0x0);
        local_20 = 0;
        local_24 = (float)dVar10;
        iVar3 = GetWorldEntity();
        if (iVar3 == 0) {
          return 1;
        }
        if (local_30 <= *(float *)(iVar3 + 0x44c)) {
          local_30 = *(float *)(iVar3 + 0x44c);
        }
        if (local_2c <= *(float *)(iVar3 + 0x450)) {
          local_2c = *(float *)(iVar3 + 0x450);
        }
        if (local_34 <= *(float *)(iVar3 + 0x448)) {
          local_34 = *(float *)(iVar3 + 0x448);
        }
        if (*(float *)(iVar3 + 0x454) <= local_34) {
          local_34 = *(float *)(iVar3 + 0x454);
        }
        if (*(float *)(iVar3 + 0x458) <= local_30) {
          local_30 = *(float *)(iVar3 + 0x458);
        }
        if (*(float *)(iVar3 + 0x45c) <= local_2c) {
          local_2c = *(float *)(iVar3 + 0x45c);
        }
        (**(code **)(*(int *)this + 0x66c))(this,&local_34,&local_28);
        return 1;
      }
      iVar7 = (**(code **)(*(int *)this + 0x648))(this);
      iVar3 = *(int *)this;
      if (3 < iVar7) {
        iVar3 = (**(code **)(iVar3 + 0x658))(this,1);
        goto joined_r0x007b88f1;
      }
    }
    iVar3 = (**(code **)(iVar3 + 0x648))(this);
    if (iVar3 != 2) {
      return 1;
    }
    iVar3 = *(int *)this;
LAB_007b8914:
    (**(code **)(iVar3 + 0x67c))(this);
    return 1;
  }
  iVar7 = (**(code **)(*(int *)this + 0x648))(this);
  iVar3 = *(int *)this;
  if (iVar7 == 2) goto LAB_007b8914;
  cVar2 = (**(code **)(iVar3 + 0x680))();
  lVar5 = 6 - (uint)(cVar2 == '\0');
  if ((*(int *)(mp_fadetoblack._28_4_ + 0x30) != 0) &&
     (iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), 1 < iVar3)) {
    return 1;
  }
  if (*(int *)param_1 < 2) {
    iVar3 = (**(code **)(*(int *)this + 0x648))(this);
    iVar3 = iVar3 + 1;
    if (iVar3 <= lVar5) {
      if (3 < iVar3) {
        lVar5 = iVar3;
      }
      goto LAB_007b878a;
    }
  }
  else {
    lVar5 = strtol(*(char **)(param_1 + 0x40c),(char **)0x0,10);
    if (lVar5 - 4U < 3) goto LAB_007b878a;
  }
  lVar5 = 4;
LAB_007b878a:
  iVar3 = (**(code **)(*(int *)this + 0x648))(this);
  piVar1 = engine;
  if (iVar3 < 2) {
    *(long *)(this + 0x1d78) = lVar5;
    (**(code **)(*piVar1 + 0x9c))(piVar1,*(undefined4 *)(this + 0x30),"cl_ideal_spec_mode %d",lVar5)
    ;
    uVar4 = 1;
  }
  else {
    uVar4 = (**(code **)(*(int *)this + 0x644))(this,lVar5);
    if ((char)uVar4 == '\0') {
      return 1;
    }
    (**(code **)(*engine + 0x9c))(engine,*(undefined4 *)(this + 0x30),"cl_ideal_spec_mode %d",lVar5)
    ;
  }
  return uVar4;
}

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)