AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Read server launch options (registered cvar) (https://forums.alliedmods.net/showthread.php?t=194506)

sickM0nkey 08-28-2012 22:32

Read server launch options (registered cvar)
 
Is it possible to set non existent cvar (cvar registered only in plugin) from server launch options and then read it from plugin? I guess not? I'm trying to accomplish that but without success! :/

fysiks 08-28-2012 23:17

Re: Read server launch options (registered cvar)
 
What exactly are you trying to do? Don't tell me the method you "think" is the solution, tell me what you want the end result to be.

DjOptimuS 08-29-2012 00:00

Re: Read server launch options (registered cvar)
 
create a cfg and add to the console startup +exec config.cfg

YamiKaitou 08-29-2012 00:21

Re: Read server launch options (registered cvar)
 
That would still execute around the same time the servercfgfile executes, which is after the cvars are registered

sickM0nkey 08-29-2012 08:23

Re: Read server launch options (registered cvar)
 
Adding cvar to config file is not an option! I need to pass cvar with launch options like so
Code:

hlds.exe -game cstrike -console +mycvar 3 +map de_dust2
and then read it from script with
Code:
get_cvar_num("mycvar")

It works only if cvar is defined in configs, but like I said, it's not an option for me. I guess it do not work because "mycvar" is not standard HL cvar and plugin is not executed at that time, so server do not keep record of that var?

I hope Im wrong! So, how can I read cvar from server startup parameters?

ty!

matsi 08-29-2012 09:22

Re: Read server launch options (registered cvar)
 
Explain us why you 'need' to do that and you'll get better answers. I'm sure there are other ways of doing what you want.

sickM0nkey 08-29-2012 14:41

Re: Read server launch options (registered cvar)
 
One way to do that is by connecting to database. Each time server runs, it gets different variable value. Server will be launched remotely by cmd. There is no option to write new config file each time.

fysiks 08-29-2012 18:46

Re: Read server launch options (registered cvar)
 
Quote:

Originally Posted by fysiks (Post 1785712)
What exactly are you trying to do? Don't tell me the method you "think" is the solution, tell me what you want the end result to be.


sickM0nkey 08-29-2012 21:19

Re: Read server launch options (registered cvar)
 
Server will be launched remotely several times a day! There is need for setting one cvar (registered in plugin) with different value each time server starts. There is no option to write cvar in server config file so it should be passed with launch options or when plugins starts it reads it from database.

Sorry for lack of info. This cvar defines the tournament id for server. I will stick to database option, because I have to poll additional data from db any way.. . like players, teams etc.


All times are GMT -4. The time now is 05:50.

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