Pause plugin
Hello!
I have created a plugin that makes the handles !pause !unpause available with small extra versions of it (!p, !up etc). There is 1 problem and a thing I would like to add, but do not really know how to.
Code can be found here: https://github.com/ksgoescoding/PausePlugin Thank you in advance! |
Re: Pause plugin
Kinda like this: https://forums.alliedmods.net/showth...=225768&page=2
Just with a more updated syntax and also fitting my current script. I am trying to add it myself on the fly and share experiences and failures. (So far I just cleaned and copied the code from the link above, and I will try to implement it in my own coding) https://github.com/ksgoescoding/Paus...ee/development |
Re: Pause plugin
Quote:
Code:
RegConsoleCmd("sm_pause", Command_Pause, "Requests a pause"); Code:
AddAliasedCommand("pause", Command_Pause, "Pauses the game"); Code:
/** Add Aliased Command callback **/ 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. |
Re: Pause plugin
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:
PHP Code:
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:
PHP Code:
|
Re: Pause plugin
Quote:
Code looks like this now: PHP Code:
|
Re: Pause plugin
here is just example for problem two.
So, do not just "copy/paste" like lazy people do. PHP Code:
|
Re: Pause plugin
Quote:
I used the code for reference and read about timers from the wiki while inserting to understand the meaning of the process. It works like a charm, but now there is two other things I am looking for. 1. I would like to translate the text in the timer callback, as well as make it print out multiple seconds. Meaning: I would like it to tell when there is 20 and 10 seconds left, and make those translateable. PHP Code:
PHP Code:
Is it possible to make the array do the same as the above. Every time a pause is used, it will ReplyToCommand or PrintToChat PHP Code:
|
Re: Pause plugin
At the moment i have coded this on top, with a timer that send PrintToChat on 30, 20, 10 and 3,2,1 seconds. But I am running into some errors that I do not really know how to fix yet.
Full code: PHP Code:
PHP Code:
|
Re: Pause plugin
For tactical timeouts, why not just use the built in system? "mp_team_timeout_max" and "mp_team_timeout_time". If you really want to use commands you can also just execute these commands on the server to still end up using the built in system "timeout_ct_start" and "timeout_terrorist_start"
|
Re: Pause plugin
Quote:
You are saying if I just use these in the commandline instead i should be able to achieve the same? Worth a try. |
All times are GMT -4. The time now is 14:00. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.