Map voting -
Ghazal - 26.05.2015
Hi, I was recently scripting a map voting system for my gamemode, I have a timer which starts every five minutes, if the round is started, it ends the round with the reason time over, if the round is not started, it starts a round.
Alright, this is how the map voting should go, I show them a dialog where they should press on a map name, and right after they press, there should be something which sets the map to the highest map with votes.
Some of my code:
pawn Код:
public RoundStatus(playerid)
{
if(roundStarted == 1)
{
foreach(Player, i)
{
SendClientMessageToAll( -1, "The round has been ended, reason: TIME UP!");
SetPlayerColor(i, COLOR_HUMAN);
SetSpawnInfo(i, TEAM_HUMANS, 26, -2260.7219, 686.1232 , 49.2969, 0, 10, 1, 23, 200, 25, 200);
SpawnPlayer(i);
}
}
if(roundStarted != 1)
{
foreach(Player, i)
{
ShowPlayerDialog(i, DIALOG_VOTE, DIALOG_STYLE_LIST, "Map Vote", "zmp_zombified \n zmp_cb \n zmp_dillimore \n zmp_funland \n zmp_grove \n zmp_lsbeach \n zmp_lshood \n zmp_mjcastillo \n zmp_outpost \n zmp_piertrip \n zmp_stormdrain \n zmp_swamp \n zmp_theships \n zmp_town \n zmp_unity \n zmp_workfare \n zmp_zombierave \n", "Vote", "Cancel" );
}
}
return 1;
}
Re: Map voting -
Ghazal - 27.05.2015
Bump.
Re: Map voting -
Ghazal - 27.05.2015
I have thought about this: for example I have two maps Zombified and Unity.
so, I will be defining two variables, zombifiedvotes and unityvotes, when a player clicks on them in the dialog, I will add
or
And ofcourse I will set the variables to zero when the vote ends, but the question now is, how would I get which map has the highest vote?
Re: Map voting -
Abagail - 27.05.2015
e.g:
pawn Код:
if(zombifiedvotes > unityvotes)
{
// more votes
}
if(zombifiedvotes >= unityvotes)
{
// equal or more than unity votes
}
if(zombifiedvotes == unityvotes)
{
// same amount of votes
}
if(zombifiedvotes < unityvotes)
{
// less than unityvotes
}
if(zombifiedvotes <= unityvotes)
{
// less or equal to
}
Simple math functions should work if there are only two variables.
Re: Map voting -
Ghazal - 27.05.2015
Quote:
Originally Posted by Abagail
e.g:
pawn Код:
if(zombifiedvotes > unityvotes) { // more votes }
if(zombifiedvotes >= unityvotes) { // equal or more than unity votes }
if(zombifiedvotes == unityvotes) { // same amount of votes }
if(zombifiedvotes < unityvotes) { // less than unityvotes }
if(zombifiedvotes <= unityvotes) { // less or equal to }
Simple math functions should work if there are only two variables.
|
There will be a way more.
Re: Map voting -
Luis- - 27.05.2015
Maybe something dynamic? Like loading all the current maps from a MySQL database then putting then into an array?
Re: Map voting -
Ghazal - 27.05.2015
Quote:
Originally Posted by Luis-
Maybe something dynamic? Like loading all the current maps from a MySQL database then putting then into an array?
|
I thought of this, but I think this will way be much harder than the current way.
Re: Map voting -
Luis- - 27.05.2015
But it'd be more easier in the long run, so you are able to add more maps with ease.
Re: Map voting -
Ghazal - 27.05.2015
Quote:
Originally Posted by Luis-
But it'd be more easier in the long run, so you are able to add more maps with ease.
|
Alright, can you show an example of how to do it?
Re: Map voting -
Ghazal - 29.05.2015
Bump.