L L4D2node

Test_RandomChance

0x002198a0 · 124 bytes · __cdecl

_ZL17Test_RandomChanceRK8CCommand

Decompiled

undefined (1 param)

/* Test_RandomChance(CCommand const&) */

void Test_RandomChance(CCommand *param_1)

{
  char *__nptr;
  longdouble lVar1;
  double dVar2;
  
  if (*(int *)param_1 < 3) {
    Error(
         "Test_RandomChance: requires percentage chance parameter (0-100) followed by command to execute."
         );
    __nptr = "";
    if (*(int *)param_1 < 2) goto LAB_002198b5;
  }
  __nptr = *(char **)(param_1 + 0x40c);
LAB_002198b5:
  dVar2 = strtod(__nptr,(char **)0x0);
  lVar1 = (longdouble)RandomFloat(0,0x42c80000);
  if ((float)dVar2 <= (float)lVar1) {
    return;
  }
  Test_RandomChance(param_1);
  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)