Raised This Month: $32 Target: $400
 8% 

Tactical time out


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
666
Senior Member
Join Date: Mar 2015
Old 03-29-2019 , 17:13   Tactical time out
Reply With Quote #1

Can you help me in making this supplement, it consists of a tactical waiting time equal to that of Csgo, a vote is called to make the waiting time tactical, if the majority of votes is yes, the waiting time starts in the next round with a duration of 1 minute, then at the end of the minute, the freezing period continues with its normal time, and this can only be used 3 times per team.


I found this in a forum but I do not know if it's really good:
PHP Code:
#include <amxmodx>

const MIN_PLAYERS 5;
const 
PAUSE_DURATION 60;
const 
TASK_FINISHVOTE 1337;

new const 
g_szTeamNames[][] = {"UNASSIGNED","TERRORIST","CT","SPECTATOR"};
new 
g_iVotesg_iMenug_iNeededg_iSaveValuebool:g_bDoTacticalPauseg_iTacticalPause[2];

public 
plugin_init( )
{
    
register_plugin"Tactical Pause""1.0""Manu" );
    
    
register_clcmd"say /pausa""CommandPause" );
    
register_logevent"ev_RoundStart"2"1=Round_Start" );
}

public 
ev_RoundStart( )
{
    
g_bDoTacticalPause false;
    
set_cvar_num"mp_freezetime"g_iSaveValue );
}

public 
CommandPauseiId )
{
    new 
iTeam get_user_teamiId );
    
    if( 
<= iTeam <= )
    {
        if( !
g_iTacticalPauseiTeam ] )
        {
            if( !
g_bDoTacticalPause )
            {
                if( !
task_existsTASK_FINISHVOTE ) )
                {
                    new 
iPlayers[32], szName[32]; g_iNeeded 0;
                    
                    
get_playersiPlayersg_iNeeded"e"g_szTeamNames[iTeam] );
                    
                    if( 
g_iNeeded >= MIN_PLAYERS )
                    {
                        
g_iMenu menu_create"¿Quieres una pausa tactica?""VoteHandler" );
                        
                        
menu_additemg_iMenu"Si\d, quiero" );
                        
menu_additemg_iMenu"No\d, cancelar" );
                        
                        
menu_addtextg_iMenu"^n\r[!]\w Quince segundos para votar!" );
                        
menu_setpropg_iMenuMPROP_EXITMEXIT_NEVER );
                        
                        for( new 
ig_iNeededi++ )
                            
menu_displayiPlayers[i], g_iMenu );
                        
                        
get_user_nameiIdszNamecharsmaxszName ) );
                        
client_print_color0print_team_default"^3%s^1 inicio una votacion para una pausa tactica!"szName );
                        
                        
g_iVotes 0;
                        
g_iTacticalPauseiTeam ] = floatroundget_gametime( ) );
                        
                        
set_task15.0"FinishVote"TASK_FINISHVOTE );
                    }
                    else
                        
client_print_coloriIdprint_team_default"Tu equipo no posee suficientes jugadores para utilizar esto." );
                }
                else
                    
client_print_coloriIdprint_team_default"Ya hay una votacion en progreso para una pausa tactica." );
            }
            else
                
client_print_coloriIdprint_team_default"Ya hay una pausa tactica en progreso, espera a que termine." );
        }
        else
            
client_print_coloriIdprint_team_default"Tu equipo ya ha votado por una pausa tactica." );
    }
    else
        
client_print_coloriIdprint_team_default"Tienes que estar jugando para usar este comando." );
    
    return 
PLUGIN_HANDLED;
}

public 
FinishVoteiTaskId )
{
    new 
iTeam = (g_iTacticalPause[0] > g_iTacticalPause[1]) ? 1;
    
    if( 
g_iVotes >= g_iNeeded )
    {
        
g_bDoTacticalPause true;
        
g_iSaveValue get_cvar_num"mp_freezetime" );
        
set_cvar_num"mp_freezetime"PAUSE_DURATION );
        
        
client_print_color0print_team_default"El equipo^3 %s^1 voto a favor de una pausa tactica."iTeam "anti-terrorista" "terrorista" );
        
