Neverlose
  • Welcome
  • Official Website
  • Useful information
    • ๐Ÿ“ฒQuick start
    • โ›ฉ๏ธCommon knowledge
    • ๐Ÿง Examples
      • โš™๏ธMaterials
      • โš™๏ธColor
      • โš™๏ธVector
      • โš™๏ธESP
      • โš™๏ธConVars
      • โš™๏ธUI
  • Documentation
    • ๐Ÿ““Events
    • โš™๏ธVariables
      • ๐ŸŒŽ_G
      • ๐Ÿ—„๏ธbit
      • ๐ŸŒˆcolor
      • โŒšcommon
      • ๐ŸŽฒcvar
      • ๐Ÿ’พdb
      • ๐Ÿ‘พentity
      • ๐Ÿ‘ฉโ€๐Ÿ’ปesp
      • ๐Ÿ—ณ๏ธevents
      • ๐Ÿ“‚files
      • ๐Ÿ“Žglobals
      • ๐Ÿ”“json
      • โœจmaterials
      • ๐Ÿ”ขmath
      • ๐Ÿ’ปui
      • โ˜๏ธnetwork
      • ๐ŸŒƒpanorama
      • ๐Ÿ’ขrage
      • ๐ŸŽจrender
      • ๐Ÿงฐutils
      • ๐Ÿ“vector
Powered by GitBook
On this page
  • Execute
  • Getting / Setting values
  • Callbacks
  1. Useful information
  2. Examples

ConVars

PreviousESPNextUI

Last updated 2 years ago

Execute

Force full-update

Turn up player footstep volume

-- Initialize the cvar objects
local cl_fullupdate = cvar.cl_fullupdate
local snd_setmixer = cvar.snd_setmixer

-- Invoke the callback
cl_fullupdate:call()

-- Adjust playersโ€™ step volume by setting the mixer volume to 1.2
snd_setmixer:call('GlobalFootsteps', 'vol', 1.2)

Getting / Setting values

Override maximum fake-lag limit

-- Initialize the cvar objects
local process_ticks = cvar.sv_maxusrcmdprocessticks

-- [60]: New value | [true]: Sets the raw value
process_ticks:int(60, true)

Callbacks

cvar.sv_cheats:set_callback(function(cvar_obj, old_value, new_value)
    if tonumber(old_value) == 0 and tonumber(new_value) == 1 then
        -- invoke ent_create convar callback with "weapon_ak47" argument
        -- cvar.ent_create:call 'weapon_ak47'

        cvar.clear:call()
        print '\aFF697Asv_cheats was updated. Crashing the server.'

        utils.console_exec 'ent_create weapon_ak47'
    end
end)

cvar.connect:set_callback(function(cvar_obj, args)
    if args[1] == '127.0.0.1' then
        return false
    end
end)

Instantly crash the server if someones changes the sv_cheats cvar to 1

Refuse the connection to the server if the IP is blacklisted

๐Ÿง 
โš™๏ธ
โ„น๏ธ
โ„น๏ธ
โ„น๏ธ
โ„น๏ธ
โ„น๏ธ