/*********************************************************************
 * Ein mapvote plugin - Version 0.8 beta                             *
 *********************************************************************
 *                                                                   *
 * Name: plugin_rindy_votemap_ger                                    *
 * Author: Rinde (rinde@fiatnox.de)                                  *
 * Released: 05/12/02                                                *
 *                                                                   *
 *                                                                   *
 * Befehle:                                                          *
 *                                                                   *
 * vote_help: Zeigt eine Hilfetext über das Nominierungssystem an    *
 * admin_nominate <map>: Nominiert eine Map                          *
 * admin_startvote [<maps]: Startet eine Nominierungsphase. Optional *
 *                          können Maps übergeben werden. "random"   *
 *                          steht für eine zufällige Map             *
 * admin_randommaps [<#>]: Startet eine Nominierungsphase mit <#>    *
 *                         zufälligen Maps. Wenn keine Zahl gegeben  *
 *                         ist, wird das Maximum verwendet           *
 * admin_cancelvote: Bricht die aktuelle Nominierungsphase ab        *
 * admin_denymap <map>: Die Map darf nicht mehr nominiert werden     *
 * admin_undenymap <map>: Die Map darf wieder nominiert werden       *
 * admin_undenyall: Alle Maps dürfen wieder nominiert werden         *
 * admin_deniedmaps: Zeigt alle Maps, die nicht erlaubt sind         *
 * admin_showstatistic: Zeigt eine liste von meistgewählten Maps an  *
 * admin_nominate_config: Konfiguriert das Plugin. Benutze           *
 *                        "admin_nominate_config help" um herauszu-  *
 *                        finden, wie.                               *
 *                                                                   *
 *                                                                   *
 * Changelog:                                                        *
 *                                                                   *
 * Version 0.8 beta                                                  *
 *                                                                   *
 *  -  Fixed: admin_nominate_config hat 0 nicht erkannt              *
 *  -  Fixed: Bei mp_chattime 0 oder 1 wurde keine Nachricht gezeigt *
 *  -  Diverse Verbesserungen in der Vote- und Vote-Handlingprozedur *
 *                                                                   *
 * Version 0.6 beta                                                  *
 *                                                                   *
 *  -  Erster Release                                                *
 *                                                                   *
 *********************************************************************/

/* Includes */
#include <adminlib>

/* Constants */
#define ACCESS_CONFIGURE 512
#define MAX_MAP_LENGTH 50

/* Global Variables */
new g_Version[50] = "0.8 beta";
new g_Access_Votemap = 0;                   /* Defines what level admin can nominate maps. Must be a power of 2 or 0. */
new g_Access_Startvote = 2;                 /* Defines what level admin can start a vote by nominating a map. Must be a power of 2 or 0. */
new g_Access_Controlvote = 2;               /* Defines what level admin can call/cancel a vote. Must be a power of 2 or 0. */
new g_NominateDuration = 60;                /* Determines how long to allow for more maps to be added in seconds. Must be a positive value. */
new g_Retry_Interval = 10;                  /* If a vote fails due to another vote being called it will retry in this many seconds. Must be a postive value. */
new g_MaxNominations = 5;                   /* The maximum number of maps you will allow to be nominated. Must be a positive value and cannot exceed 8. */
new g_AutoAdd = 1;                          /* Autoadding of random maps on/off. Must be either 0 or 1. */
new g_RememberMaps = 4;                     /* This sets the number of maps it remembers. Must be between 10 and 0. */
new g_DenyMaps = 5;                         /* This is the number of maps that can be denied by admin. Must be between 10 and 0. */
new g_NewMapTime = 300;                     /* This is how many seconds into a map the script will block map votes for. Must be a positive value or 0. */
new g_Consgreet = 1;                        /* Sets whether a consgreet message with instructions is shown on connect. Must be either 1 or 0. */
new g_RepeatFreq = 180;                     /* Defines how many seconds after a vote a new nominating period may be called. Must be a positive value or 0. */
new g_Statistics = 5;                       /* Sets the number of maps that get printed by the statistic function. 0 disables statistics. Must be a positive value or 0. */
new g_Say = 1;                              /* Switches on and off the ability of players to vote maps via the say command. Must be either 1 or 0. */
new g_ShowInterval = 2;                     /* The interval in wich the mapslist gets showed to the users in seconds. Must be a positive value. */
new g_Sounds = 1;                           /* Toggles sound on and off. Must be either 1 or 0. */
new g_NominatePoints = 1;                   /* This is the points a map gets in the statistic for being nominated. */
new g_WinvotePoints = 1;                    /* This is the points a map gets in the statistic for winning a vote. */
new g_Sound_VoteNow[100] = "sound/misc/vote_now.wav";       /* This sound is played when the vote shows up. */
new g_Sound_VoteFailed[100] = "sound/misc/vote_failed.wav"; /* This sound is played when the vote has finished and it failed. */
new g_Sound_VotePassed[100] = "sound/misc/vote_passed.wav"; /* This sound is played when the vote has finished and it succeeded. */
new g_Sound_VoteWarn[100] = "sound/ambience/doorbell.wav";  /* This sound is played shortly before the vote shows up. */

enum Status {
    NotBegun,         /* Nominating period may be called */
    InProgress,       /* Nominating allowed */
    WaitingForResult, /* Nominating not allowed - waiting for vote's result */
    Canceled,         /* Nominating not allowed - was canceled */
    Finished,         /* Nominating not allowed - vote just finished */
    MapStart          /* Nominating not allowed - map just started */
}

new Status:g_VoteStatus = NotBegun;
new g_NominatedMaps[8][MAX_MAP_LENGTH];
new g_NominatedMapsIndex;
new g_Timer;
new g_TimeToNominate;
new g_NominatedMap[MAX_PLAYERS] = {-1,-1,...};
new g_DeniedMaps[10][MAX_MAP_LENGTH];
new g_DeniedMapsIndex;
new g_RememberedMaps[10][MAX_MAP_LENGTH];
new g_timelimit;
new g_extends = 0;
new g_extendoption = 0;
new g_Starttime;

/* Function Declarations */
forward InitializeStatus(Timer,Repeat,HLUserName,HLParam);
forward AutoStartVote(Timer,Repeat,HLUserName,HLParam);
forward HVoteMap(WinningOption,HLData,VoteCount,UserCount);
forward nominate_config(HLCommand,HLData,HLUserName,UserIndex);
forward admin_vote_map(HLCommand,HLData,HLUserName,UserIndex);
forward HLvote(HLCommand,HLData,HLUserName,UserIndex);
forward HandleSay(HLCommand,HLData,HLUserName,UserIndex);
forward admin_startvote(HLCommand,HLData,HLUserName,UserIndex);
forward admin_randommaps(HLCommand,HLData,HLUserName,UserIndex);
forward admin_cancelmapvote(HLCommand,HLData,HLUserName,UserIndex);
forward admin_denymap(HLCommand,HLData,HLUserName,UserIndex);
forward admin_undenymap(HLCommand,HLData,HLUserName,UserIndex);
forward admin_undenyallmaps(HLCommand,HLData,HLUserName,UserIndex);
forward admin_deniedmaps(HLCommand,HLData,HLUserName,UserIndex);
forward admin_showstatistic(HLCommand,HLData,HLUserName,UserIndex);
forward vote_help(HLCommand,HLData,HLUserName,UserIndex);
forward check_map(Map[MAX_MAP_LENGTH],selfmessages);
forward randommap(RandomMap[MAX_MAP_LENGTH]);
forward addmap(Map[MAX_MAP_LENGTH],UserIndex);
forward removemap(MapIndex);
forward startvote();
forward TimerShowMaps(Timer,Repeat,HLUser,HLParam);
forward ShowMaps();
forward VoteOnNominatedMaps();
forward vote_map(Data[MAX_MAP_LENGTH],UserIndex,Name[MAX_NAME_LENGTH]);
forward plugin_help();
forward Statistic(Map[],Value);
forward Sort(Data[2][],iNumber);
forward playsoundall(Sound[]);
forward get_config();

