1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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");
}
|