client_print_color0print_team_default"En la proxima ronda el tiempo de espera sera de^4 %d^1 segundos."PAUSE_DURATION );
    }
    else
        
client_print_color0print_team_default"El equipo^3 %s^1 voto por una pausa tactica pero se rechazo."iTeam "anti-terrorista" "terrorista" );
    
    
menu_destroyg_iMenu );
}

public 
VoteHandleriIdiMenuiItem )
{
    if( 
iItem == )
        
g_iVotes++;
    
    
client_cmdiId"spk buttons/lightswitch2" );

__________________
666 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-29-2019 , 20:15   Re: Tactical time out
Reply With Quote #2

If you don't mind to use Orpheu:
https://forums.alliedmods.net/showthread.php?p=2119563
Or https://forums.alliedmods.net/showpo...26&postcount=6

Edit: These are different methods only, if you are interested in any of 'em I can help you with the vote feature.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-29-2019 at 23:23.
EFFx is offline
666
Senior Member
Join Date: Mar 2015
Old 03-30-2019 , 11:59   Re: Tactical time out
Reply With Quote #3

Quote:
Originally Posted by EFFx View Post
If you don't mind to use Orpheu:
https://forums.alliedmods.net/showthread.php?p=2119563
Or https://forums.alliedmods.net/showpo...26&postcount=6

Edit: These are different methods only, if you are interested in any of 'em I can help you with the vote feature.
I like your complement, now it would be necessary to add the vote, and add it when the team change the pauses that have made each team.

example: if the CT made 3 pauses and the terrorists 1, to the change of equipment they have the same pauses, terrorists 3 and CT 1
__________________
666 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-31-2019 , 22:52   Re: Tactical time out
Reply With Quote #4

And how could I make that change with the vote plugin only? If you have another plugin that changes the sides, then you should add it in there.

Also, did u test any of the two links I gave? Are they working?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
666
Senior Member
Join Date: Mar 2015
Old 04-04-2019 , 00:20   Re: Tactical time out
Reply With Quote #5

Quote:
Originally Posted by EFFx View Post
And how could I make that change with the vote plugin only? If you have another plugin that changes the sides, then you should add it in there.

Also, did u test any of the two links I gave? Are they working?

I am using this, it is only necessary that when the pug switch team, this switch the pauses corresponding for each team

PHP Code:
#include <amxmodx>
#include <objective_reset>

#define PLUGIN        "Pause Round"
#define VERSION     "1.0"
#define AUTHOR         "author"

#define TASK_PAUSE    2301031

new bool:g_bPausedbool:g_bPauseAskedg_bIsFreezeTime
new g_iPauses[2], g_iLastPause[2], g_iTeamg_iCountDown
new pCvarPauseTimepCvarMaxPausespCvarPauseDelay

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
pCvarMaxPauses register_cvar("pause_maxpauses_perteam""3")
    
pCvarPauseTime register_cvar("pause_pausetime""60")
    
pCvarPauseDelay register_cvar("pause_pausedelay""120")
    
    
register_logevent("RoundStart"2"1=Round_Start")  
    
register_event("HLTV""NewRound""a""1=0""2=0")  
    
    
register_clcmd("say /pause""cmdPause")
    
register_clcmd("say /unpause""cmdUnpause")
}

public 
RoundStart()
{
    
g_bIsFreezeTime false
}

public 
NewRound()
{
    
g_bIsFreezeTime true
    
if(g_bPauseAsked)
    {
        
pauseGame()
    }
}

