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

DeRoiD's Mapchooser v2.33


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
El Abuelo Loco
Senior Member
Join Date: Jun 2020
Old 11-29-2020 , 10:20   DeRoiD's Mapchooser v2.33
Reply With Quote #1

Probe "DRoiD Mapchooser 2.33!" but it has a bug that at a certain time does not allow anyone to enter the server, it does not allow to choose CT or TT. leaves you only spec!

any solution?

PHP Code:
/*
    ///////////////////////////////////////////////////////////
     /###///##/////##///###////////////####///////####///####///
    /#//#//#/#///#/#//#///////////////////#//////////#//////#//
    /#//#//#//#/#//#//#/////////#///#//####/////////#//////#///
    /#//#//#///#///#//#//////////#/#//#//////////////#//////#//
    /###///#///////#///###////////#///#####//##//####///####///
    ///////////////////////////////////////////////////////////
    
    Author:            DeRoiD
    Plugin name:       DeRoiD's Mapchooser
    Plugin version:    2.33
    First relase:      2015/04/08
    Last update:       2015/06/25
    Reason for update: Rounds fix
     Plugin link:       forums.alliedmods.net/showthread.php?t=261412
    
    Short description [default cvar]:
        - This plugin last 3 minutes or round open the "Vote a map" menu. 
        - The one for which more people vote it will be the next map. 
        - If best vote < min. vote percent then re-vote! There is a manner of two kinds.
        
    You can [default cvar]:
        - rtv "Rock the vote" [players 1:2]
        - nom "Nomination" (in menu) [chance 50%]
        - see timeleft | nextmap [timeleft, nextmap]
        - see played maps and played counts [/playedmaps]
        - see current map
        - if you admin then can startvote (/startvote) [StartVoteFlag]
    
    Changelog:
        - v1.00
            + First relase (hlmod.hu)
            + Map choose (Old method)
            + Played maps
            + Next map
            + Timeleft
        
        - v1.20b
            + Rounds
            + Nomination
            + Admin vote
            + Rock the vote
        
        - v1.30b
            + Previous map can not be choose
        
        - v1.35b
            + Fix bugs
            + New chooser method
            + More map choices [MAX 9]
        
        - v1.49a
            + Re-vote if vote percent < min percent
            + Removed hard coding paths.
        
        - v1.53a
            + Fixed extend time [ +- 1 min ]
            + Fixed changelevel bug.
            
        - v1.62a
            + Hud Counter
            + Change map only next round. (Cvar)
            + Fix bugs
            
        - v1.63a
            + HudMsg -> SyncHudMsg
            
        - v1.77a
            + Nobody votes bug fix
            + More languages
    
        - v1.86a
            + Countdown sounds
            
        - v2.00
            + Fix bugs
            + Check maps (valid)
            + Ad rounds in game (if rounds mod)    
            
        - v2.01
            + Current map
            
        - v2.01.3
            + Fix RTV
            
        - v2.30
            + Multilang toggle server/player
            + Start button
            + Map infos
            
        - v2.33
            + Round fix
            + amx_dmc_maxrounds
        
        Pugin like:
        
            Choose the Next Map [All votes: 9]
            
            1. de_dust2 [votes: 1] (9%)
            2. de_dust [votes: 0] (0%)
            3. de_inferno [votes: 1] (9%)
            4. de_train [votes: 5] (54%)
            5. de_nuke [votes: 1] (9%)
            
            6. de_tuscan (current map) [votes: 1] (9%)
            
            
            [Next map: de_train]
            
        You find bug?
            - deroidocska (steam)
            - https://forums.alliedmods.net/member.php?u=258497
            
        Plugin tested in [32 Real Players]:
            - AMX 1.8.2 
            - AMX 1.8.3-dev+4532 
            - AMX 1.8.3-dev-git4751
            
        Thanks for using this plugin!            
            DeRoiD
            
                    ___________[Special thanks]___________
                            
                    - fysiks for help to plugin (tips)
                    - HamletEagle for help to plugin (tips)
                    - mforce for idea
                    - cs.stambeto for idea
                    - OZH3NN for idea
                        
                    - ACM1PT for translation [es]
                    - JustVladK & K:O for translation [ro]
                    - battlefield 3 for translation [ru]
                    - Perfect Scrash for translation [bp]
                    - Belo95135 for translation [sk]
                    - wEight for translation [sr]
                    - ANTICHRISTUS for translation [fr]
                    ______________________________________
                    
                    
        Magyar nyelven is leirom!!! Koszonom, hogy ha ezt a plugint hasznalod! :)
*/

#include <amxmodx>

new const PLUGIN[] = "DeRoiD's Mapchooser";
new const 
VERSION[] = "2.33";
new const 
AUTHOR[] = "DeRoiD";

#define MapID 180912

#define R 240
#define G 240
#define B 240

#define CHUD 1.5
#define MaxCSpeed 5.0

#define Max 200
#define MinRounds 5
#define MaxChoice 9
#define PMPage 6
#define MaxSB 8

#define StartVoteFlag ADMIN_LEVEL_A
#define InfoFlag ADMIN_BAN
#define RoundFlag ADMIN_RCON

#pragma semicolon 1

new MapFile[64], MapCycle[32], MapFile_LinesMapCycle_Lines;
new 
Maps[Max][32], MapName[32], MapNames[MaxChoice][32], MapRevote[2][32], NomMaps[Max][32], NomNumNomNomed[Max];
new 
MapVote[MaxChoice], RevoteCounts[2], VoteMenuRevoteMenuMapCounterLastMap[32], VotedMap[32], BeginCounter;
new 
AllVotesAllRevotesNext[32], RTVRTVTime[3], PlayerMap[33], ElapsedTime[3], VoteMod;
new 
bool:Votedbool:PlayerVoted[33], bool:ChangeMapbool:Beginedbool:inProcessbool:Revoted,
bool:PlayerRTV[33], bool:toRTVbool:AlreadyNom[33], bool:PlayerRevoted[33], bool:NeedRV;
new 
SayTextRoundsMaxRoundsTimeLimitoRoundsLangStartButtonPlayedCountStarted;

new 
Cvar_WaitVoteMenuTimeCvar_MenuDestroyTimeCvar_RTVMinuteCvar_VoteCounter,
Cvar_NomChanceCvar_VoteSoundCvar_ExtendCvar_StartRevoteTimeCvar_VotePercentMin,
Cvar_NominationCvar_PlayedMapsCvar_RTVCvar_VoteVariableCvar_RTVMinCvar_Mod,
Cvar_ChangeSpeedCvar_MaxMapsCvar_WaitRevoteMenuTimeCvar_HudModCvar_OnlyNextRound,
Cvar_CountSoundCvar_ChooseSoundCvar_AdCvar_StartButtonCvar_LangMode;

new 
Prefix[32], sHudObjOff;

new const 
MapMenuCommands[][] =
{
    
"/playedmaps",
    
"/pm",
    
"!playedmaps",
    
"!pm",
    
"playedmaps",
    
"pm"
};
new const 
TimeLeftCommands[][] =
{
    
"/timeleft",
    
"/tl",
    
"!timeleft",
    
"!tl",
    
"timeleft",
    
"tl"
};
new const 
NextMapCommands[][] =
{
    
"/nextmap",
    
"/nm",
    
"!nextmap",
    
"!nm",
    
"nextmap",
    
"nm"
};
new const 
AdminCommands[][] =
{
    
"/startvote",
    
"!startvote",
    
"startvote"
};
new const 
RTVCommands[][] =
{
    
"/rtv",
    
"!rtv",
    
"/rockthevote",
    
"!rockthevote",
    
"rockthevote",
    
"rtv"
};
new const 
NomCommands[][] =
{
    
"/nom",
    
"!nom",
    
"/nomination",
    
"!nomination",
    
"nom",
    
"nomination"
};
new const 
CurrentMapCommands[][] =
{
    
"/currentmap",
    
"!currentmap",
    
"/cm",
    
"!cm",
    
"currentmap",
    
"cm"
};

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_cvar(PLUGINVERSIONFCVAR_SERVER);
    
