Quote:
Originally Posted by Flex1z
But that's not the point of the plugin at all. I'm trying to let the players vote for overtime when round 28 starts with the menu. If that works get more then 50% yes to have overtime otherwise a draw. With just typing !OT you instantly active overtime which I'm not trying to achieve.
|
Try that
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#pragma semicolon 1
#pragma newdecls required
public void OnPluginStart()
{
HookEvent("round_start", Event_RoundStart, EventHookMode_Post);
}
public Action Event_RoundStart(Event evEvent, const char[] szName, bool bDontBroadcast)
{
int CurrentRoundNum = GetTeamScore(CS_TEAM_T) + GetTeamScore(CS_TEAM_CT);
if(CurrentRoundNum == 28) {
DoVoteMenu();
}
}
public int Handle_VoteMenu(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
delete menu;
}
public void VoteResultCallback(Menu menu, int num_votes, int num_clients, const int[][] client_info, int num_items, const int[][] item_info)
{
char item[16];
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], item, sizeof(item));
if (StrEqual(item, "yes", false))
{
ServerCommand("mp_overtime_enable 1");
}
}
void DoVoteMenu()
{
if (IsVoteInProgress())
{
return;
}
Menu menu = new Menu(Handle_VoteMenu);
menu.VoteResultCallback = VoteResultCallback;
menu.SetTitle("Should there be an overtime?");
menu.AddItem("yes", "Yes");
menu.AddItem("no", "No");
menu.ExitButton = false;
menu.DisplayVoteToAll(20);
}
__________________