Raised This Month: $52 Target: $400
 13% 

Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016


Post New Thread Reply   
 
Thread Tools Display Modes
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 03-15-2019 , 06:01   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #21

Hello there, is the mod still beign updated?

Having 6 mods causes a problem with the votemod menu, with 6 mods the vote is completly invisible, with 6 mods and the #define MENU_ITEMS_PER_PAGE set to 7 the vote is shown but not the last option
Rivotril is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 03-15-2019 , 21:12   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #22

I just started a local server with this and it is working fine with more than 6 mods:



I also deleted my other mods and let the server only with 7 mods, and it was file too.

Can you backup your files and try installing my multimod server (the one from the gif just above)?
Link: https://forums.alliedmods.net/showthread.php?t=273018
__________________
Plugin: Sublime Text Studio , Galileo
Multi-Mod: Manager / Plugin / Server

Help the AlliedModders' website stay online!

Last edited by addons_zz; 03-16-2019 at 15:54.
addons_zz is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 03-16-2019 , 16:09   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #23

Quote:
Hey there, i need some help with your Multi-Mod plugin, if the mod menu needs to create a new list doesn't work, every mod is invisible for some reason
Your voting menu settings file should look like this:
"Half-Life/czero/addons/amxmodx/configs/multimod/voting_list.ini"
Code:
[CS-DM (DeathMatch)]:[csdm]:
;[Mode Name]:[shortModName]:
If you want to disable some mod, you just need to add a semicolon (;) in front of it.

On the above example, it has one mod enabled and one mode disabled.

As reference, you can look into the configurations of my multimod server:
https://forums.alliedmods.net/showthread.php?t=273018

And read carefully the instructions on the first page:
https://forums.alliedmods.net/showth...0#Installation

Quote:
and how can i remove the option of disable the current mod?
For that, you will need to edit the plugin code. But first, enable the debug mode changing this line to 1:
Code:
File: MultiModServer/plugins/addons/amxmodx/scripting/multimod_manager.sma 28: /** This is to view internal program data while execution. See the function 'debugMesssageLogger(...)' 29:  * and the variable 'g_debug_level' for more information. Default value: 0  - which is disabled. 30:  */ 31: #define IS_DEBUG_ENABLED 0

And this other line to 127:
Code:
File: MultiModServer/plugins/addons/amxmodx/scripting/multimod_manager.sma 36: /** 37:  * ( 00000 ) 0 disabled all debug. 38:  * ( 00001 ) 1 displays basic debug messages. 39:  * ( 00010 ) 2 displays each mod loaded. 40:  * ( 00100 ) 4 displays the keys pressed/mods loaded during voting. 41:  * ( 01000 ) 8 displays the the mapcycle configuration. 42:  * 43:  * ( 100.. ) 64 displays messages related 'client_print_color_internal'. 44:  * ( 1001111 ) 79 displays all debug levels. 45:  */ 46: new g_debug_level = 79

Then, you can try changing these lines:
Code:
/**
 * Makes at votemod menu, display the first mod as the option: "Keep Current Mod". And at
 * votemod menu, display the second mod as the option: "No mod - Disable Mod".
 */
public build_first_mods()
{
    g_modCounter = g_modCounter + 2

    ArrayPushString( g_mod_names, "Silent Mod Currently" )
    ArrayPushString( g_mod_shortNames, "silentMod" )

    ArrayPushString( g_mod_names, "Extend Current Mod" )
    ArrayPushString( g_mod_shortNames, "extendCurrent" )

    ArrayPushString( g_mod_names, "Disable Current Mod" )
    ArrayPushString( g_mod_shortNames, "disableMod" )
}
To:
Code:
/**
 * Makes at votemod menu, display the first mod as the option: "Keep Current Mod". And at
 * votemod menu, display the second mod as the option: "No mod - Disable Mod".
 */
public build_first_mods()
{
    g_modCounter = g_modCounter + 1

    ArrayPushString( g_mod_names, "Extend Current Mod" )
    ArrayPushString( g_mod_shortNames, "extendCurrent" )

    ArrayPushString( g_mod_names, "Disable Current Mod" )
    ArrayPushString( g_mod_shortNames, "disableMod" )
}
I think you will also need to look into the code of the menu selection, and fix the selection options, otherwise when someone selects the option 3, it will actually select the option 4.
__________________
Plugin: Sublime Text Studio , Galileo
Multi-Mod: Manager / Plugin / Server

Help the AlliedModders' website stay online!

Last edited by addons_zz; 03-16-2019 at 18:08.
addons_zz is offline
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 03-30-2019 , 06:28   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #24

Hello, a friend of mine fixed it for me, i don't know what the problem was but he touched the code a bit and got it
Rivotril is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 03-30-2019 , 14:14   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #25

Hi,

I am curious about what the problem was. Can you share the new code, so I can compare it?

This was the first big plugin had written. Did your friend like the code?
__________________
Plugin: Sublime Text Studio , Galileo
Multi-Mod: Manager / Plugin / Server

Help the AlliedModders' website stay online!

Last edited by addons_zz; 03-31-2019 at 14:22.
addons_zz is offline
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 03-30-2019 , 16:07   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #26

Sure, i'll PM you it, i have a new issue now, when the players vote to extend the current mod the galileo attemps to send a vote and doesn't work as the default mapcycle doesn't have maps in it, if it did, it would only show the default mapcycle maps instead of the mod mapcycle, any idea how to fix that?
Rivotril is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 03-30-2019 , 17:34   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #27

For that, can you enable the Galileo logs, this plugin logs, the condebug log and PM me the `qconsole.log` file?

To enable this plugin logs, you will need to edit the plugin code changing this line from 0 to 1:
Code:
File: amxmodx/scripting/multimod_manager.sma 28: /** This is to view internal program data while execution. See the function 'debugMesssageLogger(...)' 29:  * and the variable 'g_debug_level' for more information. Default value: 0  - which is disabled. 30:  */ 31: #define IS_DEBUG_ENABLED 0

And this other line, change the varialbe `g_debug_level` from whatever it is now to 127:
Code:
File: amxmodx/scripting/multimod_manager.sma 36: /** 37:  * ( 00000 ) 0 disabled all debug. 38:  * ( 00001 ) 1 displays basic debug messages. 39:  * ( 00010 ) 2 displays each mod loaded. 40:  * ( 00100 ) 4 displays the keys pressed/mods loaded during voting. 41:  * ( 01000 ) 8 displays the the mapcycle configuration. 42:  * 43:  * ( 100.. ) 64 displays messages related 'client_print_color_internal'. 44:  * ( 1001111 ) 79 displays all debug levels. 45:  */ 46: new g_debug_level = 127

Then, to enable the Galileo logging, editing the `galileo.sma` changing the `DEBUG_LEVEL` variable. You need to set the DEBUG_LEVEL to 16, instead of the level 0 as default. Go to around the 'line 87' and find:
Code:
#define DEBUG_LEVEL 0
and change it to:
Code:
#define DEBUG_LEVEL 16

To enable the condebug log, you can see how on the Galileo main thread support section: https://forums.alliedmods.net/showth...273019#Support

Then, you can recompile the Galileo and Multimod plugin, install their .amxx files, open your server, and run it until you reproduce the problem. On you do that, you can PM me the `qconsole.log` file.
__________________
Plugin: Sublime Text Studio , Galileo
Multi-Mod: Manager / Plugin / Server

Help the AlliedModders' website stay online!
addons_zz is offline
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 03-31-2019 , 07:41   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #28

Im using the original galileo, it basicly everytime the option of extend map is selected is using the normal mapcycle instead of the mapcycle of the current mod
Rivotril is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 03-31-2019 , 14:15   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #29

Quote:
Originally Posted by Rivotril View Post
Im using the original galileo, it basicly everytime the option of extend map is selected is using the normal mapcycle instead of the mapcycle of the current mod
Even the original galileo has a debug mode. You can try to enable it.

Then, I would say it is a bug on the original Galileo, which is not getting the correct map cycle.

There is a reason why I created a new version of Galileo, it has bugs.

I still did not receive your code from the last bug your friend fixed.

You can use https://pastebin.com/ or send an email. If you feel like not sharing because I would steal your code, it would be just sad for me because you are derivating it from an open-sourced code and are hiding bug fixes for yourself instead of sharing it with others. Anyways, why are you asking for free help here, if you do not share it? After this, I am just not sure anymore, why I would help you with my free time.

For me, I cannot say care much because if I had this problem on my server, I would definitely be able to fix. Although I am not running any servers 24/7, but others like you are may be running or trying to at least.
__________________
Plugin: Sublime Text Studio , Galileo
Multi-Mod: Manager / Plugin / Server

Help the AlliedModders' website stay online!
addons_zz is offline
Rivotril
Senior Member
Join Date: Feb 2014
Location: Argentina
Old 04-01-2019 , 10:41   Re: Multi-Mod Manager v1.1-release_candidate1.hotfix1 | Last Update: 21.01.2016
Reply With Quote #30

Quote:
Originally Posted by addons_zz View Post
Even the original galileo has a debug mode. You can try to enable it.

Then, I would say it is a bug on the original Galileo, which is not getting the correct map cycle.

There is a reason why I created a new version of Galileo, it has bugs.

I still did not receive your code from the last bug your friend fixed.

You can use https://pastebin.com/ or send an email. If you feel like not sharing because I would steal your code, it would be just sad for me because you are derivating it from an open-sourced code and are hiding bug fixes for yourself instead of sharing it with others. Anyways, why are you asking for free help here, if you do not share it? After this, I am just not sure anymore, why I would help you with my free time.

For me, I cannot say care much because if I had this problem on my server, I would definitely be able to fix. Although I am not running any servers 24/7, but others like you are may be running or trying to at least.
Sorry, i was bussy and i needed to clear it with my friend, here's the code, i changed the close, back, next, etc. to spanish, the rest is my friend,