public 
cmdPause(id)
{
    new 
iUserTeam get_user_team(id), iTeam = (iUserTeam 1)
    if(
iUserTeam >= 3)
    {
        
client_print(idprint_chat"[AMXX]: You cannot use this command while spectating.")
        return 
PLUGIN_HANDLED
    
}

    if(
g_bPaused)
    {
        
client_print(idprint_chat"[AMXX]: The game is already paused.")
        return 
PLUGIN_HANDLED
    
}
    
    if(
g_bPauseAsked)
    {
        
client_print(idprint_chat"[AMXX]: The %s already asked the pause."g_iTeam "Counter-Terrorists" "Terrorists")
        return 
PLUGIN_HANDLED
    
}
    
    if(
g_iPauses[(g_iTeam iTeam)] == get_pcvar_num(pCvarMaxPauses))
    {
        
client_print(idprint_chat"[AMXX]: Your team cannot pause anymore.")
        return 
PLUGIN_HANDLED
    
}

    new 
iSystime get_systime()
    if(
iSystime g_iLastPause[iTeam])
    {
        new 
iMath = (g_iLastPause[iTeam] - iSystime)
        if(
iMath get_pcvar_num(pCvarPauseDelay))
        {
            
client_print(idprint_chat"[AMXX]: Your team must wait %d second%s to ask a pause again."iMath, (iMath 1) ? "s" "")
            return 
PLUGIN_HANDLED
        
}
    }
    
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
client_print(idprint_chat"[AMXX]: Player %s wants to pause the game."szName)

    
g_bPauseAsked true
    
if(g_bIsFreezeTime)
    {
        
pauseGame()
    }
    else
    {
        
client_print(idprint_chat"[AMXX]: The game will be paused during the freezetime.")
    }
    
    return 
PLUGIN_HANDLED
}

public 
cmdUnpause(id)
{
    if(
get_user_team(id) > 2)
    {
        
client_print(idprint_chat"[AMXX]: You cannot use this command while spectating.")
        return 
PLUGIN_HANDLED
    
}

    if(!
g_bPaused)
    {
        
client_print(idprint_chat"[AMXX]: The game is not paused.")
        return 
PLUGIN_HANDLED
    
}
    
    new 
szName[32]
    
get_user_name(idszNamecharsmax(szName))
    
client_print(idprint_chat"[AMXX]: Player %s unpaused the game."szName)

    
unpauseGame()
    return 
PLUGIN_HANDLED
}

pauseGame()
{
    new 
iCvarPauseTime get_pcvar_num(pCvarPauseTime), iCvarMaxPauses get_pcvar_num(pCvarMaxPauses)
    
    
g_bPaused true
    g_bPauseAsked 
false
    g_iPauses
[g_iTeam]++
    
g_iCountDown iCvarPauseTime

    
new szTeam[19];szTeam g_iTeam "Counter-Terrorists" "Terrorists"
    
    
client_print(0print_chat"[AMXX]: Game paused by %s."szTeam)
    
    new 
szMessage[32]
    if(
g_iPauses[g_iTeam] < iCvarMaxPauses)
    {
        
formatex(szMessagecharsmax(szMessage), "They still have %d pauses left.", (iCvarMaxPauses g_iPauses[g_iTeam]))
    }
    else
    {
        
formatex(szMessagecharsmax(szMessage), "They have not pauses to ask anymore.")
    }
    
client_print(0print_chat"[AMXX]: %s"szMessage)
    
client_print(0print_chat"[AMXX]: The %s have %d second%s to unpause the game."szTeamiCvarPauseTime, (iCvarPauseTime 1) ? "s" "")
    
    
set_task(1.0"setPause"TASK_PAUSE, .flags "b")
}

unpauseGame()
{
    
g_iLastPause[g_iTeam] = get_systime() + get_pcvar_num(pCvarPauseDelay)
    
g_bPaused false
    g_iTeam 
0
    g_iCountDown 
0
    remove_task
(TASK_PAUSE)
}

