CVoteController::TryCastVote
0x00b40a60 · 788 bytes · __thiscall
_ZN15CVoteController11TryCastVoteEiPKc
Decompiled
undefined (3 params)
/* CVoteController::TryCastVote(int, char const*) */
undefined4 __thiscall CVoteController::TryCastVote(CVoteController *this,int param_1,char *param_2)
{
char cVar1;
int iVar2;
int *piVar3;
CBasePlayer *pCVar4;
CBaseEntity *this_00;
int iVar5;
int iVar6;
undefined **local_2c [8];
if (*(int *)(sv_allow_votes._28_4_ + 0x30) == 0) {
return 1;
}
if (0x20 < param_1) {
return 7;
}
if (*(int *)(this + 0x440) == -1) {
return 2;
}
if (*(float *)(this + 0x468) <= 0.0) {
piVar3 = *(int **)(*(int *)(this + 0x540) + *(int *)(this + 0x440) * 4);
cVar1 = (**(code **)(*piVar3 + 0x24))(piVar3);
if (cVar1 != '\0') {
this_00 = (CBaseEntity *)UTIL_EntityByIndex(param_1);
if (this_00 == (CBaseEntity *)0x0) {
return 3;
}
iVar2 = *(int *)(this + 0x53c);
iVar5 = CBaseEntity::GetTeamNumber(this_00);
iVar6 = 2;
if (iVar5 != 1) {
iVar6 = iVar5;
}
if (iVar2 != iVar6) {
return 3;
}
}
if (*(int *)(this + param_1 * 4 + 0x4b8) != 2) {
return 4;
}
if ((param_2 == "Yes") || (iVar2 = _V_stricmp(param_2,"Yes"), iVar2 == 0)) {
piVar3 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"vote_cast_yes",0,0);
if (piVar3 != (int *)0x0) {
(**(code **)(*piVar3 + 0x30))(piVar3,"team",*(undefined4 *)(this + 0x444));
(**(code **)(*piVar3 + 0x30))(piVar3,"entityid",param_1);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar3,0);
}
*(undefined4 *)(this + param_1 * 4 + 0x4b8) = 0;
iVar2 = *(int *)(this + 0x448);
CServerNetworkProperty::NetworkStateChanged((short)this + 0x24);
*(int *)(this + 0x448) = iVar2 + 1;
CheckForEarlyVoteClose(this);
pCVar4 = (CBasePlayer *)UTIL_PlayerByIndex(param_1);
CSingleUserRecipientFilter::CSingleUserRecipientFilter
((CSingleUserRecipientFilter *)local_2c,pCVar4);
/* try { // try from 00b40d61 to 00b40d86 has its CatchHandler @ 00b40da5 */
CRecipientFilter::MakeReliable((CRecipientFilter *)local_2c);
UserMessageBegin((IRecipientFilter *)local_2c,"VoteRegistered");
MessageWriteByte(1);
MessageEnd();
}
else {
if ((param_2 != "No") && (iVar2 = _V_stricmp(param_2,"No"), iVar2 != 0)) {
return 7;
}
piVar3 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"vote_cast_no",0,0);
if (piVar3 != (int *)0x0) {
(**(code **)(*piVar3 + 0x30))(piVar3,"team",*(undefined4 *)(this + 0x444));
(**(code **)(*piVar3 + 0x30))(piVar3,"entityid",param_1);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar3,0);
}
*(undefined4 *)(this + param_1 * 4 + 0x4b8) = 1;
iVar2 = *(int *)(this + 0x44c);
CServerNetworkProperty::NetworkStateChanged((short)this + 0x24);
*(int *)(this + 0x44c) = iVar2 + 1;
CheckForEarlyVoteClose(this);
pCVar4 = (CBasePlayer *)UTIL_PlayerByIndex(param_1);
CSingleUserRecipientFilter::CSingleUserRecipientFilter
((CSingleUserRecipientFilter *)local_2c,pCVar4);
/* try { // try from 00b40bfc to 00b40c21 has its CatchHandler @ 00b40d8c */
CRecipientFilter::MakeReliable((CRecipientFilter *)local_2c);
UserMessageBegin((IRecipientFilter *)local_2c,"VoteRegistered");
MessageWriteByte(0);
MessageEnd();
}
local_2c[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_2c);
return 0;
}
return 6;
}
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.