PHP Code:
/*********************** Licensing *******************************************************
*
*   Copyleft 2015-2016 @ Addons zz
*
*   Plugin Thread: https://forums.alliedmods.net/showthread.php?t=273020
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or ( at
*  your option ) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
***************************************************************************************
*/

#define VERSION "1.1-rc1.1"

#include <amxmodx>
#include <amxmisc>

#define LONG_STRING   256
#define COLOR_MESSAGE 192
#define SHORT_STRING  64

/** This is to view internal program data while execution. See the function 'debugMesssageLogger(...)'
 * and the variable 'g_debug_level' for more information.
 * Default value: 0  - which is disabled.
 */
#define IS_DEBUG_ENABLED 0

#if IS_DEBUG_ENABLED > 0
    #define DEBUG_LOGGER(%1) debugMesssageLogger( %1 )

/**
 * ( 00000 ) 0 disabled all debug.
 * ( 00001 ) 1 displays basic debug messages.
 * ( 00010 ) 2 displays each mod loaded.
 * ( 00100 ) 4 displays the keys pressed/mods loaded during voting.
 * ( 01000 ) 8 displays the the mapcycle configuration.
 *
 * ( ... ) 64 displays messages related 'client_print_color_internal'.
 * ( 1001111 ) 79 displays all debug levels.
 */
new g_debug_level 79

/**
 * Write debug messages to server's console accordantly to the global variable g_debug_level.
 *
 * @param mode the debug mode level, see the variable 'g_debug_level' for the levels.
 * @param message[] the text formatting rules to display.
 * @param any the variable number of formatting parameters.
 */
stock debugMesssageLoggermodemessage[], any: ... )
{
    if( 
mode g_debug_level )
    {
        static 
formated_messageLONG_STRING ]
        
        
vformatformated_messagecharsmaxformated_message ), message)
        
        
server_print"%s"formated_message         )
    }
}
#else
    #define DEBUG_LOGGER(%1) //
#endif

#define PLUGIN "Multi-Mod Manager"
#define AUTHOR "Addons zz"

#define TASK_VOTEMOD      2487002
#define TASK_CHVOMOD      2487004
#define TASKIS_PRINT_HELP 648215

/**
 * The client console lines number to print when is showed the help command.
 */
#define LINES_PER_PAGE 10

#define MENU_ITEMS_PER_PAGE 7

/**
 * Convert colored strings codes '!g for green', '!y for yellow', '!t for team'.
 */
#define INSERT_COLOR_TAGS(%1) \
    
{ \
        
replace_all( %1charsmax( %), "!g""^4" ); \
        
replace_all( %1charsmax( %), "!t""^3" ); \
        
replace_all( %1charsmax( %), "!n""^1" ); \
        
replace_all( %1charsmax( %), "!y""^1" ); \
    }

#define REMOVE_COLOR_TAGS(%1) \
    
{ \
        
replace_all( %1charsmax( %), "^1""" ); \
        
replace_all( %1charsmax( %), "^2""" ); \
        
replace_all( %1charsmax( %), "^3""" ); \
        
replace_all( %1charsmax( %), "^4""" ); \
    }

#define PRINT_COLORED_MESSAGE(%1,%2) \
    
{ \
        
message_beginMSG_ONE_UNRELIABLEg_user_msgid_, %); \
        
write_byte( %); \
        
write_string( %); \
        
message_end(); \
    }

new 
bool:g_is_color_chat_supported

new g_user_msgid
new g_coloredmenus
new g_menu_total_pages
new g_currentMod_id
new g_mapManagerType
new g_isFirstTime_serverLoad
new g_dynamic_array_size_temp

new Array:g_mod_names
new Array:g_mod_shortNames
new Array:g_votemodcount

new g_mod_name_temp      SHORT_STRING ]
new 
g_mod_short_name_tempSHORT_STRING ]

new 
g_modCounter             0
new g_isTimeTo_changeMapcyle false
new g_menuname[]             = "VOTE MOD MENU"

new g_menuPosition        33 ]
new 
g_currentMod_shortNameSHORT_STRING ]
new 
g_current_print_page  33 ]

new 
g_configFolder                 LONG_STRING ]
new 
g_masterConfig_filePath        LONG_STRING ]
new 
g_masterPlugin_filePath        LONG_STRING ]
new 
g_votingFinished_filePath      LONG_STRING ]
new 
g_currentMod_id_filePath       LONG_STRING ]
new 
g_currentMod_shortName_filePathLONG_STRING ]
new 
g_votingList_filePath          LONG_STRING ]

new 
gp_allowedvote
new gp_endmapvote
new gp_mintime
new gp_timelimit
new gp_mapcyclefile

new g_alertMultiMod512 ] = ";Configuration files of Multi-Mod System^n//\
which is run every time the server starts and defines which mods are enabled.^n//\
This file is managed automatically by multimod_manager.sma plugin^n//\
and any modification will be discarded in the activation of some mod.^n^n"

new g_helpamx_setmodSHORT_STRING ] = "help 1  | for help."
new g_helpamx_setmods128 ]         = "shortModName <1 or 0> to restart or not  \
| Enable/Disable any mod, loaded or not ( silent mod ). "

new g_cmdsAvailables[][ 72 ] =
{
    
"^namx_setmod help 1                | To show this help.",
    
"amx_setmod disable 1             | To deactivate any active Mod.",
    
"amx_votemod                      | To force a votemod.",
    
"say_team nextmod                 | To see which is the next mod.",
    
"say currentmod                   | To see which is the current mod.",
    
"say votemod                      | To try start a vote mod.",
    
"say_team votemod                 | To try start a vote mod."
}

/**
 * Register plugin commands and load configurations.
 */
public plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR )
    
    
register_cvar"MultiModManager"VERSIONFCVAR_SERVER FCVAR_SPONLY )
    
    
register_dictionary_colored"multimodmanager.txt" )
    
    
gp_mintime     register_cvar"amx_mintime""10" )
    
gp_allowedvote register_cvar"amx_multimod_voteallowed""1" )
    
gp_endmapvote  register_cvar"amx_multimod_endmapvote""0" )
    
    
g_mod_names      ArrayCreateSHORT_STRING )
    
g_mod_shortNames ArrayCreateSHORT_STRING )
    
g_votemodcount   ArrayCreate)
    
    
register_clcmd"amx_votemod""start_vote"ADMIN_MAP"Vote for the next mod" )
    
register_clcmd"say currentmod""user_currentmod" )
    
register_clcmd"say_team currentmod""user_currentmod" )
    
register_clcmd"say votemod""user_votemod" )
    
register_clcmd"say_team votemod""user_votemod" )
    
    
register_concmd"amx_setmod""receiveCommand"ADMIN_CFGg_helpamx_setmod )
    
register_concmd"amx_setmods""receiveCommandSilent"ADMIN_IMMUNITYg_helpamx_setmods )
    
register_menucmdregister_menuidg_menuname ), 2047"player_vote" )
    
    
g_user_msgid   get_user_msgid"SayText" );
    
g_coloredmenus colored_menus()
}

/**
 * Makes auto configuration about mapchooser plugin, switching between multimod_mapchooser and
 * galileo.
 * Gets current game mods cvars pointer to this program global variables.
 * Adjust the localinfo variable that store the current mod loaded, reading the current mod file.
 */
public plugin_cfg()
{
    
gp_timelimit    get_cvar_pointer"mp_timelimit" )
    
gp_mapcyclefile get_cvar_pointer"mapcyclefile" )
    
    
get_configsdirg_configFoldercharsmaxg_configFolder ) )
    
    
formatexg_masterPlugin_filePathcharsmaxg_masterPlugin_filePath ),
            
"%s/plugins-multi.ini"g_configFolder )
    
    
formatexg_masterConfig_filePathcharsmaxg_masterConfig_filePath ),
            
"%s/multimod/multimod.cfg"g_configFolder )
    
    
formatexg_currentMod_id_filePathcharsmaxg_currentMod_id_filePath ),
            
"%s/multimod/currentmod_id.ini"g_configFolder )
    
    
formatexg_currentMod_shortName_filePathcharsmaxg_currentMod_shortName_filePath ),
            
"%s/multimod/currentmod_shortname.ini"g_configFolder )
    
    
formatexg_votingList_filePathcharsmaxg_votingList_filePath ),
            
"%s/multimod/voting_list.ini"g_configFolder )
    
    
formatexg_votingFinished_filePathcharsmaxg_votingFinished_filePath ),
            
"%s/multimod/votingfinished.cfg"g_configFolder )
    
    
g_is_color_chat_supported = ( is_running"czero" )
                                  || 
is_running"cstrike" ) )
    
    
switchMapManager()
    
    
build_first_mods()
    
load_votingList()
    
    
loadCurrentMod()
    
    
unloadLastActiveMod()
    
    if( 
get_pcvar_numgp_endmapvote ) )
    {
        
set_task15.0"check_task"TASK_VOTEMOD""0"b" )
    }
}

/**
 * After the first time the server loads, this function execute the late configuration file
 *   used to restaure the last active mod cvars changed and the first mapcycle used.
 *
 * This function stills detect when the mod is changed due specific maps configurations
 *   files like, "./configs/maps/plugins-zm.ini", that actives the zombie plague mod.
 *
 * In order to this works, you must configure the file "./configs/maps/prefix_zm.cfg"
 *   with the command:
 *          localinfo amx_lastmod zp50Money
 *
 * For the zombie plague mod, short mod name.
 */
public unloadLastActiveMod()
{
    new 
lastMod_shortName    SHORT_STRING ]
    new 
firstServer_Mapcycle        SHORT_STRING ]
    new 
