TTT: Fix weapon shortage on CSS maps #1148

Merged
merged 1 commit into from Mar 31, 2016

Projects

None yet

7 participants

@edgarasf123
Contributor

cvars.Number("maxplayers",16) always returns 0, causing weapon shortage on some CSS maps.

@edgarasf123 edgarasf123 TTT: Fix weapon shortage on CSS maps
cvars.Number("maxplayers",16) always returns 0, causing weapon shortage on some CSS maps.
5910c63
@robotboy655 robotboy655 added the TTT label Mar 30, 2016
@edgarasf123
Contributor

Usually the script would check "maxplayers" number of the server, but since the cvars.Number function is broken, it checks by current number of players.

So basically because of this bug: If server has players 16/32 it only gets 22 weapons(primary and secondary weapons combined), when it should be giving 42 weapons originally.

@Bo98
Contributor
Bo98 commented Mar 30, 2016

IIRC GetConVar("maxplayers") returns nil (but ConVarExists("maxplayers") returns true) which is why this happens.

@willox
Collaborator
willox commented Mar 31, 2016

The function exists because maxplayers is actually a console command

@edgarasf123
Contributor

The function to get the cvar is broken, and even the cvar itself shows non-sense.
Why check the cvar when there is already a function that gives a valid value?

@bigdogmat

Why check the cvar when there is already a function that gives a valid value?

If I had to guess it existed before the function did

The function to get the cvar is broken, and even the cvar itself shows non-sense.

I guess the convar existed so you wouldn't have to set max players on the command line, though if set through the command line it wouldn't update the convar.

@Bo98
Contributor
Bo98 commented Mar 31, 2016

The function exists because maxplayers is actually a console command

ConVarExists("maxplayers") shouldn't be returning true.

@robotboy655
Collaborator

@edgarasf123, It is not broken. maxplayers is not a console variable, it is a console command. ( CreateConvar vs concommand.Add ). There was a garryfix for the GetConVarNumber functions, but that was removed when we switched those to Lua without the workaround.

@svdm svdm merged commit 97ee4db into garrynewman:master Mar 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment