Thread: [Solved] Pause plugin
View Single Post
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 01-06-2022 , 19:36   Re: Pause plugin
Reply With Quote #4

To help translate a bit...

Your code is checking for the word "pause" in two different ways. As a result, it is executing the code twice whenever it sees the word "pause". The first, and best use of "pause" is with:
PHP Code:
RegConsoleCmd("sm_pause"Command_Pause"Requests a pause"); 
Since you've already registered the word "pause" as a command there is no need for the aliased command "pause" which was created with this line of code:
PHP Code:
AddAliasedCommand("pause"Command_Pause"Pauses the game"); 
Your code isn't just that it is printing the translation twice, it is actually executing the code twice.

As Bacardi stated, the RegConsole Cmd is the best way to use the command because it allows server operators to change who has access to the command without having to rewrite your code.

The fix is to remove this line entirely:
PHP Code:
AddAliasedCommand("pause"Command_Pause"Pauses the game"); 
While you're at it, remove the other duplicates you have such as "forcepause", "forceunpause", "tech", and others. In fact, get rid of all of them and instead create multiple RegConsole commands like Bacardi stated. For example, your 'pause' commands would look like this:
PHP Code:
RegConsoleCmd("sm_pause"Command_Pause"Requests a pause");
RegConsoleCmd("sm_tac"Command_Pause"Pauses the game");
RegConsoleCmd("sm_p"Command_Pause"Pauses the game");
RegConsoleCmd("sm_tactical"Command_Pause"Pauses the game"); 
PC Gamer is offline