register_dictionary("dmc.txt");
    
sHudObj CreateHudSyncObj();
    
    static 
ConfigsDir[64]; 
    
get_localinfo("amxx_configsdir"ConfigsDir63);
    
formatex(MapFile63"%s/dmc/mapdatas.dmc"ConfigsDir);
    
get_localinfo("amxx_configsdir"ConfigsDir63);
    
formatex(MapCycle31"mapcycle.txt");
    
formatex(Prefix31"!g[DMC]");
    
    
MapFile_Lines file_size(MapFile1);
    
MapCycle_Lines file_size(MapCycle1);
    
    
Cvar_Mod register_cvar("dmc_mod""1");
    
Cvar_HudMod register_cvar("dmc_hudmod""1");
    
Cvar_ChangeSpeed register_cvar("dmc_changespeed""5.0");
    
Cvar_WaitVoteMenuTime register_cvar("dmc_waitvotemenutime""10.0");
    
Cvar_WaitRevoteMenuTime register_cvar("dmc_waitrevotemenutime""5.0");
    
Cvar_MenuDestroyTime register_cvar("dmc_menudestroyTime""5.0");
    
Cvar_RTVMinute register_cvar("dmc_rtvminute""10");
    
Cvar_VoteCounter register_cvar("dmc_votecounter""15");
    
Cvar_VoteVariable register_cvar("dmc_votevariable""3");
    
Cvar_VotePercentMin register_cvar("dmc_votepercent""50");
    
Cvar_MaxMaps register_cvar("dmc_maxmaps""5");
    
Cvar_Nomination register_cvar("dmc_nomination""1");
    
Cvar_PlayedMaps register_cvar("dmc_playedmaps""1");
    
Cvar_RTV register_cvar("dmc_rtv""1");
    
Cvar_VoteSound register_cvar("dmc_votesound""1");
    
Cvar_RTVMin register_cvar("dmc_rtvmin""2");
    
Cvar_NomChance register_cvar("dmc_nomchance""50");
    
Cvar_Extend register_cvar("dmc_extend""15");
    
Cvar_StartRevoteTime register_cvar("dmc_startrevotetime""5.0");
    
Cvar_OnlyNextRound register_cvar("dmc_onlynextround""1");
    
Cvar_CountSound register_cvar("dmc_countsound""1");
    
Cvar_ChooseSound register_cvar("dmc_choosesound""1");
    
Cvar_Ad register_cvar("dmc_ad""1");
    
Cvar_LangMode register_cvar("dmc_langmode""0");
    
Cvar_StartButton register_cvar("dmc_startbutton""1");
    
    
server_cmd("exec %s/dmc/dmc.cfg"ConfigsDir);
    
server_exec();
    
set_cvar_float("mp_chattime"120.0);
    
    
register_concmd("amx_dmc""ShowInfo");
    
    
VoteMenu register_menuid("VoteMenu");
    
RevoteMenu register_menuid("RevoteMenu");
    
register_menucmd(VoteMenu1023"VoteMenuKeys");
    
register_menucmd(RevoteMenu1023"RevoteMenuKeys");
    
SayText get_user_msgid("SayText");
    
    
TimeLimit get_cvar_num("mp_timelimit");
    
MaxRounds get_cvar_num("mp_maxrounds");
    
oRounds MaxRounds;
    
    if(
get_pcvar_num(Cvar_LangMode) == 0)
    {
        
Lang 0;
    }
    else
    {
        
Lang = -1;
    }
    
    
StartButton get_pcvar_num(Cvar_StartButton);
    
    if(
StartButton 1)
    {
        
set_pcvar_num(Cvar_StartButton1);
    }
    
    if(
StartButton && StartButton <= MaxSB)
    {
        new 
Check;
        
Check get_pcvar_num(Cvar_MaxMaps) + get_pcvar_num(Cvar_StartButton);
        
        if(
Check 9)
        {
            
Check MaxChoice get_pcvar_num(Cvar_MaxMaps);
            if(
!= Check StartButton)
            {
                
Check -= StartButton;
                
Check = -Check;
                
set_pcvar_num(Cvar_MaxMapsget_pcvar_num(Cvar_MaxMaps)-Check+1);
            }
        }
    }
    else if(
StartButton MaxSB)
    {
        
StartButton MaxSB;
        
set_pcvar_num(Cvar_MaxMaps2);
    }
    else
    {
        
StartButton 1;
    }
    
    if(
get_pcvar_num(Cvar_MaxMaps) > MaxChoice)
    {
        
set_pcvar_num(Cvar_MaxMapsMaxChoice);
    }
    
    if(
get_pcvar_num(Cvar_MaxMaps) <= 1)
    {
        
set_pcvar_num(Cvar_MaxMaps2);
    }
    
    if(
get_pcvar_float(Cvar_ChangeSpeed) > MaxCSpeed)
    {
        
set_pcvar_float(Cvar_ChangeSpeedMaxCSpeed);
    }
    
    if(
get_pcvar_float(Cvar_ChangeSpeed) < 1.0)
    {
        
set_pcvar_float(Cvar_ChangeSpeed1.0);
    }
    
    if(
MapCycle_Lines-get_pcvar_num(Cvar_MaxMaps) < 0)
    {
        new 
Error[64];
        
formatex(Errorcharsmax(Error), "Only %d maps in %s file! (Min: %d)"MapCycle_LinesMapCycleget_pcvar_num(Cvar_MaxMaps));
        
log_amx(Error);
        
        if(
MapCycle_Lines 1)
        {
            
set_pcvar_num(Cvar_MaxMapsMapCycle_Lines);
            
formatex(Errorcharsmax(Error), "MaxMaps set %d"MapCycle_Lines);
            
log_amx(Error);
        }
        else
        {
            
Off 1;
        }
    }
    
    if(
TimeLimit == && get_pcvar_num(Cvar_Mod) == 1)
    {
        
Off 1;
    }
    
    if(
Off == 0)
    {
        
register_event("HLTV""NewRound""a""1=0""2=0");
        
register_logevent("SavePresentTime"2"0=World triggered""1=Game_Commencing");
        
register_logevent("RestartRound"2"0=World triggered""1&Restart_Round_");
        
register_logevent("RestartRound"2"0=World triggered""1=Game_Commencing");
        
        if(
get_pcvar_num(Cvar_Mod) == 0)
        {
            
register_logevent("RoundEnd"2"0=World triggered""1=Round_End");
        }
        
        
set_task(0.5"CheckTime"MapID-1__"b");
        
        if(
get_pcvar_num(Cvar_Mod) == 0)
        {    
            
register_concmd("amx_dmc_maxrounds""AddRound");
            
            if(
MaxRounds MinRounds)
            {
                
server_cmd("mp_maxrounds ^"%d^""MinRounds);
            }
            
            
server_cmd("mp_timelimit 0");
            
            
MaxRounds get_cvar_num("mp_maxrounds");
            
oRounds MaxRounds;
        }
        
        if(
get_pcvar_num(Cvar_Mod) == 1)
        {
            
server_cmd("mp_maxrounds 0");
        }
    }
    
    
