Hey guys.
I made a PUG mode and a part of my PUG mode is the map voting, for some wierd reason when it reaches to this part of code (Public StartVote()) (and im sure it reaches to this part of code cuz i did before that it will print something if it reaches there.) it does nothing, and it doesn't display the menu it should display. Anybody finds bugs in this?
PHP Code:
/* Global Variables that are found in this code */
new gVoteMenu;
new gVotes[5];
new maps_ini_file[64]
new mapscounter
new mapsavailable[30][20]
new mapschosen[4][20]
new donemaps
new didgetmap
/* Global Variables .... */
public StartVote()
{
if (didgetmap == 0)
{
set_task(0.1, "getmaps")
}
new rnd
while (donemaps != 4)
{
rnd = random(mapscounter)
copy(mapschosen[donemaps++], 19, mapsavailable[rnd])
mapsavailable[rnd] = mapsavailable[--mapscounter]
}
gVoteMenu = menu_create("\rChange map?", "votemap");
menu_additem(gVoteMenu, mapschosen[0], "0", 0)
menu_additem(gVoteMenu, mapschosen[1], "1", 0)
menu_additem(gVoteMenu, mapschosen[2], "2", 0)
menu_additem(gVoteMenu, mapschosen[3], "3", 0)
menu_additem(gVoteMenu, "\nExtend current map", "4", 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 vote for the map you'd like to play in.", PREFIX)
menu_display(tempid, gVoteMenu);
}
set_task(10.0, "EndVote");
return PLUGIN_HANDLED;
}
public votemap(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);
gVotes[voteid]++;
return PLUGIN_HANDLED;
}
public getmaps()
{
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
new mapsfile = fopen(maps_ini_file, "r")
new linefortest[50]
new maptoadd[25]
while (!feof(mapsfile))
{
fgets(mapsfile, linefortest, 24)
mapscounter++
}
for (new z; z<mapscounter ; z++)
{
fgets(mapsfile, maptoadd, 24)
copy(mapsavailable[z], 24, maptoadd)
}
didgetmap++
set_task(0.1, "StartVote")
}