lateConfig_filePath        LONG_STRING ]
    
    
get_localinfo"amx_lastmod"lastMod_shortNamecharsmaxlastMod_shortName ) )
    
get_localinfo"firstMapcycle_loaded"firstServer_MapcyclecharsmaxfirstServer_Mapcycle ) )
    
    if( !
equallastMod_shortNameg_currentMod_shortName )
        && 
g_isFirstTime_serverLoad != )
    {
        
lateConfig_pathCoderlastMod_shortNamelateConfig_filePathcharsmaxlateConfig_filePath ) )
        
        if( 
file_existslateConfig_filePath ) )
        {
            
print_at_console_to_all"Executing the deactivation mod configuration file ( %s )."lateConfig_filePath )
            
server_cmd"exec %s"lateConfig_filePath )
        }
        
        if( 
g_isFirstTime_serverLoad == )
        {
            
server_cmd"mapcyclefile %s"firstServer_Mapcycle )
        }
    }
}

/**
 * Process the input command "amx_setmod OPITON1 OPITON2".
 *
 * @param player_id - will hold the players id who started the command
 * @param level - will hold the access level of the command
 * @param cid - will hold the commands internal id
 *
 * @ARG1 firstCommand_lineArgument the modShortName to enable
 * @ARG2 secondCommand_lineArgument inform to start a vote map "1" or not "0"
 */
public receiveCommandplayer_idlevelcid )
{
    
//Make sure this user is an admin
    
if( !cmd_accessplayer_idlevelcid) )
    {
        return 
PLUGIN_HANDLED
    
}
    new 
firstCommand_lineArgument SHORT_STRING ]
    new 
secondCommand_lineArgumentSHORT_STRING ]
    
    
//Get the command arguments from the console
    
read_argv1firstCommand_lineArgument,   charsmaxfirstCommand_lineArgument ) )
    
read_argv2secondCommand_lineArgumentcharsmaxsecondCommand_lineArgument ) )
    
    new 
isTimeToRestart      equalsecondCommand_lineArgument"1" )
    
g_isTimeTo_changeMapcyle true
    
    
if( primitiveFunctionsplayer_idfirstCommand_lineArgumentisTimeToRestart ) )
    {
        if( 
activateMod_byShortNamefirstCommand_lineArgument )  )
        {
            
configureModIDfirstCommand_lineArgument )
            
messageModActivatedfirstCommand_lineArgumentisTimeToRestarttrue )
        }
        else
        {
            
printHelpplayer_id )
        }
    }
    
g_isTimeTo_changeMapcyle false
    
    
return PLUGIN_HANDLED
}

/**
 * Given a mod short name like "predator", set its plugin internal mod id.
 *
 * @param shortName the mod short name.
 *
 * @return true if shortName is a valid mod, false otherwise.
 */
public configureModIDshortName[] )
{
    for( new 
mod_id_number 3mod_id_number <= g_modCountermod_id_number++ )
    {
        
ArrayGetStringg_mod_shortNamesmod_id_numberg_mod_short_name_tempcharsmaxg_mod_short_name_temp ) )
        
        if( 
equalshortNameg_mod_short_name_temp ) )
        {
            
g_currentMod_id mod_id_number
            saveCurrentModBy_id
mod_id_number )
        }
    }
}

/**
 * Check the activation of the function of disableMods and help.
 *
 * @param firstCommand_lineArgument[] the first command line argument
 * @param secondCommand_lineArgument[] the second command line argument
 * @param player_id the player id
 *
 * @return true if was not asked for a primitive function, false otherwise.
 */
public primitiveFunctionsplayer_idfirstCommand_lineArgument[], isTimeToRestart )
{
    if( 
equalfirstCommand_lineArgument"disable" ) )
    {
        
disableMods()
        
        if( 
isTimeToRestart )
        {
            
msgResourceActivated"disable"isTimeToRestarttrue )
        }
        return 
false
    
}
    
    if( 
equalfirstCommand_lineArgument"help" ) )
    {
        
printHelpplayer_id )
        return 
false
    
}
    return 
true
}

/**
 * Given a player id, prints to him and at server console the help about the command
 * "amx_setmod".
 *
 * @param player_id the player id
 */
public printHelpplayer_id )
{
    static 
formatted_string[32]

    if( 
player_id )
    {
        
player_id player_id TASKIS_PRINT_HELP
        
        
new current_print_page_total      g_current_print_pageplayer_id ] * LINES_PER_PAGE
        g_current_print_page
player_id ] = g_current_print_pageplayer_id ] + 1
        
        DEBUG_LOGGER
1"current_print_page_total: %d, g_current_print_page[ player_id ]: %d", \
                
current_print_page_totalg_current_print_pageplayer_id ] )
        
        
// print the page header
        
if( !current_print_page_total )
        {
            for( new 
0sizeofg_cmdsAvailables ); i++ )
            {
                
client_printplayer_idprint_consoleg_cmdsAvailables] )
                
DEBUG_LOGGER1g_cmdsAvailables] )
            }
            
            
set_task1.0"printHelp"player_id )
            return
        }
        
        
// print the page body
        
if( current_print_page_total LINES_PER_PAGE g_modCounter )
        {
            new 
internal_current_page_limit 0
            
            
new menu_page_total_int g_modCounter LINES_PER_PAGE
            
new menu_page_total     floatroundfloatg_modCounter ) / floatLINES_PER_PAGE ), floatround_ceil )
            
            if( 
g_modCounter LINES_PER_PAGE )
            {
                
menu_page_total_int 1
                menu_page_total     
1
            
}
            
            
client_printplayer_idprint_console"^nPrinting Page: %d of %d",
                    
g_current_print_pageplayer_id ] - 1,
                    ( 
g_modCounter LINES_PER_PAGE ) ? menu_page_total_int menu_page_total )
            
            
DEBUG_LOGGER1"^nPrinting Page: %d of %d", \
                    
g_current_print_pageplayer_id ] - 1, \
                    ( 
g_modCounter LINES_PER_PAGE ) ? menu_page_total_int menu_page_total )
            
            for( new 
current_print_page_total LINES_PER_PAGE<= g_modCounteri++ )
            {
                
ArrayGetStringg_mod_namesig_mod_name_tempcharsmaxg_mod_name_temp ) )
                
ArrayGetStringg_mod_shortNamesig_mod_short_name_tempcharsmaxg_mod_short_name_temp ) )
                
                
formatexformatted_stringcharsmaxformatted_string ), "%s 1"g_mod_short_name_temp )
                
                
client_printplayer_idprint_console"amx_setmod %-22s| to use %s"formatted_string,
                        
g_mod_name_temp )
                
                
DEBUG_LOGGER1"amx_setmod %-22s| to use %s"formatted_stringg_mod_name_temp )
                
                if( 
internal_current_page_limit++ >= ( LINES_PER_PAGE )
                    && 
g_modCounter )
                {
                    
set_task0.5"printHelp"player_id TASKIS_PRINT_HELP )
                    break
                }
            }
        }
        
        
// print the page bottom
        
if( current_print_page_total g_modCounter )
        {
            
g_current_print_pageplayer_id ] = 0
        
}
    }
    else
    {
        for( new 
0sizeofg_cmdsAvailables ); i++ )
        {
            
server_printg_cmdsAvailables] )
        }
        
        for( new 
3<= g_modCounteri++ )
        {
            
ArrayGetStringg_mod_namesig_mod_name_tempcharsmaxg_mod_name_temp ) )
            
ArrayGetStringg_mod_shortNamesig_mod_short_name_tempcharsmaxg_mod_short_name_temp ) )
            
            
formatexformatted_stringcharsmaxformatted_string ), "%s 1"g_mod_short_name_temp )
            
server_print"amx_setmod %-22s| to use %s"formatted_stringg_mod_name_temp )
        }
        
        
server_print"^n" )
    }
}

#if AMXX_VERSION_NUM < 183
public client_disconnectplayer_id )
#else
public client_disconnectedplayer_id )
#endif
{
    
remove_taskplayer_id TASKIS_PRINT_HELP )
}

/**
 * Process the input command "amx_setmod OPITON1 OPITON2".
 * Straight restarting the server, ( silent mod ) and changes and configures the mapcycle if
 *   there is one
 *
 * @param player_id - will hold the players id who started the command
 * @param level - will hold the access level of the command
 * @param cid - will hold the commands internal id
 *
 * @arg firstCommand_lineArgument the modShortName to enable silently
 * @arg secondCommand_lineArgument inform to restart the current map "1" or not "0"
 */
public receiveCommandSilentplayer_idlevelcid )
{
    
//Make sure this user is an admin
    
if( !cmd_accessplayer_idlevelcid) )
    {
        return 
PLUGIN_HANDLED
    
}
    new 
firstCommand_lineArgument            SHORT_STRING ]
    new 
secondCommand_lineArgument        SHORT_STRING ]
    
    
read_argv1firstCommand_lineArgumentcharsmaxfirstCommand_lineArgument ) )
    
read_argv2secondCommand_lineArgumentcharsmaxsecondCommand_lineArgument ) )
    
    new 
isTimeToRestart      equalsecondCommand_lineArgument"1" )
    
g_isTimeTo_changeMapcyle true
    
    
if( equalfirstCommand_lineArgument"disable" ) )
    {
        
disableMods()
        
msgResourceActivated"disable"isTimeToRestartfalse )
    }
    else if( 
activateMod_byShortNamefirstCommand_lineArgument ) )
    {
        
g_currentMod_id 0
        saveCurrentModBy_id
)
        
        
saveCurrentModBy_ShortNamefirstCommand_lineArgument             )
        
messageModActivated(               firstCommand_lineArgumentisTimeToRestartfalse )
    }
    
g_isTimeTo_changeMapcyle false
    
    
return PLUGIN_HANDLED
}

/**
 * A simple instantly server restart.
 */
