Raised This Month: $ Target: $400
 0% 

Command to change ConVar (true:false)


Post New Thread Reply   
 
Thread Tools Display Modes
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 06-25-2015 , 18:07   Re: Command to change ConVar (true:false)
Reply With Quote #11

@ddhoward
I usually agree with you but i don't think his code contains a leak for those two reasons
It's inefficient and unsafe though and your version should be preferred.

@DJ Data
See here for a simple example. It's c but the idea is the same.
__________________

Last edited by Impact123; 06-25-2015 at 18:16.
Impact123 is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 06-25-2015 , 18:26   Re: Command to change ConVar (true:false)
Reply With Quote #12

Quote:
Originally Posted by Impact123 View Post
That's good to know! Thanks!

As far as the next request goes, here.


PHP Code:
public OnPluginStart() { 
    
RegAdminCmd("sm_nb"Command_NBADMFLAG_ROOT); 


public 
Action Command_NB(int clientint args) { 
    static 
ConVar cvar
    if (
cvar == nullcvar FindConVar("sm_antistucknoblock"); 
    if (
cvar != null) {
        
cvar.BoolValue = !cvar.BoolValue;
        
PrintCenterTextAll("sm_antistucknoblock was turned %s"cvar.BoolValue "on" "off");
    }

Attached Files
File Type: sp Get Plugin or Get Source (toggleASNB.sp - 179 views - 388 Bytes)
__________________

Last edited by ddhoward; 06-25-2015 at 18:30.
ddhoward is offline
Reply


Thread Tools
Display Modes

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 05:15.


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