PHP Code:
#pragma semicolon 1
#define DEBUG
#pragma tabsize 0
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#pragma newdecls required
int Terrorists[MAXPLAYERS + 1];
int counter = 0;
public Plugin myinfo =
{
name = "",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
RegConsoleCmd("sm_command", Command,"The command that opens the vote");//edit this
}
public Action Command(int client, int args)
{
if (IsVoteInProgress())
{
return Plugin_Handled;
}
Menu menu = new Menu(MenuHandler_Vote);
menu.VoteResultCallback = VoteResultCallback_Vote;
menu.SetTitle("Your Vote Title");//edit this
for (int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i)&&!IsFakeClient(i)&&GetClientTeam(i)== CS_TEAM_T)
{
Terrorists[counter] = i;
counter++;
}
}
menu.AddItem("option1", "option1");//edit this
menu.AddItem("option2", "option2");//edit this
menu.ExitButton = false;
menu.DisplayVote(Terrorists, counter, 15);//15 is the number of seconds the menu will be shown to the Terrorists. editable.
return Plugin_Handled;
}
public int MenuHandler_Vote(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_End)
{
delete menu;
}
}
public void VoteResultCallback_Vote(Menu menu, int num_votes, int num_clients, const int[][] client_info, int num_items, const int[][] item_info)
{
char item[65];
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], item, sizeof(item));
if (StrEqual(item, "option1", false))//edit this
PrintToChatAll("%s is the answer",item);
else if(StrEqual(item, "option2", false))//edit this
PrintToChatAll("%s is the answer",item);
for (int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i)&&!IsFakeClient(i))
Terrorists[i] = 0;
}
counter = 0;
}