SA-MP Forums Archive
Creating vote system - 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: Creating vote system (/showthread.php?tid=155435)



Creating vote system - iStarzz - 18.06.2010

I am going to create a system like /votemap
Now i have on top for example:
pawn Код:
new MapVotes[5];
under ondialogresponse thingy
pawn Код:
MapVotes[0] ++;
else
MapVotes[1] ++;
now how i make a little code that tracks what map has the most votes?


Re: Creating vote system - TTJJ - 18.06.2010

Hi again FuTure`,

You think you could show us a bit more of the code so we can get an idea of exactlly what you are doing?

Cheers,

TJ


Re: Creating vote system - Nero_3D - 18.06.2010

If you already have the vote counts than you just need to compare

pawn Код:
new map;
for(new i; i < sizeof MapVotes; i++)
    if(MapVotes[map] < MapVotes[i])
        map = i;
This is a stable algorithm so if the first and the third map got five votes the first will be choosen