12.11.2011, 20:20
hi,
i searched first in order to solve my prob but it didnt help me tho'.
I hope someone can help me.
I have a voting system using variables:
So how can i find the biggest variable at the end of the vote?
I tried it with looping:
I hope you can help me (also givin reps+)
i searched first in order to solve my prob but it didnt help me tho'.
I hope someone can help me.
I have a voting system using variables:
pawn Код:
new VoteOptions[40];
//then everytime someone votes for a certain option the specific variable is increased:
if(listitem == 0)
{
VoteOptions[0]++;
}
else if(listitem == 1)
{
VoteOptions[1]++;
}
else if(listitem == 2)
{
VoteOptions[2]++;
}
//etc. up to 39...
I tried it with looping:
pawn Код:
new biggest;
for(new i = 0; i < VoteOptions[i]; i++)
for(VoteOptions[biggest] < VoteOptions[i])//i dunno what exactly to do here...
biggest = i;
if(biggest == VoteOptions[0])
{
//Do smth. when variable 1 is the biggest
}
else if(biggest == VoteOptions[1]
{
//Do smth. when variable 2 is the biggest
}
else if(biggest == VoteOptions[2])
{
//Do smth. when variable 3 is the biggest
}
//etc...
![Smiley](images/smilies/smile.png)