SA-MP Forums Archive
Help me - 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 me (/showthread.php?tid=552902)



Help me - Edw - 27.12.2014

We're back again with this problem.
So, to be more explicit we made a paintball system and a system of vote for map and weapon, the problem is I do not understand how I could give gun that was most votes.

I made a variable weapons and one for maps.
new VoteGuns [8]; and new VoteMaps [2];


Thanks so much and please excuse my English.


Re: Help me - Edw - 27.12.2014

Help, please!


Re: Help me - Eyce - 27.12.2014

Here's an example of what you can do. Assuming that there are only 2 guns to choose from.
pawn Код:
new gun1 = 0;
new gun2 = 0;

for(new i = 0; i < sizeof(VoteGuns); i++)
{
    if(VoteGuns[i] == 24) // Deagle
    {
        gun1++;
    }
    else // Spas12
    {
        gun2++;
    }
}

if(gun1 >= gun2)
{
    // give deagle to players
}
else
{
    // to give spas12 to players
}



Re: Help me - Edw - 27.12.2014

Fixed. ty all


AW: Help me - Flori - 27.12.2014

You need && instead of ||

Alao be sure you set the correct index for your number of different guns.
Like 6 different guns -> new guns[5];


Re: Help me - Edw - 27.12.2014

What is inattention ..
+repp man, thank you!