/* Event Handlers */
public plugin_init() {
    new MapsFile[MAX_NAME_LENGTH];
    new i;
    new CurrentMap[MAX_MAP_LENGTH];
    getstrvar("maps_file",MapsFile,MAX_NAME_LENGTH);
    if(strlen(MapsFile) == 0 || strcmp(MapsFile,"0") == 0) getstrvar("mapcyclefile",MapsFile,MAX_NAME_LENGTH);
    strstripquotes(MapsFile);
    if(getvar("file_access_write") == 0) {
        log("[ADMIN] FATAL ERROR, file_access_write is set to 0, should be 1. (plugin_rindy_votemap)");
        plugin_registerinfo("Rinde's map nominating plugin","Disabled, view logs for reason.",g_Version);
    } else if(getvar("file_access_read") == 0) {
        log("[ADMIN] FATAL ERROR, file_access_read is set to 0, should be 1. (plugin_rindy_votemap)");
        plugin_registerinfo("Rinde's map nominating plugin","Disabled, view logs for reason.",g_Version);
    } else if(filesize(MapsFile) < g_MaxNominations + g_DenyMaps + g_RememberMaps + 1) {
        plugin_registerinfo("Rinde's map nominating plugin","Disabled, view logs for reason.",g_Version);
        log("[ADMIN] FATAL ERROR, pool of voteable maps too small, either define maps_file, increase number of voteable maps or decrease g_MaxNominations, g_DenyMaps and g_RememberMaps. (plugin_rindy_votemap)");
    } else {
        plugin_registerinfo("Rinde's map nominating plugin","Allows multiple maps to be nominated.",g_Version);
        get_config();
        plugin_registercmd("admin_nominate_config","nominate_config",ACCESS_CONFIGURE,"admin_nominate_config <key> <value>: Sets configuration variable <key> to <value>.");
        plugin_registercmd("admin_votemap","admin_vote_map",g_Access_Votemap,"admin_votemap <map>: Nominate a map for the vote to change the map.");
        plugin_registercmd("admin_nominate","admin_vote_map",g_Access_Votemap,"admin_nominate <map>: Nominate a map for the vote to change the map.");
        plugin_registercmd("admin_nominatemap","admin_vote_map",g_Access_Votemap,"admin_nominatemap <map>: Nominate a map for the vote to change the map.");
        plugin_registercmd("admin_nominate_map","admin_vote_map",g_Access_Votemap,"admin_nominate_map <map>: Nominate a map for the vote to change the map.");
        plugin_registercmd("votemap","HLvote",ACCESS_ALL,"votemap <x>: command forwarded to admin_votemap. Type vote_help for more information.");
        plugin_registercmd("admin_startvote","admin_startvote",g_Access_Controlvote,"admin_startvote [<maps>]: Starts nominating period. Optionally, include maps. Include ^"random^" for a fixed random map.");
        plugin_registercmd("admin_randommaps","admin_randommaps",g_Access_Controlvote,"admin_randommaps [<x>]: Starts a nominating period with random maps. Optionally include a number of fixed maps.");
        plugin_registercmd("admin_cancelvote","admin_cancelmapvote",g_Access_Controlvote,"admin_cancelvote: Cancels the current map vote/nominating period.");
        plugin_registercmd("admin_denymap","admin_denymap",g_Access_Controlvote,"admin_denymap <map>: Denies a map from being nominated.");
        plugin_registercmd("admin_undenymap","admin_undenymap",g_Access_Controlvote,"admin_undenymap <map>: Undenies a map from being nominated.");
        plugin_registercmd("admin_deniedmaps","admin_deniedmaps",g_Access_Votemap,"admin_deniedmaps: Prints all denied maps.");
        plugin_registercmd("admin_undenyall","admin_undenyallmaps",g_Access_Controlvote,"admin_undenyallmaps: Undenies all maps from being nominated.");
        plugin_registercmd("vote_help","vote_help",g_Access_Votemap,"vote_help: Shows help information about the map nominating plugin.");
        plugin_registercmd("say","HandleSay",ACCESS_ALL,"say vote <map>: Nominates a map for the vote to change the map.");
        plugin_registercmd("admin_showstatistic","admin_showstatistic",g_Access_Votemap,"admin_showstatistic: Shows the top nominated/voted maps.");
        if(fileexists("addons/adminmod/lastmaps.ini") == 0) resetfile("addons/adminmod/lastmaps.ini");
        for(i=0;i<g_RememberMaps;i++) readfile("addons/adminmod/lastmaps.ini",g_RememberedMaps[i],i+1,MAX_MAP_LENGTH);
        resetfile("addons/adminmod/lastmaps.ini");
        for(i=1;i<g_RememberMaps;i++) writefile("addons/adminmod/lastmaps.ini",g_RememberedMaps[i],-1);
        currentmap(CurrentMap,MAX_MAP_LENGTH);
        writefile("addons/adminmod/lastmaps.ini",CurrentMap,-1);
        g_VoteStatus = MapStart;
        g_Timer = set_timer("InitializeStatus",g_NewMapTime,0);
        g_timelimit = getvar("mp_timelimit");
        if(getvar("admin_vote_autostart") == 1) set_timer("AutoStartVote",g_timelimit*60-120-g_NominateDuration,0);
    }
    return PLUGIN_CONTINUE;
}

public plugin_connect(HLUserName,HLIP,UserIndex) {
    new Name[MAX_NAME_LENGTH];
    convert_string(HLUserName,Name,MAX_NAME_LENGTH);
    g_NominatedMap[UserIndex] = -1;
    if(access(g_Access_Votemap,Name) != 0) {
        if(g_Consgreet == 1) {
            plugin_help();
        } else {
            consgreet("Auf diesem server laeuft Rinde's Map-Nominierungs-Plugin statt normalem Voting.");
            consgreet("Um einen Hilfetext ueber die Bedienung anzuzigen, tippe ^"vote_help^" in die console.");
        }
    }
    return PLUGIN_CONTINUE;
}

public plugin_disconnect(HLUserName,UserIndex) {
    new Name[MAX_NAME_LENGTH];
    new Text[MAX_TEXT_LENGTH];
    if(g_NominatedMap[UserIndex] != -1 && g_VoteStatus == InProgress) {
        convert_string(HLUserName,Name,MAX_NAME_LENGTH);
        snprintf(Text, MAX_TEXT_LENGTH,"%s's Nominierung %s wurde entfernt, weil er den Server verlassen hat.",Name,g_NominatedMaps[g_NominatedMap[UserIndex]]);
        say(Text);
        removemap(g_NominatedMap[UserIndex]);
    }
    return PLUGIN_CONTINUE;
}

public InitializeStatus(Timer,Repeat,HLUserName,HLParam) {
    g_VoteStatus = NotBegun;
}

public AutoStartVote(Timer,Repeat,HLUserName,HLParam) {
    if(g_VoteStatus != InProgress && g_VoteStatus != WaitingForResult) {
        g_TimeToNominate = g_NominateDuration;
        startvote();
    } else {
        set_timer("AutoStartVote",g_Retry_Interval,0);
    }
}


public HVoteMap(WinningOption,HLData,VoteCount,UserCount) {
    new Text[MAX_TEXT_LENGTH];
    if(0 < WinningOption <= g_MaxNominations && VoteCount > 0 && g_Statistics > 0) {
        Statistic(g_NominatedMaps[WinningOption-1],g_WinvotePoints);
    }
    if(g_VoteStatus == Canceled) {
        say("Das Abstimmungs-Ergebnis wird ignoriert, weil ein Admin die Abstimmung abgebrochen hat.");
    } else if(WinningOption == 0 || WinningOption == max(g_MaxNominations*g_AutoAdd,g_NominatedMapsIndex)+1+g_extendoption || VoteCount == 0) {
        say("Abstimmung fehlgeschlagen.");
        playsoundall(g_Sound_VoteFailed);
    } else if(max(g_MaxNominations*g_AutoAdd,g_NominatedMapsIndex)+1) {
        snprintf(Text,MAX_TEXT_LENGTH,"Abstimmung erfolgreich: Die aktuelle Map wird um %i minuten verlaengert.",g_timelimit);
        say(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"Erhielt %i von %i Stimmen.",VoteCount,UserCount);
        say(Text);
        playsoundall(g_Sound_VotePassed);
        g_extends++;
        numtostr((g_extends+1)*g_timelimit,Text);
        setstrvar("mp_timelimit",Text);
        if(getvar("admin_vote_autostart") == 1) {
            set_timer("AutoStartVote",g_timelimit*60-g_NominateDuration-20,0);
        }
        if(g_Statistics > 0) {
            currentmap(Text,MAX_MAP_LENGTH);
            Statistic(Text,g_WinvotePoints);
        }
    } else {
        snprintf(Text,MAX_TEXT_LENGTH,"Abstimmung erfolgreich: Die Map wird zu %s gewechselt.",g_NominatedMaps[WinningOption-1]);
        say(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"Erhielt %i von %i Stimmen.",VoteCount,UserCount);
        say(Text);
        playsoundall(g_Sound_VotePassed);
        changelevel(g_NominatedMaps[WinningOption-1],max(1,getvar("mp_chattime")-1));
    }
    if(g_VoteStatus == Canceled) {
        if(g_RepeatFreq > 0) {
            g_VoteStatus = Finished;
            g_Timer = set_timer("InitializeStatus",g_RepeatFreq,1);
        } else {
            g_VoteStatus = NotBegun;
        }
    }
    return PLUGIN_HANDLED;
}


