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
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)
Why would you set cvar value when you are already setting it while registering it?
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.
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.