Adding Custom Cvar -Help


(the_hat) #1

in g_local.h i added:

extern	vmCvar_t	g_hatweapfix0;

in g_main.c i added:

vmCvar_t		g_hatweapfix0;

in g_main.c under “cvarTable_t gameCvarTable[] = {” i added:

	{ &g_hatweapfix0,			"g_hatweapfix0",			"1",	CVAR_LATCH|CVAR_SERVERINFO, 0, },

still cant get it to work ingame, any ideas?


(nUllSkillZ) #2

Can you please also post the code where you use this CVAR?
Should be something like the following in one of the game-source-files:


if ( g_hatweapfix0.integer == 1 )
{
     ...
}


(the_hat) #3

its


if ( g_hatweapfix0.integer == 1)
		AddWeaponToPlayer( client, WP_PLIERS, 0, 1, qfalse );

but i would think that wouldnt matter atm cause im getting “Unknown Command” or something along those lines


(nUllSkillZ) #4

In which source file is this code located?


(Lanz) #5

Change it to:


{ &g_hatweapfix0,         "g_hatweapfix0",         "1",   CVAR_ARCHIVE|CVAR_SERVERINFO, 0, },

instead or only CVAR_ARCHIVE, CVAR_SERVERINFO means it will be sent with server queries to server browsers.


(the_hat) #6

In which source file is this code located?

its in game/g_client.c

i did what you said Lanz still get:

unknown cmd g_hatweapfix0

(Lanz) #7

Strange I just tried it myself to be on the safe side and it worked straight away, are you sure that your mod is executed?


(the_hat) #8

hrm, you was right :! i had my dll’s inside my pak, i thowt it would work fine that way, im guessing they dont get loaded if they are within the pak files… weirdness to me :!


(bacon) #9

You have to put any DLLs that a client would need to download in a pk3, the server DLL doesn’t go in a pk3.