server-beta icon indicating copy to clipboard operation
server-beta copied to clipboard

Add new natives SetConsoleVarAsString, SetConsoleVarAsInt, SetConsoleVarAsFloat, SetConsoleVarAsBool.

Open shierru opened this issue 1 year ago • 3 comments

There are such functions as GetConsoleVarAsString, GetConsoleVarAsInt, GetConsoleVarAsFloat, GetConsoleVarAsBool.

Sometimes there is a desire to rigidly set some settings in config.json at the game mode level, so as not to restore them every time. Yes, you can just move config.json, but sometimes from version to version new items are added to it and you have to spend time on it (although not much, but still).

I suggest to add their analogs only in reverse, which would set var: SetConsoleVarAsString, SetConsoleVarAsInt, SetConsoleVarAsFloat, SetConsoleVarAsBool.

shierru avatar Aug 07 '24 19:08 shierru

This concept probably already exist in those natives: AddServerRule, SetServerRule and RemoveServerRule (it's not covering all variables though).

NexiusTailer avatar Aug 08 '24 12:08 NexiusTailer

I think this is a bit different.

AddServerRule, SetServerRule, RemoveServerRule affect the information that is used in Query, although they also have limitations, e.g. you can't do anything with rules like: version, allowed_clients.

If you take ConsoleVar (currently GetConsoleVarAsString, GetConsoleVarAsInt, GetConsoleVarAsFloat, GetConsoleVarAsBool), they are responsible for getting the parameters set in the configuration file.

I don't know how necessary it is to add Set analogs of these functions.

shierru avatar Aug 13 '24 21:08 shierru

Well, some rules (variables) are protected so they cannot be changed at runtime and it's intended.

NexiusTailer avatar Aug 14 '24 11:08 NexiusTailer