L L4D2node

removeid

0x001f08f0 · 967 bytes · __cdecl

_ZL8removeidRK8CCommand

Decompiled

undefined (1 param)

/* removeid(CCommand const&) */

void removeid(CCommand *param_1)

{
  undefined4 *puVar1;
  code *pcVar2;
  int iVar3;
  char *pcVar4;
  undefined1 *puVar5;
  char *pcVar6;
  int iVar7;
  int *piVar8;
  undefined4 uVar9;
  undefined1 *puVar10;
  int in_GS_OFFSET;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  char local_60 [64];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((*(uint *)param_1 & 0xfffffffb) != 2) {
    ConMsg("Usage:  removeid < slot | uniqueid >\n");
    goto LAB_001f0920;
  }
  pcVar6 = *(char **)(param_1 + 0x40c);
  iVar3 = V_strncmp(pcVar6,"#",1);
  if (iVar3 == 0) {
    ConMsg("Usage:  removeid < userid | uniqueid >\n");
    ConMsg("No # necessary\n");
    goto LAB_001f0920;
  }
  if ((byte)(*pcVar6 - 0x30U) < 10) {
    iVar3 = V_atoi(pcVar6);
    if ((iVar3 < 1) || (DAT_003b244c < iVar3)) {
      ConMsg("removeid:  invalid slot %i\n",iVar3);
    }
    else {
      puVar1 = (undefined4 *)(g_UserFilters + (iVar3 + -1) * 0x18);
      local_70 = *puVar1;
      local_6c = puVar1[1];
      local_68 = puVar1[2];
      local_64 = puVar1[3];
      CUtlVector<userfilter_t,CUtlMemory<userfilter_t,int>>::ShiftElementsLeft
                ((CUtlVector<userfilter_t,CUtlMemory<userfilter_t,int>> *)&g_UserFilters,iVar3 + -1,
                 1);
      DAT_003b244c = DAT_003b244c + -1;
      uVar9 = GetUserIDString((USERID_s *)&local_70);
      ConMsg("removeid:  filter removed for %s, ID %s\n",pcVar6,uVar9);
      piVar8 = (int *)(**(code **)(s_GameEventManager + 0x1c))
                                (&s_GameEventManager,"server_removeban",0,0);
      if (piVar8 != (int *)0x0) {
        pcVar2 = *(code **)(*piVar8 + 0x3c);
        uVar9 = GetUserIDString((USERID_s *)&local_70);
        (*pcVar2)(piVar8,"networkid",uVar9);
        (**(code **)(*piVar8 + 0x3c))(piVar8,"ip",&DAT_002c79d4);
        pcVar6 = "Console";
        if (cmd_source != 1) {
          pcVar6 = (char *)(host_client + 0x3c);
        }
        (**(code **)(*piVar8 + 0x3c))(piVar8,"by",pcVar6);
        (**(code **)(s_GameEventManager + 0x20))(&s_GameEventManager,piVar8,0);
      }
    }
    goto LAB_001f0920;
  }
  iVar3 = _V_strlen("STEAM_");
  iVar3 = V_strnicmp(pcVar6,"STEAM_",iVar3);
  if (iVar3 == 0) {
    pcVar4 = "";
    if (2 < *(int *)param_1) {
      pcVar4 = *(char **)(param_1 + 0x410);
    }
    iVar3 = _V_strstr(pcVar4,":");
    if (iVar3 != 0) {
      if (*(int *)param_1 < 6) {
        puVar5 = &DAT_002c79d4;
        if (3 < *(int *)param_1) goto LAB_001f0cce;
        puVar10 = &DAT_002c79d4;
      }
      else {
        puVar5 = *(undefined1 **)(param_1 + 0x41c);
LAB_001f0cce:
        puVar10 = *(undefined1 **)(param_1 + 0x414);
      }
      iVar3 = 0;
      V_snprintf(local_60,0x40,"%s:%s:%s",pcVar6,puVar10,puVar5);
      if (0 < DAT_003b244c) {
        do {
          pcVar6 = (char *)GetUserIDString((USERID_s *)(g_UserFilters + iVar3 * 0x18));
          iVar7 = _V_stricmp(pcVar6,local_60);
          if (iVar7 == 0) {
            CUtlVector<userfilter_t,CUtlMemory<userfilter_t,int>>::ShiftElementsLeft
                      ((CUtlVector<userfilter_t,CUtlMemory<userfilter_t,int>> *)&g_UserFilters,iVar3
                       ,1);
            DAT_003b244c = DAT_003b244c + -1;
            ConMsg("removeid:  filter removed for %s\n",local_60);
            piVar8 = (int *)(**(code **)(s_GameEventManager + 0x1c))
                                      (&s_GameEventManager,"server_removeban",0,0);
            if (piVar8 != (int *)0x0) {
              (**(code **)(*piVar8 + 0x3c))(piVar8,"networkid",local_60);
              (**(code **)(*piVar8 + 0x3c))(piVar8,"ip",&DAT_002c79d4);
              pcVar6 = "Console";
              if (cmd_source != 1) {
                pcVar6 = (char *)(host_client + 0x3c);
              }
              (**(code **)(*piVar8 + 0x3c))(piVar8,"by",pcVar6);
              (**(code **)(s_GameEventManager + 0x20))(&s_GameEventManager,piVar8,0);
            }
            goto LAB_001f0920;
          }
          iVar3 = iVar3 + 1;
        } while (iVar3 < DAT_003b244c);
      }
      ConMsg("removeid:  couldn\'t find %s\n",local_60);
      goto LAB_001f0920;
    }
  }
  ConMsg("removeid:  invalid ban ID \"%s\"\n",pcVar6);
LAB_001f0920:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)