server_settings.Bool

From GMod Wiki

Jump to: navigation, search
Function
Syntax server_settings.Bool( String name, Integer default )
Where is this used?
Description:
Returns whether the named server setting is true or false.
Returns: Boolean
Part of Library: server_settings
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Server settings.Bool]Server settings.Bool [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionChecks if cheats are enabled.
Used onNewerServer.png
Code
local cheats = server_settings.Bool( "sv_cheats", 0 );
OutputN/A


Additional Notes

Internally, there is no concept of boolean to a server setting, so results are based on whether the variable is set to a 1 or 0, which mimics a boolean value.

This function makes use of server_settings.Int and compares its result to zero to see if the setting is true or not. It does this by setting default to 1 if default is given a true value, 0 otherwise. Thus, default could be given any sort of value, so long as it is true. Be aware 0 and "0" are true in Lua. Only false and nil have falseness.

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox