Raised This Month: $51 Target: $400
 12% 

Solved Map not changed after voting!


Post New Thread Reply   
 
Thread Tools Display Modes
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
leonardo121
Member
Join Date: Sep 2013
Old 07-31-2017 , 12:16   Re: Map not changed after voting!
Reply With Quote #2

Are you calling this function?
Quote:
ChangeMap()
__________________
" In the end it doesn't even matter " - Linkin Park

Last edited by leonardo121; 07-31-2017 at 12:18.
leonardo121 is offline
argox
Junior Member
Join Date: Jul 2017
Old 07-31-2017 , 12:26   Re: Map not changed after voting!
Reply With Quote #3

Quote:
Originally Posted by leonardo121 View Post
Are you calling this function?
Yes, see at the end of the code
argox is offline
leonardo121
Member
Join Date: Sep 2013
Old 07-31-2017 , 12:29   Re: Map not changed after voting!
Reply With Quote #4

is defined , But you're not calling it.
__________________
" In the end it doesn't even matter " - Linkin Park

Last edited by leonardo121; 07-31-2017 at 12:30.
leonardo121 is offline
argox
Junior Member
Join Date: Jul 2017
Old 07-31-2017 , 12:45   Re: Map not changed after voting!
Reply With Quote #5

Quote:
Originally Posted by leonardo121 View Post
is defined , But you're not calling it.
What would be the correct variable to call the changemap function
argox is offline
leonardo121
Member
Join Date: Sep 2013
Old 07-31-2017 , 12:55   Re: Map not changed after voting!
Reply With Quote #6

PHP Code:
 else if(best >= 5){ 
        
client_print(0,print_chat,"[ VOTEMAP ] Carregando Mapa %s",gMapsChosen[best]); 
        
gChangeMapTo best
    } 


PHP Code:
 else if(best >= 5){ 
        
client_print(0,print_chat,"[ VOTEMAP ] Carregando Mapa %s",gMapsChosen[best]); 
        
gChangeMapTo best
        
ChangeMap() // here ?
    


Put all the code , and we can help you
__________________
" In the end it doesn't even matter " - Linkin Park

Last edited by leonardo121; 07-31-2017 at 12:55.
leonardo121 is offline
argox
Junior Member
Join Date: Jul 2017
Old 07-31-2017 , 13:23   Re: Map not changed after voting!
Reply With Quote #7

Quote:
Originally Posted by leonardo121 View Post
PHP Code:
 else if(best >= 5){ 
        
client_print(0,print_chat,"[ VOTEMAP ] Carregando Mapa %s",gMapsChosen[best]); 
        
gChangeMapTo best
    } 


PHP Code:
 else if(best >= 5){ 
        
client_print(0,print_chat,"[ VOTEMAP ] Carregando Mapa %s",gMapsChosen[best]); 
        
gChangeMapTo best
        
ChangeMap() // here ?
    


Put all the code , and we can help you
Thanks, it now seems to have worked
argox is offline
leonardo121
Member
Join Date: Sep 2013
Old 07-31-2017 , 13:28   Re: Map not changed after voting!
Reply With Quote #8

if is your solution, put thread as solved
__________________
" In the end it doesn't even matter " - Linkin Park
leonardo121 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-31-2017 , 13:31   Re: Map not changed after voting!
Reply With Quote #9

public ChangeMap(){
server_cmd("changelevel %s", gMapsChosen[gChangeMapTo])
return PLUGIN_CONTINUE
}

Why to be a complex...
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
argox
Junior Member
Join Date: Jul 2017
Old 07-31-2017 , 15:16   Re: Map not changed after voting!
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
public ChangeMap(){
server_cmd("changelevel %s", gMapsChosen[gChangeMapTo])
return PLUGIN_CONTINUE
}

Why to be a complex...
thanks
argox is offline
Reply



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 04:41.


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