• How do I make a CVAR to enable/disable my script?
    3 replies, posted
The title is self explanitory. I want a way to be able to turn on or off my serverside script. [lua] CreateConVar( "sv_mycommand", "1", { FCVAR_REPLICATED, FCVAR_ARCHIVE } ) if sv_ragfall:GetBool() then --run my script end [/lua] Didn't work. what should I do?
[QUOTE=maxterchief;16972162]The title is self explanitory. I want a way to be able to turn on or off my serverside script. [lua] CreateConVar( "sv_mycommand", "1", { FCVAR_REPLICATED, FCVAR_ARCHIVE } ) if sv_ragfall:GetBool() then --run my script end [/lua] Didn't work. what should I do?[/QUOTE] [lua] CreateConVar( "sv_mycommand", "1", { FCVAR_REPLICATED, FCVAR_ARCHIVE } ) if( GetConVar( "sv_mycommand" ):GetBool() ) then --run script end [/lua] That's how it's supposed to be.
But only on Map Startup (or when you load that file)!
Thank you. [editline]10:05AM[/editline] [QUOTE=commander204;16978796]But only on Map Startup (or when you load that file)![/QUOTE] Hmm. Can I put a function inside of a function? How can I get it to check the CVAR each time. Or maybe I should just add commands to add or remove the hook. [editline]10:31AM[/editline] Never mind, I put the CVAR check inside the hooked function.
Sorry, you need to Log In to post a reply to this thread.