public restartTheServer()
{
    
server_cmd"restart" )
}

/**
 * Loads the 'currentmod_id.ini' and 'currentmod_shortname.ini', at ".configs/multimod" folder,
 *    that stores the current mod actually active and the current mod was activated by
 *    silent mode, respectively.
 *
 * If the mod_id stored at 'currentmod_id.ini' is:
 *     greater than 0, it is any mod saved.
 *        0, a silent mod is activated.
 *     -1, the mods are disabled.
 *
 * When 'currentmod_id.ini' stores 0, 'currentmod_shortname.ini' defines the current mod.
 * When 'currentmod_id.ini' stores anything that is not 0, 'currentmod_id.ini' defines the current mod.
 */
public loadCurrentMod()
{
    new 
currentModCode
    
new unused_lenghtInteger
    
    
new currentModCode_StringSHORT_STRING ]
    new 
currentMod_shortNameSHORT_STRING ]
    
    
// normal mod activation
    
if( file_existsg_currentMod_id_filePath ) )
    {
        
read_file(   g_currentMod_id_filePath0currentModCode_String,
                
charsmaxcurrentModCode_String ), unused_lenghtInteger )
        
        
currentModCode str_to_numcurrentModCode_String )
    }
    else
    {
        
currentModCode = -1
        write_file
g_currentMod_id_filePath,    "-1"     )
    }
    
    
// silent mod activation
    
if( file_existsg_currentMod_shortName_filePath ) )
    {
        
read_fileg_currentMod_shortName_filePath0currentMod_shortName,
                
charsmaxcurrentMod_shortName ), unused_lenghtInteger )
    }
    else
    {
        
currentModCode = -1
        write_file
g_currentMod_shortName_filePath"" )
    }
    
    
configureMod_byModCodecurrentModCodecurrentMod_shortName )
}

/**
 * Configure the current mod action after is being loaded from the file at map server start.
 *
 * @param currentModCode the code loaded from the current mod file. If it is:
 *            -1, there is no mod active.
 *         0, the current mod was activated by silent mode.
 *
 * @param currentMod_shortName[] the current mod short name loaded from the
 *    current mod silent file.
 */
public configureMod_byModCodecurrentModCodecurrentMod_shortName[] )
{
    
DEBUG_LOGGER1,  "^n^ncurrentModCode: %d | currentMod_shortName: %s^n", \
            
currentModCodecurrentMod_shortName )
    
    switch( 
currentModCode )
    {
        case -
1:
        {
            
g_currentMod_id 2
            
            ArrayGetString
g_mod_shortNamesg_currentMod_idg_mod_short_name_tempcharsmaxg_mod_short_name_temp ) )
            
setCurrentMod_atLocalInfog_mod_short_name_temp )
        }
        case 
0:
        {
            
g_currentMod_id 0
            setCurrentMod_atLocalInfo
currentMod_shortName )
        }
        default:
        {
            
g_currentMod_id currentModCode 2
            
            ArrayGetString
g_mod_shortNamesg_currentMod_idg_mod_short_name_tempcharsmaxg_mod_short_name_temp ) )
            
setCurrentMod_atLocalInfog_mod_short_name_temp )
        }
    }
}

/**
 * Configure the current mod action after being voted the next mod.
 *
 * @param mostVoted_modID the mod most voted during the vote mod:
 *      If 1, is to keep the current mod
 *      If 2, is to disable the current mod.
 */
public configureMod_byModIDmostVoted_modID )
{
    
g_currentMod_id mostVoted_modID
    
    
switch( mostVoted_modID )
    {
        case 
1:
        {
            
DEBUG_LOGGER1"^nAT configureMod_byModID, we are keeping the current mod" )
        }
        case 
2:
        {
            
disableMods()
        }
        default:
        {
            
saveCurrentModBy_idmostVoted_modID )
            
ArrayGetStringg_mod_shortNamesmostVoted_modIDg_mod_short_name_tempcharsmaxg_mod_short_name_temp ) )
            
activateMod_byShortNameg_mod_short_name_temp )
        }
    }
}

/**
 * Saves the last mod activated at localinfo "amx_lastmod" and sets the localinfo
 *   "amx_correntmod" and the global variable "g_currentMod_shortName" to the mod
 *   short name currently activated.
 *
 * @param currentMod_shortName the current just activated mod short name.
 */
public setCurrentMod_atLocalInfocurrentMod_shortName[] )
{
    
retrievesCurrentMod_atLocalInfo()
    
    
configureMapcyclecurrentMod_shortName )
    
    
set_localinfo"amx_lastmod"g_currentMod_shortName )
    
set_localinfo"amx_correntmod",     currentMod_shortName )
    
    
copyg_currentMod_shortNamecharsmaxg_currentMod_shortName ), currentMod_shortName )
}

/**
 * Retrieves the localinfo "amx_correntmod"  as a mod short name to the global variable
 *   "g_currentMod_shortName".
 */
public retrievesCurrentMod_atLocalInfo()
{
    
get_localinfo"amx_correntmod"g_currentMod_shortNamecharsmaxg_currentMod_shortName ) );
}

/**
 * Given a mod_id_number, salves it to file "currentmod_id.ini", at multimod folder.
 *
 * @param mod_id_number the mod id. If the mod_id_number is:
 *         greater than 2, it is any mod.
 *            2, a silent mod activated.
 *         1, the mods are disabled.
 */
saveCurrentModBy_idmod_id_number )
{
    new 
mod_idStringSHORT_STRING ]
    
    if( 
file_existsg_currentMod_id_filePath ) )
    {
        
delete_fileg_currentMod_id_filePath )
    }
    
    
formatexmod_idStringcharsmaxmod_idString ), "%d"mod_id_number )
    
    
write_fileg_currentMod_id_filePathmod_idString )
}

/**
 *  Saves the current silent mod activated to file "currentmod_shortname.ini", at multimod folder.
 *
 * @param modShortName[] the mod short name. Ex: surf.
 */
public saveCurrentModBy_ShortNamemodShortName[] )
{
    if( 
file_existsg_currentMod_shortName_filePath ) )
    {
        
delete_fileg_currentMod_shortName_filePath )
    }
    
write_fileg_currentMod_shortName_filePathmodShortName )
}

/**
 * Makes at votemod menu, display the first mod as the option: "Keep Current Mod". And at
 * votemod menu, display the second mod as the option: "No mod - Disable Mod".
 */
public build_first_mods()
{
    
g_modCounter g_modCounter 2
    
    ArrayPushString
g_mod_names"Modo Silencioso" )
    
ArrayPushStringg_mod_shortNames"silentMod" )
    
    
ArrayPushStringg_mod_names"Extender Modo" )
    
ArrayPushStringg_mod_shortNames"extendCurrent" )
    
    
ArrayPushStringg_mod_names"Desactivar Modo" )
    
ArrayPushStringg_mod_shortNames"disableMod" )
}

/**
 * Loads the config file "voting_list.ini" and all mods stored there.
 */
public load_votingList()
{
    new 
currentLine         LONG_STRING ]
    new 
currentLine_splited SHORT_STRING ]
    new 
unusedLast_string   SHORT_STRING ]
    
    new 
votingList_filePointer fopeng_votingList_filePath"rt" )
    
    while( !
feofvotingList_filePointer ) )
    {
        
fgetsvotingList_filePointercurrentLinecharsmaxcurrentLine ) )
        
trimcurrentLine )
        
        
// skip commentaries while reading file
        
if( !currentLine]
            || 
currentLine] == ';'
            
|| ( currentLine] == '/'
                 
&& currentLine] == '/' ) )
        {
            continue
        }
        
        if( 
currentLine] == '[' )
        {
            
g_modCounter++
            
            
// remove line delimiters [ and ]
            
replace_allcurrentLinecharsmaxcurrentLine ), "[""" )
            
replace_allcurrentLinecharsmaxcurrentLine ), "]""" )
            
            
// broke the current config line, in modname ( g_mod_name_temp ), modtag ( g_mod_short_name_temp )
            
strtokcurrentLineg_mod_name_tempcharsmaxg_mod_name_temp ), currentLine_splited,
                    
charsmaxcurrentLine_splited ), ':')
            
strtokcurrentLine_splitedg_mod_short_name_tempcharsmaxg_mod_short_name_temp ), unusedLast_string,
                    
charsmaxunusedLast_string ), ':')
            
            
// stores at memory the modname and the modShortName
            
ArrayPushStringg_mod_namesg_mod_name_temp )
            
ArrayPushStringg_mod_shortNamesg_mod_short_name_temp )
        
        
#if IS_DEBUG_ENABLED > 0
            
ArrayGetStringg_mod_namesg_modCounterg_mod_name_tempcharsmaxg_mod_name_temp ) )
            
DEBUG_LOGGER1"[AMX MOD Loaded] %d - %s",  g_modCounter 2g_mod_name_temp )
            
            if( 
g_debug_level )
            {
                new 
mapcycle_filePath       SHORT_STRING ]
                new 
config_filePath         SHORT_STRING ]
                new 
plugin_filePath         SHORT_STRING ]
                new 
message_filePath        SHORT_STRING ]
                new 
messageResource_filePathSHORT_STRING ]
                new 
lateConfig_filePath     SHORT_STRING ]
                
                
mapcycle_pathCoderg_mod_short_name_tempmapcycle_filePathcharsmaxmapcycle_filePath ) )
                
config_pathCoderg_mod_short_name_tempconfig_filePathcharsmaxconfig_filePath ) )
                
plugin_pathCoderg_mod_short_name_tempplugin_filePathcharsmaxplugin_filePath ) )
                
message_pathCoderg_mod_short_name_tempmessage_filePathcharsmaxmessage_filePath ) )
                
                
messageResource_pathCoderg_mod_short_name_tempmessageResource_filePath,
                        
