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

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 , 01:57   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

argox is offline
stephen473
Senior Member
Join Date: Jan 2017
Location: somewhere on earth
Old 07-31-2017 , 05:01   Re: Map not changed after voting!
Reply With Quote #2

Wrong section
__________________
Also known as Hardy`.

Feel free to contact me if you have a private plugin request!

My Steam Profile | Discord: Hardy`#3792
stephen473 is offline
argox
Junior Member
Join Date: Jul 2017
Old 07-31-2017 , 11:55   Re: Map not changed after voting!
Reply With Quote #3

Quote:
Originally Posted by stephen473 View Post
Wrong section
Sorry
argox is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-31-2017 , 17:38   Re: Map not changed after voting!
Reply With Quote #4

Which game?

Should your call be "map %s" and not "changelevel %s"?

Also maptochangeto seems a bit small.
__________________

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

Quote:
Originally Posted by Neuro Toxin View Post
Which game?

Should your call be "map %s" and not "changelevel %s"?

Also maptochangeto seems a bit small.
Hi this plugin is for counter-strike 1.6, i will try your tip, a member here in the forum helped me and the error was that it was not by calling the function ChangeMap (), now what happens is that when you have 10 players on the server to vote no and completed to change the map.
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 05:24.


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