10.11.2011, 12:35
Hey,
I'm in need of some help,
I'm basically making a voting system. I have ten different variables which are +1'd every time someone picks it (Its also on a timer for 35 seconds). At the end of the timer i want it to output the highest voted variable.
Voting starts:
I searched for a solutions yesterday, but i couldn't find any.
I'm not totally sure if this is the best way to do it, but it was the first thing which i thought of doing :P
Any help will be much appreciated,
Thanks : )
I'm in need of some help,
I'm basically making a voting system. I have ten different variables which are +1'd every time someone picks it (Its also on a timer for 35 seconds). At the end of the timer i want it to output the highest voted variable.
Voting starts:
pawn Код:
//foreach(Player, i) { etc...
ShowPlayerDialog(i, DIALOG_VOTE, DIALOG_STYLE_LIST, "Vote", "Variable 1\nVariable 2\nVariable 3\nVariable 4\nVariable 5\nVariable 6\nVariable 7\nVariable 8\nVariable 9\nVariable 10", "Vote", "Cancel");
voting = 1;
SetTimer("VoteTimer", 35000, false);
pawn Код:
//public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
//...
case DIALOG_VOTE:
{
switch(listitem) {
case 0:
{
if(voting == 0)
return SendClientMessage(playerid, COLOR_GREY, "Voting time has already eneded!");
variableOne++;
}
case 1:
{
if(voting == 0)
return SendClientMessage(playerid, COLOR_GREY, "Voting time has already eneded!");
variableTwo++;
}
case 2:
{
if(voting == 0)
return SendClientMessage(playerid, COLOR_GREY, "Voting time has already eneded!");
variableThree++;
}
case 3:
{
if(voting == 0)
return SendClientMessage(playerid, COLOR_GREY, "Voting time has already eneded!");
variableFour++;
}
//(etc...)
pawn Код:
public VoteTimer()
{
voting = 0;
GameTextForAll("Voting time has ended.", 5000, 1);
/*
Here is where i want to output the highest vote (variable).
However, i do have to check if the results are even, then i can just do random();
*/
}
I'm not totally sure if this is the best way to do it, but it was the first thing which i thought of doing :P
Any help will be much appreciated,
Thanks : )