get most vote next map - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: get most vote next map (
/showthread.php?tid=266167)
get most vote next map -
swieberdevos - 03.07.2011
i use this code
pawn Код:
switch(rofl)
{
case 0: { map[0] = b; rofl++; printf("%s",nextdmmapname[b]); }
case 1: { map[1] = b; rofl++; printf("%s",nextdmmapname[b]); }
case 2: { map[2] = b; rofl++; printf("%s",nextdmmapname[b]); }
case 3: { map[3] = b; rofl++; printf("%s",nextdmmapname[b]); }
case 4: { map[4] = b; rofl++; printf("%s",nextdmmapname[b]); }
case 5: { map[5] = b; rofl++; printf("%s",nextdmmapname[b]); }
case 6: { map[6] = b; rofl++; printf("%s",nextdmmapname[b]); }
case 7: { map[7] = b; rofl++; printf("%s",nextdmmapname[b]); }
}
// i save variables in upper code
//count vote on dialog response
switch(listitem)
{
case 0: map[0] ++;
case 1: map[1] ++;
case 2: map[2] ++;
case 3: map[3] ++;
case 4: map[4] ++;
case 5: map[5] ++;
case 6: map[6] ++;
}
//then get most votes in down code
new mapcount = 0;
for (new i = 0; i < sizeof(map);i++)
{
if(map[i] > mapcount)
{
NextdmmapByVote = i;
break;
}
}
but it always gives me 1st map ;s
Re: get most vote next map -
MadeMan - 03.07.2011
pawn Код:
for (new i = 0; i < sizeof(map);i++)
{
if(map[i] > mapcount)
{
NextdmmapByVote = i;
mapcount = map[i];
}
}
Re: get most vote next map -
swieberdevos - 03.07.2011
it still says map id 0 (first map in list) wins