Thread: [Solved] Pause plugin
View Single Post
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-06-2022 , 18:15   Re: Pause plugin
Reply With Quote #3

Quote:
Originally Posted by SmokieCS View Post
Hello!
...
  1. The Problem - I made translations available, but it prints out 2 times when entering !pause.
    ...


Code can be found here: https://github.com/ksgoescoding/PausePlugin
...![/B]
https://github.com/ksgoescoding/Paus...ePlugin.sp#L33
Code:
    RegConsoleCmd("sm_pause", Command_Pause, "Requests a pause");
https://github.com/ksgoescoding/Paus...ePlugin.sp#L51
Code:
    AddAliasedCommand("pause", Command_Pause, "Pauses the game");
https://github.com/ksgoescoding/Paus...n.sp#L153-L163
Code:
/** Add Aliased Command callback **/
public void AddAliasedCommand(const char[] command, ConCmd callback, const char[] description) {
  char smCommandBuffer[COMMAND_LENGTH];
  Format(smCommandBuffer, sizeof(smCommandBuffer), "sm_%s", command);
  RegConsoleCmd(smCommandBuffer, callback, description);


  char dotCommandBuffer[ALIAS_LENGTH];
  Format(dotCommandBuffer, sizeof(dotCommandBuffer), ".%s", command);
  AddChatAlias(dotCommandBuffer, smCommandBuffer);
}
*edit
When someone want add more "chat triggers" for one specific command callback, I would recommend to use some kind custom KeyValue file rather than
hard code lot of reg console commands or check say command arguments in plugin code.
With custom KeyValue txt file:
- User, who want use plugin, can modified or remove these unnecessary thing in they own server.
- Not need edit plugin code and recompile
- Not need look every console commands for override them from admin configures.

This is just my opinion.

Last edited by Bacardi; 01-06-2022 at 18:23.
Bacardi is offline