AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   quick easy question (https://forums.alliedmods.net/showthread.php?t=64307)

Checkmarks 12-12-2007 17:23

quick easy question
 
How to make a cvar that let's you turn your whole plugin on and off?

Drak 12-12-2007 22:17

Re: quick easy question
 
A whole plugin on and off?
I think that can be done by another plugin.. Tho.. I'm not exactly sure.. But..
If you were to pause a plugin, you couldn't turn it back on.. Since it would be paused.. So it would need another plugin to do it for it.

Wilson [29th ID] 12-13-2007 07:12

Re: quick easy question
 
...

Make an enabled CVAR, then in each function, check if the CVAR is enabled before doing anything...

Checkmarks 12-13-2007 14:59

Re: quick easy question
 
Eh, I won't worry about it..Atleast not yet, maybe in v2 or something ><

Lee 12-14-2007 04:22

Re: quick easy question
 
It's really very simple..

Code:
new enabled; public plugin_init() {     enabled = register_cvar("pluginname_enabled", "1"); } doSomthing() {     if(!get_pcvar_num(enabled))     {         return;     }     doRealWork() } doSomthingElse() {     if(!get_pcvar_num(enabled))     {         return;     }     doOtherRealWork() }


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

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