AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Pass custom cvar at server launch (https://forums.alliedmods.net/showthread.php?t=274590)

sumrak666 11-10-2015 18:04

Pass custom cvar at server launch
 
Hello all.
Is it somehow possible to pass parameters to at server launch, and get value in amxmodx plugin.
Something like that ./hlds_run -console -game cstrike +custom_parameter=value.

Looks like register_cvar not working, maybe because parameter passed before plugin inicialization.

klippy 11-10-2015 18:10

Re: Pass custom cvar at server launch
 
You should be able to set console variables in command line by writing:
Code:

+cvar_name cvar_value
// e.g.
+mp_startmoney 16000

but I am not sure if that counts in cvars registered by plugins with register_cvar(), I think it does.
Anyway, why don't you just put cvars in server.cfg?

sumrak666 11-10-2015 18:33

Re: Pass custom cvar at server launch
 
Quote:

Originally Posted by KliPPy (Post 2361879)
You should be able to set console variables in command line by writing:
Code:

+cvar_name cvar_value
// e.g.
+mp_startmoney 16000


Yes, it works, but only for already predefined by engine cvars like mp_startmoney, sv_roundtime e.t.c

But main purpose is to pass a custom cvar.

Quote:

Originally Posted by KliPPy (Post 2361879)
but I am not sure if that counts in cvars registered by plugins with register_cvar(), I think it does.

Unfortunately, looks like it does't.
I have tried to call register_cvar("custom_parameter", "1", {flag}) with any of this flags FCVAR_ARCHIVE, FCVAR_USERINFO, FCVAR_PROTECTED, FCVAR_SPONLY



Quote:

Originally Posted by KliPPy (Post 2361879)
Anyway, why don't you just put cvars in server.cfg?

Here the same situation, works only for predefined cvars. If i add line "custom_parameter 22", i cant even get the value of it in console of already launched server. (Just type in console ""mp_startmoney" and you can see ""mp_startmoney" is "800"", but if i type "custom_parameter" i got no output)


All times are GMT -4. The time now is 18:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.