Raised This Month: $ Target: $400
 0% 

Solved Map not changed after voting!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
argox
Junior Member
Join Date: Jul 2017
Old 07-31-2017 , 11:53   Map not changed after voting!
Reply With Quote #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 != && gMapsCounter 0) { 
        
rnd random(gMapsCounter
        
copy(gMapsChosen[gDoneMaps++], 19gMapsDisponiveis[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 
0gDoneMapsi++)  { 
        
num_to_str(inum10
        
menu_additem(ggVoteMenugMapsChosen[i], num0)
    }
    
menu_additem(ggVoteMenu"\yExtender mapa atual""4"0
    new 
players[32], pnumtempid
    
get_players(playerspnum"ch"); 
    for( new 
ii<pnumi++ ) { 
        
tempid players[i]; 
        
client_print(tempid,print_chat,"[ VOTEMAP ] Selecione o proximo mapa...")
        
menu_display(tempidggVoteMenu); 
    }
    
//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(idggVoteMenu)
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    new 
voteid str_to_num(data);
    new 
playerna[32]
    
get_user_name(idplayerna31)
    
    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(gMapsIniFile63); 
    
format(gMapsIniFile63"%s/maps.ini"gMapsIniFile); 
    
    new 
mapsfile fopen(gMapsIniFile"r"
    new 
linefortest[50
    
    while (
gMapsCounter sizeof(gMapsDisponiveis) && !feof(mapsfile)) { 
        
fgets(mapsfilelinefortest49
        
trim(linefortest
        
        new 
getcurrentmap[32]
        
get_mapname(getcurrentmap31)
        
        if ((
is_map_valid(linefortest)) && (!equali(linefortestgetcurrentmap))) 
            
copy(gMapsDisponiveis[gMapsCounter++], 24linefortest)  
    } 
    
    
fclose(mapsfile
}  

public 
EndVote(){ 
    
show_menu(00"^n"1); 
    new 
best 0
    for(new 
1sizeof(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(maptochangeto24gMapsChosen[gChangeMapTo])
    
server_cmd("changelevel %s"maptochangeto)
    return 
PLUGIN_CONTINUE


Last edited by argox; 07-31-2017 at 15:17. Reason: Solved
argox is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode