CTerrorPlayer::HandleCommand_JoinTeam
0x009c9b80 · 1117 bytes · __thiscall
_ZN13CTerrorPlayer22HandleCommand_JoinTeamEi21SurvivorCharacterTypeb
Decompiled
undefined (4 params)
/* CTerrorPlayer::HandleCommand_JoinTeam(int, SurvivorCharacterType, bool) */
undefined4 __thiscall
CTerrorPlayer::HandleCommand_JoinTeam(CTerrorPlayer *this,int param_1,int param_3,char param_4)
{
code *pcVar1;
CBaseEdict *this_00;
char cVar2;
int iVar3;
int iVar4;
undefined4 *puVar5;
CTerrorPlayer local_21;
puVar5 = (undefined4 *)&stack0xffffffb4;
iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
if (iVar3 == param_1) {
return 1;
}
iVar3 = GetGlobalTeam(param_1);
if (iVar3 == 0) {
Warning();
return 0;
}
if ((param_1 == 4) && (cVar2 = (**(code **)(*(int *)this + 0x778))(), cVar2 == '\0')) {
return 0;
}
if (*(char *)(TheNavMesh + 0x60c) == '\0') {
ClientPrint((CBasePlayer *)this,4,"ERROR: FLOW IS BROKEN - DIRECTOR CANNOT POPULATE WORLD",
(char *)0x0,(char *)0x0,(char *)0x0,(char *)0x0);
ClientPrint((CBasePlayer *)this,3,"ERROR: FLOW IS BROKEN - DIRECTOR CANNOT POPULATE WORLD",
(char *)0x0,(char *)0x0,(char *)0x0,(char *)0x0);
}
(**(code **)(*(int *)this + 0x534))();
local_21 = (CTerrorPlayer)0x0;
if ((1 < param_1 - 2U) || (param_4 != '\0')) goto LAB_009c9be8;
if (*(int *)(ZombieRestrictTeamChange._28_4_ + 0x30) != 0) {
param_1 = 2;
cVar2 = CDirector::IsTeamFull();
if (cVar2 != '\0') {
param_1 = 1;
cVar2 = CDirector::IsTeamFull();
local_21 = (CTerrorPlayer)0x1;
if (cVar2 == '\0') {
param_1 = 3;
(**(code **)(*(int *)this + 0x8e0))();
ResetClassSpawnSystem(this);
local_21 = (CTerrorPlayer)0x0;
*(undefined4 *)(this + 0x2d48) = 0;
}
}
goto LAB_009c9be8;
}
if ((param_3 == 8) || (cVar2 = (**(code **)(*(int *)this + 0x778))(), cVar2 != '\0')) {
if (param_1 == 2) {
cVar2 = CDirector::IsTeamFull();
if (cVar2 != '\0') {
LAB_009c9fa8:
param_1 = 3;
(**(code **)(*(int *)this + 0x778))();
}
}
else {
(**(code **)(*(int *)this + 0x778))();
cVar2 = CDirector::IsTeamFull();
if (cVar2 == '\0') goto LAB_009c9fa8;
param_1 = 2;
}
cVar2 = CDirector::IsTeamFull();
local_21 = (CTerrorPlayer)0x0;
if (cVar2 != '\0') {
param_1 = 1;
iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
local_21 = (CTerrorPlayer)0x1;
if (iVar3 == 0) goto LAB_009c9be8;
param_1 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
local_21 = (CTerrorPlayer)(param_1 == 1);
}
}
else {
cVar2 = CDirector::IsTeamFull();
if (cVar2 != '\0') {
return 0;
}
}
if ((param_1 == 3) && (iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar3 != 3)) {
cVar2 = (**(code **)(*(int *)this + 300))();
if (cVar2 != '\0') {
this[0x3375] = (CTerrorPlayer)0x1;
this[0x3376] = (CTerrorPlayer)0x1;
}
ResetClassSpawnSystem(this);
*(undefined4 *)(this + 0x2d48) = 0;
}
LAB_009c9be8:
*(int *)(this + 0x2eac) = param_3;
if ((param_3 == 8) || (iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), param_1 != iVar3))
{
iVar3 = (**(code **)(*(int *)this + 0x194))();
cVar2 = IsASurvivorTeam(iVar3);
if (cVar2 != '\0') {
iVar3 = ChooseSurvivorCharacter();
if (iVar3 + 1 != *(int *)(this + 0x290c)) {
if (this[0x6c] == (CTerrorPlayer)0x0) {
this_00 = *(CBaseEdict **)(this + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar4 + 2) = 0;
}
}
else {
this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
}
*(int *)(this + 0x290c) = iVar3 + 1;
}
GetSurvivorModelName();
(**(code **)(*(int *)this + 0x20))();
puVar5 = (undefined4 *)&stack0xffffffb0;
(**(code **)(*(int *)this + 0xb8))();
UTIL_LogPrintf("(SKIN) Survivor %s changed model from %s to %s via HandleCommand_JoinTeam\n");
(**(code **)(*(int *)this + 0x70))();
(**(code **)(*(int *)this + 0x920))();
}
this[0x3ab0] = local_21;
iVar3 = *(int *)this;
puVar5[3] = 0;
puVar5[2] = 0;
puVar5[1] = "takeover_survivor_bar";
*puVar5 = this;
pcVar1 = *(code **)(iVar3 + 0x580);
puVar5[-1] = 0x9c9c4e;
(*pcVar1)();
*puVar5 = this;
puVar5[-1] = 0x9c9c56;
UpdateTeamDesired((CTerrorPlayer *)*puVar5);
}
return 1;
}
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.