AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [L4D] Cvars (6/28/09) (https://forums.alliedmods.net/showthread.php?t=95889)

bl4nk 07-31-2009 16:00

Re: [L4D] Cvars (6/28/09)
 
I don't have the old plugin I used to list the cvars, but there's always an easier way. Just unlock all of the cvars with the following code:
PHP Code:

#if !defined FCVAR_DEVELOPMENTONLY
#define FCVAR_DEVELOPMENTONLY    (1<<1)
#endif

public OnPluginStart()
{
    
decl String:name[64];
    new 
Handle:cvarbool:isCommandflagsHandle:convar;

    
cvar FindFirstConCommand(namesizeof(name), isCommandflags);
    if (
cvar == INVALID_HANDLE)
    {
        
SetFailState("Could not load cvar list");
    }

    do
    {
        if (
isCommand || !(flags FCVAR_DEVELOPMENTONLY) || !StrContains(name"bot"))
        {
            continue;
        }
        
convar FindConVar(name);
        
flags &= ~FCVAR_DEVELOPMENTONLY;
        
flags &= ~FCVAR_CHEAT;
        
SetConVarFlags(convarflags);
    } while (
FindNextConCommand(cvarnamesizeof(name), isCommandflags));

    
CloseHandle(cvar);


and use the command 'cvarlist' to print out all of the cvars.

Dragonshadow 08-01-2009 18:10

Re: [L4D] Cvars (6/28/09)
 
Quote:

Originally Posted by bl4nk (Post 886849)
I don't have the old plugin I used to list the cvars, but there's always an easier way. Just unlock all of the cvars with the following code:
PHP Code:

#if !defined FCVAR_DEVELOPMENTONLY
#define FCVAR_DEVELOPMENTONLY    (1<<1)
#endif

public OnPluginStart()
{
    
decl String:name[64];
    new 
Handle:cvarbool:isCommandflagsHandle:convar;

    
cvar FindFirstConCommand(namesizeof(name), isCommandflags);
    if (
cvar == INVALID_HANDLE)
    {
        
SetFailState("Could not load cvar list");
    }

    do
    {
        if (
isCommand || !(flags FCVAR_DEVELOPMENTONLY) || !StrContains(name"bot"))
        {
            continue;
        }
        
convar FindConVar(name);
        
flags &= ~FCVAR_DEVELOPMENTONLY;
        
flags &= ~FCVAR_CHEAT;
        
SetConVarFlags(convarflags);
    } while (
FindNextConCommand(cvarnamesizeof(name), isCommandflags));

    
CloseHandle(cvar);


and use the command 'cvarlist' to print out all of the cvars.

If I unload metamod (and thus sourcemod) after using this will it relock the commands?

Thraka 08-01-2009 19:36

Re: [L4D] Cvars (6/28/09)
 
Restarting the server would be a way to make sure it locked them again.

Update: Yep, restarting the server locks them. Whew!

bl4nk 08-02-2009 14:23

Re: [L4D] Cvars (6/28/09)
 
It only unlocks stuff on the server-side, not the client. There's no security issues when using that plugin, it just makes it so you won't have to use sm_cvar to set some convars.

Dragonshadow 08-03-2009 17:49

Re: [L4D] Cvars (6/28/09)
 
What I mean by relocking them is that I don't want the metamod and sourcemod commands to show up in my cvarlist, but if unloading metamod (and thus sourcemod) relocks them, I'll have to edit out the meta/source mod commands


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

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