L L4D2node

TextToChannel

0x005989b0 · 166 bytes · __cdecl

_Z13TextToChannelPKc

Decompiled

undefined (1 param)

/* TextToChannel(char const*) */

long TextToChannel(char *param_1)

{
  int iVar1;
  long lVar2;
  int iVar3;
  
  if (param_1 != (char *)0x0) {
    iVar3 = 0;
    iVar1 = V_strncasecmp(param_1,"chan_",5);
    if (iVar1 != 0) {
      lVar2 = strtol(param_1,(char **)0x0,10);
      return lVar2;
    }
    do {
      iVar1 = V_strcasecmp(param_1,(&PTR_s_CHAN_AUTO_00f212e4)[iVar3 * 2]);
      if (iVar1 == 0) {
        return (&g_pChannelNames)[iVar3 * 2];
      }
      iVar3 = iVar3 + 1;
    } while (iVar3 != 7);
    DevMsg("CSoundEmitterSystem:  Warning, unknown channel type in sounds.txt (%s)\n",param_1);
  }
  return 0;
}

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)