L L4D2node

CBasePlayer::HandleVoteCommands

0x007b8320 · 494 bytes · __thiscall

_ZN11CBasePlayer18HandleVoteCommandsERK8CCommand

Decompiled

undefined (2 params)

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

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

{
  int iVar1;
  undefined4 uVar2;
  char *pcVar3;
  int in_GS_OFFSET;
  char local_50 [64];
  int local_10;
  
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  if (g_voteController == (CVoteController *)0x0) {
LAB_007b8410:
    uVar2 = 0;
  }
  else {
    iVar1 = *(int *)param_1;
    if (iVar1 < 1) {
      pcVar3 = "";
LAB_007b835d:
      iVar1 = _V_stricmp(pcVar3,"Vote");
      if (iVar1 != 0) goto LAB_007b8410;
      iVar1 = *(int *)param_1;
    }
    else {
      pcVar3 = *(char **)(param_1 + 0x408);
      if (pcVar3 != "Vote") goto LAB_007b835d;
    }
    if (1 < iVar1) {
      pcVar3 = *(char **)(param_1 + 0x40c);
      if (*(int *)(this + 0x30) == 0) {
        iVar1 = 0;
      }
      else {
        iVar1 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      uVar2 = CVoteController::TryCastVote(g_voteController,iVar1,pcVar3);
      switch(uVar2) {
      case 0:
        V_snprintf(local_50,0x40,"Voting %s.",pcVar3);
        break;
      case 1:
        V_snprintf(local_50,0x40,"Vote failed: server disabled.");
        break;
      case 2:
        V_snprintf(local_50,0x40,"Vote failed: no active issue.");
        break;
      case 3:
        V_snprintf(local_50,0x40,"Vote failed: team restricted.");
        break;
      case 4:
        V_snprintf(local_50,0x40,"Vote failed: no changing vote.");
        break;
      case 5:
        V_snprintf(local_50,0x40,"Vote failed: already voting %s.",pcVar3);
        break;
      case 6:
        V_snprintf(local_50,0x40,"Vote failed: voting closed.");
        break;
      default:
        V_snprintf(local_50,0x40,"Vote failed: system error.");
      }
      DevMsg("%s",local_50);
    }
    uVar2 = 1;
  }
  if (local_10 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return uVar2;
}

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)