Raised This Month: $ Target: $400
 0% 

Pass custom cvar at server launch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sumrak666
Junior Member
Join Date: Nov 2015
Old 11-10-2015 , 18:04   Pass custom cvar at server launch
Reply With Quote #1

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.

Last edited by sumrak666; 11-11-2015 at 17:15.
sumrak666 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-10-2015 , 18:10   Re: Pass custom cvar at server launch
Reply With Quote #2

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?

Last edited by klippy; 11-10-2015 at 18:10.
klippy is offline
sumrak666
Junior Member
Join Date: Nov 2015
Old 11-10-2015 , 18:33   Re: Pass custom cvar at server launch
Reply With Quote #3

Quote:
Originally Posted by KliPPy View Post
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 View Post
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 View Post
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)

Last edited by sumrak666; 11-10-2015 at 18:48.
sumrak666 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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