/* Command Handlers */
public nominate_config(HLCommand,HLData,HLUserName,UserIndex) {
    new Data[MAX_DATA_LENGTH];
    new Value[MAX_DATA_LENGTH];
    new Text[MAX_TEXT_LENGTH];
    new i,j;
    convert_string(HLData,Data,MAX_DATA_LENGTH);
    strstripquotes(Data);
    strsep(Data," ",Data,MAX_DATA_LENGTH,Value,MAX_DATA_LENGTH);
    if(strcasecmp(Data,"help") == 0) {
        selfmessage("");
        selfmessage("------------------------------------------------");
        selfmessage("Help for admin_nominate_config");
        selfmessage("");
        selfmessage("Usage: admin_nominate_config <cvar> <value>");
        selfmessage("This will set the configuration variable <cvar>");
        selfmessage("to <value>. The if no value is given, the");
        selfmessage("current value is displayed. The cvar ^"help^"");
        selfmessage("displays this text, the cvar ^"list^"");
        selfmessage("a list of all cvars and ^"view^" the values of");
        selfmessage("all variables.");
        selfmessage("");
    } else if(strcasecmp(Data,"list") == 0) {
        selfmessage("");
        selfmessage("------------------------------------------------");
        selfmessage("Configuration variables list for admin_nominate_config");
        selfmessage("");
        selfmessage("access_nominate: Required accesslevel for nominating a map");
        selfmessage("access_startvote: Required accesslevel for starting a nominating period by making a nomination");
        selfmessage("access_controlvote: Required accesslevel for controling a vote");
        selfmessage("nominate_duration: Time players are allowed to nominate maps");
        selfmessage("show_interval: Interval the maplist gets showed w/o changes");
        selfmessage("retry_interval: If vote fails due to another vote, it will retry in this many seconds");
        selfmessage("repeat_freq: Don't allow nominating period this many seconds into a new map");
        selfmessage("max_nominations: The maximum number of nominations");
        selfmessage("autoadd: Switches autoadding of random maps on/off");
        selfmessage("remember_maps: The plugin will remember this many maps an block nominations");
        selfmessage("deny_maps: Admins can deny nominations for this many maps");
        selfmessage("newmap_time: Don't allow nominating period this many seconds into a new map");
        selfmessage("say: Switch voting via chat on/off");
        selfmessage("consgreet: Switch displaying of help text to connecting clients on/off");
        selfmessage("sounds: Switches sounds on/off");
        selfmessage("statistic_map_number: Number of maps the admin_showstatistic command shows");
        selfmessage("statistic_nominate_points: Statistic points a map gets for beeing nominated");
        selfmessage("statistic_winvote_points: Statistic points a map gets for winning a vote");
        selfmessage("");
        selfmessage("view: View actual configuration");
        selfmessage("");
    } else if(strcasecmp(Data,"view") == 0) {
        selfmessage("");
        selfmessage("------------------------------------------------");
        selfmessage("Configuration data of map nominating plugin");
        selfmessage("");
        snprintf(Text,MAX_TEXT_LENGTH,"access_nominate = %i",g_Access_Votemap);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"access_startvote = %i",g_Access_Startvote);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"access_controlvote = %i",g_Access_Controlvote);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"nominate_duration = %i",g_NominateDuration);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"show_interval = %i",g_ShowInterval);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"retry_interval = %i",g_Retry_Interval);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"repeat_freq = %i",g_RepeatFreq);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"max_nominations = %i",g_MaxNominations);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"autoadd = %i",g_AutoAdd);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"remember_maps = %i",g_RememberMaps);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"deny_maps = %i",g_DenyMaps);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"newmap_time = %i",g_NewMapTime);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"say = %i",g_Say);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"consgreet = %i",g_Consgreet);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"sounds = %i",g_Sounds);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"statistic_map_number = %i",g_Statistics);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"statistic_nominate_points = %i",g_NominatePoints);
        selfmessage(Text);
        snprintf(Text,MAX_TEXT_LENGTH,"statistic_winvote_points = %i",g_WinvotePoints);
        selfmessage(Text);
        selfmessage("");
    } else if(strcasecmp(Data,"access_nominate") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"access_nominate = %i",g_Access_Votemap);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if(i < 0) {
                selfmessage("Wrong syntax, must be a at least 0:");
                selfmessage(Value);
            } else if(i == 0) {
                if(i != g_Access_Votemap) {
                    g_Access_Votemap = i;
                    snprintf(Text,MAX_TEXT_LENGTH,"access_nominate changed to %i",g_Access_Votemap);
                    selfmessage(Text);
                }
            } else {
                for(j=1;j<=131072;j*=2) {
                    if(i == j) {
                        if(i != g_Access_Votemap) {
                            g_Access_Votemap = i;
                            snprintf(Text,MAX_TEXT_LENGTH,"access_nominate changed to %i",g_Access_Votemap);
                            selfmessage(Text);
                        }
                        break;
                    }
                }
            }
            if(j == 262144) {
                selfmessage("Wrong syntax, must be a power of 2 or 0:");
                selfmessage(Value);
            }
        }
    } else if(strcasecmp(Data,"access_startvote") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"access_startvote = %i",g_Access_Startvote);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if(i < 0) {
                selfmessage("Wrong syntax, must be a at least 0:");
                selfmessage(Value);
            } else if(i == 0) {
                if(i != g_Access_Startvote) {
                    g_Access_Startvote = i;
                    snprintf(Text,MAX_TEXT_LENGTH,"access_startvote changed to %i",g_Access_Startvote);
                    selfmessage(Text);
                }
            } else {
                for(j=1;j<=131072;j*=2) {
                    if(i == j) {
                        if(i != g_Access_Startvote) {
                            g_Access_Startvote = i;
                            snprintf(Text,MAX_TEXT_LENGTH,"access_startvote changed to %i",g_Access_Startvote);
                            selfmessage(Text);
                        }
                        break;
                    }
                }
            }
            if(j == 262144) {
                selfmessage("Wrong syntax, must be a power of 2 or 0:");
                selfmessage(Value);
            }
        }
    } else if(strcasecmp(Data,"access_controlvote") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"access_controlvote = %i",g_Access_Controlvote);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if(i == 0) {
                if(i != g_Access_Controlvote) {
                    g_Access_Controlvote = i;
                    snprintf(Text,MAX_TEXT_LENGTH,"access_controlvote changed to %i",g_Access_Controlvote);
                    selfmessage(Text);
                }
            } else {
                for(j=1;j<=131072;j*=2) {
                    if(i == j) {
                        if(i != g_Access_Controlvote) {
                            g_Access_Controlvote = i;
                            snprintf(Text,MAX_TEXT_LENGTH,"access_controlvote changed to %i",g_Access_Controlvote);
                            selfmessage(Text);
                        }
                        break;
                    }
                }
            }
            if(j == 262144) {
                selfmessage("Wrong syntax, must be a power of 2 or 0:");
                selfmessage(Value);
            }
        }
    } else if(strcasecmp(Data,"nominate_duration") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"nominate_duration = %i",g_NominateDuration);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(1,min(i,300))) {
                selfmessage("Wrong syntax, must be between 1 and 300:");
                selfmessage(Value);
            } else if(i != g_NominateDuration) {
                g_NominateDuration = i;
                snprintf(Text,MAX_TEXT_LENGTH,"nominate_duration changed to %i",g_NominateDuration);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"show_interval") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"show_interval = %i",g_ShowInterval);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(1,min(i,30))) {
                selfmessage("Wrong syntax, must be between 1 and 30:");
                selfmessage(Value);
            } else if(i != g_ShowInterval) {
                g_ShowInterval = i;
                snprintf(Text,MAX_TEXT_LENGTH,"show_interval changed to %i",g_ShowInterval);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"retry_interval") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"retry_interval = %i",g_Retry_Interval);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(1,min(i,90))) {
                selfmessage("Wrong syntax, must be between 1 and 90:");
                selfmessage(Value);
            } else if(i != g_Retry_Interval) {
                g_Retry_Interval = i;
                snprintf(Text,MAX_TEXT_LENGTH,"retry_interval changed to %i",g_Retry_Interval);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"repeat_freq") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"repeat_freq = %i",g_RepeatFreq);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,600))) {
                selfmessage("Wrong syntax, must be between 0 and 600:");
                selfmessage(Value);
            } else if(i != g_RepeatFreq) {
                g_RepeatFreq = i;
                snprintf(Text,MAX_TEXT_LENGTH,"repeat_freq changed to %i",g_RepeatFreq);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"max_nominations") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"max_nominations = %i",g_MaxNominations);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(1,min(i,8))) {
                selfmessage("Wrong syntax, must be between 1 and 8:");
                selfmessage(Value);
            } else if(i != g_MaxNominations) {
                g_MaxNominations = i;
                snprintf(Text,MAX_TEXT_LENGTH,"max_nominations changed to %i",g_MaxNominations);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"autoadd") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"autoadd = %i",g_AutoAdd);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,1))) {
                selfmessage("Wrong syntax, must be either 0 or 1:");
                selfmessage(Value);
            } else if(i != g_AutoAdd) {
                g_AutoAdd = i;
                snprintf(Text,MAX_TEXT_LENGTH,"autoadd changed to %i",g_AutoAdd);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"remember_maps") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"remember_maps = %i",g_RememberMaps);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,10))) {
                selfmessage("Wrong syntax, must be between 0 and 10:");
                selfmessage(Value);
            } else if(i != g_RememberMaps) {
                g_RememberMaps = i;
                snprintf(Text,MAX_TEXT_LENGTH,"remember_maps changed to %i",g_RememberMaps);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"deny_maps") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"deny_maps = %i",g_DenyMaps);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,10))) {
                selfmessage("Wrong syntax, must be between 0 and 10:");
                selfmessage(Value);
            } else if(i != g_DenyMaps) {
                g_DenyMaps = i;
                snprintf(Text,MAX_TEXT_LENGTH,"deny_maps changed to %i",g_DenyMaps);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"newmap_time") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"newmap_time = %i",g_NewMapTime);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,600))) {
                selfmessage("Wrong syntax, must be between 0 and 600:");
                selfmessage(Value);
            } else if(i != g_NewMapTime) {
                g_NewMapTime = i;
                snprintf(Text,MAX_TEXT_LENGTH,"newmap_time changed to %i",g_NewMapTime);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"say") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"say = %i",g_Say);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,1))) {
                selfmessage("Wrong syntax, must be either 0 or 1:");
                selfmessage(Value);
            } else if(i != g_Say) {
                g_Say = i;
                snprintf(Text,MAX_TEXT_LENGTH,"say changed to %i",g_Say);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"consgreet") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"consgreet = %i",g_Consgreet);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,1))) {
                selfmessage("Wrong syntax, must be either 0 or 1:");
                selfmessage(Value);
            } else if(i != g_Consgreet) {
                g_Consgreet = i;
                snprintf(Text,MAX_TEXT_LENGTH,"consgreet changed to %i",g_Consgreet);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"sounds") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"sounds = %i",g_Sounds);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,1))) {
                selfmessage("Wrong syntax, must be either 0 or 1:");
                selfmessage(Value);
            } else if(i != g_Sounds) {
                g_Sounds = i;
                snprintf(Text,MAX_TEXT_LENGTH,"sounds changed to %i",g_Sounds);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"statistic_map_number") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"statistic_map_number = %i",g_Statistics);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,10))) {
                selfmessage("Wrong syntax, must be between 0 and 10:");
                selfmessage(Value);
            } else if(i != g_Statistics) {
                g_Statistics = i;
                snprintf(Text,MAX_TEXT_LENGTH,"statistic_map_number changed to %i",g_Statistics);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"statistic_nominate_points") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"statistic_nominate_points = %i",g_NominatePoints);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,5))) {
                selfmessage("Wrong syntax, must be between 0 and 5:");
                selfmessage(Value);
            } else if(i != g_NominatePoints) {
                g_NominatePoints = i;
                snprintf(Text,MAX_TEXT_LENGTH,"statistic_nominate_points changed to %i",g_NominatePoints);
                selfmessage(Text);
            }
        }
    } else if(strcasecmp(Data,"statistic_winvote_points") == 0) {
        if(strlen(Value) == 0) {
            snprintf(Text,MAX_TEXT_LENGTH,"statistic_winvote_points = %i",g_WinvotePoints);
            selfmessage(Text);
        } else if(strspn(Value,"1234567890-") != strlen(Value)) {
            selfmessage("Wrong syntax, must be a number:");
            selfmessage(Value);
        } else {
            i = strtonum(Value);
            if( i != max(0,min(i,5))) {
                selfmessage("Wrong syntax, must be between 0 and 5:");
                selfmessage(Value);
            } else if(i != g_WinvotePoints) {
                g_WinvotePoints = i;
                snprintf(Text,MAX_TEXT_LENGTH,"statistic_winvote_points changed to %i",g_WinvotePoints);
                selfmessage(Text);
            }
        }
    } else {
        selfmessage("Unknown configuration variable:");
        selfmessage(Data);
        selfmessage("Type ^"admin_nominate_config help^" for a list");
    }
    snprintf(Text,MAX_TEXT_LENGTH,"%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i",g_Access_Votemap,g_Access_Startvote,g_Access_Controlvote,g_NominateDuration,g_ShowInterval,g_Retry_Interval,g_RepeatFreq,g_MaxNominations,g_AutoAdd,g_RememberMaps,g_DenyMaps,g_NewMapTime,g_Say,g_Consgreet,g_Sounds,g_Statistics,g_NominatePoints,g_WinvotePoints);
    set_vaultdata("NOMINATION_CONFIG",Text);
    return PLUGIN_HANDLED;
}

