PHP Code:
public EndVote()
{
//If the first option recieved the most votes
if ( gVotes[0] > gVotes[1] )
client_print(0, print_chat, "First option recieved most votes (%d )", gVotes[0] );
//Else if the second option recieved the most votes
else if ( gVotes[0] < gVotes[1] )
client_print(0, print_chat, "Second option recieved most votes (%d )", gVotes[1] );
//Otherwise the vote tied
else
{
// Random victory
switch(random_num(0, 1))
{
case 0:
{
client_print(0, print_chat, "First option recieved most votes (%d )", gVotes[0] );
}
case 1:
{
client_print(0, print_chat, "Second option recieved most votes (%d )", gVotes[1] );
}
}
}
client_print(0, print_chat, "The vote tied at %d votes each.", gVotes[0] );
//Don't forget to destroy the menu now that we are completely done with it
menu_destroy( gVoteMenu );
//Reset that no players are voting
gVoting = 0;
}