charsmaxmessageResource_filePath ) )
                
                
lateConfig_pathCoderg_mod_short_name_templateConfig_filePathcharsmaxlateConfig_filePath ) )
                
                
DEBUG_LOGGER1"[AMX MOD Loaded] %s"g_mod_short_name_temp )
                
DEBUG_LOGGER1"[AMX MOD Loaded] %s"mapcycle_filePath )
                
DEBUG_LOGGER1"[AMX MOD Loaded] %s"plugin_filePath )
                
DEBUG_LOGGER1"[AMX MOD Loaded] %s"config_filePath )
                
DEBUG_LOGGER1"[AMX MOD Loaded] %s"message_filePath )
                
DEBUG_LOGGER1"[AMX MOD Loaded] %s"lateConfig_filePath )
                
DEBUG_LOGGER1"[AMX MOD Loaded] %s^n"messageResource_filePath )
            }
        
#endif
        
}
    }
    
fclosevotingList_filePointer )
}

/**
 * Hard code the message recourse file location at the string parameter messageResource_filePath[].
 * These are the resource messages files at ".configs/multimod/" folder. executed when a
 *   resource as disable, is activated by the command "amx_setmod".
 *
 * @param modShortName[] the mod short name without extension. Ex: surf
 * @param messageResource_filePath[] the message resource file path containing its file extension.
 *                    Ex: mapcycles/surf.txt
 *
 * @param stringReturnSize the messageResource_filePath[] charsmax value.
 */
public messageResource_pathCoderresourceName[], messageResource_filePath[], stringReturnSize )
{
    
formatexmessageResource_filePathstringReturnSize"%s/multimod/%s.cfg"g_configFolderresourceName )
}

/**
 * Hard code the message file location at the string parameter message_filePath[].
 * These are the messages files at ".configs/multimod/msg/" folder, executed when a
 *   mod is activated by the command "amx_setmod".
 *
 * @param modShortName[] the mod short name without extension. Ex: surf
 * @param message_filePath[] the message file path containing its file extension. Ex: mapcycles/surf.txt
 * @param stringReturnSize the message_filePath[] charsmax value.
 */
public message_pathCodermodShortName[], message_filePath[], stringReturnSize )
{
    
formatexmessage_filePathstringReturnSize"%s/multimod/msg/%s.cfg"g_configFoldermodShortName )
}

/**
 * Hard code the plugin file location at the string parameter plugin_filePath[].
 * These are the mods plugins files, to be activated at ".configs/multimod/plugins/" folder.
 *
 * @param modShortName[] the mod short name without extension. Ex: surf
 * @param plugin_filePath[] the plugin file path containing its file extension. Ex: mapcycles/surf.txt
 * @param stringReturnSize the plugin_filePath[] charsmax value.
 */
public plugin_pathCodermodShortName[], plugin_filePath[], stringReturnSize )
{
    
formatexplugin_filePathstringReturnSize"%s/multimod/plugins/%s.ini"g_configFoldermodShortName )
}

/**
 * Hard code the config file location at the string parameter config_filePath[].
 * These are the mods configuration files, to be loaded at ".configs/multimod/cfg/" folder.
 *
 * @param modShortName[] the mod short name without extension. Ex: surf
 * @param config_filePath[] the config file path containing its file extension. Ex: mapcycles/surf.txt
 * @param stringReturnSize the config_filePath[] charsmax value.
 */
public config_pathCodermodShortName[], config_filePath[], stringReturnSize )
{
    
formatexconfig_filePathstringReturnSize"%s/multimod/cfg/%s.cfg"g_configFoldermodShortName )
}

/**
 * Hard code the late config file location at the string parameter lateConfig_filePath[].
 * These are the mods configuration files, to be loaded at ".configs/multimod/latecfg/" folder.
 * These files are only executed once when the mod is deactivated.
 *
 * @param modShortName[] the mod short name without extension. Ex: surf
 * @param lateConfig_filePath[] the late config file path containing its file extension. Ex: mapcycles/surf.txt
 * @param stringReturnSize the lateConfig_filePath[] charsmax value.
 */
public lateConfig_pathCodermodShortName[], lateConfig_filePath[], stringReturnSize )
{
    
formatexlateConfig_filePathstringReturnSize"%s/multimod/latecfg/%s.cfg"g_configFoldermodShortName )
}

/**
 * Hard code the mapcycle file location at the string parameter mapcycle_filePath[].
 * These are the mods mapcycles files at ".gamemod/mapcycles/" folder, to be used when a mod is
 *   activated.
 *
 * @param modShortName[] the mod short name without extension. Ex: surf
 * @param mapcycle_filePath[] the mapcycle file path containing its file extension. Ex: mapcycles/surf.txt
 * @param stringReturnSize the mapcycle_filePath[] charsmax value.
 */
public mapcycle_pathCodermodShortName[], mapcycle_filePath[], stringReturnSize )
{
    
formatexmapcycle_filePathstringReturnSize"mapcycles/%s.txt"modShortName )
}

/**
 * Configure which map cycles the server will use at start up and after each mod is loaded.
 *
 * @param modShortName[] the mod short name to configure is mapcycle. Ex: csdm
 */
configureMapcyclemodShortName[] )
{
    new 
mapcycle_filePathSHORT_STRING ]
    
    
mapcycle_pathCodermodShortNamemapcycle_filePathcharsmaxmapcycle_filePath ) )
    
    
configMapManagermapcycle_filePath )
    
configDailyMapsmapcycle_filePath )
}

/**
 * Makes the autoswitch between mapchooser and galileo_reloaded. If both are
 *   active, prevails galileo_reloaded.
 */
public switchMapManager()
{
    if( 
is_plugin_loaded"Galileo" ) != -)
    {
        
g_mapManagerType 2
    
}
    else if( 
find_plugin_byfile"Nextmap Chooser" ) != -)
    {
        
g_mapManagerType 1
    
}
}

/**
 * Setup the map manager to work with votemod menu at Silent mode. That is, configures
 *  the compatibility with galileo_reloaded, multimod_mapchooser and daily_maps, because now
 *  there is no mod_id_number, hence because the mod is not loaded from the mod file configs.
 *
 * @param mapcycle_filePath[] the mapcycle file name with extension and path. Ex: mapcycles/surf.txt
 */
public configMapManagermapcycle_filePath[] )
{
    if( 
file_existsmapcycle_filePath ) )
    {
        switch( 
g_mapManagerType )
        {
            case 
1:
            {
                if( 
callfunc_begin"plugin_init""multimod_mapchooser.amxx" ) == )
                {
                    
callfunc_end()
                }
                else
                {
                    
log_errorAMX_ERR_NOTFOUND"Error at configMapManager!! multimod_mapchooser.amxx NOT FOUND!^n" )
                    
print_at_console_to_all"Error at configMapManager!! multimod_mapchooser.amxx NOT FOUND!^n" )
                }
            }
            case 
2:
            {
                new 
galileo_mapfile get_cvar_pointer"gal_vote_mapfile" )
                
                if( 
galileo_mapfile )
                {
                    
set_pcvar_stringgalileo_mapfilemapcycle_filePath )
                }
            }
        }
    }
    
    if( 
file_existsmapcycle_filePath ) )
    {
        
set_pcvar_stringgp_mapcyclefilemapcycle_filePath )
    }
    
    
server_exec()
}

/**
 * Change the game global variable at localinfo isFirstTime_serverLoad to 1 or 2, after
 *   the first map load. It is to avoid mapcycle re-change, causing the first mapcycle
 *   map, always being the nextmap.
 *
 * The localinfo isFirstTime_serverLoad as 1, is used by multimod_manager.sma,
 *    to know if there is a game mod mapcycle file being used.
 *
 * The localinfo isFirstTime_serverLoad as 2, is used by multimod_daily_changer.sma,
 *    to know if its can define which one is the mapcycle.
 *
 * @param mapcycle_filePath[] the mapcycle file name with its extension and path. Ex: mapcycles/surf.txt
 */
public configDailyMapsmapcycle_filePath[] )
{
    new 
isFirstTime32 ]
    
    
get_localinfo(       "isFirstTime_serverLoad"isFirstTimecharsmaxisFirstTime ) );
    
g_isFirstTime_serverLoad str_to_numisFirstTime )
    
    if( 
g_isFirstTime_serverLoad  == )
    {
        new 
currentMapcycle_filePathSHORT_STRING ]
        
        
g_isTimeTo_changeMapcyle true
        
        get_pcvar_string
gp_mapcyclefilecurrentMapcycle_filePathcharsmaxcurrentMapcycle_filePath ) )
        
        
set_localinfo(   "firstMapcycle_loaded",         currentMapcycle_filePath )
    }

#if IS_DEBUG_ENABLED > 0
    
DEBUG_LOGGER1"( Inside ) configDailyMaps()" )
    
DEBUG_LOGGER1"g_isFirstTime_serverLoad is: %d",         g_isFirstTime_serverLoad         )
    
DEBUG_LOGGER1"g_isTimeTo_changeMapcyle is: %d",         g_isTimeTo_changeMapcyle         )
    
DEBUG_LOGGER1"file_exists( mapcycle_filePath ) is: %d"file_existsmapcycle_filePath ) )
    
DEBUG_LOGGER1"mapcycle_filePath is: %s^n",              mapcycle_filePath                )
#endif
    
    
if( g_isTimeTo_changeMapcyle )
    {
        
g_isTimeTo_changeMapcyle false
        
        
if( file_existsmapcycle_filePath ) )
        {
            
set_pcvar_string(   gp_mapcyclefile,           mapcycle_filePath )
            
set_localinfo(  "isFirstTime_serverLoad",         "1"                 )
            
server_exec()
        }
        else
        {
            
set_localinfo"isFirstTime_serverLoad""2" );
        }
    }
}

