Thanks that works too, thanks alot Exolent
Now I have one more question. I used an .ini file that the pug will read from to spot if its after map vote or not, so after plugin_precache it wont do "type .rdy" again even if it was already and its after vote map, so it'll spot that if there's a specific written character I set, it'll start teams vote. The problem is, The teams vote doesnt work (teams vote = how the teams will be organized), I checked console and it says "Vote how you would like the teams to be organized" and then just says "Teams will be kept as they are", like it decides by itself the first option, and it doesnt even display the menu...
Here is the code:
PHP Code:
public TeamsVote()
{
rVoteMenu = menu_create("\rHow do you want the teams organized?", "votemap");
menu_additem(rVoteMenu, "Keep current teams as they are.", "0", 0)
menu_additem(rVoteMenu, "Random captains picking their team.", "1", 0)
menu_additem(rVoteMenu, "Random teams.", "2", 0)
;
new players[32], pnum, tempid;
get_players(players, pnum, "ch");
for( new i; i<pnum; i++ )
{
tempid = players[i];
client_print(tempid, print_chat, "%s Please pick the way you'd like the teams to be organized.", PREFIX)
menu_display(tempid, rVoteMenu, 0);
}
set_task(10.0, "EndTeamsVote");
return PLUGIN_HANDLED;
}
public voteteams(id, menu, item)
{
if( item == MENU_EXIT )
{
return PLUGIN_HANDLED;
}
new data[6], szName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);
new voteid = str_to_num(data);
rVotes[voteid]++;
return PLUGIN_HANDLED;
}
public EndTeamsVote()
{
for(new x; x<3; x++)
{
for (new c; c<3 ; c++)
{
if (gVotes[x] >= gVotes[c])
{
if ((x == 2) && (c == 2))
{
client_print(0, print_chat, "%s The teams will be kept as they are, match will now start.", PREFIX)
set_task(3.0, "StartMatch")
}
else if ((x == 0) && (c == 2))
{
client_print(0, print_chat, "%s Random Captains will be chosen in 10 seconds.", PREFIX)
set_task(10.0, "RandomCpt")
}
else if ((x == 1) && (c == 2))
{
client_print(0, print_chat, "%s Random teams will be set in 10 seconds.", PREFIX)
set_task(10.0, "RandomTeams")
}
}
}
}
}