I have a PLUGIN that has a special Round/Event that works according to rounds, 7 games GAME_MODE
So that comes the special round it shows a menu for everyone who has to choose what they want to run so I have 7 games and it always shows the first 4 I don't know why also I vote something else it picks me the Event of GAME: Weapon
Code:
#define SPECIAL_DAY 6
#define GAME_MODE 7
new const g_szGame[GAME_MODE][] = {
"NoScope",
"Fog",
"knife",
"p228",
"weapon",
"grenade",
"Invisibility"
};
Code:
public Open_DayModeMenu(id)
{
if(g_iDayModeVoteTime < 1)
return PLUGIN_HANDLED;
new szMenu[512], iBitKeys = (1<<9), iLen;
title_menu(szMenu, iLen, "\d- \wPlease choose your favorite day^n^n\d- Time: %d secs -^n^n", g_iDayModeVoteTime);
if (!g_bVoteStarted)
{
new iRandom, x = 0;
while (x < 4)
{
iRandom = random_num(0, 4);
if (IsRandomInArray(g_aChoses, iRandom))
continue;
ArrayPushCell(g_aChoses, iRandom);
x++;
}
ArrayPushCell(g_aChoses, x);
}
new i;
for(i = 0; i < 4; i++)
{
if(!g_bUserVoted[id])
{
add_item_menu(szMenu, iLen, "\y[%d] \w%s \y(%d Votes)^n", i+1, g_szGame[ArrayGetCell(g_aChoses, i)], g_aDataDayMode[ArrayGetCell(g_aChoses, i)][VOTES_NUM]);
iBitKeys |= (1<<i);
}
else
{
add_item_menu(szMenu, iLen, "\d[%d] %s \y(%d Votes)^n", i+1, g_szGame[ArrayGetCell(g_aChoses, i)], g_aDataDayMode[ArrayGetCell(g_aChoses, i)][VOTES_NUM]);
}
}
/*if(!g_bUserVoted[id])
{
add_item_menu(szMenu, iLen, "^n\y[5] \wRandomize \y(%d Votes)^n", g_aDataDayMode[ArrayGetCell(g_aChoses, i)][VOTES_NUM]);
iBitKeys |= (1<<i);
}
else
{
add_item_menu(szMenu, iLen, "^n\d[5] Randomize \y(%d Votes)^n", g_aDataDayMode[ArrayGetCell(g_aChoses, i)][VOTES_NUM]);
}*/
return menu_show(id, iBitKeys, szMenu, "Open_DayModeMenu");
}
public Close_DayModeMenu(id, iKey)
{
if(iKey == 9)
return PLUGIN_HANDLED;
g_bUserVoted[id] = true;
new iDay = ArrayGetCell(g_aChoses, iKey);
g_aDataDayMode[iDay][VOTES_NUM]++;
if (iKey < 4)
client_print_color(0, print_team_default, "%s ^3%n ^1has voted to ^x04%s^x01.", PREFIX, id, g_szGame[iDay] );
/*else
client_print_color(0, print_team_default, "%s ^3%n ^1has randomized^x01.", PREFIX, id );*/
return PLUGIN_HANDLED;
}
stock IsRandomInArray(Array:aRandomArray, iRandom)
{
for(new i = 0; i < ArraySize(aRandomArray); i++)
{
if (ArrayGetCell(aRandomArray, i) == iRandom)
{
return true;
}
}
return false;
}
public vote_day_mode_timer()
{
if(_get_alive_players() > 1)
{
if(--g_iDayModeVoteTime)
{
for(new iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
{
if(!is_user_alive(iPlayer))
continue;
Open_DayModeMenu(iPlayer);
if (!g_bVoteStarted)
{
g_bVoteStarted = true;
}
}
}
else
{
vote_day_mode_ended();
}
}
}
public vote_day_mode_ended()
{
for(new iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
{
if(!is_user_connected(iPlayer))
continue;
show_menu(iPlayer, 0, "^n");
}
if (g_aDataDayMode[ArrayGetCell(g_aChoses, ArraySize(g_aChoses) - 1)][VOTES_NUM])
{
for (new i = 0; i < g_aDataDayMode[ArrayGetCell(g_aChoses, ArraySize(g_aChoses) - 1)][VOTES_NUM]; i++)
g_aDataDayMode[ArrayGetCell(g_aChoses, random(ArraySize(g_aChoses) - 1))][VOTES_NUM]++;
}
new iVotesNum = 0;
for(new iGame = 0; iGame < GAME_MODE; iGame++)
{
if (!g_aDataDayMode[iGame][VOTES_NUM])
continue;
if(g_aDataDayMode[iGame][VOTES_NUM] >= iVotesNum)
{
iVotesNum = g_aDataDayMode[iGame][VOTES_NUM];
g_iGame = iGame;
}
}
ArrayClear(g_aChoses);
if (!iVotesNum)
{
g_iGame = random_num(0, 4);
client_print_color(0, print_team_default, "There was no votes. Day^4 %s ^1has been chosen automaically.", PREFIX, g_szGame[g_iGame]);
}
else
client_print_color(0, print_team_default, "%s Day^4 %s ^1has earned the most votes.", PREFIX, g_szGame[g_iGame]);
g_iTimeToStart = 15;
day_mode_start();
}
So how can make it look random all that's on the list and not just the first four?