/**
 * Deactivate any loaded/active mod.
 */
public disableMods()
{
    
DEBUG_LOGGER1"^n AT disableMods, the g_currentMod_shortName is: %s^n"g_currentMod_shortName )
    
    if( 
file_existsg_currentMod_id_filePath ) )
    {
        
delete_fileg_currentMod_id_filePath )
    }
    
    if( 
file_existsg_masterConfig_filePath ) )
    {
        
delete_fileg_masterConfig_filePath )
    }
    
    if( 
file_existsg_currentMod_shortName_filePath ) )
    {
        
delete_fileg_currentMod_shortName_filePath )
    }
    
    if( 
file_existsg_masterPlugin_filePath ) )
    {
        
delete_fileg_masterPlugin_filePath )
    }
    
    
write_fileg_masterConfig_filePath,                     g_alertMultiMod )
    
write_fileg_masterPlugin_filePath,                                     g_alertMultiMod )
    
write_fileg_currentMod_shortName_filePath,         ""                             )
    
write_fileg_currentMod_id_filePath,                         "-1"                             )
}

/**
 * Actives a mod by its short name. If the the short name plugin file exists and
 *    change the current mod to 'Keep Current Mod'.
 *
 * @param modShortName[] the mod short name to active. Ex: surf
 *
 * @throws error any configuration file is missing!
 */
public activateMod_byShortNamemodShortName[] )
{
    new 
plugin_filePathLONG_STRING ]
    
    
plugin_pathCodermodShortNameplugin_filePathcharsmaxplugin_filePath ) )
    
    if( 
file_existsplugin_filePath ) )
    {
        new 
config_filePathLONG_STRING ]
        
        
config_pathCodermodShortNameconfig_filePathcharsmaxconfig_filePath ) )
        
        if( 
file_existsconfig_filePath ) )
        {
            
copyFilesconfig_filePathg_masterConfig_filePathg_alertMultiMod )
        }
        
copyFilesplugin_filePathg_masterPlugin_filePathg_alertMultiMod )
        
        
configureMapcyclemodShortName )
        
        
print_at_console_to_all"[AMX MOD Loaded] Setting multimod to %s"modShortName )
        
        return 
true
    
}
    else
    {
        
log_errorAMX_ERR_NOTFOUND"Error at activateMod_byShortName!! plugin_filePath: %s"plugin_filePath )
        
print_at_console_to_all"Error at activateMod_byShortName!! plugin_filePath: %s"plugin_filePath )
    }
    
DEBUG_LOGGER1"^n activateMod_byShortName, plugin_filePath: %s^n"plugin_filePath )
    
    return 
false
}

/**
 * Copy the sourceFilePath to destinationFilePath, replacing the existing file destination and
 * adding to its beginning the contents of the String inicialFileText.
 *
 * @param sourceFilePath[] the source file
 * @param destinationFilePath[] the destination file
 * @param inicialFileText[] an additional text
 */
public copyFilessourceFilePath[], destinationFilePath[], inicialFileText[] )
{
    if( 
file_existsdestinationFilePath ) )
    {
        
delete_filedestinationFilePath )
    }
    
write_filedestinationFilePathinicialFileText)
    
    new 
sourceFilePathPointer fopensourceFilePath"rt" )
    new 
Text512 ];
    
    while( !
feofsourceFilePathPointer ) )
    {
        
fgetssourceFilePathPointerTextsizeofText ) - )
        
trimText )
        
write_filedestinationFilePathText, -)
    }
    
fclosesourceFilePathPointer )
}

/**
 * Copies the contents of sourceFilePath to the beginning of destinationFilePath
 *
 * @param sourceFilePath[] the source file
 * @param destinationFilePath[] the destination file
 */
public copyFiles2sourceFilePath[], destinationFilePath[] )
{
    new 
sourceFilePathPointer fopensourceFilePath"rt" )
    new 
Text512 ];
    
    while( !
feofsourceFilePathPointer ) )
    {
        
fgetssourceFilePathPointerTextsizeofText ) - )
        
trimText )
        
write_filedestinationFilePathText, -)
    }
    
fclosesourceFilePathPointer )
}

/**
 * Displays a message to all server players about a command line Mod active with "amx_setmod".
 *
 * @param modShortName[] the activated mod mod long name. Ex: surf
 * @param isTimeToRestart inform to restart the server
 * @param isTimeTo_executeMessage instruct to execute the message activation file. Ex: "msg/csdm.cfg"
 */
public messageModActivatedmodShortName[], isTimeToRestartisTimeTo_executeMessage )
{
    
client_print_color_internal0"^1The mod ( ^4%s^1 ) will be activated at ^4next server restart^1."modShortName )
    
    if( 
isTimeToRestart )
    {
        new 
message_filePathLONG_STRING ]
        
        
message_pathCodermodShortNamemessage_filePathcharsmaxmessage_filePath ) )
        
        if( 
file_existsmessage_filePath )
            && 
isTimeTo_executeMessage )
        {
            
server_cmd"exec %s"message_filePath )
        }
        else
        {
            
// freeze the game and show the scoreboard
            
message_beginMSG_ALLSVC_INTERMISSION );
            
message_end();
            
            
set_task5.0"restartTheServer" );
        }
    }
}

/**
 * Displays a message to all server player about a command line Resource active with "amx_setmod".
 * Its must match the file msg name at "multimod" folder.
 *
 * @param resourceName[] the name of the activated resource. Ex: disable
 * @param isTimeToRestart inform to restart the server
 * @param isTimeTo_executeMessage instruct to execute the message activation file. Ex: "msg/csdm.cfg"
 */
public msgResourceActivatedresourceName[], isTimeToRestartisTimeTo_executeMessage )
{
    
client_print_color_internal0"^1The resource ( ^4%s^1 ) will be activated at ^4next server restart^1."resourceName )
    
    if( 
isTimeToRestart )
    {
        new 
messageResource_filePathLONG_STRING ]
        
        
messageResource_pathCoderresourceNamemessageResource_filePathcharsmaxmessageResource_filePath ) )
        
        if( 
file_existsmessageResource_filePath )
            && 
isTimeTo_executeMessage )
        {
            
server_cmd"exec %s"messageResource_filePath )
        }
        else
        {
            
// freeze the game and show the scoreboard
            
message_beginMSG_ALLSVC_INTERMISSION );
            
message_end();
            
            
set_task5.0"restartTheServer" );
        }
    }
}

/**
 * Displays a message to a specific server player show the current mod.
 *
 * @param player_id the player id
 */
public user_currentmodplayer_id )
{
    
ArrayGetString(               g_mod_namesg_currentMod_idg_mod_name_tempcharsmaxg_mod_name_temp ) )
    
client_print_color_internalplayer_id"^1L%"player_id"MM_HUDMSG"g_mod_name_temp )
    
    return 
PLUGIN_HANDLED
}

/**
 * Called with "say votemod". Checks:
 *    If users can invoke voting.
 *    If its already voted.
 *
 * @param player_id the player id
 */
public user_votemodplayer_id )
{
    if( 
get_pcvar_numgp_allowedvote ) )
    {
        
ArrayGetString(               g_mod_namesg_currentMod_idg_mod_name_tempcharsmaxg_mod_name_temp ) )
        
client_print_color_internalplayer_id"^1%L"player_id"MM_VOTEMOD"g_mod_name_temp )
        
        return 
PLUGIN_HANDLED
    
}
    new 
Float:elapsedTime get_pcvar_floatgp_timelimit ) - ( floatget_timeleft() ) / 60.0 )
    new 
Float:minTime
    minTime 
get_pcvar_floatgp_mintime )
    
    if( 
elapsedTime minTime )
    {
        
client_print_color_internalplayer_id"^4[AMX MultiMod]^1 %L"player_id"MM_PL_WAIT",
                
floatroundminTime elapsedTimefloatround_ceil ) )
        
        return 
PLUGIN_HANDLED
    
}
    new 
timeleft get_timeleft()
    
    if( 
timeleft 180 )
    {
        
client_print_color_internalplayer_id"^1%L"player_id"MM_PL_WAIT"timeleft )
        
        return 
PLUGIN_HANDLED
    
}
    
start_vote()
    return 
PLUGIN_HANDLED
}

public 
check_task()
{
    new 
timeleft get_timeleft()
    
    if( 
timeleft 300
        
|| timeleft 330 )
    {
        return
    }
    
start_vote()
}

/**
 * Start multi mod voting.
 *
 * If a new voting was invoked:
 *   Restart voting count.
 *   Restart voting players menu position.
 */
public start_vote()
{
    
remove_taskTASK_VOTEMOD )
    
remove_taskTASK_CHVOMOD )
    
    for( new 
033i++ )
    {
        
g_menuPosition] = 0
    
}
    
    
ArrayClearg_votemodcount )
    
    for( new 
0ArraySizeg_mod_names ); i++ )
    {
        
ArrayPushCellg_votemodcount)
    }
    
    
display_votemod_menu0)
    
client_cmd0"spk Gman/Gman_Choose2" )

#if IS_DEBUG_ENABLED > 0
    
set_task6.0"check_vote"TASK_CHVOMOD )
#else
    
set_task30.0"check_vote"TASK_CHVOMOD )
#endif
}

/**
 * Create the vote mod menu multi pages.
 *
 * @param player_id the player id to display the menu.
 * @param menu_current_page the number of the current menu page to draw the menu.
 */
public display_votemod_menuplayer_idmenu_current_page )
{
    if( 
menu_current_page )
    {
        return
    }
    
    new 
menu_body1024 ]
    new 
menu_valid_keys
    
new current_write_position
    
new current_page_itens
    
new g_menusNumber g_modCounter
    
    
// calc. g_menu_total_pages
    