public admin_vote_map(HLCommand,HLData,HLUserName,UserIndex) {
    new Data[MAX_MAP_LENGTH];
    new Name[MAX_NAME_LENGTH];
    convert_string(HLData,Data,MAX_DATA_LENGTH);
    convert_string(HLUserName,Name,MAX_NAME_LENGTH);
    strstripquotes(Data);
    vote_map(Data,UserIndex,Name);
    return PLUGIN_HANDLED;
}

public HLvote(HLCommand,HLData,HLUserName,UserIndex) {
    new sLine[MAX_NUMBER_LENGTH];
    new Mapcycle[MAX_NAME_LENGTH];
    new Name[MAX_NAME_LENGTH];
    new Map[MAX_MAP_LENGTH];
    new Line;
    convert_string(HLUserName,Name,MAX_NAME_LENGTH);
    if(access(g_Access_Votemap,Name) == 1) {
        selfmessage("Dieser Server vewendet Rinde's Map-Nominierungs-Plugin.");
        selfmessage("Bitte benutze in Zukunft admin_nominate <map> fuer mehr Funktionalitaet.");
        selfmessage("Um mehr ueber das Nominierungssystem zu erfahren, schreibe ^"vote_help^" in die Console");
        convert_string(HLData,sLine,MAX_NUMBER_LENGTH);
        getstrvar("mapcyclefile",Mapcycle,MAX_NAME_LENGTH);
        Line = strtonum(sLine);
        if(0 < Line < filesize(Mapcycle)) {
            readfile(Mapcycle,Map,Line,MAX_MAP_LENGTH);
            vote_map(Map,UserIndex,Name);
        } else {
            selfmessage("Ungueltiger Mapindex.");
        }
    } else {
        selfmessage("Mapvoting ist deaktiviert.");
    }
    return PLUGIN_HANDLED;
}

