L L4D2node

CBaseServerVehicle::FindOrCreatePassengerRole

0x00b3bce0 · 185 bytes · __thiscall

_ZN18CBaseServerVehicle25FindOrCreatePassengerRoleE8string_tPi

Decompiled

undefined (3 params)

/* CBaseServerVehicle::FindOrCreatePassengerRole(string_t, int*) */

int __thiscall
CBaseServerVehicle::FindOrCreatePassengerRole(CBaseServerVehicle *this,char *param_2,int *param_3)

{
  char *pcVar1;
  int iVar2;
  char *pcVar3;
  int iVar4;
  int local_20;
  
  iVar2 = *(int *)(this + 0x24);
  if (0 < iVar2) {
    local_20 = 0;
    pcVar3 = "";
    if (param_2 != (char *)0x0) {
      pcVar3 = param_2;
    }
    iVar4 = 0;
    do {
      pcVar1 = *(char **)(*(int *)(this + 0x18) + iVar4);
      if (pcVar1 == (char *)0x0) {
        pcVar1 = "";
      }
      if ((pcVar3 == pcVar1) || (iVar2 = _V_stricmp(pcVar1,pcVar3), iVar2 == 0)) {
        if (param_3 != (int *)0x0) {
          *param_3 = local_20;
        }
        return *(int *)(this + 0x18) + iVar4;
      }
      local_20 = local_20 + 1;
      iVar4 = iVar4 + 0x18;
      iVar2 = *(int *)(this + 0x24);
    } while (local_20 < iVar2);
  }
  iVar2 = CUtlVector<CPassengerRole,CUtlMemory<CPassengerRole,int>>::InsertBefore
                    ((CUtlVector<CPassengerRole,CUtlMemory<CPassengerRole,int>> *)(this + 0x18),
                     iVar2);
  *(char **)(*(int *)(this + 0x18) + iVar2 * 0x18) = param_2;
  if (param_3 != (int *)0x0) {
    *param_3 = iVar2;
  }
  return *(int *)(this + 0x18) + iVar2 * 0x18;
}

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)