if( ( g_menusNumber MENU_ITEMS_PER_PAGE ) > )
    {
        
g_menu_total_pages = ( g_menusNumber MENU_ITEMS_PER_PAGE ) + 1
    
}
    else
    {
        
g_menu_total_pages = ( g_menusNumber MENU_ITEMS_PER_PAGE )
    }
    
    
// calc. Menu titles
    
if( g_coloredmenus )
    {
        
current_write_position formatexmenu_bodycharsmaxmenu_body ), "\y%L: \R%d/%d\w^n^n",
                
player_id"MM_CHOOSE"menu_current_page 1g_menu_total_pages )
    }
    else
    {
        
current_write_position formatexmenu_bodycharsmaxmenu_body ), "%L: %d/%d^n^n",
                
player_id"MM_CHOOSE"menu_current_page 1g_menu_total_pages )
    }
    
    
// calc. the number of current_page_itens
    
if( g_menu_total_pages == menu_current_page )
    {
        
current_page_itens g_menusNumber MENU_ITEMS_PER_PAGE
    
}
    else
    {
        
current_page_itens MENU_ITEMS_PER_PAGE
    
}
    
    
// calc. the current page menu body
    
new for_index 0
    
new mod_vote_id
    
    
for( new vote_mod_code menu_current_page 10;
         
vote_mod_code menu_current_page 10 current_page_itensvote_mod_code++ )
    {
        
mod_vote_id convert_octal_to_decimalvote_mod_code )
        
        
ArrayGetStringg_mod_namesmod_vote_id 1g_mod_name_tempcharsmaxg_mod_name_temp ) )
        
        
current_write_position += formatexmenu_bodycurrent_write_position ],
                
sizeofmenu_body ) - current_write_position"%d. %s^n"for_index 1g_mod_name_temp )
        
        
DEBUG_LOGGER4"( inside ) display_votemod_menu()| mod_vote_id:%d"mod_vote_id )
        
for_index++
    }
    
    
// create valid keys ( 0 to 9 )
    
menu_valid_keys MENU_KEY_0
    
    
for( new 09i++ )
    {
        
menu_valid_keys |= ( << )
    }
    
menu_valid_keys |= MENU_KEY_9
    
    
// calc. the final page buttons
    
if( menu_current_page )
    {
        if( 
g_menu_total_pages == menu_current_page )
        {
            
current_write_position += formatexmenu_bodycurrent_write_position ],
                    
sizeofmenu_body ) - current_write_position"^n0. Atrás" )
        }
        else
        {
            
current_write_position += formatexmenu_bodycurrent_write_position ],
                    
sizeofmenu_body ) - current_write_position"^n9. Más...^n0. Atrás" )
        }
    }
    else
    {
        if( 
g_menu_total_pages != menu_current_page )
        {
            
current_write_position += formatexmenu_bodycurrent_write_position ],
                    
sizeofmenu_body ) - current_write_position"^n9. Más...^n" )
        }
    }

#if IS_DEBUG_ENABLED > 0
    
new debug_player_name64 ]
    
    
get_user_nameplayer_iddebug_player_name63 )
    
    
DEBUG_LOGGER1"Player: %s^nMenu body %s ^nMenu name: %s ^nMenu valid keys: %i", \
            
debug_player_namemenu_bodyg_menunamemenu_valid_keys )
    
    
show_menuplayer_idmenu_valid_keysmenu_body5g_menuname )
#else
    
show_menuplayer_idmenu_valid_keysmenu_body25g_menuname )
#endif
}

/**
 * Given a vote_mod_code ( octal number ), calculates and return the mod internal id
 * ( decimal number ).
 */
public convert_octal_to_decimaloctal_number )
{
    new 
decimal 0
    
new i       0
    
new remainder
    
    
while( octal_number != )
    {
        
remainder     octal_number 10
        octal_number 
/= 10
        decimal      
+= remainder power8);
        ++
i
    
}
    return 
decimal;
}

/**
 * Compute a player mod vote.
 *
 * @param player_id the player id
 * @param key the player pressed/option key.
 */
public player_voteplayer_idkey )
{
    
DEBUG_LOGGER4"Key before switch: %d"key )
    
    
/* Well, I dont know why, but it doesnt even matter, how hard you try...
     * You press the key 0, you gets 9 here. ...
     * So here, i made the switch back.  */
    
switch( key )
    {
        case 
9key 0
        
case 0key 1
        
case 1key 2
        
case 2key 3
        
case 3key 4
        
case 4key 5
        
case 5key 6
        
case 6key 7
        
case 7key 8
        
case 8key 9
    
}
    
DEBUG_LOGGER4"Key after switch: %d"key )
    
    if( 
key == )
    {
        if( 
g_menuPositionplayer_id ] + != g_menu_total_pages )
        {
            
display_votemod_menuplayer_id, ++g_menuPositionplayer_id ] )
        }
        else
        {
            
display_votemod_menuplayer_idg_menuPositionplayer_id ] )
        }
    }
    else
    {
        if( 
key == )
        {
            if( 
g_menuPositionplayer_id ] != )
            {
                
display_votemod_menuplayer_id, --g_menuPositionplayer_id ] )
            }
            else
            {
                
display_votemod_menuplayer_idg_menuPositionplayer_id ] )
            }
        }
        else
        {
            new 
mod_vote_id get_mod_vote_idg_menuPositionplayer_id ], key )
            
            if( 
mod_vote_id <= g_modCounter )
            {
                new 
player_nameSHORT_STRING ]
                
                
get_user_name(  player_idplayer_namecharsmaxplayer_name ) )
                
ArrayGetStringg_mod_namesmod_vote_idg_mod_name_tempcharsmaxg_mod_name_temp ) )
                
                
client_print_color_internal0"^1%L"LANG_PLAYER"X_CHOSE_X"player_nameg_mod_name_temp )
                
DEBUG_LOGGER1"^1%L"player_id"X_CHOSE_X"player_nameg_mod_name_temp )
                
                new 
current_votes ArrayGetCellg_votemodcountmod_vote_id )
                
                
ArraySetCellg_votemodcountmod_vote_idcurrent_votes )
            }
            else
            {
                
display_votemod_menuplayer_idg_menuPositionplayer_id ] )
            }
        }
    }
}

/**
 * Given a current_menu_page and a current_pressed_key, returns internal the vote mod id.
 *
 * @param current_menu_page the current page of player vote menu.
 * @param current_pressed_key the key pressed by the player to vote.
 */
public get_mod_vote_idcurrent_menu_pagecurrent_pressed_key )
{
    new 
vote_mod_code current_menu_page 10 current_pressed_key
    
new mod_vote_id   convert_octal_to_decimalvote_mod_code )
    
    return 
mod_vote_id
}

/**
 * Start computing the mod voting.
 */
public check_vote()
{
    new 
mostVoted_modID 1
    
new totalVotes
    
    
for( new possible_most_voted_index 0possible_most_voted_index <= g_modCounter;
         
possible_most_voted_index++ )
    {
        
g_dynamic_array_size_temp ArrayGetCellg_votemodcountpossible_most_voted_index )
        
        if( 
ArrayGetCellg_votemodcountmostVoted_modID ) < g_dynamic_array_size_temp )
        {
            
mostVoted_modID possible_most_voted_index
        
}
        
        
totalVotes totalVotes g_dynamic_array_size_temp
        
        DEBUG_LOGGER
1"( inside ) check_vote()| totalVotes:%d, g_dynamic_array_size_temp: %d", \
                
totalVotesg_dynamic_array_size_temp )
    }
    
displayVoteResultsmostVoted_modIDtotalVotes )
}

/**
 * Calculates the minimum votes required and print to server users the mod voting results.
 *
 * @param mostVoted_modID the most voted mod id.
 * @param totalVotes the number total of votes.
 */
public displayVoteResultsmostVoted_modIDtotalVotes )
{
    new 
playerMin players_currently_playing0.3 )
    
    
ArrayGetStringg_mod_namesmostVoted_modIDg_mod_name_tempcharsmaxg_mod_name_temp ) )
    
    if( 
totalVotes playerMin )
    {
        
g_isTimeTo_changeMapcyle true
        
        configureMod_byModID
(       mostVoted_modID    )
        
client_print_color_internal0,  "^1%L"LANG_PLAYER"MM_VOTEMOD"g_mod_name_temp )
        
server_cmd(        "exec %s"g_votingFinished_filePath )
    }
    else
    {
        
client_print_color_internal0,  "^1The vote did not reached the ^3required minimum! \
                ^4The next mod remains: %s"
g_mod_name_temp )
    }
    
    
print_at_console_to_all"Total Mod Votes: %d  | Player Min: %d  | Most Voted: %s",
            
totalVotesplayerMing_mod_name_temp )
}

/**
 * Returns the percent of player playing at game server, skipping bots and spectators.
 *
 * @param percent a percent of the total playing players, in decimal. Example for 30%: 0.3
 *
 * @return an integer of the parameter percent of players
 */
public players_currently_playingFloat:percent )
{
    new 
players32 ]
    new 
players_count
    
new count 0
    
    
// get the players in the server skipping bots
    
get_playersplayersplayers_count"c" )
    
    for( new 
0players_counti++ )
    {
        switch( 
get_user_teamplayers] ) )
        {
            case 
1:
            {
                
count++ // terror
            
}
            case 
2:
            {
                
count++ // ct
            
}
        }
    }
    return 
floatroundcount percent )
}

/**
 * Displays a message all players and server consoles.
 *
 * @param message[] the text formatting rules to display.
 * @param any the variable number of formatting parameters.
 */
public print_at_console_to_allmessage[], any: ... )
{
    static 
formated_messageLONG_STRING ]
    
    
vformatformated_messagecharsmaxformated_message ), message)
    
    
client_print0print_consoleformated_message )
    
