PDA

View Full Version : Register server variables


Sanjay Singh
12-21-2016, 03:45
How to register server variable in a plugin for example shovemod I want to register shovemod 5.0

klippy
12-21-2016, 04:01
This is how it's usually made. FCVAR_SERVER should be what makes it a server variable. FCVAR_SPONLY makes it so it can't be changed by admins, so it stays constant (unless you fiddle with it through RCon).

register_cvar("cvar_name", "cvar_value", FCVAR_SERVER | FCVAR_SPONLY);

shehzad1234
12-21-2016, 09:27
#define VERSION "5.0"

register_cvar("Shovemod", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
set_cvar_string("Shovemod", VERSION);

Try this :P

Napoleon_be
12-21-2016, 11:09
use pcvars instead

#define VERSION "5.0"

new pCvar



pCvar = register_cvar("Shovemod", VERSION, FCVAR_SERVER | FCVAR_SPONLY)
set_pcvar_string(pCvar, VERSION)

klippy
12-21-2016, 11:45
Why would you set cvar value when you are already setting it while registering it?

fysiks
12-21-2016, 11:56
Using pcvars is not necessary if it's only being used as info in HLSW (or other web service) and never changes in the plugin itself.