pedido countdown con hud
#1
buenas tengo esta funcion
Código PHP:
public StartVoting()
{
    
remove_task(TASK_READY);
    
ExecuteEvent(ALL_PLAYER_IS_READY)
    if(!
g_votes)
    {
        
g_votes TrieCreate()
    }
    
TrieClear(g_votes)
    
g_iCurrentVote = -1;
    
pug_state VOTING;
    if(
get_pcvar_num(g_pVoteMap) > 0)
    {
        
StartVoteMap()
    }
    else
    {
        
set_pcvar_num(g_pVoteMap1)
        
NextVote()
    }


y si me pueden ayudar que esta funcion
Código PHP:
StartVoteMap() 
se active despues de pasar 10 seg un countdown con hud que diga faltan tantos segundos para que empieze la votacion de mapa
Responder
#2
(27/06/2019, 01:53 PM)Forever123 escribió: buenas tengo esta funcion
Código PHP:
public StartVoting()
{
    
remove_task(TASK_READY);
    
ExecuteEvent(ALL_PLAYER_IS_READY)
    if(!
g_votes)
    {
        
g_votes TrieCreate()
    }
    
TrieClear(g_votes)
    
g_iCurrentVote = -1;
    
pug_state VOTING;
    if(
get_pcvar_num(g_pVoteMap) > 0)
    {
        
StartVoteMap()
    }
    else
    {
        
set_pcvar_num(g_pVoteMap1)
        
NextVote()
    }


y si me pueden ayudar que esta funcion
Código PHP:
StartVoteMap() 
se active despues de pasar 10 seg un countdown con hud que diga faltan tantos segundos para que empieze la votacion de mapa

La verdad no veo el CountDown. Pero aca te dejo uno
https://forums.alliedmods.net/showthread...?p=1904268
___________________________________
SI NECESITAS UN PLUGIN TE LO HAGO $$$
COMUNICATE A MI DISCORD: emanuelitop15
Responder
#3
Te escribí esto, espero te sirva.

Si necesitas ayuda en algo más avisa por aquí.

Saludos. Crab


Código PHP:
/*
    NOMBRE: VoteMap Countdown
    
    VÍNCULO: 

    AUTOR: Chema - [ www.facebook.com/CSPlayerChema ]

    CHANGELOG:
    
    - 1.0b
        [*] Versión inicial, Fecha de lanzamiento: 28 de junio de 2019.
*/

#include < amxmodx >
#include < engine >
#include < fakemeta >
#include < colorchat >

#pragma semicolon 1

/* GLOBAL STUFF */
#define IsUserValidConnected(%1) ( 1 <= %1 <= g_iMaxPlayers{0} && is_user_connected( %1 ) )

#define MAX_USERS 32 + 1

new const g_szPluginName[ ] = "VoteMap Countdown";
new const 
g_szPluginVersion[ ] = "1.0b";
new const 
g_szPluginAuthor[ ] = "Chema";
new const 
g_szPluginCvar[ ] = "vmc_version";

new const 
g_szWebsiteUrl[ ] = "www.skill-gamerz.net";
new const 
g_szItemMenuSound[ ] = "Ui/buttonclickrelease.wav";

enum _:eMap_Struct {

    
Map_Name21 ],
    
Map_RealName21 ]
};

new const 
g_szMapNames[ ][ _:eMap_Struct ] = {

    { 
"DUST II""de_dust2" },
    { 
"INFERNO""de_inferno" },
    { 
"NUKE""de_nuke" },
    { 
"MIRAGE""de_mirage" },
    { 
"CBBLE""de_cbble" },
    { 
"ASSAULT""cs_assault" },
    { 
"DUST""de_dust" },
    { 
"MILITIA""cs_militia" },
    { 
"ITALY""cs_italy" },
    { 
"ESTATE""cs_estate" }
};

new 
g_szPlayerNameMAX_USERS ][ 32 ];
new 
g_iPageMAX_USERS ];

enum {

    
Countdown_Vote,
    
Countdown_Random,
    
Countdown_Normal
};

new 
g_iCountdown;
new 
g_iCountdownType;
new 
g_iCountdownEntity;
new 
g_iRandomMap;
new 
g_iMapWinner 0;

new 
bool:g_bVoteStarted false;
new 
bool:g_bVoteIsRunning;

new 
g_iMapssizeofg_szMapNames ) ];
new 
g_iVotessizeofg_szMapNames ) ];
new 
g_iMaxPlayers1 char ];

public 
plugin_init( ) {

    
/* Register Plugin & Cvars */
    
register_pluging_szPluginNameg_szPluginVersiong_szPluginAuthor );

    
register_cvarg_szPluginCvarg_szPluginVersionFCVAR_SERVER|FCVAR_SPONLY );

    
/* Client-related Stuff */
    
register_clcmd"say !startvote""ClientCommand_StartCountdown" );

    
/* Menus */
    
register_menucmdregister_menuid"Maps Menu" ), 1023"HandlerVoteMapMenu" );
    
    
/* Think's */
    
