SA-MP Forums Archive
Help - 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)
+--- Thread: Help (/showthread.php?tid=552781)



Help - Edw - 26.12.2014

How can command / paintvote?
I mean to put 3-4 weapons and you can vote in a dialogue but I can not figure out how pote choose server weapon with the highest number of votes.


Re: Help - Edw - 26.12.2014

upppp


Re: Help - jackx3rx - 26.12.2014

Use an integer and whenever a player votes, up the value by one.

pawn Код:
Votes += 1;



Re: Help - Edw - 26.12.2014

I know how to do this, but do not understand how that weapon with the most votes will be the paintball.


Re: Help - jackx3rx - 26.12.2014

Once the voting process is over, to get the one with the most votes simply try this:

pawn Код:
if(option1 > option2 || option1 > option3 || option1 > option4)
{
    // paintball gun will be option1
}
else if(option2 > option1 || option2 > option3 || option2 > option4)
{
    // paintball gun will be option2
}
else if(option3 > option1 || option3 > option2 || option3 > option4)
{
    // paintball gun will be option3
}
else if(option4 > option1 || option4 > option2 || option4 > option3)
{
    // paintball gun will be option4
}
else
{
    // it was a draw between 2 of them, so pick a random option?
}



Re: Help - Edw - 26.12.2014

fixed


Re: Help - Edw - 26.12.2014

help please,


Re: Help - Write - 26.12.2014

Make a global variable for each option.


Re: Help - Edw - 26.12.2014

fixed


Re: Help - Edw - 26.12.2014

fixed