Junior Member
|
07-31-2017
, 11:53
Map not changed after voting!
|
#1
|
Hi, I need a lot of help from everyone here, I have a auto mix plugin running almost everything perfectly, the problem occurs when the votemap, which when finalized the vote the chosen map is not loaded.
Here is the votemap code, please wait for help.
PHP Code:
/* ------------ VARIABLES THE VOTEMAP */
new gMapsIniFile[64],gMapsDisponiveis[30][20],gMapsChosen[4][20],ggVotes[5]
new gMapsCounter,gDoneMaps,gChangeMapTo,ggVoteMenu,gPlacar,gAviso
PHP Code:
public VoteMap(){
getmaps()
new rnd
while (gDoneMaps != 4 && gMapsCounter > 0) {
rnd = random(gMapsCounter)
copy(gMapsChosen[gDoneMaps++], 19, gMapsDisponiveis[rnd])
gMapsDisponiveis[rnd] = gMapsDisponiveis[--gMapsCounter]
}
ggVoteMenu = menu_create("\r Alugue seu servidor. ^n\y[ \w WhatsApp: 33 98436-9586 - \rVOTEMAP \y]^n","votethemap");
new num[11]
for(new i = 0; i < gDoneMaps; i++) {
num_to_str(i, num, 10)
menu_additem(ggVoteMenu, gMapsChosen[i], num, 0)
}
menu_additem(ggVoteMenu, "\yExtender mapa atual", "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,"[ VOTEMAP ] Selecione o proximo mapa...")
menu_display(tempid, ggVoteMenu);
}
//client_cmd(0, "spk ^"get red(e80) ninety(s45) to check(e20) use bay(s18) mass(e42) cap(s50)^"")
set_task(10.0, "EndVote");
return PLUGIN_HANDLED;
}
public votethemap(id,menu,item){
if( item == MENU_EXIT ) {
menu_display(id, ggVoteMenu)
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);
new playerna[32]
get_user_name(id, playerna, 31)
if (voteid != 4)
client_print(0,print_chat,"[ VOTEMAP ] %s Escolheu %s para o proximo mapa... ",playerna,gMapsChosen[voteid])
else
client_print(0,print_chat,"[ VOTEMAP ] %s Escolheu Extender o Mapa atual...",playerna)
ggVotes[voteid]++;
return PLUGIN_HANDLED;
}
public getmaps(){
get_configsdir(gMapsIniFile, 63);
format(gMapsIniFile, 63, "%s/maps.ini", gMapsIniFile);
new mapsfile = fopen(gMapsIniFile, "r")
new linefortest[50]
while (gMapsCounter < sizeof(gMapsDisponiveis) && !feof(mapsfile)) {
fgets(mapsfile, linefortest, 49)
trim(linefortest)
new getcurrentmap[32]
get_mapname(getcurrentmap, 31)
if ((is_map_valid(linefortest)) && (!equali(linefortest, getcurrentmap)))
copy(gMapsDisponiveis[gMapsCounter++], 24, linefortest)
}
fclose(mapsfile)
}
public EndVote(){
show_menu(0, 0, "^n", 1);
new best = 0;
for(new i = 1; i < sizeof(ggVotes); i++) {
if(ggVotes[i] > ggVotes[best])
best = i;
}
ggVotes[0] = 0
ggVotes[1] = 0
ggVotes[2] = 0
ggVotes[3] = 0
ggVotes[4] = 0
if(best == 4) {
client_print(0,print_chat,"[ VOTEMAP ] Uma nova votacao ira iniciar em 10 Segundos");
set_task(10.0,"VoteMap")
}
else if(best >= 5){
client_print(0,print_chat,"[ VOTEMAP ] Carregando Mapa %s",gMapsChosen[best]);
gChangeMapTo = best;
}
if(best <= 3){
client_print(0,print_chat,"[ VOTEMAP ] Mapa atual sera estendido...");
client_print(0,print_chat,"[ VOTEMAP ] Recarregando Modo FUN em 10 Segundos.");
set_task(10.0,"Fun",_,_,_,_,_);
best = 0;
}
return PLUGIN_HANDLED
}
public ChangeMap(){
new maptochangeto[25]
remove_task()
copy(maptochangeto, 24, gMapsChosen[gChangeMapTo])
server_cmd("changelevel %s", maptochangeto)
return PLUGIN_CONTINUE
}
Last edited by argox; 07-31-2017 at 15:17.
Reason: Solved
|
|