public HandleSay(HLCommand,HLData,HLUserName,UserIndex) {
    new Data[MAX_DATA_LENGTH];
    new Name[MAX_NAME_LENGTH];
    new Map[MAX_MAP_LENGTH];
    convert_string(HLData,Data,MAX_DATA_LENGTH);
    strstripquotes(Data);
    if(strncasecmp(Data,"vote ",5) == 0 || strncasecmp(Data,"votemap ",8) == 0 || strncasecmp(Data,"nominate ",9) == 0) {
        convert_string(HLUserName,Name,MAX_NAME_LENGTH);
        if(g_Say == 1) {
            strsep(Data," ",Map,1,Map,MAX_MAP_LENGTH);
            vote_map(Map,UserIndex,Name);
        } else {
            messageex(Name,"Mapvoting ueber Chat ist deaktiviert. benutze ^"admin_nominate <map>^".",print_chat);
        }
        return PLUGIN_HANDLED;
    }
    return PLUGIN_CONTINUE;
}

public admin_startvote(HLCommand,HLData,HLUserName,UserIndex) {
    new Data[MAX_DATA_LENGTH];
    new Maps[8][MAX_MAP_LENGTH];
    new i,j;
    convert_string(HLData,Data,MAX_DATA_LENGTH);
    strstripquotes(Data);
    if(g_VoteStatus != InProgress && g_VoteStatus != WaitingForResult) {
        while(i < g_MaxNominations) {
            strinit(Maps[i]);
            strsep(Data," ",Maps[i],MAX_MAP_LENGTH,Data,MAX_DATA_LENGTH);
            if(strlen(Maps[i]) == 0) {
                break;
            } else if(strcasecmp(Maps[i],"random") == 0) {
                i++;
            } else if(check_map(Maps[i],0) > 0) {
                for(j=0;j<i;j++) {
                    if(strcasecmp(Maps[i],Maps[j]) == 0) {
                        selfmessage("Duplicate parameter:");
                        selfmessage(Maps[i]);
                        i--;
                        break;
                    }
                }
                i++;
            } else {
                check_map(Maps[i],1);
            }
        }
        g_TimeToNominate = g_NominateDuration*(g_MaxNominations-i)/g_MaxNominations;
        startvote();
        for(j=0;j<i;j++) {
            if(strcasecmp(Maps[j],"random") != 0) {
                strcpy(g_NominatedMaps[j],Maps[j],MAX_MAP_LENGTH);
            }
        }
        g_NominatedMapsIndex = i;
        for(j=0;j<i;j++) {
            if(strcasecmp(Maps[j],"random") == 0) {
                randommap(Maps[j]);
                strcpy(g_NominatedMaps[j],Maps[j],MAX_MAP_LENGTH);
            }
        }
        ShowMaps();
    } else {
        selfmessage("Es findet bereits eine Abstimmung statt. Warte, bis sie zuende ist.");
    }
    return PLUGIN_HANDLED;
}

public admin_randommaps(HLCommand,HLData,HLUserName,UserIndex) {
    new Data[MAX_NUMBER_LENGTH];
    new Number;
    new i;
    if(g_VoteStatus != InProgress && g_VoteStatus != WaitingForResult) {
        convert_string(HLData,Data,MAX_DATA_LENGTH);
        strstripquotes(Data);
        if(0 < strtonum(Data) <= g_MaxNominations) {
            Number = strtonum(Data);
        } else {
            Number = g_MaxNominations;
        }
        g_TimeToNominate = g_NominateDuration*(g_MaxNominations-Number)/g_MaxNominations;
        startvote();
        if(g_AutoAdd == 1) {
            g_NominatedMapsIndex = Number;
        } else {
            for(i=0;i<Number;i++) {
                randommap(g_NominatedMaps[i]);
            }
            g_NominatedMapsIndex = Number;
        }
        ShowMaps();
    } else {
        selfmessage("Es findet bereits eine Abstimmung statt. Warte, bis sie zuende ist.");
    }
    return PLUGIN_HANDLED;
}

public admin_cancelmapvote(HLCommand,HLData,HLUserName,UserIndex) {
    if(g_VoteStatus == InProgress || g_VoteStatus == WaitingForResult) {
        g_VoteStatus = Canceled;
        kill_timer(g_Timer);
        g_Timer = set_timer("InitializeStatus",g_RepeatFreq,0);
        say("Die Abstimmung wurde von einem Admin abgebrochen.");
    } else {
        selfmessage("Es findet im Moment keine Abstimmung statt.");
    }
    return PLUGIN_HANDLED;
}

public admin_denymap(HLCommand,HLData,HLUserName,UserIndex) {
    new Data[MAX_MAP_LENGTH];
    new Text[100];
    new i;
    convert_string(HLData,Data,MAX_MAP_LENGTH);
    strstripquotes(Data);
    if(g_DenyMaps < 1) {
        selfmessage("Diese Fuktion ist zur Zeit deaktiviert.");
    } else if(check_map(Data,0) == 0) {
        selfmessage("Diese Map kann nicht verboten werden, da sie nicht nominiert werden kann:");
        selfmessage(Data);
    } else {
        if(g_DeniedMapsIndex < g_DenyMaps) {
            snprintf(Text,100,"Ein Admin hat Nominierungen von %s verboten.",Data);
            say(Text);
            g_DeniedMapsIndex++;
        } else {
            snprintf(Text,100,"Ein Admin hat Nominierungen von %s verboten, %s kann deswegen wieder nominiert werden.",Data,g_DeniedMaps[g_DenyMaps-1]);
            say(Text);
            snprintf(Text,100,"Weil du nur %i Maps gleichzeitig verbieten kannst, wurde %s wieder erlaubt.",g_DenyMaps,g_DeniedMaps[g_DenyMaps-1]);
            selfmessage(Text);
        }
        for(i=g_DeniedMapsIndex-1;i>0;i--) {
            strcpy(g_DeniedMaps[i],g_DeniedMaps[i-1],MAX_MAP_LENGTH);
        }
        strcpy(g_DeniedMaps[0],Data,MAX_MAP_LENGTH);
        for(i=0;i<g_MaxNominations;i++) {
            if(strcasecmp(Data,g_NominatedMaps[i]) == 0) {
                removemap(i);
                snprintf(Text,100,"%s wurde von den Nominierungen entfernt.",Data);
                say(Text);
                if(g_AutoAdd == 1) {
                    randommap(g_NominatedMaps[g_MaxNominations-1]);
                }
                break;
            }
        }
        selfmessage("");
        selfmessage("Verbotene Maps:");
        for(i=0;i<g_DeniedMapsIndex;i++) {
            selfmessage(g_DeniedMaps[i]);
        }
    }
    return PLUGIN_HANDLED;
}

public admin_undenymap(HLCommand,HLData,HLUserName,UserIndex) {
    new Data[MAX_MAP_LENGTH];
    new Text[100];
    new i,Found = -1;
    convert_string(HLData,Data,MAX_MAP_LENGTH);
    if(g_DenyMaps < 1) {
        selfmessage("Diese Funktion ist zu Zeit deaktiviert.");
    } else {
        for(i=0;i<g_DeniedMapsIndex;i++) {
            if(strcasecmp(Data,g_DeniedMaps[i]) == 0) {
                Found = i;
                g_DeniedMapsIndex--;
                break;
            }
        }
        if(Found != -1) {
            for(i=Found;i<g_DeniedMapsIndex;i++) {
                strcpy(g_DeniedMaps[i],g_DeniedMaps[i+1],MAX_MAP_LENGTH);
            }
            strinit(g_DeniedMaps[g_DeniedMapsIndex]);
            snprintf(Text,100,"Ein Admin hat die Nominierung von %s wieder erlaubt.",Data);
            say(Text);
        } else {
            selfmessage("Nominierungen von dieser Map sind nicht verboten:");
            selfmessage(Data);
        }
        if(g_DeniedMapsIndex > 0) {
            selfmessage("");
            selfmessage("Verbotene Maps:");
            for(i=0;i<g_DeniedMapsIndex;i++) {
                selfmessage(g_DeniedMaps[i]);
            }
        } else {
            selfmessage("Im Moment ist keine Map verboten.");
        }
    }
    return PLUGIN_HANDLED;
}

