Host_Say
0x00642120 · 2124 bytes · __cdecl
_Z8Host_SayP7edict_tRK8CCommandb
Decompiled
undefined (3 params)
/* Host_Say(edict_t*, CCommand const&, bool) */
void Host_Say(edict_t *param_1,CCommand *param_2,bool param_3)
{
char cVar1;
int iVar2;
CBasePlayer *this;
char *pcVar3;
CCommand *pCVar4;
uint uVar5;
uint uVar6;
size_t sVar7;
int iVar8;
CVoiceGameMgr *this_00;
CBasePlayer *pCVar9;
undefined4 uVar10;
int *piVar11;
uint *puVar12;
uint *puVar13;
int in_GS_OFFSET;
char *local_36c;
char *local_368;
char *local_364;
uint *local_360;
CCommand *local_35c;
undefined **local_340 [8];
uint local_320 [63];
CCommand aCStack_222 [258];
undefined1 local_120 [256];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (*(int *)param_2 < 1) {
if (*(int *)param_2 == 0) goto LAB_006421e8;
pcVar3 = "";
}
else {
pcVar3 = *(char **)(param_2 + 0x408);
}
iVar2 = _V_stricmp(pcVar3,"say");
if ((iVar2 == 0) || (iVar2 = _V_stricmp(pcVar3,"say_team"), iVar2 == 0)) {
if (*(int *)param_2 < 2) goto LAB_006421e8;
local_35c = param_2 + *(int *)(param_2 + 4) + 8;
if (*(int *)(param_2 + 4) == 0) {
local_35c = (CCommand *)&DAT_00d539c2;
}
}
else if (*(int *)param_2 < 2) {
local_35c = aCStack_222 + 2;
V_snprintf((char *)local_35c,0x100,"%s",pcVar3);
}
else {
pCVar4 = (CCommand *)&DAT_00d539c2;
if (*(int *)(param_2 + 4) != 0) {
pCVar4 = param_2 + *(int *)(param_2 + 4) + 8;
}
local_35c = aCStack_222 + 2;
V_snprintf((char *)local_35c,0x100,"%s %s",pcVar3,pCVar4);
}
if (param_1 == (edict_t *)0x0) {
this = (CBasePlayer *)0x0;
}
else {
piVar11 = *(int **)(param_1 + 0xc);
if (piVar11 == (int *)0x0) {
this = (CBasePlayer *)0x0;
}
else {
this = (CBasePlayer *)(**(code **)(*piVar11 + 0x18))(piVar11);
}
pcVar3 = (char *)CheckChatText(this,(char *)local_35c);
if ((pcVar3 == (char *)0x0) ||
(cVar1 = (**(code **)(*(int *)this + 0x728))(this), cVar1 == '\0')) goto LAB_006421e8;
(**(code **)(*(int *)this + 0x730))(this,pcVar3,0x7f);
local_35c = (CCommand *)CheckChatText(this,pcVar3);
if (local_35c == (CCommand *)0x0) goto LAB_006421e8;
}
if (g_pGameRules == (int *)0x0) {
local_368 = (char *)0x0;
pcVar3 = (char *)0x0;
local_36c = (char *)0x0;
}
else {
local_36c = (char *)(**(code **)(*g_pGameRules + 0x1f0))(g_pGameRules,param_3,this);
pcVar3 = (char *)(**(code **)(*g_pGameRules + 0x1e8))(g_pGameRules,param_3,this);
local_368 = (char *)(**(code **)(*g_pGameRules + 0x1ec))(g_pGameRules,param_3,this);
}
local_364 = "Console";
if (this != (CBasePlayer *)0x0) {
local_364 = (char *)(**(code **)(*(int *)this + 0xb8))(this);
}
if ((pcVar3 == (char *)0x0) || (*pcVar3 == '\0')) {
V_snprintf((char *)local_320,0x100,"%s: ",local_364);
}
else if ((local_368 == (char *)0x0) || (*local_368 == '\0')) {
V_snprintf((char *)local_320,0x100,"%s %s: ",pcVar3,local_364);
}
else {
V_snprintf((char *)local_320,0x100,"%s %s @ %s: ",pcVar3,local_364,local_368);
}
local_360 = local_320;
puVar13 = local_360;
do {
puVar12 = puVar13;
uVar5 = *puVar12 + 0xfefefeff & ~*puVar12;
uVar6 = uVar5 & 0x80808080;
puVar13 = puVar12 + 1;
} while (uVar6 == 0);
if ((uVar5 & 0x8080) == 0) {
puVar13 = (uint *)((int)puVar12 + 6);
uVar6 = uVar6 >> 0x10;
}
sVar7 = strlen((char *)local_35c);
if ((int)(aCStack_222 + -((int)puVar13 + (-3 - (uint)CARRY1((byte)uVar6,(byte)uVar6)))) <
(int)sVar7) {
local_35c[(int)(aCStack_222 + -((int)puVar13 + (-3 - (uint)CARRY1((byte)uVar6,(byte)uVar6))))] =
(CCommand)0x0;
}
V_strncat((char *)local_360,(char *)local_35c,0x100,-1);
V_strncat((char *)local_360,"\n",0x100,-1);
cVar1 = CDirectorChallengeMode::ScriptInterceptChat
(*(CDirectorChallengeMode **)(TheDirector + 0x648),(CBaseEntity *)this,
(char *)local_360);
if ((cVar1 != '\0') && (0 < *(int *)(gpGlobals + 0x14))) {
iVar2 = 1;
do {
pCVar9 = (CBasePlayer *)UTIL_PlayerByIndex(iVar2);
if ((((pCVar9 != (CBasePlayer *)0x0) &&
(cVar1 = (**(code **)(*(int *)pCVar9 + 0x16c))(pCVar9), cVar1 != '\0')) &&
(*(edict_t **)(pCVar9 + 0x30) != (edict_t *)0x0)) &&
(((param_1 != *(edict_t **)(pCVar9 + 0x30) &&
(cVar1 = (**(code **)(*(int *)pCVar9 + 0x170))(pCVar9), cVar1 != '\0')) &&
((!param_3 ||
(cVar1 = (**(code **)(*g_pGameRules + 0x1a8))(g_pGameRules,pCVar9,this), cVar1 != '\0')))
))) {
if (this != (CBasePlayer *)0x0) {
cVar1 = (**(code **)(*(int *)pCVar9 + 0x724))(pCVar9,this);
if (cVar1 == '\0') goto LAB_00642528;
iVar8 = GetVoiceGameMgr();
if (iVar8 != 0) {
if (*(int *)(this + 0x30) == 0) {
iVar8 = 0;
}
else {
iVar8 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
this_00 = (CVoiceGameMgr *)GetVoiceGameMgr();
cVar1 = CVoiceGameMgr::IsPlayerIgnoringPlayer(this_00,iVar8,iVar2);
if (cVar1 != '\0') goto LAB_00642528;
}
}
CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_340);
local_340[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
/* try { // try from 006424a8 to 006424ac has its CatchHandler @ 006429c6 */
CRecipientFilter::AddRecipient((CRecipientFilter *)local_340,pCVar9);
/* try { // try from 006424b6 to 0064250c has its CatchHandler @ 006429a4 */
CRecipientFilter::MakeReliable((CRecipientFilter *)local_340);
if (local_36c == (char *)0x0) {
/* try { // try from 00642995 to 00642999 has its CatchHandler @ 006429a4 */
UTIL_SayTextFilter((IRecipientFilter *)local_340,(char *)local_360,this,true);
}
else {
UTIL_SayText2Filter((IRecipientFilter *)local_340,this,true,local_36c,local_364,
(char *)local_35c,local_368,(char *)0x0);
}
local_340[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_340);
}
LAB_00642528:
iVar2 = iVar2 + 1;
} while (iVar2 <= *(int *)(gpGlobals + 0x14));
}
if (this != (CBasePlayer *)0x0) {
CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_340);
local_340[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
/* try { // try from 006425d7 to 006425db has its CatchHandler @ 006429e6 */
CRecipientFilter::AddRecipient((CRecipientFilter *)local_340,this);
/* try { // try from 006425df to 0064262f has its CatchHandler @ 006429ca */
CRecipientFilter::MakeReliable((CRecipientFilter *)local_340);
if (local_36c == (char *)0x0) {
/* try { // try from 0064292a to 0064292e has its CatchHandler @ 006429ca */
UTIL_SayTextFilter((IRecipientFilter *)local_340,(char *)local_360,this,true);
}
else {
UTIL_SayText2Filter((IRecipientFilter *)local_340,this,true,local_36c,local_364,
(char *)local_35c,local_368,(char *)0x0);
}
local_340[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_340);
}
cVar1 = (**(code **)(*engine + 8))(engine);
if (cVar1 != '\0') {
Msg("%s",local_360);
}
if (this == (CBasePlayer *)0x0) {
if (param_3) {
uVar10 = 0;
UTIL_LogPrintf("\"Console<0>\" say_team \"%s\"\n",local_35c);
}
else {
uVar10 = 0;
UTIL_LogPrintf("\"Console<0>\" say \"%s\"\n",local_35c);
}
}
else {
uVar10 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
CBasePlayer::GetNetworkIDString(this);
(**(code **)(*(int *)this + 0xb8))(this);
piVar11 = (int *)CBaseEntity::GetTeam((CBaseEntity *)this);
if (piVar11 != (int *)0x0) {
(**(code **)(*piVar11 + 0x32c))(piVar11);
}
piVar11 = (int *)TheLog();
(**(code **)(*piVar11 + 0x14))(piVar11,this,local_120,0x100);
if (param_3) {
UTIL_LogPrintf("%s say_team \"%s\"\n",local_120,local_35c);
}
else {
UTIL_LogPrintf("%s say \"%s\"\n",local_120,local_35c);
}
cVar1 = (**(code **)(*(int *)this + 0x16c))(this);
if (cVar1 != '\0') {
*(undefined4 *)(this + 0x2400) = *(undefined4 *)(gpGlobals + 0xc);
}
}
piVar11 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"player_say",0,0);
if (piVar11 != (int *)0x0) {
(**(code **)(*piVar11 + 0x30))(piVar11,"userid",uVar10);
(**(code **)(*piVar11 + 0x3c))(piVar11,"text",local_35c);
(**(code **)(*piVar11 + 0x30))(piVar11,"priority",1);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar11,0);
}
LAB_006421e8:
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.