ent_setang
0x00641780 · 540 bytes · __cdecl
_ZL10ent_setangRK8CCommand
Decompiled
undefined (1 param)
/* ent_setang(CCommand const&) */
void ent_setang(CCommand *param_1)
{
byte *pbVar1;
int *piVar2;
char cVar3;
CBasePlayer *pCVar4;
uint uVar5;
CBaseEntity *this;
char *pcVar6;
byte *pbVar7;
float fVar8;
double dVar9;
float local_28;
float local_24;
float local_20;
if (*(int *)(*(int *)(sv_cheats + 0x1c) + 0x30) == 0) {
return;
}
pCVar4 = (CBasePlayer *)UTIL_GetCommandClient();
if (pCVar4 == (CBasePlayer *)0x0) {
return;
}
cVar3 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4);
if (cVar3 == '\0') {
return;
}
if (*(int *)param_1 < 4) {
ClientPrint(pCVar4,2,"Usage: ent_setang index pitch yaw <optional roll>\n",(char *)0x0,
(char *)0x0,(char *)0x0,(char *)0x0);
return;
}
uVar5 = V_atoi(*(char **)(param_1 + 0x40c));
pbVar1 = *(byte **)(gpGlobals + 0x58);
if (uVar5 < 0x800) {
if (pbVar1 == (byte *)0x0) goto LAB_00641927;
pbVar7 = pbVar1 + uVar5 * 0x10;
if ((pbVar1[uVar5 * 0x10] & 2) != 0) goto LAB_0064191c;
}
else {
if (pbVar1 == (byte *)0x0) goto LAB_00641927;
LAB_0064191c:
pbVar7 = pbVar1;
if ((*pbVar1 & 2) != 0) goto LAB_00641927;
}
piVar2 = *(int **)(pbVar7 + 0xc);
if ((piVar2 != (int *)0x0) &&
(this = (CBaseEntity *)(**(code **)(*piVar2 + 0x18))(piVar2), this != (CBaseEntity *)0x0)) {
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this);
}
pcVar6 = "";
fVar8 = *(float *)(this + 900);
if (2 < *(int *)param_1) {
pcVar6 = *(char **)(param_1 + 0x410);
}
dVar9 = strtod(pcVar6,(char **)0x0);
pcVar6 = "";
local_28 = (float)dVar9;
if (3 < *(int *)param_1) {
pcVar6 = *(char **)(param_1 + 0x414);
}
dVar9 = strtod(pcVar6,(char **)0x0);
local_24 = (float)dVar9;
if (*(int *)param_1 == 5) {
dVar9 = strtod(*(char **)(param_1 + 0x418),(char **)0x0);
fVar8 = (float)dVar9;
}
local_20 = fVar8;
CBaseEntity::SetAbsAngles(this,(QAngle *)&local_28);
return;
}
LAB_00641927:
pcVar6 = (char *)UTIL_VarArgs("ent_setang no entity %d\n",uVar5);
ClientPrint(pCVar4,2,pcVar6,(char *)0x0,(char *)0x0,(char *)0x0,(char *)0x0);
return;
}
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.