[Scoreboard] [Client / Server CVars] [Personal Radar]

Client / Server CVars

Files to be modified:-

g_local.h
g_main.c
cg_local.h
cg_main.c

Existing code is Red
New code is Blue

g_local.h

Add your CVar into the extern vmCvar_t section. eg.
extern vmCvar_t g_weaponForIt;

g_main.c

In the section where the vmCvar_t's are created, add your new Cvar in there eg.
vmCvar_t g_filterBan;
vmCvar_t g_weaponForIt;
Then assign your new CVar in the CVar table structure eg.
{ &g_allowVote, "g_allowVote", "1", 0, 0, qfalse }, <-- You have to add the comma
{ &g_weaponForIt, "g_weaponForIt", "9", CVAR_SYSTEMINFO, 0, qtrue }

What's this CVAR_SYSTEMINFO thingy?
This is how the game knows to communicate g_weaponForIt to the client side. Each CVAR_SYSTEMINFO has a matching cg_ type CVar on the client side. You can also add more Constants to this by using the | symbol eg. how it is used in BFG Tag. { &g_weaponForIt, "g_weaponForIt", "9", CVAR_ARCHIVE | CVAR_LATCH | CVAR_SYSTEMINFO, 0, qtrue },

cg_local.h

Add your CVar into the extern vmCvar_t section. eg.
extern vmCvar_t cg_weaponForIt;
Note, this should be the same as on the server side (but with cg_ instead of g_) to make your code easier to read.

cg_main.c

Add the cvar in the table on the client side in a similar way to the server side.
{ &cg_syncronousClients, "g_syncronousClients", "0", 0 },
{ &cg_weaponForIt, "g_weaponForIt", "0", 0 },
Note:-
See how cg_weaponForIt points to the value from g_weaponForIt.


You can now access the server CVars on client side by using standard methods eg. cg_weaponForIt.integer will give the integer value from the server CVar g_weaponForIt.




Any Comments can be sent tojazz@telefragged.com



Quake is Copyright ID Software
This page is Copyright 2000 Sam Dickinson