server_printformated_message )
}

/**
 * Print colored text to a given player_id. It has to be called to each player using its player_id
 * instead of 'LANG_PLAYER' constant. Just use the 'LANG_PLAYER' constant when using this function
 * to display to all players.
 *
 * This includes the code:
 * ConnorMcLeod's [Dyn Native] ColorChat v0.3.2 (04 jul 2013) register_dictionary_colored function:
 *   <a href="https://forums.alliedmods.net/showthread.php?p=851160">ColorChat v0.3.2</a>
 *
 * If you are at the Amx Mod X 1.8.2, you can call this function using the player_id as 0. But it
 * will use more resources to decode its arguments. To be more optimized you should call it to every
 * player on the server, to display the colored message to all players using global scope. Example:
 * @code{.cpp}
 * #if AMXX_VERSION_NUM < 183
 * new g_colored_player_id
 * new g_colored_players_number
 * new g_colored_current_index
 * new g_colored_players_ids[ 32 ]
 * #endif
 *
 * some_function()
 * {
 *     ... some code
 * #if AMXX_VERSION_NUM < 183
 *     get_players( g_colored_players_ids, g_colored_players_number, "ch" );
 *
 *     for( g_colored_current_index = 0; g_colored_current_index < g_colored_players_number;
 *          g_colored_current_index++ )
 *     {
 *         g_colored_player_id = g_colored_players_ids[ g_colored_current_index ]
 *
 *         client_print_color_internal( g_colored_player_id, "^1%L %L %L",
 *                 g_colored_player_id, "LANG_A", g_colored_player_id, "LANG_B",
 *                 g_colored_player_id, "LANG_C", any_variable_used_on_LANG_C )
 *     }
 * #else
 *     client_print_color_internal( 0, "^1%L %L %L", LANG_PLAYER, "LANG_A",
 *             LANG_PLAYER, "LANG_B", LANG_PLAYER, "LANG_C", any_variable_used_on_LANG_C );
 * #endif
 *     ... some code
 * }
 * @endcode
 *
 * If you are at the Amx Mod X 1.8.3 or superior, you can call this function using the player_id
 * as 0, to display the colored message to all players on the server.
 *
 * If you run this function on a Game Mod that do not support colored messages, they will be
 * displayed as normal messages without any errors or bad formats.
 *
 * This allow you to use '!g for green', '!y for yellow', '!t for team' color with LANGs at a
 * register_dictionary_colored file. Otherwise use '^1', '^2', '^3' and '^4'.
 *
 * @param player_id the player id.
 * @param message[] the text formatting rules to display.
 * @param any the variable number of formatting parameters.
 *
 * @see <a href="https://www.amxmodx.org/api/amxmodx/client_print_color">client_print_color</a>
 * for Amx Mod X 1.8.3 or superior.
 */
stock client_print_color_internalplayer_idmessage[], any: ... )
{
    new 
formated_messageCOLOR_MESSAGE ]
    
    if( 
g_is_color_chat_supported )
    {
#if AMXX_VERSION_NUM < 183
        
if( player_id )
        {
            
vformatformated_messagecharsmaxformated_message ), message)
            
DEBUG_LOGGER64"( in ) Player_Id: %d, Chat printed: %s"player_idformated_message )
            
            
PRINT_COLORED_MESSAGEplayer_idformated_message )
        }
        else
        {
            new 
players_array32 ]
            new 
players_number;
            
            
get_playersplayers_arrayplayers_number"ch" );
            
            
// Figure out if at least 1 player is connected
            // so we don't execute useless code
            
if( !players_number )
            {
                
DEBUG_LOGGER64"!players_number. players_number = %d"players_number )
                return;
            }
            
            new 
player_id;
            new 
string_index
            
new argument_index
            
new multi_lingual_constants_number
            
            
new params_number                     numargs();
            new Array:
multi_lingual_indexes_array ArrayCreate();
            
            
DEBUG_LOGGER64"players_number: %d, params_number: %d"players_numberparams_number )
            
            if( 
params_number >= // ML can be used
            
{
                for( 
argument_index 2argument_index params_numberargument_index++ )
                {
                    
DEBUG_LOGGER64"argument_index: %d, getarg(argument_index): %d / %s", \
                            
argument_indexgetargargument_index ), getargargument_index ) )
                    
                    
// retrieve original param value and check if it's LANG_PLAYER value
                    
if( getargargument_index ) == LANG_PLAYER )
                    {
                        
string_index 0;
                        
                        
// as LANG_PLAYER == -1, check if next param string is a registered language translation
                        
while( ( formated_messagestring_index ] =
                                     
getargargument_index 1string_index++ ) ) )
                        {
                        }
                        
formated_messagestring_index ] = 0
                        
                        DEBUG_LOGGER
64"Player_Id: %d, formated_message: %s, \
                                GetLangTransKey( formated_message ) != TransKey_Bad: %d"
, \
                                
player_idformated_message, \
                                
GetLangTransKeyformated_message ) != TransKey_Bad )
                        
                        
DEBUG_LOGGER64"(multi_lingual_constants_number: %d, string_index: %d", \
                                
multi_lingual_constants_numberstring_index )
                        
                        if( 
GetLangTransKeyformated_message ) != TransKey_Bad )
                        {
                            
// Store that argument as LANG_PLAYER so we can alter it later
                            
ArrayPushCellmulti_lingual_indexes_arrayargument_index++ );
                            
                            
// Update ML array, so we'll know 1st if ML is used,
                            // 2nd how many arguments we have to change
                            
multi_lingual_constants_number++;
                        }
                        
                        
DEBUG_LOGGER64"argument_index (after ArrayPushCell): %d"argument_index )
                    }
                }
            }
            
            
DEBUG_LOGGER64"(multi_lingual_constants_number: %d"multi_lingual_constants_number )
            
            for( --
players_numberplayers_number >= 0players_number-- )
            {
                
player_id players_arrayplayers_number ];
                
                if( 
multi_lingual_constants_number )
                {
                    for( 
argument_index 0argument_index multi_lingual_constants_numberargument_index++ )
                    {
                        
// Set all LANG_PLAYER args to player index ( = player_id )
                        // so we can format the text for that specific player
                        
setargArrayGetCellmulti_lingual_indexes_arrayargument_index ), _player_id );
                        
                        
DEBUG_LOGGER64"(argument_index: %d, player_id: %d, \
                                ArrayGetCell( multi_lingual_indexes_array, argument_index ): %d"
, \
                                
argument_indexplayer_id, \
                                
ArrayGetCellmulti_lingual_indexes_arrayargument_index ) )
                    }
                    
vformatformated_messagecharsmaxformated_message ), message)
                }
                
                
DEBUG_LOGGER64"( in ) Player_Id: %d, Chat printed: %s"player_idformated_message )
                
PRINT_COLORED_MESSAGEplayer_idformated_message )
            }
            
            
ArrayDestroymulti_lingual_indexes_array );
        }
#else
        
vformatformated_messagecharsmaxformated_message ), message)
        
DEBUG_LOGGER64"( in ) Player_Id: %d, Chat printed: %s"player_idformated_message )
        
        
client_print_colorplayer_idprint_team_defaultformated_message )
#endif
    
}
    else
    {
        
vformatformated_messagecharsmaxformated_message ), message)
        
DEBUG_LOGGER64"( in ) Player_Id: %d, Chat printed: %s"player_idformated_message )
        
        
REMOVE_COLOR_TAGSformated_message )
        
client_printplayer_idprint_chatformated_message )
    }
    
    
// this is to show the immediate results, as the plugin is usually controlled by the server
    // or the player console.
    
if( player_id )
    {
        
client_printplayer_idprint_consoleformated_message )
    }
    else
    {
        
server_printformated_message )
    }
    
    
DEBUG_LOGGER64"( out ) Player_Id: %d, Chat printed: %s"player_idformated_message )
}

/**
 * ConnorMcLeod's [Dyn Native] ColorChat v0.3.2 (04 jul 2013) register_dictionary_colored function:
 *   <a href="https://forums.alliedmods.net/showthread.php?p=851160">ColorChat v0.3.2</a>
 *
 * @param filename the dictionary file name including its file extension.
 */
stock register_dictionary_colored( const filename[] )
{
    if( !
register_dictionaryfilename ) )
    {
        return 
0;
    }
    
    new 
szFileName256 ];
    
get_localinfo"amxx_datadir"szFileNamecharsmaxszFileName ) );
    
formatexszFileNamecharsmaxszFileName ), "%s/lang/%s"szFileNamefilename );
    new 
fp fopenszFileName"rt" );
    
    if( !
fp )
    {
        
log_amx"Failed to open %s"szFileName );
        return 
0;
    }
    
    new 
szBuffer512 ], szLang], szKey64 ], szTranslation256 ], TransKey:iKey;
    
    while( !
feoffp ) )
    {
        
fgetsfpszBuffercharsmaxszBuffer ) );
        
trimszBuffer );
        
        if( 
szBuffer] == '[' )
        {
            
strtokszBuffer], szLangcharsmaxszLang ), szBuffer1']' );
        }
        else if( 
szBuffer] )
        {
        
#if AMXX_VERSION_NUM < 183
            
strbreakszBufferszKeycharsmaxszKey ), szTranslationcharsmaxszTranslation ) );
        
#else
            
argbreakszBufferszKeycharsmaxszKey ), szTranslationcharsmaxszTranslation ) );
        
#endif
            
iKey GetLangTransKeyszKey );
            
            if( 
iKey != TransKey_Bad )
            {
                
INSERT_COLOR_TAGSszTranslation )
                
AddTranslationszLangiKeyszTranslation] );
            }
        }
    }
    
    
fclosefp );
    return 
1;

Rivotril is offline
Reply


Thread Tools
Display Modes

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 14:21.


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