static szCountClassName[ ] = "VoteMapTimer";
    
register_thinkszCountClassName"Think_VoteMap" );

    
/* Global Vars & Entities */
    
g_iCountdownEntity create_entity"info_target" );
    
set_pevg_iCountdownEntitypev_classnameszCountClassName );

    
g_iMaxPlayers{0} = get_maxplayers( );
}

/* Client-related Stuff */
public ClientCommand_StartCountdown( const id ) {

    if( !( 
get_user_flagsid ) & ADMIN_IMMUNITY ) ) {

        
ColorChatidRed"No tienes acceso para ejecutar una votación de mapa." );
        return 
1;
    }

    if( 
g_bVoteIsRunning ) {

        
ColorChatidRed"Hay una votación en progreso." );
        return 
1;
    }

    if( 
g_bVoteStarted ) {

        
ColorChatidRed"Ya se realizó una votación." );
        return 
1;
    }

    
g_iCountdownType Countdown_Vote;
    
g_iCountdown 10;
    
set_pevg_iCountdownEntitypev_nextthinkget_gametime( ) );

    
get_user_nameidg_szPlayerNameid ], charsmaxg_szPlayerName ) );
    
ColorChatidRed"El administrador ^4%s^1 inició el conteo para la votación de mapa."g_szPlayerNameid ] );

    
g_bVoteStarted true;
    return 
1;
}

/* Think's */
public Think_VoteMap( const iEntity ) {
    
    new 
iColor];
    
iColor] = random_num0255 );
    
iColor] = random_num0255 );
    
iColor] = random_num0255 );

    if( 
g_iCountdown ) {

        if( 
g_iCountdownType == Countdown_Vote ) {

            
set_hudmessageiColor], iColor], iColor], -1.0, -1.000.01.10.00.0);
            
show_hudmessage0"La votación para el siguiente mapa^ncomenzará en %i segundo%s"g_iCountdowng_iCountdown "s" "" );
        }
        else if( 
g_iCountdownType == Countdown_Random ) {

            
set_hudmessageiColor], iColor], iColor], -1.0, -1.000.01.10.00.0);
            
show_hudmessage0"Nadie votó, se elegirá un mapa aleatorio en %i segundo%s"g_iCountdowng_iCountdown "s" "" );
        }
        else if( 
g_iCountdownType == Countdown_Normal ) {

            
set_hudmessageiColor], iColor], iColor], -1.0, -1.000.01.10.00.0);
            
show_hudmessage0"Cambiando de mapa en %i segundo%s..."g_iCountdowng_iCountdown "s" "" );
        }

        
set_peviEntitypev_nextthinkget_gametime( ) + 1.0 );

        new 
szBuffer16 ];
        
num_to_wordg_iCountdownszBuffer15 );
        
client_cmd0"spk ^"fvox/%s^""szBuffer );

        --
g_iCountdown;
    }
    else {
        
        if( 
g_iCountdownType == Countdown_Vote ) {

            
set_hudmessageiColor], iColor], iColor], -1.0, -1.000.01.10.00.0);
            
show_hudmessage0"Votación para el siguiente mapa iniciada!" );

            for( new 
0sizeofg_szMapNames ); i++ ) {

                
g_iMaps] = 0;
                
g_iVotes] = 0;
            }

            
g_bVoteIsRunning true;

            for( new 
id 1id <= g_iMaxPlayers{0}; id++ ) {

                if( !
is_user_connectedid ) )
                    continue;

                if( 
get_user_teamid ) == || get_user_teamid ) == )
                    
ShowVoteMapMenuidg_iPageid ] = );
            }

            
set_task10.0"task_VoteMapEnd" );
        }
        else if( 
g_iCountdownType == Countdown_Random )
            
task__SelectRandomMap( );
        else if( 
g_iCountdownType == Countdown_Normal ) {

            
set_hudmessageiColor], iColor], iColor], -1.0, -1.000.01.10.00.0);
            
show_hudmessage0"La votación para el siguiente mapa^ncomenzará en %i segundo%s"g_iCountdowng_iCountdown "s" "" );
        }
    }
}

/* VoteMap Menu */
ShowVoteMapMenuidiPage ) {

    if( 
iPage )
        return 
0;
    
    new 
szMenu256 ], szMap22 ], iNumiStart iPage 6iEnd iStart 6;
    
    
get_mapnameszMapcharsmaxszMap ) );

    
iNum sizeofg_szMapNames );
    if( 
iStart iNum iStart iPage g_iPageid ] = 0;
    if( 
iEnd iNum iEnd iNum;
    
    new 
iActualiLeniCurrentKeyiKeys = ( << );

    
iLen formatexszMenuiLen ], 255"\ySkill-Gamerz \r- \yVotación de mapa! \r(%s)^n\d%s^n^n"g_szPluginVersiong_szWebsiteUrl );
    
    for( new 
iStartiEndi++ ) {

        
iActual equalszMapg_szMapNames][ Map_RealName ] );

        if( 
iActual )
            