public admin_undenyallmaps(HLCommand,HLData,HLUserName,UserIndex) {
    new i;
    if(g_DenyMaps < 1) {
        selfmessage("Diese Funktion ist zur Zeit deaktiviert.");
    } else {
        for(i=0;i<g_DeniedMapsIndex;i++) {
            strinit(g_DeniedMaps[i]);
        }
        g_DeniedMapsIndex = 0;
        say("Ein Admin hat alle Maps wieder zur Nominierung freigegeben.");
    }
    return PLUGIN_HANDLED;
}

public admin_deniedmaps(HLCommand,HLData,HLUserName,UserIndex) {
    new i;
    if(g_DenyMaps < 1) {
        selfmessage("Diese Funktion ist zur Zeit deaktiviert.");
    } else {
        if(g_DeniedMapsIndex > 0) {
            selfmessage("");
            selfmessage("Verbotene Maps:");
            for(i=0;i<g_DeniedMapsIndex;i++) {
                selfmessage(g_DeniedMaps[i]);
            }
        } else {
            selfmessage("Im Moment ist keine Map verboten.");
        }
    }
    return PLUGIN_HANDLED;
}

public admin_showstatistic(HLCommand,HLData,HLUserName,UserIndex) {
    new Data[2][251];
    new UserName[MAX_NAME_LENGTH];
    new LineData[MAX_DATA_LENGTH];
    new Outstring[255] = "Meistnominierte Maps:^n";
    new Line = 0;
    new i = 0;
    convert_string(HLUserName,UserName,MAX_NAME_LENGTH);
    while(i < 251) {
        if(readfile("addons/adminmod/statistics.txt",LineData,++Line,MAX_DATA_LENGTH) == 1) {
            if(strlen(LineData) > 3 && strcount(LineData,' ') == 1 && LineData[0] != '#') {
                Data[0][i] = Line;
                Data[1][i] = strtonum(LineData[strchr(LineData,' ')+1]);
                i++;
            }
        } else {
            break;
        }
    }
    Sort(Data,i);
    Line = min(g_Statistics,i);
    for(i=0;i<Line;i++) {
        readfile("addons/adminmod/statistics.txt",LineData,Data[0][i],MAX_DATA_LENGTH);
        snprintf(LineData,MAX_DATA_LENGTH,"^n  %i. %s",i+1,LineData);
        strcat(Outstring,LineData,255);
    }
    messageex(UserName,Outstring,print_tty);
    return PLUGIN_HANDLED;
}

public vote_help(HLCommand,HLData,HLUserName,UserIndex) {
    plugin_help();
    return PLUGIN_HANDLED;
}

/* Support Functions */
check_map(Map[MAX_MAP_LENGTH],selfmessages) {
    new Currentmap[MAX_MAP_LENGTH];
    new i;
    if(strlen(Map) == 0) {
        return 2;
    }
    if(valid_map(Map) == 0) {
        if(selfmessages == 1) {
            selfmessage("Ungueltige Map:");
            selfmessage(Map);
        }
        return 0;
    }
    currentmap(Currentmap,MAX_MAP_LENGTH);
    if(strcasecmp(Map,Currentmap) == 0) {
        if(selfmessages == 1) {
            selfmessage("Nominierung nicht erlaubt:");
            selfmessage(Map);
            selfmessage("Grund: Ist die aktuelle Map.");
        }
        return 0;
    }
    for(i=0;i<g_NominatedMapsIndex;i++) {
        if(strcasecmp(Map,g_NominatedMaps[i]) == 0) {
            if(selfmessages == 1) {
                selfmessage("Nominierung nicht erlaubt:");
                selfmessage(Map);
                selfmessage("Grund: Bereits nominiert.");
            }
            return 0;
        }
    }
    for(i=0;i<g_RememberMaps;i++) {
        if(strcasecmp(Map,g_RememberedMaps[i]) == 0) {
            if(selfmessages == 1) {
                selfmessage("Nominierung nicht erlaubt:");
                selfmessage(Map);
                selfmessage("Grund: Wurde kuerzlich gespielt.");
            }
            return 1;
        }
    }
    for(i=0;i<g_DeniedMapsIndex;i++) {
        if(strcasecmp(Map,g_DeniedMaps[i]) == 0) {
            if(selfmessages == 1) {
                selfmessage("Nominierung nicht erlaubt:");
                selfmessage(Map);
                selfmessage("Grund: Ein Admin hat Nominierungen fuer diese Map verboten.");
            }
            return 1;
        }
    }
    return 2;
}

randommap(RandomMap[MAX_MAP_LENGTH]) {
    new MapsFile[MAX_NAME_LENGTH];
    new MapsFileSize;
    getstrvar("maps_file",MapsFile,MAX_NAME_LENGTH);
    if(strlen(MapsFile) == 0 || strcmp(MapsFile,"0") == 0) {
        getstrvar("mapcyclefile",MapsFile,MAX_NAME_LENGTH);
    }
    strstripquotes(MapsFile);
    MapsFileSize = filesize(MapsFile);
    while(check_map(RandomMap,0) < 2 || strlen(RandomMap) == 0) {
        readfile(MapsFile,RandomMap,random(MapsFileSize),MAX_MAP_LENGTH);
    }
}

addmap(Map[MAX_MAP_LENGTH],UserIndex) {
    new i;
    if(g_AutoAdd == 1) {
        for(i=g_NominatedMapsIndex;i<g_MaxNominations;i++) {
            if(strcasecmp(Map,g_NominatedMaps[i]) == 0) {
                strcpy(g_NominatedMaps[i],g_NominatedMaps[g_NominatedMapsIndex],MAX_MAP_LENGTH);
            }
        }
    }
    strcpy(g_NominatedMaps[g_NominatedMapsIndex],Map,MAX_MAP_LENGTH);
    g_NominatedMap[UserIndex] = g_NominatedMapsIndex;
    if(g_Statistics > 0) {
        Statistic(Map,g_NominatePoints);
    }
    g_NominatedMapsIndex++;
}

removemap(MapIndex) {
    new Map[MAX_MAP_LENGTH];
    new maxplayers = maxplayercount();
    new i;
    strcpy(Map,g_NominatedMaps[MapIndex],MAX_MAP_LENGTH);
    for(i=MapIndex;i<g_MaxNominations-1;i++)
        strcpy(g_NominatedMaps[i],g_NominatedMaps[i+1],MAX_MAP_LENGTH);
    for(i=0;i<=maxplayers;i++) {
        if(g_NominatedMap[i] == MapIndex) {
            g_NominatedMap[i] = -1;
        }
        if(-1 < g_NominatedMap[i] > MapIndex) {
            g_NominatedMap[i] -= 1;
        }
    }
    if(MapIndex < g_NominatedMapsIndex) {
        g_NominatedMapsIndex--;
    }
    if(g_AutoAdd == 1) {
        strcpy(g_NominatedMaps[g_MaxNominations-1],Map,MAX_MAP_LENGTH);
    }
    ShowMaps();
}

startvote() {
    new i;
    new Text[MAX_TEXT_LENGTH];
    if(g_VoteStatus == MapStart || g_VoteStatus == Finished || g_VoteStatus == Canceled) {
        kill_timer(g_Timer);
    }
    g_Timer = set_timer("TimerShowMaps",g_ShowInterval,g_TimeToNominate / g_ShowInterval);
    g_extendoption = 0;
    if(maptime(0,0) >= (g_extends+1)*g_timelimit*60-g_TimeToNominate-180 && getvar("admin_vote_maxextend") > g_extends) g_extendoption = 1;
    for(i=0;i<g_MaxNominations;i++) {
        if(g_AutoAdd == 1) {
            randommap(g_NominatedMaps[i]);
        } else {
            strinit(g_NominatedMaps[i]);
        }
    }
    g_NominatedMapsIndex = 0;
    g_VoteStatus = InProgress;
    g_Starttime = systemtime();
    for(i=0;i<33;i++) {
        g_NominatedMap[i] = -1;
    }
    snprintf(Text,MAX_TEXT_LENGTH,"Die Nominierungsphase hat begonnen, in %i Sekunden ist die Abstimmung.",g_TimeToNominate);
    say(Text);
    say("Fuer Informationen ueber das Nominierungssystem, schreibe ^"vote_help^" in die Console.");
}

public TimerShowMaps(Timer,Repeat,HLUser,HLParam) {
    if(Repeat == 1) {
        VoteOnNominatedMaps();
    } else {
        if(Repeat == 2 && vote_allowed() == 1) {
            playsoundall(g_Sound_VoteWarn);
        }
        ShowMaps();
    }
}

