Server Convars to Client Lua

I tried everything I could think of in attempt to get a server-side convar (one that I know that is actualy working) into a client lua script but they all return nil values. I used this to try to get the convar from the server:

if (ConVarExists(“zw_wave”)) then
Wave = GetConVar(“zw_wave”):GetInt()

I’m sure that the answer is probably quite simple and I don’t have a clue as to what I’m doing. I don’t know why its returning nil. Is it the way the convar is layed out? Heres the ConVar:


In the server console it returns “zw_wave” as its proper variable.

Are you making these in a shared area? If so it should work fine.

No, the convar is made in a serverside script and it returns fine. The GetConVar is in the client script I want to retrieve it from. Any other way to do this?

Way to ignore what I said… Put it in a shared area and it will work fine.

[editline]12th June 2012[/editline]

If you dont want to use it in a shared area, use user messages to stream the data from server to client.

I’ll try that. But I can’t actualy use it in shared because its a hud and I’ve never seen a shared hud before.

Serverside convars are normally not known by the client. You have to add FCVAR_REPLICATED to the convar flags so that the value gets networked to all clients.

Oh thank you so much. I didn’t even know what half of the convar flags even meant. I’ll use that instead and see if it works. I thought that the FCVAR_CLIENTCMD_CAN_EXECUTE flag had somthing to do with that.

You and me both… Learn something new every day :V