Raised This Month: $51 Target: $400
 12% 

Code to toggle plugin on and off


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
petomatick
Member
Join Date: Sep 2010
Old 10-05-2010 , 07:31   Code to toggle plugin on and off
Reply With Quote #1

Well, hello people! I'm just wondering. Whats the code to be able to toggle a plugin on and off by using a server command.
Like maby sm_toggle_(plugin) 0/1.
The mod i was planning to make is named for example "logitech" (lol) and the command i would like to be able to toggle the mod is
"sm_logitech 0/1"
petomatick is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 10-07-2010 , 21:25   Re: Code to toggle plugin on and off
Reply With Quote #2

Add this to any actions the plugin will run.
PHP Code:
if(GetConVarInt(HandleToYourCVAR) == 1)
{
        
//Your actions

__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
Sammy-ROCK!
Senior Member
Join Date: Jun 2008
Location: Near Mrs.Lag
Old 10-07-2010 , 23:13   Re: Code to toggle plugin on and off
Reply With Quote #3

ServerCommand("sm plugins unload myplugin");
ServerCommand("sm plugins load myplugin");
Sammy-ROCK! is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 10-08-2010 , 03:15   Re: Code to toggle plugin on and off
Reply With Quote #4

Boo. They most wise way is to hook cvar change and store it inside the plugin. It'll save thousands of GetConVarInt calls.
__________________
FaTony is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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