Fortress Forever

Go Back   Fortress Forever > Projects > Fortress Forever > Feature

Creating CVars using Lua? Issue Tools
issueid=439 01-04-2014 03:20 PM
worst ff player eu
Creating CVars using Lua?
Interested to know whether it would even be possible to implement...

Adding the ability to create (not just change pre-existing) serverside console commands using Lua would really make adjusting Lua-made settings much easier, as server operators can quickly and easily use the console commands to adjust the global variables located at the top of most scripts.

I'd suggest something like:
MakeCVar( cvar name , default settings ), with the name having the prefix "sv_ff_lua_" added to it.

In an example:
MakeCVar("flagcapture_teampoints",10) would add the cvar sv_ff_lua_flagcapture_teampoints which has a default setting of 10.

Using the pre-existing get_cvar, you can just use this inside Lua to get the setting:

get_cvar("sv_ff_lua_flagcapture_teampoints")

Of course, I realise that adding variables once the game has already started is a little strange, and also that if these were held inside an ordinary Lua file, they wouldn't work effectively as .cfg's would have been ran before the cvar was made, and other stuff.

I'd suggest a file called "cvars.lua", which is ran on startup (and could be put in the globalscripts area which is so empty for most people), and can either be used as a relay for file-specific cvar addition to be IncludeScripted, or to have server operators simply copy paste new maps' cvar's into the file.

(Bear in mind I know very little about C or modding HL2 in general, so I have absolutely no idea whether this can be done, never mind work properly and not slowdown server startup...)

EDIT: You can completely wipe the thing about .cfg's being ran before the cvars are made, because they aren't. server.cfg is ran a split second after Lua, if I noticed correctly.
Issue Details
Issue Type Feature
Project Fortress Forever
Category LUA (Map Scripting)
Status Suggested
Priority 7 - Med/Low
Suggested Version Undefined
Implemented Version (none)
Votes for this feature 0
Votes against this feature 0
Assigned Users (none)
Tags (none)

Reply

All times are GMT. The time now is 09:13 PM.


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