SA-MP Forums Archive
Give the voted map some more points, how? - 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: Give the voted map some more points, how? (/showthread.php?tid=266310)



Give the voted map some more points, how? - swieberdevos - 04.07.2011

So, i'm looping these map id's and put them in variable using this:
pawn Код:
mapid[b] = b;
Then i give people option to select their next map and when they select their map it should count that vote.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1995)
    {
        if(VoteAbility[playerid] == 1)
        {
             // how to make it count for that certain map?
        }
    }
    return 1;
}
Then to make it select map with most votes:
pawn Код:
new mapcount;

    for (new i = 0; i < sizeof(mapid);i++)
    {
        if(mapid[i] > mapcount)
        {
            NextdmmapByVote = i;
            mapcount = mapid[i];
           
            printf("selected: %d", NextdmmapByVote);
            break;
        }
    }
Now how do i make it count for that certain mapid?


Re: Give the voted map some more points, how? - Lorenc_ - 04.07.2011

Make a boolean to check wether the player voted, later on you need to make it add on the votes by map in a array:
pawn Код:
new gMapCount[MAX_MAPS];//MAX_MAPS needs to be assigned ...
Inside the dialog simply

pawn Код:
gMapCount[0]++; // Map ID: 0 has its value +1 than it is.
Then loop it by the mapcount and assign it to the NextdmmapByVote variable.


AW: Give the voted map some more points, how? - Nero_3D - 04.07.2011

First of all set every map to 0, should be a fair count

pawn Код:
for(new b; b != sizeof mapid; ++b) {
    mapid[b] = 0;
}
Just use

pawn Код:
mapid[listitem]++;
that only works if the items fit with your maps (first map = first item, and so on)

I hope this dialog is called only once by the script (could be abused if the player can call it by himself)