L L4D2node

CDirectorItemManager::IsWeaponAllowedToExist

0x008a4aa0 · 194 bytes · __thiscall

_ZN20CDirectorItemManager22IsWeaponAllowedToExistE10CSWeaponIDb

Decompiled

undefined (3 params)

/* CDirectorItemManager::IsWeaponAllowedToExist(CSWeaponID, bool) */

bool __thiscall
CDirectorItemManager::IsWeaponAllowedToExist(undefined4 this,int param_2,char param_3)

{
  char cVar1;
  KeyValues *this_00;
  int iVar2;
  longdouble lVar3;
  
  cVar1 = (**(code **)(*engine + 500))(engine);
  if (cVar1 == '\0') {
    if (param_2 == 0x1c) {
      cVar1 = (**(code **)(*engine + 500))(engine);
      if ((cVar1 != '\0') &&
         (this_00 = (KeyValues *)CTerrorGameRules::GetMissionInfo(), this_00 != (KeyValues *)0x0)) {
        iVar2 = KeyValues::GetInt(this_00,"allow_cola",0);
        return iVar2 != 0;
      }
    }
    else if ((0x1b < param_2) && (param_2 - 0x21U < 4)) {
      cVar1 = AreCSWeaponsAllowed();
      if (cVar1 == '\0') {
        return false;
      }
      if (param_3 == '\0') {
        lVar3 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0,0x3f800000);
        return (float)lVar3 < *(float *)(director_cs_weapon_spawn_chance._28_4_ + 0x2c) ||
               (float)lVar3 == *(float *)(director_cs_weapon_spawn_chance._28_4_ + 0x2c);
      }
    }
  }
  return true;
}

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)