Thread: [TF2] Addcond
View Single Post
EHG
Senior Member
Join Date: May 2009
Location: 127.0.0.1
Old 08-22-2009 , 09:42   Re: [TF2] Addcond
Reply With Quote #28

You will not be able to run this command with server side sv_cheats turned off since this is one of those commands that requires sv_cheats to be enabled serverside to work.
You can use this:
http://forums.alliedmods.net/showthread.php?t=92289
to send sv_cheats 1 to a client and see for yourself.

However there is a chance removing addcond's cheat flag would remove its dependency on server side sv_cheats. However this is unlikely since other commands like thirdperson do not lose their dependency.

This is a better way to handle the sv_cheats,
PHP Code:
stock TF2_AddCond(clientcond) {
    new 
Handle:cvar FindConVar("sv_cheats"), bool:enabled GetConVarBool(cvar), flags GetConVarFlags(cvar);
    if(!
enabled) {
        
SetConVarFlags(cvarflags^(FCVAR_NOTIFY|FCVAR_REPLICATED));
        
SetConVarBool(cvartrue);
    }
    
FakeClientCommand(client"addcond %i"cond);
    if(!
enabled) {
        
SetConVarBool(cvarfalse);
        
SetConVarFlags(cvarflags);
    }
}
stock TF2_RemoveCond(clientcond) {
    new 
Handle:cvar FindConVar("sv_cheats"), bool:enabled GetConVarBool(cvar), flags GetConVarFlags(cvar);
    if(!
enabled) {
        
SetConVarFlags(cvarflags^(FCVAR_NOTIFY|FCVAR_REPLICATED));
        
SetConVarBool(cvartrue);
    }
    
FakeClientCommand(client"removecond %i"cond);
    if(!
enabled) {
        
SetConVarBool(cvarfalse);
        
SetConVarFlags(cvarflags);
    }

This way the replicated flag is also removed so sv_cheats 1 is never sent to the client and only changed serverside.

Last edited by EHG; 09-30-2009 at 10:56. Reason: Fixed script
EHG is offline