Hey guys, salut mes amis och hallå gubbar, Maxim here.
This is a video on advanced scripting which is a second part for my old video called
Basic Scripting Tutorial.
If you haven't seen it and you wanna know the basics I'll put it in the video description.
In this video I'm gonna go through the more advanced scripting commands that you can use.
But Maximuh, can scripts get me banned?
Using scripts will NOT get you VAC banned at all, some servers might allow it but that's
up to the servers!
In the first video I covered aliases and some basic use of the + and - commands.
So let's continue and start with toggle.
For example toggle crosshair 0 and 1.
This will disable and enable the crosshair each time we enter it.
Another example is changing the volume of the game, like this, toogle volume 0.5 and
0.8 Each time we enter it to the console the value
changes back and forth.
Now there is another toggle command called BindToggle but you can only use it for simple
commands that can be switched either ON or OFF, for example sv_cheats.
But it's still very useful because you can bind it to a key and it will save the bind,
even if you restart the game.
For example if we type BindToggle K sv_cheats you can now toggle cheats on your server by
pressing K.
Now let's go back to Toggle again and I'll show you a command that would not work with
BindToggle.
If we type r_drawclipbrushes 2, it will turn on clip brushes which can be very useful to
find boost spots for example.
Setting it to 0 will turn it off.
Since the command values are not 0 and 1, but 0 and 2 we can't use BindToggle, but we
can still do some cool sh**.
If we type Toggle r_drawclipbrushes 0 2, we can toggle the clipbrushes of the map, and
let's add an alias for this that we call "clip".
This means that you can use your new custom command "clip" to toggle clip brushes.
And now we can bind clip to a key to make it work.
The next thing I wanna teach you guys is how you can change + and - commands to act as
toggles.
You can change crouch for example, so pressing a key once will make you crouch and pressing
it again will make you stand up instead of holding down a button.
Now this part is very hard to explain without showing you the finished script so here it
is.
What it does, is pretty cool.
First I've created an alias called duckswitch which is set to duck-on.
When you press your KEY, in this example it's CTRL, duckswitch will read this line, also
known as duck-on which means it will make you crouch, but it will also tell duckswitch
that it's not duck-on anymore, it's now set to duck-off.
This means that if you press CTRL again, it will read from this line, also known as duck-off,
instead of this line.
This also means that you will stop crouching, and once again, it will tell duckswitch that
it's not duck-off anymore, it's back to duck-on.
Basically what you're seeing is an infinite loop, fooling the system to rename the alias
duckswitch from duck-on to duck-off each time you press CTRL.
You might need to replay this part of the video to understand it better, but if you
did understand it the first time then you're pretty smart.
Another example of using this is for the scoreboard, which uses +score and -score.
You can replace duck with score if you want and give the aliases new names and now you
only need to press your key once to toggle it on or off.
If you want more ideas of what you can do, you can type + in the console and find all
the commands that you can potentially change into so called toggles.
Next command to learn is IncrementVar which lets you choose many values inside one command.
For example, cl_crosshaircolor will change your crosshair's color.
You can go from 0 to 4 and get different colors.
So how can we use IncrementVar for this example?
First type IncrementVar cl_crosshaircolor, next you need to select your start value,
which is 0 in this case and your end value, which is 4.
The last thing we need to do is tell the command how many times it needs to jump from the start
to end value.
If we put 1, it will move from 0 to 4 one step at a time.
So if we enter it it will start with the value 0 which was red.
If we hit it again it will go the value 1 which is green, etc etc.
We can now see that the crosshaircolor value is at 4.
So if we do it one more time, it will go back to 0 again (which was red).
We can also create an alias for this, let's call it colorchange.
And just like before we can bind colorchange to a key now.
Let's continue by creating an alias which loads the colorchange script each time we
shoot.
We can do it like this for example.
And finally, to finish the video, let's add this colorchange script into a toggle script
that I showed you guys earlier in the video.
This script will bind mouse1 to +firecolors which will give you the rainbow effect.
But if you don't like it, you can turn it ON or OFF by using this key.
I feel like this video needs to end here, otherwise there's too much information at
once, but I hope you enjoyed it and that you learned something new.
I can make videos with useful scripts if you want later on.
You can follow me on Twitter and Instagram if you like what I do, I'll see you guys soon,
and go bananas!