Raised This Month: $433 Target: $400
 108% 

Solved [CS:GO] Can't register "pause" / "unpause" Command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jamo
Junior Member
Join Date: Aug 2018
Old 03-12-2020 , 17:30   [CS:GO] Can't register "pause" / "unpause" Command
Reply With Quote #1

Hey there!

So - I'm currently creating a plugin which contains !pause and !unpause commands.
Unfortunately it's not working.
I've registered my commands as follows:

PHP Code:
RegConsoleCmd("pause"pause_match);
RegConsoleCmd("unpause"unpause_match); 
The commands refer to the following Actions:

PHP Code:
public Action pause_match(int clientint args) {
    
char full[256];
    
GetCmdArgString(fullsizeof(full));
    if(!
gamepause_active && GameRules_GetProp("m_bWarmupPeriod") == 0) {
        new 
String:name[99];
        
ServerCommand("mp_pause_match");
        
GetClientName(clientnamesizeof(name));
        
PrintToChatAll("%s triggered a game pause!",name);
        
gamepause_active true;
    } else if(
gamepause_active) {
        
PrintHintText(client,"A pause has already been triggered!");
    } else if(
GameRules_GetProp("m_bWarmupPeriod") == 1) {
        
PrintHintText(client,"Can't start pause during warmup!");
    }
}

public 
Action unpause_match(int clientint args) {
    
char full[256];
    
GetCmdArgString(fullsizeof(full));
    if(!
gamepause_active) {
        
PrintHintText(client,"There is no scheduled pause!");
    } else {
        
// Both teams need to !unpause
        // Check if pause was set by admin or players
    
}

So far so good - everything compiles just fine.
But I can't call the command ingame.

What I noticed is, that if I renamd my commands to something like "123_pause", it works.
Is it possible that there already are !pause and !unpause commands built in by sourcemod?

If yes - how can I overwrite those??

Thanks in advance!

Last edited by Jamo; 03-12-2020 at 17:46.
Jamo is offline
Silvers
AlliedModders Donor
Join Date: Aug 2010
Location: SpaceX
Old 03-12-2020 , 17:34   Re: [CS:GO] Can't register "pause" / "unpause" Command
Reply With Quote #2

The game itself already has "pause" and "unpause" commands. If you want to use "!pause" in chat, you register the commands as "sm_pause" and "sm_unpause".
__________________

Last edited by Silvers; 03-12-2020 at 17:34.
Silvers is offline
Jamo
Junior Member
Join Date: Aug 2018
Old 03-12-2020 , 17:37   Re: [CS:GO] Can't register "pause" / "unpause" Command
Reply With Quote #3

Quote:
Originally Posted by Silvers View Post
The game itself already has "pause" and "unpause" commands. If you want to use "!pause" in chat, you register the commands as "sm_pause" and "sm_unpause".
Thanks!
Do you mean like that:
PHP Code:
RegConsoleCmd("sm_pause"pause_match);
RegConsoleCmd("sm_unpause"unpause_match); 
Jamo is offline
Jamo
Junior Member
Join Date: Aug 2018
Old 03-12-2020 , 17:46   Re: [CS:GO] Can't register "pause" / "unpause" Command
Reply With Quote #4

GOT IT!

Registered the events like that:
PHP Code:
RegConsoleCmd("sm_pause"pause_match);
RegConsoleCmd("sm_unpause"unpause_match); 
The main problem where the actions. They have to be declared as follows:
PHP Code:
public Action:pause_match(int clientint args) {
   
// Coooode
}
public 
Action:unpause_match(int clientint args) {
   
// Coooode

Now !pause and !unpause are available.
Jamo 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 12:02.


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