get_mapname(MapNamecharsmax(MapName));
    
get_localinfo("lastMap"LastMap31);
    
    
set_task(random_float(0.10.5), "LoadMaps");
    
set_task(random_float(0.10.5), "LoadVoteMaps");
    
set_task(random_float(0.10.5), "SavePresentTime");
    
    if(
get_pcvar_num(Cvar_Ad) == 1)
    {
        
set_task(random_float(100.0200.0), "AdvTime"MapID-10__"b");
    }
    
    
toRTV false;

    new 
Cmd[32];
    
    if(
get_pcvar_num(Cvar_PlayedMaps) == 1)
    {
        for(new 
Num 0Num sizeof MapMenuCommandsNum++)
        {
            
format(Cmdcharsmax(Cmd), "say %s"MapMenuCommands[Num]);
            
register_clcmd(Cmd"ShowMapMenu");
        }
    }
    
    for(new 
Num 0Num sizeof NextMapCommandsNum++)
    {
        
format(Cmdcharsmax(Cmd), "say %s"NextMapCommands[Num]);
        
register_clcmd(Cmd"ShowNextMap");
    }
    
    for(new 
Num 0Num sizeof CurrentMapCommandsNum++)
    {
        
format(Cmdcharsmax(Cmd), "say %s"CurrentMapCommands[Num]);
        
register_clcmd(Cmd"ShowCurrentMap");
    }
    
    for(new 
Num 0Num sizeof TimeLeftCommandsNum++)
    {
        
format(Cmdcharsmax(Cmd), "say %s"TimeLeftCommands[Num]);
        
register_clcmd(Cmd"ShowTimeLeft");
    }
    
    for(new 
Num 0Num sizeof AdminCommandsNum++)
    {
        
format(Cmdcharsmax(Cmd), "say %s"AdminCommands[Num]);
        
register_clcmd(Cmd"StartVote");
    }
    
    if(
get_pcvar_num(Cvar_RTV) == 1)
    {
        for(new 
Num 0Num sizeof RTVCommandsNum++)
        {
            
format(Cmdcharsmax(Cmd), "say %s"RTVCommands[Num]);
            
register_clcmd(Cmd"RockTheVote");
        }
    }
    
    if(
get_pcvar_num(Cvar_Nomination) == 1)
    {
        for(new 
Num 0Num sizeof NomCommandsNum++)
        {
            
format(Cmdcharsmax(Cmd), "say %s"NomCommands[Num]);
            
register_clcmd(Cmd"ShowNomMenu");
        }
    }
}
public 
AddRound(id) {
    if(
get_user_flags(id) & RoundFlag)
    {
        new 
sRound[32], RoundNum;
        
read_args(sRoundcharsmax(sRound));
        
remove_quotes(sRound);
        
        
RoundNum str_to_num(sRound);
        
        
MaxRounds RoundNum+Rounds;
        
set_cvar_num("mp_maxrounds"get_cvar_num("mp_maxrounds")+RoundNum);
    }
}
public 
SavePresentTime()
{    
    new 
Hour[32], Minute[32], Second[32];
    
format_time(Hoursizeof Hour 1"%H");
    
format_time(Minutesizeof Minute 1"%M");
    
format_time(Secondsizeof Second  1"%S");
    
ElapsedTime[0] = str_to_num(Second);
    
ElapsedTime[1] = str_to_num(Minute);
    
ElapsedTime[2] = str_to_num(Hour);
    
RTVTime[2] = str_to_num(Hour);
    
RTVTime[1] = str_to_num(Minute)+get_pcvar_num(Cvar_RTVMinute);
    
RTVTime[0] = str_to_num(Second);
    
    if(
RTVTime[1] >= 60)
    {
        
RTVTime[1] -= 60;
        
RTVTime[2]++;
    }
}
public 
plugin_end()
{
    
set_localinfo("lastMap"MapName);
}
public 
AdvTime()
{
    
print_color(0"%s %L"PrefixLang"ADV"PLUGINVERSION);
}
public 
RestartRound() {
    if(
get_pcvar_num(Cvar_Mod) == 1)
        
server_cmd("mp_timelimit %d"TimeLimit);
    else
    {
        
server_cmd("mp_maxrounds %d"get_cvar_num("mp_maxrounds")+oRounds+Rounds);
        
MaxRounds oRounds+Rounds;
    }
    
    
remove_task(MapID+8123);
    
remove_task(MapID+1);
    
remove_task(MapID+211);
    
remove_task(MapID+2);
    
remove_task(MapID+3);
    
remove_task(MapID+33);
    
NeedRV false;
    
ChangeMap false;
    
Begined false;
    
BeginCounter 0;
    
MapCounter 0;
    
Voted false;
    
Revoted false;
    
inProcess false;
    
AllVotes 0;
    
AllRevotes 0;
    
Started 0;
    
    new 
Num;
    
    for(
Num 0Num 32Num++)
    {
        if(!
is_user_connected(Num))
        {
            continue;
        }
        
        
AlreadyNom[Num] = false;
        
PlayerMap[Num] = 0;
        
PlayerVoted[Num] = false;
        
PlayerRevoted[Num] = false;
    }
    
    for(
Num 0Num NomNum++)
    {
        
NomMaps[Num] = "";
    }
    
    for(
Num 0Num MaxNum++)
    {
        
Nomed[Num] = 0;
    }
    
    for(
Num 0Num get_pcvar_num(Cvar_MaxMaps); Num++)
    {
        
MapNames[Num] = "";
        
MapVote[Num] = 0;
    }
    
    
RTV 0;
    
Nom 0;
    
LoadVoteMaps();
    
LoadNomMaps();
    
Next "";
    
set_task(get_pcvar_float(Cvar_MenuDestroyTime)+1.0"VotedMapN"MapID+777);
    
SavePresentTime();
}
public 
NewRound() {
    if(
get_pcvar_num(Cvar_Mod) == 1)
    {
        if(
ChangeMap)
        {
            if(
isValidMap(Next))
            {
                
ChangeLevel();
            }
        }
    }
    else if(
get_pcvar_num(Cvar_Mod) == 0)
    {
        if(
>= MaxRounds-Rounds)
        {
            if(
ChangeMap)
            {
                if(
isValidMap(Next))
                {
                    
ChangeLevel();
                }
            }
        }
    }
}
public 
RoundEnd()
{
    if(
MaxRounds-Rounds && Started == 1)
    {
        
Rounds++;
    }
    if(
Started == 0)
    {
        
Started 1;
    }
}
public 
StartVote(id)
{
    if(
get_user_flags(id) & StartVoteFlag)
    {
        if(!
inProcess || !Voted || !Revoted || !ChangeMap || Off == || !Begined)
        {
            
NeedRV false;
            new 
String[32];
            
float_to_str(get_pcvar_float(Cvar_WaitVoteMenuTime), String2);
            
replace_all(String2".""");
            
Begined true;
            
inProcess true;
            
            if(
get_pcvar_num(Cvar_Mod) == 1)
            {
                
server_cmd("mp_timelimit 0");
            }
            else if(
get_pcvar_num(Cvar_Mod) == 0)
            {
                
Rounds MaxRounds;
            }
            
            
VoteMod 2;
            
            if(
get_pcvar_num(Cvar_HudMod) == 1)
            {
                
remove_task(MapID+8123);
                
BeginCounter str_to_num(String);
                
VoteCounter();
            }
            else if(
get_pcvar_num(Cvar_HudMod) == 0)
            {
                
set_task(get_pcvar_float(Cvar_WaitVoteMenuTime), "StartMapChooser"MapID+3);
                
set_hudmessage(RGB, -1.00.2006.0get_pcvar_float(Cvar_WaitVoteMenuTime));
                
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE2"String);
            }
        }
    }
}
public 
VoteCounter()
{
    if(
BeginCounter 0)
    {
        new 
String[32];
        
num_to_str(BeginCounterString2);
        
        if(
get_pcvar_num(Cvar_CountSound) == 1)
        {
            new 
CountSound[32];
            
num_to_word(BeginCounterCountSound31);
            
            if(
get_pcvar_num(Cvar_VoteSound) == 1)
                
client_cmd(0"spk ^"fvox/%s^""CountSound);
        }
        
        
set_hudmessage(RGB, -1.00.2000.1CHUD);
        
        if(
VoteMod == 4)
        {
            
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE4"String);
        }
        else if(
VoteMod == 3)
        {
            
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE3"String);
        }
        else if(
VoteMod == 2)
        {
            
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE2"String);
        }
        else if(
VoteMod == 1)
        {
            
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE1"String);
        }
        
        
BeginCounter--;
        
set_task(1.0"VoteCounter"MapID+8123);
    }
    else
    {
        if(
NeedRV)
        {
            
StartRevote();
        }
        else
        {
            
StartMapChooser();
        }
    }
}
public 
RockTheVote(id)
{
    new 
Hour[32], Minute[32], Time[2];
    
format_time(Hoursizeof Hour 1"%H");
    
format_time(Minutesizeof Minute 1"%M");
    
Time[0] = str_to_num(Hour);
    
Time[1] = str_to_num(Minute);
    
    if(
Time[0] > RTVTime[2]
    || 
Time[0] == RTVTime[2] && Time[1] >= RTVTime[1])
    
toRTV true;
    
    if(
PlayerRTV[id] || Voted || inProcess || !toRTV || Off == 1)
    {
        if(!
toRTV)
        {
            if(
RTVTime[2] > Time[0])
            {
                
print_color(id"%s %L"PrefixLang"RTV2", (RTVTime[1]+60)-Time[1]);
            }
            else
            {
                
print_color(id"%s %L"PrefixLang"RTV2"RTVTime[1]-Time[1]);
            }
        }
        
        if(
PlayerRTV[id])
        {
            
print_color(id"%s %L"PrefixLang"RTV1");
        }
        
        return 
PLUGIN_HANDLED;
    }
    
    
PlayerRTV[id] = true;
    
RTV++;
    
    new 
Players[32], Num;
    
get_players(PlayersNum"c");
    
    if(
RTV >= Num/get_pcvar_num(Cvar_RTVMin))
    {
        new 
String[32];
        
float_to_str(get_pcvar_float(Cvar_WaitVoteMenuTime), String2);
        
replace_all(String2".""");
        
Begined true;
        
inProcess true;
        
        if(
get_pcvar_num(Cvar_Mod) == 1)
        {
            
server_cmd("mp_timelimit 0");
        }
        else if(
get_pcvar_num(Cvar_Mod) == 0)
        {
            
Rounds MaxRounds;
        }
        
        
VoteMod 1;
        
        if(
get_pcvar_num(Cvar_HudMod) == 1)
        {
            
remove_task(MapID+8123);
            
BeginCounter str_to_num(String);
            
VoteCounter();
        }
        else if(
get_pcvar_num(Cvar_HudMod) == 0)
        {
            
set_task(get_pcvar_float(Cvar_WaitVoteMenuTime), "StartMapChooser"MapID+3);
            
set_hudmessage(RGB, -1.00.2006.0get_pcvar_float(Cvar_WaitVoteMenuTime));
            
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE1"String);
        }
    }
    else
    {
        
print_color(0"%s %L"PrefixLang"RTV3", (Num/get_pcvar_num(Cvar_RTVMin))-RTV);
    }
    
    return 
PLUGIN_HANDLED;
}
public 
Extend()
{
    
NeedRV false;
    
ChangeMap false;
    
Begined false;
    
Voted false;
    
Revoted false;
    
inProcess false;
    
AllVotes 0;
    
AllRevotes 0;
    
    new 
Num;
    
    for(
Num 0Num 32Num++)
    {
        if(!
is_user_connected(Num))
        {
            continue;
        }
        
        
AlreadyNom[Num] = false;
        
PlayerMap[Num] = 0;
        
PlayerVoted[Num] = false;
        
PlayerRevoted[Num] = false;
    }
    
    for(
Num 0Num NomNum++)
    {
        
NomMaps[Num] = "";
    }
    
    for(
Num 0Num MaxNum++)
    {
        
Nomed[Num] = 0;
    }
    
    for(
Num 0Num get_pcvar_num(Cvar_MaxMaps); Num++)
    {
        
MapNames[Num] = "";
        
MapVote[Num] = 0;
    }
    
    
RTV 0;
    
Nom 0;
    
LoadVoteMaps();
    
LoadNomMaps();
    
Next "";
    
set_task(get_pcvar_float(Cvar_MenuDestroyTime)+1.0"VotedMapN"MapID+777);
}
public 
VotedMapN()
{
    
VotedMap "";
}
public 
CheckTime()
{
    static 
Time[3];
    
Time[0] = get_timeleft();
    
Time[1] = Time[0] / 60;
    
Time[2] = Time[1] / 60;
    
Time[0] = Time[0] - Time[1] * 60;
    
Time[1] = Time[1] - Time[2] * 60;
    
    if(
get_pcvar_num(Cvar_Mod) == 1)
    {
        if(
Time[1] <= get_pcvar_num(Cvar_VoteVariable) && !Begined && !inProcess)
        {
            new 
String[32];
            
float_to_str(get_pcvar_float(Cvar_WaitVoteMenuTime), String2);
            
replace_all(String2".""");
            
            
VoteMod 3;
            
            if(
get_pcvar_num(Cvar_HudMod) == 1)
            {
                
remove_task(MapID+8123);
                
BeginCounter str_to_num(String);
                
VoteCounter();
            }
            else if(
get_pcvar_num(Cvar_HudMod) == 0)
            {
                
set_task(get_pcvar_float(Cvar_WaitVoteMenuTime), "StartMapChooser"MapID+3);
                
set_hudmessage(RGB, -1.00.2006.0get_pcvar_float(Cvar_WaitVoteMenuTime));
                
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE3"String);
            }
        
            
Begined true;
            
inProcess true;
        }
    
        if(
Time[0] <= && Time[1] == && Time[2] == 0)
        {
            
server_cmd("mp_timelimit 0");
            if(!
ChangeMap && Voted && !inProcess && !Revoted
            
|| !ChangeMap && Revoted && !inProcess && !Voted)
            {
                if(
get_pcvar_num(Cvar_OnlyNextRound) == 1)
                {
                    
print_color(0"%s %L"PrefixLang"MCAR");
                    
set_cvar_string("amx_nextmap"Next);
                    
ChangeMap true;
                }
                else if(
get_pcvar_num(Cvar_OnlyNextRound) == 0)
                {
                    
ChangeMap true;
                    
set_cvar_string("amx_nextmap"Next);
                    
ChangeLevel();
                }
            }
        }
    }
    else if(
get_pcvar_num(Cvar_Mod) == 0)
    {
        if(
Rounds == MaxRounds-get_pcvar_num(Cvar_VoteVariable) && !Begined && !inProcess)
        {
            new 
String[32];
            
float_to_str(get_pcvar_float(Cvar_WaitVoteMenuTime), String2);
            
replace_all(String2".""");
            
            
VoteMod 3;
            
            if(
get_pcvar_num(Cvar_HudMod) == 1)
            {
                
remove_task(MapID+8123);
                
BeginCounter str_to_num(String);
                
VoteCounter();
            }
            else if(
get_pcvar_num(Cvar_HudMod) == 0)
            {
                
set_task(get_pcvar_float(Cvar_WaitVoteMenuTime), "StartMapChooser"MapID+3);
                
set_hudmessage(RGB, -1.00.2006.0get_pcvar_float(Cvar_WaitVoteMenuTime));
                
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE3"String);
            }
            
            
Begined true;
            
inProcess true;
        }
        
        if(
Rounds >= MaxRounds && !ChangeMap && Voted
        
|| Rounds >= MaxRounds && !ChangeMap && Revoted)
        {
            
print_color(0"%s %L"PrefixLang"MCAR");
            
set_cvar_string("amx_nextmap"Next);
            
ChangeMap true;
        }
    }
    
    if(!
toRTV)
    {
        new 
Hour[32], Minute[32];
        
format_time(Hoursizeof Hour 1"%H");
        
format_time(Minutesizeof Minute 1"%M");
        
Time[2] = str_to_num(Hour);
        
Time[1] = str_to_num(Minute);
        
        if(
RTVTime[2] == Time[2] && RTVTime[1]+get_pcvar_num(Cvar_RTVMinute) <= Time[1])
        {
            
toRTV true;
        }
    }
}
public 
StartMapChooser()
{
    
remove_task(MapID+3);
    
ChangeMap false;
    
Voted false;
    
Revoted false;
    
MapCounter get_pcvar_num(Cvar_VoteCounter);
    
Counter();
    
VoteMod 0;
    if(
get_pcvar_num(Cvar_VoteSound) == 1)
    {
        
client_cmd(0"spk Gman/Gman_Choose%i"random_num(12));
    }
}
public 
Change()
{
    if(
ChangeMap)
    {
        
server_cmd("changelevel ^"%s^""Next);
    }
}
public 
ShowInfo(id)
{
    if(
get_user_flags(id) & InfoFlag)
    {
        
client_print(idprint_console"* ------------");
        
client_print(idprint_console"* %s - v%s *"PLUGINVERSION);
        
client_print(idprint_console"* ------------");
        
client_print(idprint_console"* Last map: %s"LastMap);
        
client_print(idprint_console"* Next map: %s"Next);
        
client_print(idprint_console"* Total maps: %d"NomNum);
        
client_print(idprint_console"* ------------");
        
client_print(idprint_console"* Original timeleft: %d"TimeLimit);
        
client_print(idprint_console"* Max Rounds: %d"oRounds);
        
client_print(idprint_console"* ------------");
        
client_print(idprint_console"* Total played count: %d"PlayedCount);
        
client_print(idprint_console"* ------------");
    }
}
public 
ShowTimeLeft()
{
    if(
get_pcvar_num(Cvar_Mod) == 1)
    {
        static 
Time[3];
        
Time[0] = get_timeleft();
        
Time[1] = Time[0] / 60;
        
Time[2] = Time[1] / 60;
        
Time[0] = Time[0] - Time[1] * 60;
        
Time[1] = Time[1] - Time[2] * 60;
        if(
ChangeMap && Voted && Begined && !Revoted || ChangeMap && Revoted && Begined && !Voted)
        {
            
print_color(0"%s!y %L!t !t-!y:!t-"PrefixLang"TL");
        }
        else
        {
            if(
Time[2] > && Time[1] > && Time[0] > 0)
                
print_color(0"%s!y %L!t %d%!y:!t%02d!y:!t%02d"PrefixLang"TL"Time[2], Time[1], Time[0]);
            else if(
Time[1] > && Time[0] > 0)
                
print_color(0"%s!y %L!t %02d!y:!t%02d"PrefixLang"TL"Time[1], Time[0]);
            else
                
print_color(0"%s!y %L!t !t-!y:!t-"PrefixLang"TL");
        }
    }
    else if(
get_pcvar_num(Cvar_Mod) == 0)
    {
        
print_color(0"%s!t %L"PrefixLang"RM"MaxRounds-Rounds);
    }
}
public 
ShowNextMap()
{
    new 
Status[2][32];
    
formatex(Status[0], 31"%L"Lang"NYT");
    
formatex(Status[1], 31"%L"Lang"VIP");
    if(
isValidMap(Next))
    
print_color(0"%s!y %L!t %s"PrefixLang"NM"Next);
    else
    {
        if(
inProcess)
        {
            
print_color(0"%s!y %L!t %s"PrefixLang"NM"Status[1]);
        }
        else
        {
            
print_color(0"%s!y %L!t %s"PrefixLang"NM"Status[0]);
        }
    }
}
public 
ShowCurrentMap()
{
    
print_color(0"%s!y %L"PrefixLang"CM"MapName);
}
public 
Counter()
{
    if(
MapCounter 1)
    {
        
Voted true;
        
        
inProcess false;
        
        
CheckVotes();
        
        for(new 
NumNum 32Num++)
        {
            if(!
is_user_connected(Num))
                continue;
                
            
ShowVoteMenu(Num);
        }
    }
    else
    {
        
MapCounter--;
        
        
set_task(1.0"Counter"MapID+1);
        
        for(new 
NumNum 32Num++)
        {
            if(!
is_user_connected(Num))
                continue;
                
            
ShowVoteMenu(Num);
        }
    }
}
public 
NextMap()
{
    
remove_task(MapID-4);
    
    if(!
NeedRV)
    {
        
ShowNextMap();
    }
    
    
set_task(get_pcvar_float(Cvar_MenuDestroyTime), "DestroyVoteMenu"MapID-4);
}
public 
DestroyVoteMenu()
{
    for(new 
NumNum 32Num++)
    {
        if(!
is_user_connected(Num))
            continue;
            
        
show_menu(Num0"^n"1);
    }
}
public 
ShowVoteMenu(id)
{    
    if(
equal(VotedMapMapName))
    {
        
DestroyVoteMenu();
        return;
    }
    
    new 
Menu[512], String[128], KeyMapPercent[MaxChoice];
    
    
AllVotes 0;
    
    for(new 
AllAll get_pcvar_num(Cvar_MaxMaps); All++)
    {
        
AllVotes += MapVote[All];
    }
    
    
formatex(String127"%L"Lang"CHONM"AllVotes);
    
add(Menu511String);
    
    for(new 
NumNum get_pcvar_num(Cvar_MaxMaps); Num++)
    {
        if(
MapVote[Num] > 0)
        
MapPercent[Num] = ((MapVote[Num]*100)/(AllVotes));
        if(
equal(MapNameMapNames[Num]))
        
formatex(String127"%L"Lang"MOP5"Num+StartButtonMapNames[Num], MapVote[Num], MapPercent[Num]);
        else
        
formatex(String127"%L"Lang"MOPD"Num+StartButtonMapNames[Num], MapVote[Num], MapPercent[Num]);
        
add(Menu511String);
    }
    
    if(
Voted)
    
formatex(String127"%L"Lang"MNM"Next);
    else if(!
Revoted && !Voted && MapCounter <= && NeedRV)
    
formatex(String127"%L"Lang"MNRE");
    else
    
formatex(String127"%L"Lang"MCSL"MapCounter);
    
    
add(Menu511String);
    
    
Key = (-1^(-1<<(get_pcvar_num(Cvar_MaxMaps)+StartButton)));
    
    
show_menu(idKeyMenu, -1"VoteMenu");
}
public 
VoteMenuKeys(idKey)
{
    if(
PlayerVoted[id] || Voted)
    {
        if(
PlayerVoted[id])
        {
            
print_color(id"%s %L"PrefixLang"AVO");
        }
        return;
    }
    
    if(!
Begined || NeedRV)
    {
        
show_menu(id0"^n"1);
        return;
    }
    
    new 
PlayerName[32];
    
get_user_name(idPlayerName31);
    
    
Key -= StartButton-1;
    if(
Key get_pcvar_num(Cvar_MaxMaps) && Key > -1)
    {
        
PlayerMap[id] = Key;
        
PlayerVoted[id] = true;
        
print_color(0"%s %L"PrefixLang"PCHO"PlayerNameMapNames[Key]);
        
MapVote[Key]++;
        if(
get_pcvar_num(Cvar_ChooseSound) == 1)
        {
            
client_cmd(0"spk buttons/lightswitch2");
        }
    }
    
    
ShowVoteMenu(id);
}
public 
LoadVoteMaps()
{
    new 
Line[128], Map[32], LenUsed[Max], LoadedFileFound;
    
    
File fopen(MapCycle"rt");
    
    if(
File)
    {
        
        for(new 
lNumlNum MaxlNum++)
        {
            
Found 0;
            
            new 
RandomMap random(MapCycle_Lines);
            
read_file(MapCycleRandomMapLine127Len);
            
            
parse(LineMap31);
            
            for(new 
mcmc MaxChoicemc++)
            {
                if(
equali(MapMapNames[mc]))
                {
                    
Found 1;
                }
            }
            
            if(
Found == || equali(MapMapName))
            {
                continue;
            }
            
            if(
Used[RandomMap] == && Loaded get_pcvar_num(Cvar_MaxMaps)-&& isValidMap(Map))
            {
                
Used[RandomMap] = 1;
                
copy(MapNames[Loaded], sizeof Map 1Map);
                
Loaded++;
            }
        }
        
    }
    
    
fclose(File);
    
    
MapNames[get_pcvar_num(Cvar_MaxMaps)-1] = MapName;
    
set_task(0.1"LoadNomMaps"MapID+69);
}
public 
LoadNomMaps()
{
    new 
Line[128], Map[32], FileFound;
    
    
File fopen(MapCycle"rt");
    
    while(!
feof(File))
    {
        
fgets(FileLinecharsmax(Line));
            
        
parse(LineMap31);
        
        for(new 
nnnn NomNumnn++)
        {
            if(
equali(MapNomMaps[nn]))
            {
                
Found 1;
            }
        }
        
        if(
Found == 1)
        {
            continue;
        }
        
        if(
NomNum MapCycle_Lines && isValidMap(Map))
        {
            
copy(NomMaps[NomNum], sizeof Map 1Map);
            
NomNum++;
        }
    }
    
    
fclose(File);
}
public 
ShowMapMenu(id)
{
    new 
MenuMenuLine[128], MapDatas[2][32], String[32];
    
formatex(MenuLine127"%L"Lang"MPNM");
    
Menu menu_create(MenuLine"MapKey");
    
    for(new 
MapNumMapNum MapFile_Lines-1MapNum++)
    {
        
parse(Maps[MapNum], MapDatas[0], 31MapDatas[1], 31);
        
formatex(MenuLine127"%L"Lang"PMPM"MapDatas[0], MapDatas[1]);
        
num_to_str(MapNumString2);
        
menu_additem(MenuMenuLineString);
    }
    
    
formatex(MenuLine127"%L"Lang"MNEXT");
    
menu_setprop(MenuMPROP_NEXTNAMEMenuLine);
    
formatex(MenuLine127"%L"Lang"MEXIT");
    
menu_setprop(MenuMPROP_EXITNAMEMenuLine);
    
formatex(MenuLine127"%L"Lang"MBACK");
    
menu_setprop(MenuMPROP_BACKNAMEMenuLine);
    
menu_setprop(MenuMPROP_PERPAGEPMPage);
    
menu_display(idMenu);
}
public 
MapKey(idMenuItem)
{
    new 
MenuNum[2], Data[2][32], Key;
    
menu_item_getinfo(MenuItemMenuNum[0], Data[0], charsmax(Data), Data[1], charsmax(Data), MenuNum[1]);
    
    
Key str_to_num(Data[0]);
    
    if(
Item == MENU_EXIT)
    {
        
menu_destroy(Menu);
        return;
    }
    
    new 
MapDatas[2][32];
    
parse(Maps[Key], MapDatas[0], 31MapDatas[1], 31);
    
    
print_color(id"%s %L"PrefixLang"MNP"MapDatas[0], MapDatas[1]);
}
public 
ShowNomMenu(id)
{    
    if(
Nom >= get_pcvar_num(Cvar_MaxMaps)-1)
    {
        
print_color(id"%s %L"PrefixLang"NOMT");
        return;
    }
    if(
AlreadyNom[id])
    {
        
print_color(id"%s %L"PrefixLang"NOMN");
        return;
    }
    if(
inProcess || Voted || Revoted)
    {
        return;
    }
    
    new 
MenuMenuLine[128], Already;
    
formatex(MenuLine127"%L"Lang"NOMM");
    
Menu menu_create(MenuLine"NomKey");
    
    for(new 
MapNumMapNum MapCycle_LinesMapNum++)
    {
        if(
Nomed[MapNum] == 1)
            continue;
            
        
Already 0;
        
        for(new 
mcmc MaxChoicemc++)
        {
            if(
equali(NomMaps[MapNum], MapNames[mc]))
            {
                
Already 1;
            }
        }
        
        if(
Already == 1)
            continue;
            
        if(
equali(NomMaps[MapNum], MapName))
            continue;
            
        if(!
isValidMap(NomMaps[MapNum]))
            continue;
        
        
formatex(MenuLine127"%L"Lang"NOM1"NomMaps[MapNum]);
        
menu_additem(MenuMenuLineNomMaps[MapNum]);
    }
    
    
formatex(MenuLine127"%L"Lang"MNEXT");
    
menu_setprop(MenuMPROP_NEXTNAMEMenuLine);
    
formatex(MenuLine127"%L"Lang"MEXIT");
    
menu_setprop(MenuMPROP_EXITNAMEMenuLine);
    
formatex(MenuLine127"%L"Lang"MBACK");
    
menu_setprop(MenuMPROP_BACKNAMEMenuLine);
    
menu_display(idMenu);
}
public 
NomKey(idMenuItem)
{
    if(
Nom get_pcvar_num(Cvar_MaxMaps)-1)
    {
        
print_color(id"%s %L"PrefixLang"NOMT");
        return 
PLUGIN_HANDLED;
    }
    if(
AlreadyNom[id])
    {
        
print_color(id"%s %L"PrefixLang"NOMN");
        return 
PLUGIN_HANDLED;
    }
    if(
inProcess || Voted)
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
MenuNum[2], Data_1[32], Data_2[32], PlayerName[32];
    
menu_item_getinfo(MenuItemMenuNum[0], Data_1charsmax(Data_1), Data_2charsmax(Data_2), MenuNum[1]);
    
    if(
Item == MENU_EXIT)
    {
        
menu_destroy(Menu);
        return 
PLUGIN_HANDLED;
    }
            
    new 
Already 0;

    for(new 
mcmc MaxChoicemc++)
    {
        if(
equali(Data_1MapNames[mc]))
        {
            
Already 1;
        }
    }
    
    if(
Already == || !isValidMap(Data_1) || Nomed[Nom] == 1)
    return 
PLUGIN_HANDLED;
    
    
get_user_name(idPlayerNamecharsmax(PlayerName));
    
    
print_color(0"%s %L"PrefixLang"NOMC"PlayerNameData_1);
    
    if(
get_pcvar_num(Cvar_NomChance) >= (random_num(1,100)))
    {
        
MapNames[Nom] = Data_1;
    }
    
    
MapNames[Nom] = Data_1;
    
Nomed[Nom] = 1;
    
Nom++;
    
AlreadyNom[id] = true;
    
    return 
PLUGIN_HANDLED;
}
public 
LoadMapMenu()
{
    new 
Line[64], FileLen;
    
    
File fopen(MapFile"rt");
    
    if(
File)
    {
        for(new 
MapNumMapNum MapFile_LinesMapNum++)
        {
            
read_file(MapFileMapNumLine63Len);
            
            if(
Line[0] == ';' || strlen(Line) < 2)
                continue;
                
            
remove_quotes(Line);
            
            
copy(Maps[MapNum], sizeof Line 1Line);
        }
    }
    
    
fclose(File);
}
public 
LoadMaps()
{
    
remove_task(MapID);
    
    new 
Line[64], FileMapDatas[2][32], LineNumMapNumbool:Found;
    
File fopen(MapFile"rt");
    
    while(!
feof(File))
    {
        
fgets(FileLinecharsmax(Line));
        
        if(
Line[0] == ';' || strlen(Line) < 2)
            continue;
            
        
parse(LineMapDatas[0], 31MapDatas[1], 31);
        
        
PlayedCount += str_to_num(MapDatas[1]);
        
        if(
equal(MapDatas[0], MapName))
        {
            
MapNum str_to_num(MapDatas[1])+1;
            
format(Linesizeof Line 1"^"%s^" ^"%d^""MapNameMapNum);
            
write_file(MapFileLineLineNum);
            
Found true;
        }
        
        
LineNum++;
    }
    
    
fclose(File);
    
    if(!
Found)
    {
        
NewMap();
    }
    
    
set_task(0.5"LoadMapMenu"MapID);
}
public 
NewMap()
{
    new 
Line[32], File;
    
File fopen(MapFile"at+");
    
formatex(Linesizeof Line 1"^"%s^" ^"%d^"^n"MapName1);
    
fprintf(FileLine);
    
fclose(File);
}
public 
StartRevoteTime() 
{
    new 
String[32];
    
float_to_str(get_pcvar_float(Cvar_WaitRevoteMenuTime), String2);
    
replace_all(String2".""");
    
VoteMod 4;
    if(
get_pcvar_num(Cvar_HudMod) == 1)
    {
        
remove_task(MapID+8123);
        
BeginCounter str_to_num(String);
        
VoteCounter();
    }
    else if(
get_pcvar_num(Cvar_HudMod) == 0)
    {
        
set_task(get_pcvar_float(Cvar_StartRevoteTime), "StartRevote"MapID+33);
        
set_hudmessage(RGB, -1.00.2006.0get_pcvar_float(Cvar_WaitVoteMenuTime));
        
ShowSyncHudMsg(0sHudObj"%L"Lang"VOTE4"String);
    }
    
    
inProcess true;
}
public 
StartRevote() 
{
    
Voted false;
    
Begined true;
    
MapCounter get_pcvar_num(Cvar_VoteCounter);
    
ReCounter();
    if(
get_pcvar_num(Cvar_VoteSound) == 1)
        
client_cmd(0"spk Gman/Gman_Choose%i"random_num(12));
}
public 
ShowRevoteMenu(id)
{
    if(
equal(VotedMapMapName))
    {
        
DestroyVoteMenu();
        return;
    }
    
    new 
Menu[512], String[128], KeyMapPercent[MaxChoice];
    
    
AllRevotes 0;
    
    for(new 
AllAll 2All++)
    {
        
AllRevotes += RevoteCounts[All];
    }
    
    
formatex(String127"%L"Lang"CHONM"AllRevotes);
    
add(Menu511String);
    
    for(new 
NumNum 2Num++)
    {
        if(
RevoteCounts[Num] > 0)
        
MapPercent[Num] = ((RevoteCounts[Num]*100)/(AllRevotes));
        
formatex(String127"%L"Lang"MOPD"Num+StartButtonMapRevote[Num], RevoteCounts[Num], MapPercent[Num]);
        
add(Menu511String);
    }
    
    if(!
Revoted)
    
formatex(String127"%L"Lang"MCSL"MapCounter);
    else
    
formatex(String127"%L"Lang"MNM"Next);
    
    
add(Menu511String);
    
    
Key = (-1^(-1<<(1+StartButton)));
    
    
show_menu(idKeyMenu, -1"RevoteMenu");
}
public 
RevoteMenuKeys(idKey)
{
    if(
PlayerRevoted[id] || Revoted)
    {
        if(
PlayerVoted[id])
            
print_color(id"%s %L"PrefixLang"AVO");
        
        
ShowRevoteMenu(id);
        return;
    }
    
    if(!
Begined)
    {
        
show_menu(id0"^n"1);
        return;
    }
    
    new 
PlayerName[32];
    
get_user_name(idPlayerName31);
    
    
Key -= StartButton-1;
    
    if(
Key <= && Key > -1)
    {
        
PlayerMap[id] = Key;
        
PlayerRevoted[id] = true;
        
print_color(0"%s %L"PrefixLang"PCHO"PlayerNameMapRevote[Key]);
        
RevoteCounts[Key]++;
        if(
get_pcvar_num(Cvar_ChooseSound) == 1)
        {
            
client_cmd(0"spk buttons/lightswitch2");
        }
    }
    
    
ShowRevoteMenu(id);
}
public 
ReCounter()
{
    if(
MapCounter 1)
    {
        
Revoted true;
        
        
inProcess false;
        
        
CheckRevotes();
        
        for(new 
NumNum 32Num++)
        {
            if(!
is_user_connected(Num))
                continue;
                
            
ShowRevoteMenu(Num);
        }
    }
    else
    {
        
MapCounter--;
        
        
set_task(1.0"ReCounter"MapID+211);
        
        for(new 
NumNum 32Num++)
        {
            if(!
is_user_connected(Num))
                continue;
                
            
ShowRevoteMenu(Num);
        }
    }
}
public 
client_disconnect(id)
{
    if(
PlayerRTV[id])
    {
        
RTV--;
        
PlayerRTV[id] = false;
    }
    
    if(
PlayerVoted[id])
    {
        
MapVote[PlayerMap[id]]--;
        
PlayerVoted[id] = false;
    }
    
    if(
PlayerRevoted[id])
    {
        
RevoteCounts[PlayerMap[id]]--;
        
PlayerRevoted[id] = false;
    }
    
    
PlayerMap[id] = 0;
    
}
stock ChangeLevel()
{
    
set_task(get_pcvar_float(Cvar_ChangeSpeed), "Change"MapID+2);
    
message_begin(MSG_ALLSVC_INTERMISSION);
    
message_end();
}
stock print_color(const id, const input[], any:...)
{
    new 
Count 1Players[32];
    static 
Msg[191];
    
vformat(Msg190input3);
    
    
replace_all(Msg190"!g""^4");
    
replace_all(Msg190"!y""^1");
    
replace_all(Msg190"!t""^3");

    if(
idPlayers[0] = id; else get_players(PlayersCount"ch");
    {
        for (new 
0Counti++)
        {
            if (
is_user_connected(Players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLESayText_Players[i]);
                
write_byte(Players[i]);
                
write_string(Msg);
                
message_end();
            }
        }
    }
    return 
PLUGIN_HANDLED;
}
stock CheckVotes() {
    
    if(
AllVotes == 0)
    {
        
Revoted false;
        
Next MapNames[0];
        
set_cvar_string("amx_nextmap"Next);
        
NextMap();
        return 
PLUGIN_HANDLED;
    }
    
    new 
VoteNum_1 0;
    
    for(new 
Num 0Num get_pcvar_num(Cvar_MaxMaps); ++Num)
    {
        if(
MapVote[VoteNum_1] < MapVote[Num])
        {
            
VoteNum_1 Num;
        }
    }
    
    if((
MapVote[VoteNum_1]*100/AllVotes) >= get_pcvar_num(Cvar_VotePercentMin))
    {
        
Revoted false;
        
Next MapNames[VoteNum_1];
        
VotedMap Next;
        
set_cvar_string("amx_nextmap"Next);
        
        if(
get_pcvar_num(Cvar_Mod) == 1)
        {
            if(
equali(NextMapName))
            {
                new 
Hour[32], Minute[32], Second[32], pTime[3];
                
format_time(Hoursizeof Hour 1"%H");
                
format_time(Minutesizeof Minute 1"%M");
                
format_time(Secondsizeof Second 1"%S");
                
pTime[0] = str_to_num(Second);
                
pTime[1] = str_to_num(Minute);
                
pTime[2] = str_to_num(Hour);
                
                
pTime[1] = pTime[1] - ElapsedTime[1];
                
                if(
pTime[0] >= ElapsedTime[0])
                    
pTime[0] = pTime[0] - ElapsedTime[0];
                else
                {
                    
pTime[0] = pTime[0]+60 ElapsedTime[0];
                    
pTime[1]--;
                }
                
                if(
pTime[2] == ElapsedTime[2])
                
server_cmd("mp_timelimit %d.%02d"get_pcvar_num(Cvar_Extend)+pTime[1], pTime[0]);
                else
                
server_cmd("mp_timelimit %d.%02d", (get_pcvar_num(Cvar_Extend)+pTime[1])+(60*(pTime[2]-ElapsedTime[2])), pTime[0]);
                
                
print_color(0"%s %L"PrefixLang"MEXTEND1"get_pcvar_num(Cvar_Extend));
                
                
Extend();
            }
        }
        else if(
get_pcvar_num(Cvar_Mod) == 0)
        {
            if(
equali(NextMapName))
            {
                
print_color(0"%s %L"PrefixLang"MEXTEND2"get_pcvar_num(Cvar_Extend));
                
server_cmd("mp_maxrounds ^"%d^""get_pcvar_num(Cvar_Extend)+oRounds+Rounds);
                
                
MaxRounds get_pcvar_num(Cvar_Extend)+(MaxRounds-Rounds);
                
Rounds 0;
                
                
Extend();
            }
        }
    }
    else
    {
        
NeedRV true;
        
Voted false;
        
        
MapVote[VoteNum_1] = -MapVote[VoteNum_1];
        
        new 
VoteNum_1_1 0;

        for(new 
Num 0Num get_pcvar_num(Cvar_MaxMaps); ++Num)
        {
            if(
MapVote[VoteNum_1_1] < MapVote[Num])
            {
                
VoteNum_1_1 Num;
            }
        }
        
        
MapVote[VoteNum_1] = 0-MapVote[VoteNum_1];
        
        
copy(MapRevote[0], 31MapNames[VoteNum_1]);
        
copy(MapRevote[1], 31MapNames[VoteNum_1_1]);
        
        
RevoteCounts[0] = 0;
        
RevoteCounts[1] = 0;
        
        
VoteMod 0;
        
set_task(get_pcvar_float(Cvar_StartRevoteTime), "StartRevoteTime"MapID+3);
        
print_color(0"%s %L"PrefixLang"RER"get_pcvar_num(Cvar_VotePercentMin));
    }    
    
    
NextMap();
    return 
PLUGIN_CONTINUE;
}
stock CheckRevotes() {
    
    if(
AllRevotes == 0)
    {
        
Next MapRevote[0];
        
set_cvar_string("amx_nextmap"Next);
        
NeedRV false;
        
VotedMap Next;
        
NextMap();
        return 
PLUGIN_HANDLED;
    }
    
    new 
VoteNum_1 0;
    
    for(new 
Num 0Num 2; ++Num)
    {
        if(
RevoteCounts[VoteNum_1] < RevoteCounts[Num])
        
VoteNum_1 Num;
    }
    
    
Next MapRevote[VoteNum_1];
    
set_cvar_string("amx_nextmap"Next);
    
NeedRV false;
    
VotedMap Next;
    
    if(
get_pcvar_num(Cvar_Mod) == 1)
    {
        if(
equali(NextMapName))
        {
            new 
Hour[32], Minute[32], Second[32], pTime[3];
            
format_time(Hoursizeof Hour 1"%H");
            
format_time(Minutesizeof Minute 1"%M");
            
format_time(Secondsizeof Second 1"%S");
            
pTime[0] = str_to_num(Second);
            
pTime[1] = str_to_num(Minute);
            
pTime[2] = str_to_num(Hour);
            
            
pTime[1] = pTime[1] - ElapsedTime[1];
            
            if(
pTime[0] >= ElapsedTime[0])
                
pTime[0] = pTime[0] - ElapsedTime[0];
            else
            {
                
pTime[0] = pTime[0]+60 ElapsedTime[0];
                
pTime[1]--;
            }
            
            if(
pTime[2] == ElapsedTime[2])
            
server_cmd("mp_timelimit %d.%02d"get_pcvar_num(Cvar_Extend)+pTime[1], pTime[0]);
            else
            
server_cmd("mp_timelimit %d.%02d", (get_pcvar_num(Cvar_Extend)+pTime[1])+(60*(pTime[2]-ElapsedTime[2])), pTime[0]);
            
            
print_color(0"%s %L"PrefixLang"MEXTEND1"get_pcvar_num(Cvar_Extend));
            
            
Extend();
        }
    }
    else if(
get_pcvar_num(Cvar_Mod) == 0)
    {
        if(
equali(NextMapName))
        {
            
print_color(0"%s %L"PrefixLang"MEXTEND2"get_pcvar_num(Cvar_Extend));
            
server_cmd("mp_maxrounds ^"%d^""get_pcvar_num(Cvar_Extend)+oRounds+Rounds);
            
            
MaxRounds get_pcvar_num(Cvar_Extend)+(MaxRounds-Rounds);
            
Rounds 0;
            
            
Extend();
        }
    }
    
    
NextMap();
    return 
PLUGIN_CONTINUE;
}
stock bool:isValidMap(Map[])
{
    if(
is_map_valid(Map))
    {
        return 
true;
    }
    
    new 
Len strlen(Map) - 4;
    
    if(
Len)
    {
        return 
false;
    }
    
    if(
equali(Map[Len], ".bsp"))
    {
        
Map[Len] = '^0';
        
        if(
is_map_valid(Map))
        {
            return 
true;
        }
    }
    
    return 
false;

El Abuelo Loco is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-01-2020 , 02:04   Re: DeRoiD's Mapchooser v2.33
Reply With Quote #2

If you you have an issue with a plugin that is already on this forum, post in the plugin's own thread. If you have a custom version of a big plugin that you have issues with, attach the .sma file instead of pasting the entire source code.

Have you looked in the original thread to see if anyone else had this issue?
__________________
fysiks 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 10:21.


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