public 
setPause()
{
    
set_hudmessage(255255255, -1.00.301.01.0)
    
show_hudmessage(0"GAME PAUSED")
    
    
SetRoundTime(11)
    
    new 
szTeam[19];szTeam g_iTeam "Counter-Terrorists" "Terrorists"
    
if(g_iCountDown == (get_pcvar_num(pCvarPauseTime) / 2))
    {
        
client_print(0print_chat"[AMXX]: The %s team have %d seconds left to unpause."szTeam, (get_pcvar_num(pCvarPauseTime) / 2))
    }
    else if(
g_iCountDown == 0)
    {
        
unpauseGame()
        
client_print(0print_chat"[AMXX]: The %s team pause time has ended."szTeam)
    }
    
    
g_iCountDown--

__________________
666 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-04-2019 , 12:57   Re: Tactical time out
Reply With Quote #6

And how am I suppose to know when the PUG switched the teams?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-04-2019 at 12:57.
EFFx is offline
666
Senior Member
Join Date: Mar 2015
Old 04-04-2019 , 13:19   Re: Tactical time out
Reply With Quote #7

Quote:
Originally Posted by EFFx View Post
And how am I suppose to know when the PUG switched the teams?

this is what I use when I change the equipment and scores I guess I should go there hehe

PHP Code:
public PUG_SwapTeams()
{
    new 
iPlayers[32],iNum,Players;
    
get_players(iPlayers,iNum,"h");
    
    for(new 
i;iNum;i++)
    {
        
Players iPlayers[i];
    
        switch(
get_member(Players,m_iTeam))
        {
            case 
CS_TEAM_T:
            {
                
rg_set_user_teamPlayersTEAM_CTMODEL_AUTO );
            }
            case 
CS_TEAM_CT:
            {
                
rg_set_user_teamPlayersTEAM_TERRORISTMODEL_AUTO );
            }
        }
    }
    
    new 
iTemp PUG_iScores[CS_TEAM_T];
    
PUG_iScores[CS_TEAM_T]     = PUG_iScores[CS_TEAM_CT];
    
PUG_iScores[CS_TEAM_CT] = iTemp;

__________________
666 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-04-2019 , 13:40   Re: Tactical time out
Reply With Quote #8

If you have the pause plugin inside the PUG code, try it:

PHP Code:
public PUG_SwapTeams() 

    new 
iPlayers[32],iNum,Players
    
get_players(iPlayers,iNum,"h"); 
     
    for(new 
i;iNum;i++) 
    { 
        
Players iPlayers[i]; 
     
        switch(
get_member(Players,m_iTeam)) 
        { 
            case 
CS_TEAM_T
            { 
                
rg_set_user_teamPlayersTEAM_CTMODEL_AUTO ); 
            } 
            case 
CS_TEAM_CT
            { 
                
rg_set_user_teamPlayersTEAM_TERRORISTMODEL_AUTO ); 
            } 
        } 
    } 
     
    new 
iTemp PUG_iScores[CS_TEAM_T]; 
    
PUG_iScores[CS_TEAM_T]     = PUG_iScores[CS_TEAM_CT]; 
    
PUG_iScores[CS_TEAM_CT] = iTemp

    new 
iPausesTeamT g_iPauses[0];
    
g_iPauses[0] = g_iPauses[1];
    
g_iPauses[1] = iPauseTeamT;

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
666
Senior Member
Join Date: Mar 2015
Old 04-04-2019 , 13:59   Re: Tactical time out
Reply With Quote #9

Quote:
Originally Posted by EFFx View Post
If you have the pause plugin inside the PUG code, try it:

PHP Code:
public PUG_SwapTeams() 

    new 
iPlayers[32],iNum,Players
    
get_players(iPlayers,iNum,"h"); 
     
    for(new 
i;iNum;i++) 
    { 
        
Players iPlayers[i]; 
     
        switch(
get_member(Players,m_iTeam)) 
        { 
            case 
CS_TEAM_T
            { 
                
rg_set_user_teamPlayersTEAM_CTMODEL_AUTO ); 
            } 
            case 
CS_TEAM_CT
            { 
                
rg_set_user_teamPlayersTEAM_TERRORISTMODEL_AUTO ); 
            } 
        } 
    } 
     
    new 
iTemp PUG_iScores[CS_TEAM_T]; 
    
PUG_iScores[CS_TEAM_T]     = PUG_iScores[CS_TEAM_CT]; 
    
PUG_iScores[CS_TEAM_CT] = iTemp

    new 
iPausesTeamT g_iPauses[0];
    
g_iPauses[0] = g_iPauses[1];
    
g_iPauses[1] = iPauseTeamT;

works well thanks friend
__________________
666 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:26.


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