iCurrentKey++;
        else
            
iKeys |= ( << iCurrentKey++ );
        
        
iLen += formatexszMenuiLen ], 255 iLen"\r%i. %s%s%s^n"iCurrentKeyiActual "\d" "\w"g_szMapNames][ Map_Name ], iActual " \r[ACTÚAL]" "" );
    }
    
    
iLen += formatexszMenuiLen ], 255 iLen"^n\r7. \wNo votar" );

    if( 
g_iPageid ] == ) {

        
iKeys |= ( << )|( << );
        
iLen += formatexszMenuiLen ], 255 iLen"^n\d8. \dAtrás^n" );
        
iLen += formatexszMenuiLen ], 255 iLen"\r9. \wSiguiente^n" );
    }
    else {

        
iKeys |= ( << )|( << );
        
iLen += formatexszMenuiLen ], 255 iLen"^n\r8. \wAtrás^n" );
        
iLen += formatexszMenuiLen ], 255 iLen"\d9. \dSiguiente^n" );
    }

    
iLen += formatexszMenuiLen ], 255 iLen"^n\r0. \wCerrar" );

    
show_menuidiKeysszMenu, -1"Maps Menu" );
    
    return 
0;
}

public 
HandlerVoteMapMenu( const id, const iKey ) {

    if( !
g_bVoteIsRunning )
        return 
1;

    
get_user_nameidg_szPlayerNameid ], charsmaxg_szPlayerName ) );

    switch( 
iKey ) {

        case 
0..5: {

            
g_iMapsg_iPageid ] * iKey ]++;
            
g_iVotesg_iPageid ] * iKey ]++;

            
ColorChatidRed"^4%s^1 votó por el mapa: ^3%s^1."g_szPlayerNameid ], g_szMapNamesg_iPageid ] * iKey ][ Map_Name ] );
        }
        case 
6ColorChatidRed"^4%s^1 eligió no ser parte de la votación."g_szPlayerNameid ] );
        case 
7: {

            if( 
g_iPageid ] == )
                
g_iPageid ] = 0;

            
ShowVoteMapMenuidg_iPageid ] );
        }
        case 
8: {

            if( 
g_iPageid ] == )
                
g_iPageid ] = 1;

            
ShowVoteMapMenuidg_iPageid ] );
        }
    }
    
    if( 
iKey != )
        
client_cmdid"spk ^"%s^""g_szItemMenuSound );

    return 
1;
}

/* Task's */
public task__VoteMapEnd( ) {

    
g_bVoteIsRunning false;
    
    new 
iMapWinner], Float:fTotal;
    for( new 
0sizeofg_szMapNames ); i++ ) {

        if( 
g_iMaps] > iMapWinner] ) {

            
iMapWinner] = i;
            
iMapWinner] = g_iMaps];
        }
        
g_iMaps] = 0;
    }

    for( new 
id 1id <= g_iMaxPlayers{0}; id++ ) {

        if( !
is_user_connectedid ) )
            continue;

        
show_menuid0"^n");
    }

    for( new 
0sizeofg_szMapNames ); i++ )
        
fTotal floatg_iMaps] + );

    if( !
iMapWinner] ) {

        
g_iCountdownType Countdown_Random;
        
g_iCountdown 5;
        
set_pevg_iCountdownEntitypev_nextthinkget_gametime( ) );
    }
    else {

        
g_iMapWinner iMapWinner];
        
ColorChat0Red"El mapa ganador fue: ^4%s^1 con ^3%i/%i^1 votos."g_szMapNamesiMapWinner] ][ Map_Name ], g_iVotesiMapWinner] ], floatroundfTotal ) );
        
g_iCountdownType Countdown_Normal;
        
g_iCountdown 5;
        
set_pevg_iCountdownEntitypev_nextthinkget_gametime( ) );
        
set_task5.0"task__ChangeMap" );
    }
    
    return 
1;
}

public 
task__SelectRandomMap( ) {

    
g_iRandomMap random_num0sizeofg_szMapNames ) - );

    
ColorChat0Red"El mapa elegido aleatoriamente fue: ^3%s^1."g_szMapNamesg_iRandomMap ][ Map_Name ] );
    
set_task2.5"task__SetThink" );
    return 
1;
}

public 
task__SetThink( ) {

    
g_iCountdownType Countdown_Normal;
    
g_iCountdown 5;
    
set_pevg_iCountdownEntitypev_nextthinkget_gametime( ) );
    
set_task5.0"task__ChangeRandomMap" );
}

public 
task__ChangeMap( ) {

    
server_cmd"changelevel ^"%s^""g_szMapNamesg_iMapWinner ][ Map_RealName ] );
    
remove_task( );
    return 
1;
}

public 
task__ChangeRandomMap( ) {

    
server_cmd"changelevel ^"%s^""g_szMapNamesg_iRandomMap ][ Map_RealName ] );
    
remove_task( );
    return 
1;



Archivos adjuntos
.inc   colorchat.inc (Tamaño: 2.12 KB / Descargas: 4)
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)