Allied Modders en español

Versión completa: votemap cada 20 rondas
Actualmente estas viendo una versión simplificada de nuestro contenido. Ver la versión completa con el formato correcto.
hola buenas, vengo a realizar un pedido o consulta, bueno si abra un plugin que se pueda elegir mapa cada 20 rondas, bueno espero me ayuden, saludos.
Código PHP:
#include <amxmodx>
#include <amxmisc>

#define SELECTMAPS  4
#define charsof(%1) (sizeof(%1)-1)

new n_roundsp_galileog_maxrounds, Array:g_mapNameg_mapNumsg_lastMap[32], g_nextName[SELECTMAPS], c

public plugin_init() {
    
register_plugin("Count Round+Nextmap Chooser"AMXX_VERSION_STR"AMXX Dev Team (edited mlibre)")
    
    
p_galileo register_cvar("amx_galileo","0")
    
g_maxrounds register_cvar("amx_maxrounds","20")
    
    
register_event("HLTV""event_RoundStart""a""1=0""2=0")
    
register_event("TextMsg""event_GameRestart""a""2=#Game_Commencing""2=#Game_will_restart_in")
    
    
g_mapName=ArrayCreate(32)
    
    
get_localinfo("lastMap"g_lastMapcharsmax(g_lastMap))
    
set_localinfo("lastMap""")
    
    new 
maps_ini_file[64]; get_configsdir(maps_ini_filecharsmax(maps_ini_file))
    
    
formatex(maps_ini_filecharsmax(maps_ini_file), "%s/maps.ini"maps_ini_file)
    
    if (!
file_exists(maps_ini_file)) 
        
get_cvar_string("mapcyclefile"maps_ini_filecharsmax(maps_ini_file))
    
    
loadSettings(maps_ini_file)
}
bool:isInMenu(id)
{
    for (new 
0c; ++a)
    {
        if (
id == g_nextName[a])
            return 
true
    
}    
    return 
false
}
public 
event_RoundStart()
{
    
n_rounds++
    
    if( 
n_rounds >= get_pcvar_num(g_maxrounds) )
    {
        if( 
get_pcvar_num(p_galileo) )
        {
            
set_cvar_num("gal_rtv_wait", -1), server_cmd("gal_startvote")
        }
        else {
            new 
map[128], admax = (g_mapNums SELECTMAPS) ? SELECTMAPS g_mapNumsx
            
            
for (0dmax; ++c)
            {
                
random_num(0g_mapNums 1)
                
                while (
isInMenu(a))
                    if (++
>= g_mapNums0
                
                g_nextName
[c] = a
                
                x 
+= formatex(map[x], charsmax(map), " %a"ArrayGetStringHandle(g_mapNamea) )
            }
            
server_cmd("amx_votemap%s"map[0])
            
            
client_cmd(0"spk Gman/Gman_Choose2")
        }
    }
}
public 
event_GameRestart()
{
    
n_rounds 0
}
loadSettings(filename[])
{
    if (!
file_exists(filename))
        return 
0
    
    
new szText[32], currentMap[32], buff[256]; get_mapname(currentMapcharsmax(currentMap))
    
    new 
fp=fopen(filename,"r");
    
    while (!
feof(fp))
    {
        
buff[0]='^0';
        
szText[0]='^0';
        
        
fgets(fpbuffcharsof(buff));
        
        
parse(buffszTextcharsof(szText));
        
        if (
szText[0] != ';' &&
        
ValidMap(szText) &&
        !
equali(szTextg_lastMap) &&
        !
equali(szTextcurrentMap))
        {
            
ArrayPushString(g_mapNameszText);
            ++
g_mapNums;
        }
    
    }
    
fclose(fp);
    
    return 
g_mapNums
}
stock bool:ValidMap(mapname[])
{
    if ( 
is_map_valid(mapname) )
    {
        return 
true;
    }
    
// If the is_map_valid check failed, check the end of the string
    
new len strlen(mapname) - 4;
    
    
// The mapname was too short to possibly house the .bsp extension
    
if (len 0)
    {
        return 
false;
    }
    if ( 
equali(mapname[len], ".bsp") )
    {
        
// If the ending was .bsp, then cut it off.
        // the string is byref'ed, so this copies back to the loaded text.
        
mapname[len] = '^0';
        
        
// recheck
        
if ( is_map_valid(mapname) )
        {
            return 
true;
        }
    }
    return 
false;
}
public 
plugin_end()
{
    new 
current_map[32]; get_mapname(current_mapcharsmax(current_map))
    
    
set_localinfo("lastMap"current_map)

  • fix gal_rtv_wait