vote next map
#1

so now i got 10 maps but i want when every dm round is finished a map vote.

but i only want to show 5 of them.

but i dont know how to because when i use random function it might show twice the same map or even more times!!

i had idea

pawn Код:
#define maxmapsshown 5
for (new x = 0; x < maxmapsshown; x ++)
format(str, sizeof(str),"%s\n", DMmapname[x]);
i hope somebody can help me
Reply
#2

Try to add that other 5 to do Timer or to vote Dialog or textdraw i dont know what you using
Reply
#3

i use this

pawn Код:
#define maxmapsss 12

new DMmapname[maxmapsss-1][56] = {
{"dmpalace"},
{"dm mall"},
{"dm factory"},
{"dm madness"},
{"dm docks"},
{"dm sf town"},
{"dm airport"},
{"dm evening"},
{"dm trapper"},
{"dm ur owned"}
};
and i only want 5 to be vote able, but not that they show double in dialog, u dont need to help make dialog only that it wont show twice or more times the same map
Reply
#4

Just mark the maps you already selected

pawn Код:
//
    #define maxmapsshown 5
    new
        x = 0, //loop variable
        rand = 0, //random variable
        count = 0, //counts variable
        selected = 0; //saves the selected maps
    for( ; count != maxmapsshown ; ++count) { //loops till we got our 5 maps
        rand = random(sizeof DMmapname - count); //gets an random value
        for(x = 0; x != sizeof DMmapname; ++x) { //loops through all mapids
            if(selected & (1 << x)) {
                continue; //jumps over the selected
            }
            if(!rand--) { //adds the map if we found our randomized map
                strcat(str, DMmapname[x], sizeof str); //adds the mapname to the string
                strcat(str, "\n", sizeof str); //adds a newline - strcat is faster than format
                selected |= (1 << x); //marks the map as selected
                break; //stops the loop - we found our map
            }
        }
    }
Another note:

You dont need to enter the size of constant arrays
pawn Код:
#define maxmapsss sizeof(DMmapname)

stock const DMmapname[][] = {
    "dmpalace",
    "dm mall",
    "dm factory",
    "dm madness",
    "dm docks",
    "dm sf town",
    "dm airport",
    "dm evening",
    "dm trapper",
    "dm ur owned"
};
Reply
#5

thanks alot, your the best

Sorry for bothering again, but how i detect which map get's a vote on the dialog response?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)