Add this above OnGameModeExit or under OnGameModeInit:
pawn Код:
new MapNames[][4] =
{
{55,66,77},
{1,1,1}
};
new Map[][] =
{
"Map1",
"Map2"
};
new CurrentMap = 0;
new Votes[50];
new CanVote[MAX_PLAYERS];
new bool:ActiveVote;
stock GetHighestNumberEx(num[], size = sizeof(num))
{
new highesty = 0;
for (new i = 0; i < size; i++)
{
if (num[i] > highesty) highesty = num[i];
}
return highesty;
}
forward endvote();
public endvote()
{
ActiveVote = false;
new high = GetHighestNumberEx(Votes);
printf("%d",high);
for (new i = 0; i<sizeof(Votes);i++)
{
if (Votes[i] == high)
{
CurrentMap = i;
new msg[50];
format(msg,sizeof(msg),"The Map %s Has been Nominated.",Map[i]);
SendClientMessageToAll(COLOR_RED,msg);
break;
}
}
return 1;
}
forward BeginVote();
public BeginVote()
{
SendClientMessageToAll(COLOR_RED,"Voting Ends in 15 seconds. Cast your Votes");
SetTimer("endvote",15000,0);
ActiveVote = true;
new info[150];
for (new i = 0;i<sizeof(MapNames);i++)
{
if (i == 0) format(info,sizeof(info),"%s\n",Map[i]);
if (i == sizeof(MapNames)-1) format(info,sizeof(info),"%s%s",info,Map[i]);
if (i != sizeof(MapNames) && i != 0) format(info,sizeof(info),"%s\n",info,Map[i]);
}
for (new i = 0;i<MAX_PLAYERS; i++)
{
CanVote[i] = 1;
ShowPlayerDialog(i,500,DIALOG_STYLE_LIST,"Vote for Map",info,"Vote","Vote");
}
return 1;
}
stock GetHighestNumber(...)
{
new args = numargs();
new highestyet = 0;
for (new i = 0; i<args; i++)
{
if (getarg(i,0) > highestyet) highestyet = getarg(i,0);
}
return highestyet;
}
This under OnPlayerConnect:
pawn Код:
if (ActiveVote == true) CanVote[playerid] = 0;
This above OnPlayerSpawn:
pawn Код:
forward Spawn(playerid);
public Spawn(playerid)
{
SetPlayerPos(playerid,MapNames[CurrentMap][1],MapNames[CurrentMap][2],MapNames[CurrentMap][3]);
new msg[50];
format(msg,sizeof(msg),"You have Spawned In Map: %s(%d,%d,%d)",Map[CurrentMap],MapNames[CurrentMap][0],MapNames[CurrentMap][1],MapNames[CurrentMap][2]);
SendClientMessage(playerid,COLOR_RED,msg);
return 1;
}
This under OnPlayerSpawn:
pawn Код:
SetTimerEx("Spawn",500,0,"%d",playerid);
Best Of Luck!