Raised This Month: $51 Target: $400
 12% 

[CSGO] !Pause command


Post New Thread Reply   
 
Thread Tools Display Modes
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 09-19-2013 , 07:48   Re: [CSGO] !Pause command
Reply With Quote #11

Obviously it doesn't work, because there is no PrintToConsoleAll function.
Make a loop and print to each player's console manually.
xf117 is offline
Send a message via ICQ to xf117
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 09-19-2013 , 08:49   Re: [CSGO] !Pause command
Reply With Quote #12

this is going to sound stupid but how does one do that with it printing to console. I've had a look at this one: http://forums.alliedmods.net/showpos...55&postcount=4 but still not getting how it will print to each client.
Also had a look at the wiki and doesn't show it with this sort of thing. http://wiki.alliedmods.net/Introduct...urcePawn#Loops

Would it look something like this?
PHP Code:
for (new 1<= MaxClientsi++)
{
PrintToConsole(i,"CT have asked to unpause the game. Please type /unpause to unpause the match.");

This is where it needs to go.
PHP Code:
public Action:UnPause(clientargs)
{
    if (
g_paused)
    {
        if (
GetConVarBool(g_h_pause_comfirm))
        {
            if (
GetClientTeam(client) == && g_pause_offered_ct == false && g_pause_offered_t == false)
            {
                
g_pause_offered_ct true;
//Loop needs to be here to print the below command
                
PrintToConsole(client"CT have asked to unpause the game. Please type /unpause to unpause the match.");
            } 
__________________

Last edited by versatile_bfg; 09-19-2013 at 08:54.
versatile_bfg is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 09-19-2013 , 09:10   Re: [CSGO] !Pause command
Reply With Quote #13

I don't think PrintToConsole was working properly last time i fiddled with it in CS:GO; I couldn't get it to appear, but that may have been right after an update, I didn't test it much. But you have the right format, provided you IsClientInGame.
__________________

Last edited by thetwistedpanda; 09-19-2013 at 09:11.
thetwistedpanda is offline
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 09-19-2013 , 09:10   Re: [CSGO] !Pause command
Reply With Quote #14

Add this to the end of your plugin and call it with
PrintToConsoleAll("CT have asked to unpause...");
PHP Code:
stock PrintToConsoleAll(const String:message[]) {

    for (new 
1<= MaxClientsi++) {
        if (
IsClientInGame(i) {
            
PrintToConsole(imessage);
        }
    }

PrintToConsole works just fine in cs:go

Last edited by xf117; 09-19-2013 at 09:17.
xf117 is offline
Send a message via ICQ to xf117
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 09-19-2013 , 09:25   Re: [CSGO] !Pause command
Reply With Quote #15

Thanks heaps for that. =D
__________________
versatile_bfg is offline
MOTHER
Member
Join Date: Jun 2012
Old 01-10-2014 , 19:14   Re: [CSGO] !Pause command
Reply With Quote #16

It seems the opponents are always in a hurry to unpause or even do not pause the game if someone disconnects.

We use wm_pause_comfirm "0" for any side pause but can !unpause option be included to be voted by both sides?
MOTHER is offline
Mathias.
Veteran Member
Join Date: Aug 2010
Location: Canada is my city
Old 01-10-2014 , 20:28   Re: [CSGO] !Pause command
Reply With Quote #17

If I can give my opinion about it, since I'm working on a similar mod and was thinking about implementing this sort of feature. It should pause after the round end (saving player weapons, money, score, etc.) and throw them into a sort of pregame until the game is unpause, the reason for this is that it can be exploited by team to use this extra time in the middle of the round to found out a solution or a strategy. Also becareful money is affected depending on how much time a team lost in a row and should be saved also to keep everything clean as it was never paused.

This is just an idea, I'm not yet that far to develop the idea so tell me what you think about it.
Mathias. is offline
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 01-10-2014 , 23:02   Re: [CSGO] !Pause command
Reply With Quote #18

versatile, just so you know : the event "round_freeze_end" does exist and work AFAIK. No need to start a timer.

You can use https://wiki.alliedmods.net/Counter-...fensive_Events for a list of event.
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work
RedSword is offline
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 01-16-2014 , 04:54   Re: [CSGO] !Pause command
Reply With Quote #19

Quote:
Originally Posted by RedSword View Post
versatile, just so you know : the event "round_freeze_end" does exist and work AFAIK. No need to start a timer.

You can use https://wiki.alliedmods.net/Counter-...fensive_Events for a list of event.
Ah cheers for that. I just wanted it to go before freeze time ended I think and used Event Round_Start. New pause command fixed this anyway.

For anyone that wanted the code here is the updated code for csgo

Full code of warmod is here https://github.com/Versatile-BFG/War...ster/warmod.sp

PHP Code:
/* Pause and Unpause */
new bool:g_pause_freezetime false;
new 
bool:g_pause_offered_t false;
new 
bool:g_pause_offered_ct false;
new 
bool:g_paused false;

new 
Handle:sv_pausable;
new 
Handle:g_h_auto_unpause INVALID_HANDLE;
new 
Handle:g_h_auto_unpause_delay INVALID_HANDLE;
//new Handle:g_h_pause_freezetime = INVALID_HANDLE;
new Handle:g_h_pause_comfirm INVALID_HANDLE;
new 
Handle:g_h_pause_limit INVALID_HANDLE;
new 
g_t_pause_count 0;
new 
g_ct_pause_count 0;
new 
Handle:g_h_stored_timer INVALID_HANDLE;

public 
OnPluginStart()
{
    
// Pause and Unpause stuff
    
sv_pausable FindConVar ("sv_pausable");
    
g_h_pause_comfirm CreateConVar("wm_pause_comfirm""1""Wait for other team to comfirm pause: 0 = off, 1 = on"FCVAR_NOTIFY);
    
g_h_auto_unpause CreateConVar("wm_auto_unpause""1""Sets auto unpause: 0 = off, 1 = on"FCVAR_NOTIFY);
//    g_h_pause_freezetime = CreateConVar("wm_pause_freezetime", "1", "Wait for freeze time to pause: 0 = off, 1 = on", FCVAR_NOTIFY);
    
g_h_auto_unpause_delay CreateConVar("wm_auto_unpause_delay""180""Sets the seconds to wait before auto unpause"FCVAR_NOTIFYtrue0.0);
    
g_h_pause_limit CreateConVar("wm_pause_limit""1""Sets max pause count per team per half"FCVAR_NOTIFY);
}

public 
Action:SayChat(clientargs)
{
    if (!
IsActive(0true) || args 1)
    {
        
// warmod is disabled or no arguments
        
return Plugin_Continue;
    }
    
    new 
String:type[64];
    
GetCmdArg(0typesizeof(type));
    
    new 
bool:teamOnly false;
    new 
bool:silence false;
    
    if (
StrEqual(type"say_team"false))
    {
        
// true if not console, as console is always global
        
teamOnly = !! client;
    }
    
    new 
String:message[192];
    
GetCmdArgString(messagesizeof(message));
    
StripQuotes(message);
    
    if (
message[0] == '!' || message[0] == '.' || message[0] == '/')
    {
        if (
StrEqual(command"pause"false) || StrEqual(command"pauses"false) || StrEqual(command"p"false))
        {
            
Pause(clientargs);
        }
        else if (
StrEqual(command"unpause"false) || StrEqual(command"unpauses"false) || StrEqual(command"up"false))
        {
            
Unpause(clientargs);
        }
    }
}

public 
Event_Round_Start(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (!
IsActive(0true))
    {
        return;
    }
    
    
//Pause command fire on round end May change to on round start
    
if (g_pause_freezetime == true)
    {
        
g_pause_freezetime false;
        
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Unpause Notice"LANG_SERVER);
        if(
GetConVarBool(g_h_auto_unpause))
        {
            
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T"CHAT_PREFIXGetConVarInt(g_h_auto_unpause_delay), "Unpause Timer"LANG_SERVER);
            
g_h_stored_timer CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
        }
        
g_paused true;
        
//ServerCommand("mp_pause_match 1");
    
}
}


//Pause and Unpause Commands + timers
public Action:Pause(clientargs)
{
    if (
GetConVarBool(sv_pausable) && g_live)
    {
        if (
GetConVarBool(g_h_pause_comfirm))
        {
            if (
GetClientTeam(client) == && g_pause_offered_ct == true)
            {
                if(
g_h_stored_timer != INVALID_HANDLE)
                {
                    
KillTimer(g_h_stored_timer);
                    
g_h_stored_timer INVALID_HANDLE;
                }
                
                
g_pause_offered_ct false;
                
g_ct_pause_count++;
                
                
//if (GetConVarBool(g_h_pause_freezetime))
                //{
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Freeze Time"LANG_SERVER);
                
g_pause_freezetime true;
                
/*}
                else
                {
                    PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER);
                    if (GetConVarBool(g_h_auto_unpause))
                    {
                        PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(g_h_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
                        g_h_stored_timer = CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
                    }*/
                
g_paused true;
                
ServerCommand("mp_pause_match 1");
                return;
                
//}
            
}
            else if (
GetClientTeam(client) == && g_pause_offered_t == true)
            {
                if(
g_h_stored_timer != INVALID_HANDLE)
                {
                    
KillTimer(g_h_stored_timer);
                    
g_h_stored_timer INVALID_HANDLE;
                }
                
g_pause_offered_t false;
                
g_t_pause_count++;
                
                
//if (GetConVarBool(g_h_pause_freezetime))
                //{
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Round End"LANG_SERVER);
                
g_pause_freezetime true;
                
/*}
                else
                {
                    PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER);
                    if (GetConVarBool(g_h_auto_unpause))
                    {
                        PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(g_h_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
                        g_h_stored_timer = CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
                    }*/
                
g_paused true;
                
ServerCommand("mp_pause_match 1");
                return;
                
//}
            
}
            else if (
GetClientTeam(client) == && g_t_pause_count == GetConVarInt(g_h_pause_limit))
            {
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Limit"LANG_SERVER);
            }
            else if (
GetClientTeam(client) == && g_ct_pause_count == GetConVarInt(g_h_pause_limit))
            {
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Limit"LANG_SERVER);
            }
            else if (
GetClientTeam(client) < )
            {
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Non-player"LANG_SERVER);
            }
            else if (
GetClientTeam(client) == && g_ct_pause_count != GetConVarInt(g_h_pause_limit) && g_pause_offered_ct == false)
            {
                
g_pause_offered_ct true;
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_ct_name"Pause Offer"LANG_SERVER);
                
g_h_stored_timer CreateTimer(30.0PauseTimeout);
            }
            else if (
GetClientTeam(client) == && g_t_pause_count != GetConVarInt(g_h_pause_limit) && g_pause_offered_t == false)
            {
                
g_pause_offered_t true;
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_t_name"Pause Offer"LANG_SERVER);
                
g_h_stored_timer CreateTimer(30.0PauseTimeout);
            }
        }
        else if (
GetClientTeam(client) == && g_ct_pause_count != GetConVarInt(g_h_pause_limit) && !GetConVarBool(g_h_pause_comfirm))
        {
            
g_ct_pause_count++;
            
//if (GetConVarBool(g_h_pause_freezetime))
            //{
            
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Freeze Time"LANG_SERVER);
            
g_pause_freezetime true;
            
/*}
            else
            {
                PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER);
                if(GetConVarBool(g_h_auto_unpause))
                {
                    PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(g_h_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
                    g_h_stored_timer = CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
                }*/
            
g_paused true;
            
ServerCommand("mp_pause_match 1");
            return;
            
//}
        
}
        else if (
GetClientTeam(client) == &&  g_t_pause_count != GetConVarInt(g_h_pause_limit) && GetConVarBool(g_h_pause_comfirm) == false)
        {
            
g_t_pause_count++;
            
//if (GetConVarBool(g_h_pause_freezetime))
            //{
            
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Freeze Time"LANG_SERVER);
            
g_pause_freezetime true;
            
/*}
            else
            {
                PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER);
                if(GetConVarBool(g_h_auto_unpause))
                {
                    PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(g_h_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
                    g_h_stored_timer = CreateTimer(GetConVarFloat(g_h_auto_unpause_delay), UnPauseTimer);
                }*/
            
g_paused true;
            
ServerCommand("mp_pause_match 1");
            return;
            
//}
        
}
        else if (
GetClientTeam(client) == && g_t_pause_count == GetConVarInt(g_h_pause_limit))
        {
            
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Limit"LANG_SERVER);
        }
        else if (
GetClientTeam(client) == && g_ct_pause_count == GetConVarInt(g_h_pause_limit))
        {
            
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Limit"LANG_SERVER);
        }
        else if (
GetClientTeam(client) < 2)
        {
        
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Non-player"LANG_SERVER);
        }
    }
    else if (!
g_live)
    {
        
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Match Not In Progress"LANG_SERVER);
    }
    else
    {
        
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Not Enabled"LANG_SERVER);
    }
}

public 
Action:Unpause(clientargs)
{
    if (
g_paused)
    {
        if (
GetConVarBool(g_h_pause_comfirm))
        {
            if (
GetClientTeam(client) == && g_pause_offered_ct == false && g_pause_offered_t == false)
            {
                
g_pause_offered_ct true;
                
PrintToConsoleAll("<WarMod_BFG> CT have asked to unpause the game. Please type /unpause to unpause the match.");
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_ct_name"Unpause Offer"LANG_SERVER);
            }
            else if (
GetClientTeam(client) == && g_pause_offered_t == false && g_pause_offered_ct == false)
            {
                
g_pause_offered_t true;
                
PrintToConsoleAll("<WarMod_BFG> T have asked to unpause the game. Please type /unpause to unpause the match.");
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_t_name"Unpause Offer"LANG_SERVER);
            }
            else if (
GetClientTeam(client) == && g_pause_offered_ct == true)
            {
                
g_pause_offered_ct false;
                
g_paused false;
                
ServerCommand("mp_unpause_match 1");
            }
            else if (
GetClientTeam(client) == && g_pause_offered_t == true)
            {
                
g_pause_offered_t false;
                
g_paused false;
                
ServerCommand("mp_unpause_match 1");
            }
            else if (
GetClientTeam(client) < )
            {
                
PrintToConsole(client"<WarMod_BFG> You must be on T or CT to enable /unpause");
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Unpause Non-player"LANG_SERVER);
            }
        }
        else
        {
            if (
GetClientTeam(client) == 2)
            {
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_t_name"Unpaused Match"LANG_SERVER);
                
g_paused false;
                
ServerCommand("mp_unpause_match 1");
            }
            else if (
GetClientTeam(client) == 3)
            {
                
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T"CHAT_PREFIXg_ct_name"Unpaused Match"LANG_SERVER);
                
g_paused false;
                
ServerCommand("mp_unpause_match 1");
            }
            else if (
GetClientTeam(client) < )
            {
                
PrintToConsole(client"<WarMod_BFG> You must be on T or CT to enable /unpause");
                
PrintToChat(client"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Unpause Non-player"LANG_SERVER);
            }
        }
    }
    else
    {
        
PrintToChat(client,"\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Paused Via Rcon"LANG_SERVER);
        
PrintToConsole(client,"<WarMod_BFG> Server is not paused or was paused via rcon");
    }
}

public 
Action:PauseTimeout(Handle:timer)
{
    
g_h_stored_timer INVALID_HANDLE;
    
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Pause Offer Not Confirmed"LANG_SERVER);
    
g_pause_offered_ct false;
    
g_pause_offered_t false;
}

public 
Action:UnPauseTimer(Handle:timer)
{
    
g_h_stored_timer INVALID_HANDLE;
    
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T"CHAT_PREFIX"Unpause Auto"LANG_SERVER);
    
ServerCommand("mp_unpause_match 1");
    
g_pause_offered_ct false;
    
g_pause_offered_t false;

__________________
versatile_bfg 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 16:32.


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