ClientCommand
0x006440d0 · 1213 bytes · __cdecl
_Z13ClientCommandP11CBasePlayerRK8CCommand
Decompiled
undefined (2 params)
/* ClientCommand(CBasePlayer*, CCommand const&) */
void ClientCommand(CBasePlayer *param_1,CCommand *param_2)
{
int *piVar1;
char cVar2;
int iVar3;
undefined4 uVar4;
QAngle *pQVar5;
Vector *pVVar6;
CBaseEntity *pCVar7;
CBaseEntity *pCVar8;
char *pcVar9;
int in_GS_OFFSET;
char *local_144;
char *local_140;
color32_s local_130;
undefined1 local_12f;
undefined1 local_12e;
undefined1 local_12d;
undefined **local_12c;
undefined1 local_128;
undefined1 local_127;
undefined4 local_24;
int local_20;
piVar1 = mdlcache;
pcVar9 = "";
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (0 < *(int *)param_2) {
pcVar9 = *(char **)(param_2 + 0x408);
}
if (param_1 == (CBasePlayer *)0x0) goto LAB_00644198;
(**(code **)(*mdlcache + 0x68))(mdlcache);
/* try { // try from 0064412e to 00644189 has its CatchHandler @ 006445ae */
if ((pcVar9 == "killtarget") || (iVar3 = _V_stricmp(pcVar9,"killtarget"), iVar3 == 0)) {
if ((*(int *)(*(int *)(g_pDeveloper + 0x1c) + 0x30) != 0) &&
((*(int *)(*(int *)(sv_cheats + 0x1c) + 0x30) != 0 &&
(cVar2 = UTIL_IsCommandIssuedByServerAdmin(), cVar2 != '\0')))) {
pcVar9 = "";
if (1 < *(int *)param_2) {
pcVar9 = *(char **)(param_2 + 0x40c);
}
ConsoleKillTarget(param_1,pcVar9);
}
}
else {
/* try { // try from 006441cf to 00644599 has its CatchHandler @ 006445ae */
if ((pcVar9 == "demorestart") || (iVar3 = _V_stricmp(pcVar9,"demorestart"), iVar3 == 0)) {
(**(code **)(*(int *)param_1 + 0x714))(param_1);
}
else if ((pcVar9 == "fade") || (iVar3 = _V_stricmp(pcVar9,"fade"), iVar3 == 0)) {
local_130 = (color32_s)0x20;
local_12f = 0x3f;
local_12e = 100;
local_12d = 200;
UTIL_ScreenFade((CBaseEntity *)param_1,&local_130,3.0,3.0,2);
}
else if ((pcVar9 == "te") || (iVar3 = _V_stricmp(pcVar9,"te"), iVar3 == 0)) {
if ((*(int *)(*(int *)(sv_cheats + 0x1c) + 0x30) != 0) &&
(cVar2 = UTIL_IsCommandIssuedByServerAdmin(), cVar2 != '\0')) {
if (*(int *)param_2 < 2) {
pcVar9 = "";
LAB_00644426:
iVar3 = _V_stricmp(pcVar9,"stop");
if (iVar3 != 0) {
if (*(int *)param_2 < 3) {
local_144 = "";
if (*(int *)param_2 == 2) goto LAB_0064453f;
local_140 = "";
}
else {
local_144 = *(char **)(param_2 + 0x410);
LAB_0064453f:
local_140 = *(char **)(param_2 + 0x40c);
}
pQVar5 = (QAngle *)(**(code **)(*(int *)param_1 + 0x238))(param_1);
pVVar6 = (Vector *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
CTempEntTester::Create(pVVar6,pQVar5,local_140,local_144);
goto LAB_00644190;
}
}
else {
pcVar9 = *(char **)(param_2 + 0x40c);
if (pcVar9 != "stop") goto LAB_00644426;
}
pCVar7 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,"te_tester");
while (pCVar7 != (CBaseEntity *)0x0) {
pCVar8 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,pCVar7,"te_tester");
UTIL_Remove(pCVar7);
pCVar7 = pCVar8;
}
}
}
else if ((pcVar9 == "bugpause") || (iVar3 = _V_stricmp(pcVar9,"bugpause"), iVar3 == 0)) {
local_128 = 1;
local_12c = &PTR_InitQuietTruncation_00c08ee8;
local_127 = 0;
local_24 = 0;
uVar4 = (**(code **)(*(int *)param_1 + 0xb8))(param_1);
pcVar9 = (char *)CFmtStrN<256>::sprintf
((CFmtStrN<256> *)&local_12c,"BUG REPORTER ACTIVATED BY: %s\n",
uVar4);
UTIL_ClientPrintAll(3,pcVar9,(char *)0x0,(char *)0x0,(char *)0x0,(char *)0x0);
(**(code **)(*engine + 0x1fc))(engine,1,1);
}
else if ((pcVar9 == "bugunpause") || (iVar3 = _V_stricmp(pcVar9,"bugunpause"), iVar3 == 0)) {
(**(code **)(*engine + 0x1fc))(engine,0,1);
}
else {
cVar2 = (**(code **)(*g_pGameRules + 300))(g_pGameRules,param_1,param_2);
if (cVar2 == '\0') {
iVar3 = _V_strlen(pcVar9);
if (iVar3 < 0x81) {
pcVar9 = (char *)UTIL_VarArgs("Unknown command: %s\n",pcVar9);
ClientPrint(param_1,2,pcVar9,(char *)0x0,(char *)0x0,(char *)0x0,(char *)0x0);
}
else {
ClientPrint(param_1,2,"Console command too long.\n",(char *)0x0,(char *)0x0,(char *)0x0,
(char *)0x0);
}
}
}
}
LAB_00644190:
(**(code **)(*piVar1 + 0x6c))(piVar1);
LAB_00644198:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.