ShowMaps() {
    new Text[255] = "Nominierte Maps:^n^n";
    new UserName[MAX_NAME_LENGTH];
    new maxplayers = maxplayercount();
    new i;
    if(g_NominatedMapsIndex + g_AutoAdd + g_extendoption > 0) {
        for(i=0;i<g_NominatedMapsIndex;i++) {
            snprintf(Text,255,"%s%i. %s^n",Text,i+1,g_NominatedMaps[i]);
        }
        if(g_AutoAdd == 1) {
            for(i=g_NominatedMapsIndex;i<g_MaxNominations;i++) {
                snprintf(Text,255,"%s%i. [%s]^n",Text,i+1,g_NominatedMaps[i]);
            }
        }
        snprintf(Text,255,"%s^n%i. Kein Mapwechsel^n",Text,i+1);
        if(g_extendoption == 1) {
            snprintf(Text,255,"%s%i. Map verlaengern^n",Text,i+2);
        }
    } else {
        strcat(Text,"Bis jetzt wurde keine Map nominiert. Benutze ^"admin_nominate^" um das zu tun.^n",255);
    }
    snprintf(Text,255,"%s^nDie Abstimmung erfolgt in %i Sekunden",Text,g_Starttime-systemtime()+g_TimeToNominate);
    for(i=1;i<=maxplayers;i++) {
        if(playerinfo(i,UserName,MAX_NAME_LENGTH) == 1) {
            messageex(UserName,Text,print_tty);
        }
    }
}

VoteOnNominatedMaps() {
    new msg[MAX_TEXT_LENGTH] = "\yMapwechsel: \w^n";
    new nochange[MAX_TEXT_LENGTH] = "Kein Mapwechsel";
    new Extendmap[MAX_TEXT_LENGTH] = "Map verlaengern";
    new nosound = 0;
    if(vote_allowed() == 0) {
        say("Die Abstimmung wurde verzoegert.");
        g_Timer = set_timer("TimerShowMaps",g_ShowInterval,g_Retry_Interval / g_ShowInterval);
        g_TimeToNominate = g_Retry_Interval;
        g_Starttime = systemtime();
        ShowMaps();
    } else {
        strcat(g_NominatedMaps[max(max(g_NominatedMapsIndex,g_MaxNominations*g_AutoAdd)-1,0)],"^n",MAX_MAP_LENGTH);
        if(g_extendoption == 1) switch(max(g_NominatedMapsIndex,g_AutoAdd*g_MaxNominations)) {
            case 0: vote("\yMap verlaengern?\w^n","Ja","Nein","HVoteMap","");
            case 1: vote(msg,g_NominatedMaps[0],Extendmap,nochange,"HVoteMap","");
            case 2: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],Extendmap,nochange,"HVoteMap","");
            case 3: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],Extendmap,nochange,"HVoteMap","");
            case 4: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],Extendmap,nochange,"HVoteMap","");
            case 5: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],g_NominatedMaps[4],Extendmap,nochange,"HVoteMap","");
            case 6: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],g_NominatedMaps[4],g_NominatedMaps[5],Extendmap,nochange,"HVoteMap","");
            case 7: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],g_NominatedMaps[4],g_NominatedMaps[5],g_NominatedMaps[6],Extendmap,nochange,"HVoteMap","");
            case 8: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],g_NominatedMaps[4],g_NominatedMaps[5],g_NominatedMaps[6],g_NominatedMaps[7],Extendmap,nochange,"HVoteMap","");
        } else switch(max(g_NominatedMapsIndex,g_AutoAdd*g_MaxNominations)) {
            case 0: nosound = 1;
            case 1: vote(msg,g_NominatedMaps[0],nochange,"HVoteMap","");
            case 2: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],nochange,"HVoteMap","");
            case 3: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],nochange,"HVoteMap","");
            case 4: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],nochange,"HVoteMap","");
            case 5: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],g_NominatedMaps[4],nochange,"HVoteMap","");
            case 6: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],g_NominatedMaps[4],g_NominatedMaps[5],nochange,"HVoteMap","");
            case 7: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],g_NominatedMaps[4],g_NominatedMaps[5],g_NominatedMaps[6],nochange,"HVoteMap","");
            case 8: vote(msg,g_NominatedMaps[0],g_NominatedMaps[1],g_NominatedMaps[2],g_NominatedMaps[3],g_NominatedMaps[4],g_NominatedMaps[5],g_NominatedMaps[6],g_NominatedMaps[7],nochange,"HVoteMap","");
        }
        if(nosound == 0) {
            playsoundall(g_Sound_VoteNow);
        }
        g_VoteStatus = WaitingForResult;
    }
}

vote_map(Data[MAX_MAP_LENGTH],UserIndex,Name[MAX_NAME_LENGTH]) {
    new Text[MAX_TEXT_LENGTH];
    new Status:DenyStatus;
    new i;
    if(access(g_Access_Controlvote,Name) == 1 && g_VoteStatus != WaitingForResult) {
        DenyStatus = NotBegun;
    } else {
        DenyStatus = g_VoteStatus;
    }
    switch(DenyStatus) {
        case WaitingForResult: {
            messageex(Name,"Du kannst zumindest auf das Ergebnis der letzten Abstimmung warten, bevor du eine neue startest.",print_chat);
            messageex(Name,"Du kannst zumindest auf das Ergebnis der letzten Abstimmung warten, bevor du eine neue startest.",print_console);
        }
        case Canceled: {
            messageex(Name,"Du darfst keine neue Nominierungspphase starten, ein Admin hat kuerzlich eine abgebrochen.",print_chat);
            messageex(Name,"Du darfst keine neue Nominierungspphase starten, ein Admin hat kuerzlich eine abgebrochen.",print_console);
        }
        case Finished: {
            messageex(Name,"Du darfst keine neue Nominierungsphase starten, die letzte liegt noch nicht weit genug zurueck.",print_chat);
            messageex(Name,"Du darfst keine neue Nominierungsphase starten, die letzte liegt noch nicht weit genug zurueck.",print_console);
        }
        case MapStart: {
            snprintf(Text,MAX_TEXT_LENGTH,"Diese Map laeuft erst seit %i Minuten. Auch wenn du sie nicht magst, darfst",maptime(0)/60);
            messageex(Name,Text,print_chat);
            messageex(Name,Text,print_console);
            snprintf(Text,MAX_TEXT_LENGTH,"du keine Nominierungsphase innerhalb der ersten %i Minuten einer Map starten.",g_NewMapTime / 60);
            messageex(Name,Text,print_chat);
            messageex(Name,Text,print_console);
        }
        default: {
            if(strlen(Data) == 0) {
                if(g_NominatedMap[UserIndex] != -1) {
                    snprintf(Text,MAX_TEXT_LENGTH,"%s hat seine Nominierung fuer %s zurueckgezogen",Name,g_NominatedMaps[g_NominatedMap[UserIndex]]);
                    say(Text);
                    if(g_Statistics > 0) {
                        Statistic(g_NominatedMaps[g_NominatedMap[UserIndex]],-g_NominatePoints);
                    }
                    removemap(g_NominatedMap[UserIndex]);
                } else {
                    messageex(Name,"Du musst eine Map angeben, wenn du noch keine nominiert hast.",print_chat);
                    messageex(Name,"Du musst eine Map angeben, wenn du noch keine nominiert hast.",print_console);
                }
            } else if(check_map(Data,0) + access(g_Access_Controlvote,Name) > 1) {
                if(g_VoteStatus != InProgress) {
                    if(access(g_Access_Startvote,Name) == 1) {
                        g_TimeToNominate = g_NominateDuration;
                        startvote();
                        addmap(Data,UserIndex);
                        snprintf(Text,MAX_TEXT_LENGTH,"%s wurde von %s nominiert.",Data,Name);
                        say(Text);
                        ShowMaps();
                    } else {
                        messageex(Name,"Nur Admins duerfen eine Nominierungsphase starten.",print_chat);
                        messageex(Name,"Nur Admins duerfen eine Nominierungsphase starten.",print_console);
                    }
                } else {
                    if(g_NominatedMap[UserIndex] != -1 && UserIndex != 0) {
                        if(strcasecmp(g_NominatedMaps[g_NominatedMap[UserIndex]],Data) != 0) {
                            if(g_Statistics > 0) {
                                Statistic(g_NominatedMaps[g_NominatedMap[UserIndex]],-g_NominatePoints);
                                Statistic(Data,g_NominatePoints);
                            }
                            for(i=g_NominatedMapsIndex;i<g_MaxNominations;i++) {
                                if(strcasecmp(Data,g_NominatedMaps[i]) == 0) {
                                    strcpy(g_NominatedMaps[i],g_NominatedMaps[g_NominatedMap[UserIndex]],MAX_MAP_LENGTH);
                                    break;
                                }
                            }
                            strcpy(g_NominatedMaps[g_NominatedMap[UserIndex]],Data,MAX_MAP_LENGTH);
                            snprintf(Text,MAX_TEXT_LENGTH,"%s wechselt seine Nominierung zu %s",Name,Data);
                            say(Text);
                        } else {
                            messageex(Name,"Du hast diese Map bereits nomniniert.",print_chat);
                            messageex(Name,"Du hast diese Map bereits nomniniert.",print_console);
                        }
                    } else {
                        if(g_NominatedMapsIndex < g_MaxNominations) {
                            addmap(Data,UserIndex);
                            snprintf(Text,MAX_TEXT_LENGTH,"%s wurde von %s nominiert.",Data,Name);
                            say(Text);
                        } else {
                            messageex(Name,"Die Nominierung kann nicht angenommen werden, das Nominierungsmaximum wurde erreicht.",print_chat);
                            messageex(Name,"Die Nominierung kann nicht angenommen werden, das Nominierungsmaximum wurde erreicht.",print_console);
                        }
                    }
                    ShowMaps();
                }
            } else {
                check_map(Data,1);
            }
        }
    }
    return PLUGIN_HANDLED;
}

