CVoteController::TryCreateVote
0x00b40dc0 · 1718 bytes · __thiscall
_ZN15CVoteController13TryCreateVoteEiPKcS1_
Decompiled
undefined (4 params)
/* CVoteController::TryCreateVote(int, char const*, char const*) */
undefined4 __thiscall
CVoteController::TryCreateVote(CVoteController *this,int param_1,char *param_2,char *param_3)
{
float fVar1;
int *piVar2;
CBaseEdict *pCVar3;
undefined4 uVar4;
char cVar5;
CBaseEntity *this_00;
int iVar6;
int iVar7;
char *pcVar8;
int *piVar9;
undefined **ppuVar10;
undefined4 uVar11;
int in_GS_OFFSET;
longdouble lVar12;
int local_234;
undefined **local_220;
undefined4 local_21c;
char local_200 [64];
char local_1c0 [64];
undefined1 local_180 [96];
undefined1 local_120 [256];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if ((((*(int *)(sv_allow_votes._28_4_ + 0x30) != 0) && (*(int *)(this + 0x440) == -1)) &&
(this_00 = (CBaseEntity *)UTIL_PlayerByIndex(param_1), this_00 != (CBaseEntity *)0x0)) &&
((iVar6 = CBaseEntity::GetTeamNumber(this_00), iVar6 != 0 && (*(int *)(this + 0x554) == 0)))) {
cVar5 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
if (cVar5 == '\0') {
ppuVar10 = (undefined **)0x0;
}
else {
local_220 = (undefined **)0x0;
local_21c = 0;
cVar5 = CBaseMultiplayerPlayer::GetSteamID
((CBaseMultiplayerPlayer *)this_00,(CSteamID *)&local_220);
ppuVar10 = (undefined **)0x0;
if (cVar5 != '\0') {
ppuVar10 = local_220;
}
}
uVar11 = SteamUserCanCallVote(this,(int)ppuVar10);
uVar4 = sv_vote_show_caller._28_4_;
if ((char)uVar11 == '\0') {
SendVoteFailedMessage(this,this_00,2);
goto LAB_00b40dfd;
}
*(undefined ***)(this + 0x558) = ppuVar10;
if (*(int *)(uVar4 + 0x30) == 0) {
local_200[0] = '\0';
}
else {
pcVar8 = (char *)(**(code **)(*(int *)this_00 + 0xb8))(this_00);
V_strncpy(local_200,pcVar8,0x40);
}
if (0 < *(int *)(this + 0x54c)) {
local_234 = 0;
piVar2 = (int *)**(undefined4 **)(this + 0x540);
while ((piVar2 + 1 != (int *)param_2 &&
(iVar6 = _V_stricmp(param_2,(char *)(piVar2 + 1)), iVar6 != 0))) {
local_234 = local_234 + 1;
if (*(int *)(this + 0x54c) <= local_234) goto LAB_00b40dfb;
piVar2 = *(int **)(*(int *)(this + 0x540) + local_234 * 4);
}
local_180[0] = 0;
uVar11 = (**(code **)(*piVar2 + 0x20))(piVar2,param_1,param_3,local_180);
if ((char)uVar11 != '\0') {
if (*(int *)(this + 0x448) != 0) {
if (this[0x6c] == (CVoteController)0x0) {
pCVar3 = *(CBaseEdict **)(this + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CVoteController)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x448) = 0;
}
if (*(int *)(this + 0x44c) != 0) {
if (this[0x6c] == (CVoteController)0x0) {
pCVar3 = *(CBaseEdict **)(this + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CVoteController)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x44c) = 0;
}
if (local_234 != *(int *)(this + 0x440)) {
if (this[0x6c] == (CVoteController)0x0) {
pCVar3 = *(CBaseEdict **)(this + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CVoteController)((byte)this[0x70] | 1);
}
*(int *)(this + 0x440) = local_234;
}
(**(code **)(*piVar2 + 0xc))(piVar2,param_3);
*(int *)(this + 0x538) = param_1;
iVar6 = CBaseEntity::GetTeamNumber(this_00);
if (iVar6 == 1) {
iVar6 = 2;
}
*(int *)(this + 0x53c) = iVar6;
cVar5 = (**(code **)(*piVar2 + 0x24))(piVar2);
if (cVar5 == '\0') {
if (*(int *)(this + 0x444) != -1) {
if (this[0x6c] == (CVoteController)0x0) {
pCVar3 = *(CBaseEdict **)(this + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CVoteController)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x444) = 0xffffffff;
}
}
else {
iVar7 = CBaseEntity::GetTeamNumber(this_00);
iVar6 = 2;
if (iVar7 != 1) {
iVar6 = iVar7;
}
if (iVar6 != *(int *)(this + 0x444)) {
if (this[0x6c] == (CVoteController)0x0) {
pCVar3 = *(CBaseEdict **)(this + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CVoteController)((byte)this[0x70] | 1);
}
*(int *)(this + 0x444) = iVar6;
}
}
iVar6 = (**(code **)(*piVar2 + 0x38))(piVar2);
if (iVar6 != *(int *)(this + 0x450)) {
if (this[0x6c] == (CVoteController)0x0) {
pCVar3 = *(CBaseEdict **)(this + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CVoteController)((byte)this[0x70] | 1);
}
*(int *)(this + 0x450) = iVar6;
}
fVar1 = *(float *)(sv_vote_timer_duration._28_4_ + 0x2c);
lVar12 = (longdouble)CountdownTimer::Now();
if ((float)lVar12 + fVar1 != *(float *)(this + 0x45c)) {
(**(code **)(*(int *)(this + 0x454) + 4))(this + 0x454,this + 0x45c);
*(float *)(this + 0x45c) = (float)lVar12 + fVar1;
}
if (fVar1 != *(float *)(this + 0x458)) {
(**(code **)(*(int *)(this + 0x454) + 4))(this + 0x454,this + 0x458);
*(float *)(this + 0x458) = fVar1;
}
CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_220);
local_220 = &PTR__CBroadcastRecipientFilter_00c09928;
/* try { // try from 00b4118f to 00b41193 has its CatchHandler @ 00b414a8 */
CRecipientFilter::AddAllPlayers((CRecipientFilter *)&local_220);
/* try { // try from 00b4119d to 00b412ad has its CatchHandler @ 00b41486 */
CRecipientFilter::MakeReliable((CRecipientFilter *)&local_220);
pcVar8 = (char *)(**(code **)(*piVar2 + 8))(piVar2);
V_strncpy(local_1c0,pcVar8,0x40);
UserMessageBegin((IRecipientFilter *)&local_220,"VoteStart");
MessageWriteByte(*(int *)(this + 0x444));
MessageWriteByte(*(int *)(this + 0x538));
pcVar8 = (char *)(**(code **)(*piVar2 + 0x28))(piVar2);
MessageWriteString(pcVar8);
MessageWriteString(local_1c0);
MessageWriteString(local_200);
MessageEnd();
piVar9 = (int *)TheLog();
(**(code **)(*piVar9 + 0x14))(piVar9,this_00,local_120,0x100);
if ((param_3 == (char *)0x0) || (*param_3 == '\0')) {
UTIL_LogPrintf("%s called vote \"%s\"\n",local_120,param_2);
}
else {
/* try { // try from 00b41441 to 00b41445 has its CatchHandler @ 00b41486 */
UTIL_LogPrintf("%s called vote \"%s %s\"\n",local_120,param_2,param_3);
}
TryCastVote(this,param_1,"Yes");
(**(code **)(*piVar2 + 0x18))(piVar2);
local_220 = &PTR__CBroadcastRecipientFilter_00c09928;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)&local_220);
}
goto LAB_00b40dfd;
}
}
LAB_00b40dfb:
uVar11 = 0;
LAB_00b40dfd:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return uVar11;
}
/* 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.