Hi.
I don't understand why Handler_VoteCallback doesn't return a value.
Any idea?
No error in compilation.
I only got this error
Code:
L 01/17/2022 - 20:14:40: [SM] Call stack trace:
L 01/17/2022 - 20:14:40: [SM] [0] VFormat
L 01/17/2022 - 20:14:40: [SM] [1] Line 94, C:\Users\User\Docs\dev\addons\sourcemod\scripting\include\multicolors.inc::CPrintToChatAll
L 01/17/2022 - 20:14:40: [SM] [2] Line 179, testvote.sp::Handler_VoteCallback
L 01/17/2022 - 20:14:40: [SM] Exception reported: Language phrase "{default}Vote Successful" not found (arg 3)
L 01/17/2022 - 20:14:34: [SM] Exception reported: Language phrase "{default}}No Votes Cast" not found (arg 3)
L 01/17/2022 - 20:11:34: [SM] Exception reported: Language phrase "{default}Vote Failed" not found (arg 3)
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <multicolors>
#define PLUGIN_VERSION "1.0"
#define VOTE_NO "###no###"
#define VOTE_YES "###yes###"
ConVar g_CVar_mp_timeround;
public Plugin:myinfo =
{
name = "test",
author = "test",
description = "test plugin",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
RegAdminCmd("sm_fmptimeround", Command_ForceTimeround, ADMFLAG_CONVARS, "Force Forcetimeround Enable 1/0");
g_CVar_mp_timeround = FindConVar("mp_timeround");
}
public int Handler_VoteCallback(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
else if (action == MenuAction_DisplayItem)
{
char display[64];
menu.GetItem(param2, "", 0, _, display, sizeof(display));
if (strcmp(display, VOTE_NO) == 0 || strcmp(display, VOTE_YES) == 0)
{
char buffer[255];
Format(buffer, sizeof(buffer), "%T", display, param1);
return RedrawMenuItem(buffer);
}
}
else if (action == MenuAction_VoteCancel && param1 == VoteCancel_NoVotes)
{
CPrintToChatAll("{green}[SM] %t", "{default}}No Votes Cast");
}