Hey there.
I've another strange problem:
How could be that ConVars differs between client and server if they was set global?
I set the ConVar in this way (outside of CLIENT or SERVER checks):
CreateConVar("ttt2_clairvoyant_mode", "1", FCVAR_NOTIFY + FCVAR_ARCHIVE + FCVAR_REPLICATED)
and print the result like this (same way):
print("Current mode: " .. GetConVar("ttt2_clairvoyant_mode"):GetInt())
The result on Client is "0" and on the Server "1"...
How to solve this?
Try adding FCVAR_SERVER_CAN_EXECUTE
FCVAR_ enums are actually numbers so the "+" is adding
try this
local name=""--the name of the cvar
local default=""--what your cvar defaults to when there's nothing to tell it what to change to
local flags={FCVAR_ARCHIVE,FCVAR_REPLICATED,FCVAR_SERVER_CAN_EXECUTE}--flags that you will want to use in replicated cvars
local helptext=""--the text that pops up when someone types help and the name of the cvar
CreateConVar(name,default,flags,helptext)
Adding those numbers is fine considering it's a bitfield, only issue would be if 2 enums contained the same bit, which isn't the case. Also, I don't believe you can pass flags to CreateConVar as a variable list, and if you can then it's undocumented.
You cannot. You can pass them in table, though.
I can recommend ditching the convars for a net-system instead.
Convars have been unreliable when I tried to use them for my addon and I was forced to use a net-system instead.
Sorry, you need to Log In to post a reply to this thread.