*edit
Dam, you have multiple vote options... let me edit post
- No wait. Nevermind. item_info[0] is WINNER options from vote if there were total 1 num_items .
I did not test, but should work.
This example is not limited to exactly 8 players, you can change that.
But when vote is cast, all players currently in server need vote, and vote same option.
VoteHandler
Code:
public void Handle_VoteResults(Menu menu,
int num_votes,
int num_clients,
const int[][] client_info,
int num_items,
const int[][] item_info)
{
/* See if there were multiple winners */
int winner = 0;
//if (num_items > 1
//&& (item_info[0][VOTEINFO_ITEM_VOTES] == item_info[1][VOTEINFO_ITEM_VOTES]))
//{
// winner = GetRandomInt(0, 1);
//}
if (num_items == 1
&& num_clients == num_votes)
{
char votedisplayname[30];
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], votedisplayname, sizeof(votedisplayname));
PrintToChatAll("All %i players voted vote %s", num_clients, votedisplayname);
}
//char map[64];
//menu.GetItem(item_info[winner][VOTEINFO_ITEM_INDEX], map, sizeof(map));
//ServerCommand("changelevel %s", map);
}
__________________