plugin_help() {
    new Text[MAX_TEXT_LENGTH];
    consgreet("");
    consgreet("");
    consgreet("Dieser Server verwendet Rinde's Map-Nominierungs-Plugin");
    snprintf(Text,MAX_TEXT_LENGTH,"Es erlaubt jedem spieler, eine Map zu nominieren. Bis zu %i Maps koennen nominiert werden.",g_MaxNominations);
    consgreet(Text);
    if(g_AutoAdd == 1) {
        snprintf(Text,MAX_TEXT_LENGTH,"Der Server wird die Nominierungen bis zu einer Anzahl von %i mit zufaelligen Maps auffuellen.",g_MaxNominations);
        consgreet(Text);
        consgreet("Diese zufaelligen Maps werden durch ^"[]^" gekennzeichnet, und durch Nominierungen ueberschrieben.");
    }
    consgreet("Um eine Map zu nominieren, schreibe ^"admin_nominate <mapname>^" in der Console. Du kannst deine");
    consgreet("aendern, indem du eine beliebige andere nominierst. Den Befehl ^"admin_nominate^" ohne eine Map");
    consgreet("einzugeben entfernt deine Nominierung. Nach einiger Zeit findet eine Abstimmung statt, zu welcher");
    consgreet("Map gewechselt werden soll. Weil alle nominierten Maps waehrend der Nominierungsphase angezeigt");
    if(g_RememberMaps == 0) {
        consgreet("werden, hast du genug Zeit, dich fuer eine zu entscheiden.");
    } else {
        snprintf(Text,MAX_TEXT_LENGTH,"werden, hast du genug Zeit, dich fuer eine zu entscheiden. Bitte beachte, dass die lezten %i Maps,",g_RememberMaps);
        consgreet(Text);
        consgreet("die gespielt wurden, nicht nominiert werden koennen.");
    }
    consgreet("Admins koennen einzelne Maps von den Nominierungen ausschliessen. Um diese einzusehen, schreibe,");
    consgreet("^"admin_deniedmaps^" in die Console. Um diesen Text anzuzeigen, schreibe ^"vote_help^" in die Console.");
    consgreet("");
    consgreet("");
}

Statistic(Map[],Value) {
    new LineData[MAX_DATA_LENGTH];
    new Line = 0;
    new i = 0;
    new Number;
    if(Value != 0) {
        if(fileexists("addons/adminmod/statistics.txt") == 0) {
            resetfile("addons/adminmod/statistics.txt");
        }
        while(i < 251) {
            if(readfile("addons/adminmod/statistics.txt",LineData,++Line,MAX_DATA_LENGTH) == 1) {
                if(strlen(LineData) > 3 && strcount(LineData,' ') == 1 && LineData[0] != '#') {
                    if(strncasecmp(Map,LineData,strlen(Map)) == 0) {
                        Number = strtonum(LineData[strchr(LineData,' ')+1]) + Value;
                        break;
                    }
                    i++;
                }
            } else {
                break;
            }
        }
        if(i > 250) {
            snprintf(LineData,MAX_DATA_LENGTH,"[ADMIN] Warning: Statistic file is full, failed to add entry for %s. (plugin_rindy_votemap)",Map);
            log(LineData);
        } else {
            if(Line > filesize("addons/adminmod/statistics.txt")) {
                Line = -1;
                Number = Value;
            }
            snprintf(LineData,MAX_DATA_LENGTH,"%s %i",Map,Number);
            writefile("addons/adminmod/statistics.txt",LineData,Line);
        }
    }
}

Sort(Data[2][],iNumber) {
    new i,j,k;
    new Buffer[2];
    for(i=1;i<iNumber;i++) {
        for(j=0;j<i;j++) {
            if(Data[1][i] > Data[1][j]) {
                Buffer[0] = Data[0][i];
                Buffer[1] = Data[1][i];
                for(k=i-1;k>=j;k--) {
                    Data[0][k+1] = Data[0][k];
                    Data[1][k+1] = Data[1][k];
                }
                Data[0][j] = Buffer[0];
                Data[1][j] = Buffer[1];
            }
        }
    }
}

playsoundall(Sound[]) {
    new Name[MAX_NAME_LENGTH];
    new maxplayers = maxplayercount();
    new i;
    if(g_Sounds == 1 && strlen(Sound) > 0) {
        for(i=1;i<=maxplayers;i++) {
            if(playerinfo(i,Name,MAX_NAME_LENGTH) == 1) {
                playsound(Name,Sound);
            }
        }
    }
}

get_config() {
    new Data[MAX_TEXT_LENGTH];
    new Token[MAX_NUMBER_LENGTH];
    new i;
    if(get_vaultdata("NOMINATION_CONFIG",Data,MAX_TEXT_LENGTH) == 1) {
        for(i=0;i<18;i++) {
            strsep(Data,"=",Token,MAX_NUMBER_LENGTH,Data,MAX_TEXT_LENGTH);
            switch(i) {
                case  0: g_Access_Votemap = strtonum(Token);
                case  1: g_Access_Startvote = strtonum(Token);
                case  2: g_Access_Controlvote = strtonum(Token);
                case  3: g_NominateDuration = strtonum(Token);
                case  4: g_ShowInterval = strtonum(Token);
                case  5: g_Retry_Interval = strtonum(Token);
                case  6: g_RepeatFreq = strtonum(Token);
                case  7: g_MaxNominations = strtonum(Token);
                case  8: g_AutoAdd = strtonum(Token);
                case  9: g_RememberMaps = strtonum(Token);
                case 10: g_DenyMaps = strtonum(Token);
                case 11: g_NewMapTime = strtonum(Token);
                case 12: g_Say = strtonum(Token);
                case 13: g_Consgreet = strtonum(Token);
                case 14: g_Sounds = strtonum(Token);
                case 15: g_Statistics = strtonum(Token);
                case 16: g_NominatePoints = strtonum(Token);
                case 17: g_WinvotePoints = strtonum(Token);
            }
        }
    } else {
        snprintf(Data,MAX_TEXT_LENGTH,"%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i=%i",g_Access_Votemap,g_Access_Startvote,g_Access_Controlvote,g_NominateDuration,g_ShowInterval,g_Retry_Interval,g_RepeatFreq,g_MaxNominations,g_AutoAdd,g_RememberMaps,g_DenyMaps,g_NewMapTime,g_Say,g_Consgreet,g_Sounds,g_Statistics,g_NominatePoints,g_WinvotePoints);
        set_vaultdata("NOMINATION_CONFIG",Data);
    }
}