L L4D2node

writeip

0x001ef630 · 335 bytes · __cdecl

_ZL7writeipRK8CCommand

Decompiled

undefined (1 param)

/* writeip(CCommand const&) */

void writeip(CCommand *param_1)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int in_GS_OFFSET;
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  V_strncpy(local_124,"cfg/banned_ip.cfg",0x104);
  ConMsg("Writing %s.\n",local_124);
  iVar2 = (**(code **)(g_pFileSystem[1] + 8))(g_pFileSystem + 1,local_124,&DAT_002a5c80,0);
  if (iVar2 == 0) {
    ConMsg("Couldn\'t open %s\n",local_124);
  }
  else {
    iVar4 = 0;
    if (0 < DAT_003b2460) {
      do {
        while (iVar3 = iVar4 * 0x10 + g_IPFilters, uVar1 = *(uint *)(iVar3 + 4),
              *(float *)(iVar3 + 0xc) != 0.0) {
          iVar4 = iVar4 + 1;
          if (DAT_003b2460 <= iVar4) goto LAB_001ef745;
        }
        iVar4 = iVar4 + 1;
        (**(code **)(*g_pFileSystem + 100))
                  (g_pFileSystem,iVar2,"addip 0 %i.%i.%i.%i\r\n",uVar1 & 0xff,uVar1 >> 8 & 0xff,
                   uVar1 >> 0x10 & 0xff,uVar1 >> 0x18);
      } while (iVar4 < DAT_003b2460);
    }
LAB_001ef745:
    (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar2);
  }
  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)