L L4D2node

GetCharacterFromName

0x0051f560 · 418 bytes · __cdecl

_Z20GetCharacterFromNamePKc

Decompiled

undefined (1 param)

/* GetCharacterFromName(char const*) */

undefined4 GetCharacterFromName(char *param_1)

{
  int iVar1;
  
  iVar1 = _V_stricmp("Coach",param_1);
  if (iVar1 == 0) {
    return 2;
  }
  iVar1 = _V_stricmp("Mechanic",param_1);
  if ((iVar1 == 0) || (iVar1 = _V_stricmp("Ellis",param_1), iVar1 == 0)) {
    return 3;
  }
  iVar1 = _V_stricmp("Gambler",param_1);
  if ((iVar1 == 0) || (iVar1 = _V_stricmp("Nick",param_1), iVar1 == 0)) {
    return 0;
  }
  iVar1 = _V_stricmp("Producer",param_1);
  if ((iVar1 == 0) || (iVar1 = _V_stricmp("Rochelle",param_1), iVar1 == 0)) {
    return 1;
  }
  iVar1 = _V_stricmp("NamVet",param_1);
  if ((iVar1 != 0) && (iVar1 = _V_stricmp("Bill",param_1), iVar1 != 0)) {
    iVar1 = _V_stricmp("TeenGirl",param_1);
    if (((iVar1 == 0) || (iVar1 = _V_stricmp("Zoey",param_1), iVar1 == 0)) ||
       (iVar1 = _V_stricmp("TeenAngst",param_1), iVar1 == 0)) {
      return 5;
    }
    iVar1 = _V_stricmp("Biker",param_1);
    if ((iVar1 == 0) || (iVar1 = _V_stricmp("Francis",param_1), iVar1 == 0)) {
      return 6;
    }
    iVar1 = _V_stricmp("Manager",param_1);
    if ((iVar1 != 0) && (iVar1 = _V_stricmp("Louis",param_1), iVar1 != 0)) {
      return 8;
    }
    return 7;
  }
  return 4;
}

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)