vote next map - 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: vote next map (
/showthread.php?tid=266084)
vote next map -
swieberdevos - 03.07.2011
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
Re: vote next map -
SpiderWalk - 03.07.2011
Try to add that other 5 to do Timer or to vote Dialog or textdraw i dont know what you using
Re: vote next map -
swieberdevos - 03.07.2011
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
AW: vote next map -
Nero_3D - 03.07.2011
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"
};
-
swieberdevos - 03.07.2011
thanks alot, your the best
Sorry for bothering again, but how i detect which map get's a vote on the dialog response?