ClientActive
0x0096e6e0 · 1815 bytes · __cdecl
_Z12ClientActiveP7edict_tb
Decompiled
undefined (2 params)
/* ClientActive(edict_t*, bool) */
void ClientActive(edict_t *param_1,bool param_2)
{
int *piVar1;
char cVar2;
edict_t *peVar3;
CBasePlayer *this;
int iVar4;
char *pcVar5;
CBasePlayer *pCVar6;
undefined4 uVar7;
undefined4 uVar8;
char *pcVar9;
CBaseEntity *this_00;
int in_GS_OFFSET;
undefined4 uVar10;
undefined4 uVar11;
undefined1 local_dc [12];
int local_d0;
undefined4 local_cc;
undefined4 local_c8;
undefined4 local_c4;
undefined **local_c0;
undefined4 local_bc;
undefined4 local_b8;
char local_a0 [128];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
peVar3 = param_1;
if (((param_1 == (edict_t *)0x0) &&
((peVar3 = *(edict_t **)(gpGlobals + 0x58), peVar3 == (edict_t *)0x0 ||
(((byte)*peVar3 & 2) != 0)))) ||
((piVar1 = *(int **)(peVar3 + 0xc), piVar1 == (int *)0x0 ||
((this = (CBasePlayer *)(**(code **)(*piVar1 + 0x18))(piVar1), this == (CBasePlayer *)0x0 ||
(cVar2 = (**(code **)(*(int *)this + 0x16c))(this), cVar2 == '\0')))))) {
this = (CBasePlayer *)0x0;
iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)0x0);
}
else {
iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
}
if (iVar4 != 0) {
uVar7 = (**(code **)(*(int *)this + 0xb8))(this);
Warning("Second ClientActive on %s\n",uVar7);
goto LAB_0096e9df;
}
cVar2 = CDirector::IsTransitioned(TheDirector);
if (cVar2 != '\0') {
if (param_1 == (edict_t *)0x0) {
iVar4 = 0;
}
else {
iVar4 = (int)param_1 - *(int *)(gpGlobals + 0x58) >> 4;
}
pcVar5 = (char *)(**(code **)(*engine + 0xe0))(engine,iVar4,"name");
V_strncpy(local_a0,pcVar5,0x20);
AllocPooledString((char *)&local_d0);
*(int *)(this + 0x1c90) = local_d0;
}
cVar2 = CDirector::IsTransitioned(TheDirector);
if (cVar2 == '\0') {
LAB_0096ea00:
(**(code **)(*(int *)this + 0x578))(this);
if (this[0x105] != (CBasePlayer)0x0) {
(**(code **)(*(int *)this + 0x224))(this,this + 0x105);
this[0x105] = (CBasePlayer)0x0;
}
if (this[0x1c80] != (CBasePlayer)0x1) {
(**(code **)(*(int *)(this + 0x1c7c) + 4))(this + 0x1c7c,this + 0x1c80);
this[0x1c80] = (CBasePlayer)0x1;
}
if (this[0x104] != (CBasePlayer)0x2) {
(**(code **)(*(int *)this + 0x21c))(this,this + 0x104);
this[0x104] = (CBasePlayer)0x2;
}
CBaseEntity::AddEffects((CBaseEntity *)this,0x20);
(**(code **)(*(int *)this + 0x194))(this,0);
uVar11 = 0;
uVar10 = 0;
uVar7 = 0;
uVar8 = 0;
pCVar6 = this;
CBaseEntity::ThinkSet((_func_void *)local_dc,(float)this,(char *)0x0);
local_cc = vec3_angle;
local_c8 = DAT_01053d40;
local_c4 = DAT_01053d44;
local_c0 = vec3_origin;
local_bc = DAT_01053d4c;
local_b8 = DAT_01053d50;
if (*(int *)(gpGlobals + 0x48) == 3) {
if ((FinishClientPutInServer(CTerrorPlayer*)::pointViewcontrolStr == '\0') &&
(iVar4 = __cxa_guard_acquire(&FinishClientPutInServer(CTerrorPlayer*)::pointViewcontrolStr,
pCVar6,uVar7,uVar8,uVar10,uVar11), iVar4 != 0)) {
DAT_01013348 = 0;
FinishClientPutInServer(CTerrorPlayer*)::pointViewcontrolStr = 0;
DAT_01013344 = "point_viewcontrol";
__cxa_guard_release(&FinishClientPutInServer(CTerrorPlayer*)::pointViewcontrolStr);
__cxa_atexit(CGameString::~CGameString,
&FinishClientPutInServer(CTerrorPlayer*)::pointViewcontrolStr,&__dso_handle);
}
if (((FinishClientPutInServer(CTerrorPlayer*)::pointViewcontrolStr == 0) ||
(iVar4 = FinishClientPutInServer(CTerrorPlayer*)::pointViewcontrolStr,
DAT_01013348 != CGameString::gm_iSerialNumber)) &&
(iVar4 = 0, DAT_01013344 != (char *)0x0)) {
AllocPooledString((char *)&local_d0);
FinishClientPutInServer(CTerrorPlayer*)::pointViewcontrolStr = local_d0;
DAT_01013348 = CGameString::gm_iSerialNumber;
iVar4 = local_d0;
}
this_00 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassnameFast((CGlobalEntityList *)gEntList,0,iVar4);
if (this_00 == (CBaseEntity *)0x0) goto LAB_0096eb12;
if (((byte)this_00[0x14d] & 8) == 0) {
local_c0 = *(undefined ***)(this_00 + 0x2e0);
local_bc = *(undefined4 *)(this_00 + 0x2e4);
local_b8 = *(undefined4 *)(this_00 + 0x2e8);
}
else {
CBaseEntity::CalcAbsolutePosition(this_00);
local_c0 = *(undefined ***)(this_00 + 0x2e0);
local_bc = *(undefined4 *)(this_00 + 0x2e4);
local_b8 = *(undefined4 *)(this_00 + 0x2e8);
if ((*(uint *)(this_00 + 0x14c) & 0x800) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
}
local_cc = *(undefined4 *)(this_00 + 0x37c);
local_c8 = *(undefined4 *)(this_00 + 0x380);
local_c4 = *(undefined4 *)(this_00 + 900);
}
else {
LAB_0096eb12:
GetPlayerSpawnPosition(8,&local_c0,&local_cc,0);
}
(**(code **)(*(int *)this + 0x1dc))(this,&local_c0,&local_cc,&vec3_origin);
CBaseEntity::SetMoveType((CBaseEntity *)this,0,0);
}
else {
if ((this == (CBasePlayer *)0x0) ||
(cVar2 = (**(code **)(*(int *)this + 0x16c))(this), pCVar6 = this, cVar2 == '\0')) {
pCVar6 = (CBasePlayer *)0x0;
}
cVar2 = (**(code **)(*(int *)pCVar6 + 0x8c8))(pCVar6);
if (cVar2 == '\0') goto LAB_0096ea00;
}
*(undefined4 *)(this + 0x23e4) = 0;
CBasePlayer::SetViewEntity(this,(CBaseEntity *)0x0);
cVar2 = CDirector::IsTransitioned(TheDirector);
if (cVar2 == '\0') {
uVar7 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
uVar8 = (**(code **)(*(int *)this + 0xb8))(this);
UTIL_LogPrintf("FinishClientPutInServer %s(%d): looking for bots to take over\n",uVar8,uVar7);
cVar2 = CTerrorPlayer::TakeOverBot((CTerrorPlayer *)this,true);
if (((cVar2 == '\0') && (TheDirector[0x291] != (CDirector)0x0)) &&
(cVar2 = CTerrorGameRules::IsGenericCooperativeMode(), cVar2 != '\0')) {
CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_c0);
local_c0 = &PTR__CSingleUserRecipientFilter_00c08ea8;
/* try { // try from 0096ed6c to 0096ed70 has its CatchHandler @ 0096ee35 */
CRecipientFilter::AddRecipient((CRecipientFilter *)&local_c0,this);
/* try { // try from 0096ed7c to 0096ed85 has its CatchHandler @ 0096ee19 */
UserMessageBegin((IRecipientFilter *)&local_c0,"JoinLateMsg");
MessageEnd();
local_c0 = &PTR__CSingleUserRecipientFilter_00c08ea8;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)&local_c0);
}
}
pcVar5 = (char *)(**(code **)(*(int *)this + 0xb8))(this);
V_strncpy(local_a0,pcVar5,0x80);
pcVar5 = local_a0;
cVar2 = local_a0[0];
if (local_a0[0] == '\0') {
iVar4 = 0;
if (*(int *)(this + 0x30) != 0) {
iVar4 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
pcVar9 = (char *)(**(code **)(*engine + 0xe0))(engine,iVar4,"name");
V_strncpy(local_a0,pcVar9,0x80);
cVar2 = local_a0[0];
}
while (cVar2 != '\0') {
if (cVar2 == '%') {
*pcVar5 = ' ';
}
if (pcVar5 == &DAT_ffffffff) break;
pcVar5 = pcVar5 + 1;
cVar2 = *pcVar5;
}
cVar2 = (**(code **)(*(int *)this + 0x170))(this);
if (((cVar2 != '\0') ||
((iVar4 = V_stristr(local_a0,"Zombie"), iVar4 == 0 &&
(iVar4 = V_stristr(local_a0,"Survivor"), iVar4 == 0)))) &&
((1 < *(int *)(developer._28_4_ + 0x30) ||
(cVar2 = (**(code **)(*(int *)this + 0x170))(this), cVar2 != '\0')))) {
pcVar5 = "<unconnected>";
if (local_a0[0] != '\0') {
pcVar5 = local_a0;
}
UTIL_ClientPrintAll(1,"#Game_connected",pcVar5,(char *)0x0,(char *)0x0,(char *)0x0);
}
LAB_0096e9df:
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.