I've got a bit of a problem. I'd like to add a new CVAR to Half-Life called "mp_aquashotgun". If it's 0, you can't fire the shotgun under water (like normal). If it's anything else (ie. 1), then you CAN shoot the shotgun underwater. So, I define my CVAR in game.cpp like so:
 
cvar_t mp_aquashotgun = { "mp_aquashotgun", "0", FCVAR_SERVER };
 
    Then I register it later on in the file:
 
CVAR_REGISTER( &mp_aquashotgun );
 
    Now I need to actually use it somewhere, so I open up shotgun.cpp and in the PrimaryAttack function, I add an additional check to the waterlevel statement:
 
if (m_pPlayer->pev->waterlevel == 3 && CVAR_GET_FLOAT( "mp_aquashotgun") == 0)
 
    Well, the problem is that the *client* can't access "mp_aquashotgun" so if I leave this code as it is, the game will freeze as soon as you try to fire the shotgun under water. I messed around with it for awhile and rewrote the code to use #ifdef CLIENT_DLL and such, but the best I could do was actually have it fire under water but none of the effects would play. Of course... client side weapons. I think that's what's causing the problem.
    So the question is, how can I access my CVAR on the client?
 
- Varlock

Reply via email to