Ok dumb question
what is cvar and how do i use it?
Ok dumb question
what is cvar and how do i use it?
Hey, a cvar is something like a persistent variable (till server restart). It can only contain strings, integers (int) or floating point numbers (float).
In server-console you can do:
set somevalue HELLO
somevalue -> will print HELLO
Then there are some codscript-functions to access those variables:
Code:gethello = getcvar("somevalue"); // the variable gethello contains HELLO nowWhat returns this function-call now? getcvar("somevalue"); *question for you*Code:setcvar("somevalue", "BYE"); // the variable gethello is set to BYE now
Like the server got cvar's, a client got them also. You can set client-cvars like this:
Code:player setclientcvar("com_maxfps", "125"); // everybody can strafe now :D
timescale 0.01
Ok and if i wanted to for example
change the gravity to 50 after i use a trigger_use?
nvm Fixed thanks ^_^
Please post solution
timescale 0.01
sure...
or anything similar...Code:lowgravtrig() { trig = getent("lowgravtrigger", "targetname"); while(true) { trig waittill("trigger", user); if(!isplayer(user)) continue; oldgrav = getcvarint("g_gravity"); setcvar("g_gravity", 50); wait 60; setcvar("g_gravity", oldgrav);' } }
kung foo man (30th November 2012)
i just did
xDCode:thread gravity(); } gravity() { button2 = getent("button2", "targetname"); while(1) { button2 waittill("trigger", player); setCvar("g_gravity", "50"); iprintlnbold((player.name) + "\n IT WORKED!"); wait 5.0; } }