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...
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...
new highest[2] = {VoteOptions[0], 0};
for(new n=0; n<40; n++) //change the 40 to your highest number + 1 (highest number = amount)
{
if(VoteOptions[n] > highest[0])
highest[1] = n;
}
new string[100];
format(string, sizeof(string), "Highest value for option %d - value: %d", highest[1], highest[0]);
SendClientMessageToAll(0x999999AA, string);
new highest[2] = {0, -1};
for(new n=0; n<42; n++)
{
if(MapsToVote[n] > highest[0])
highest[1] = n;
}
if(highest[1] == MapsToVote[0])
{
//change to map 1
}
else if(highest[1] == MapsToVote[1])
{
//change to map 2
}
else if(highest[1] == MapsToVote[2])
{
//change to map 3
}
else if(highest[1] == MapsToVote[3])
{
//change to map 4
}
//...
if(MapsToVote[n] > highest[0])
{
highest[1] = n;
highest[0] = MapsToVote[n];
}
new highest[2] = {0, -1};//the 0 and the -1 here??
new biggest;
for(new i = 0; i < sizeof(VoteOptions); i++)
if(VoteOptions[i] > biggest)
biggest = VoteOptions[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...
k, thx.
can u pls explain to me what this does mean? pawn Код:
![]() |
new highest[2] = {VoteOptions[0], 0};
new highest[2] = {VoteOptions[0], 0};