aboutsummaryrefslogtreecommitdiff
path: root/scripting/yuuko_callvote_fix.sp
diff options
context:
space:
mode:
Diffstat (limited to 'scripting/yuuko_callvote_fix.sp')
-rw-r--r--scripting/yuuko_callvote_fix.sp46
1 files changed, 46 insertions, 0 deletions
diff --git a/scripting/yuuko_callvote_fix.sp b/scripting/yuuko_callvote_fix.sp
new file mode 100644
index 0000000..17d4137
--- /dev/null
+++ b/scripting/yuuko_callvote_fix.sp
@@ -0,0 +1,46 @@
+#include <sourcemod>
+#include <sdktools>
+
+public Plugin myinfo = {
+ name = "yuuko's callvote fix",
+ author = "yuuko",
+ description = "makes the open fortress callvote command console-accessible",
+ version = SOURCEMOD_VERSION,
+ url = "https://www.partyvan.io/"
+};
+
+Handle CVoteController_CreateVote;
+int vote_controller_id;
+
+// OF's callvote unceremoniously returns early if run by the dedicated server.
+// we need to fix that if our server-only votes are to be worth anything.
+Action callvote_Callback(int client, const char[] command, int argc)
+{
+ if (strcmp(command, "callvote") != 0 || client != 0)
+ return Plugin_Continue;
+ char buf1[128], buf2[128];
+ if (argc > 0)
+ GetCmdArg(1, buf1, 128);
+ if (argc > 1)
+ GetCmdArg(2, buf2, 128);
+ SDKCall(CVoteController_CreateVote, vote_controller_id, 129, buf1, buf2);
+ return Plugin_Handled;
+}
+
+public void OnPluginStart()
+{
+ {
+ GameData GD = LoadGameConfigFile("yuuko_open_fortress");
+
+ StartPrepSDKCall(SDKCall_Entity);
+ PrepSDKCall_SetFromConf(GD, SDKConf_Signature, "CVoteController::CreateVote");
+ PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);
+ PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
+ PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer);
+ PrepSDKCall_SetReturnInfo(SDKType_Bool, SDKPass_Plain);
+
+ CVoteController_CreateVote = EndPrepSDKCall();
+ vote_controller_id = FindEntityByClassname(-1, "vote_controller");
+ }
+ AddCommandListener(callvote_Callback, "callvote");
+} \ No newline at end of file