AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [CS:GO] Can't register "pause" / "unpause" Command (https://forums.alliedmods.net/showthread.php?t=322032)

Jamo 03-12-2020 17:30

[CS:GO] Can't register "pause" / "unpause" Command
 
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!

Silvers 03-12-2020 17:34

Re: [CS:GO] Can't register "pause" / "unpause" Command
 
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".

Jamo 03-12-2020 17:37

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

Originally Posted by Silvers (Post 2686749)
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 03-12-2020 17:46

Re: [CS:GO] Can't register "pause" / "unpause" Command
 
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.


All times are GMT -4. The time now is 11:30.

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