Give the voted map some more points, how?
#1

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?
Reply
#2

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.
Reply
#3

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)