Offline knife binds for CSGO (New knives added!)

I spend a lot of time offline with bots, practicing aim, surfing etc., sometimes its boring to just inspect the default knives that come with the vanilla game. Since Valve has provided a way to switch knifes, I thought why not bind it and I wrote a script to just do that! Now I can run around switching knives with just the press of a button. Sweet!

There is another way to equip all skins, gloves etc, but that requires running the game in insecure mode which means no connection to Valve’s servers. Maybe some other time.

This script should also work when playing online with friends, just need to make sure whoever is hosting the server has sv_cheats set to 1 and everyone else joining the server should have the knife script.

Download Link –> knife_binds_v2.zip

Quick Setup


After downloading the files, extract the files to csgo/cfg.

The folder structure after extraction should look like this

├── cfg  
│   ├── knife_binds.cfg  
│   ├── ...
│   ├── custom  
│   │   ├── knives  
│   │   │   └── m9bayonet.cfg  
│   │   │   └── butterfly.cfg  
│   │   │   └── ...  


Go ahead and startup an offline casual game, use exec knife_binds to run the script.

The knives I added to the script are my favorite knives as of writing and can be changed by editing the knife_binds.cfg file, try it, its self-explanatory

Although I have only tested on classic casual, it should work on pretty much any other gamemodes except for Death match since we can’t drop weapons on that mode. What a shame, nothing I can do about that.

Read on to see how everything works.

The Basics (for beginners)


Firstly, create a file in your cfg folder, mine is "E:\Steam Library\steamapps\common\Counter-Strike Global Offensive\csgo\cfg"

The filename can be anything you want, just make sure to put a .cfg at the end. I used knife_binds.cfg. Open up the file and write echo Hello World! and save it.

Now open up CSGO and press ~ to bring up the in-game console. Console is disabled by default, you can enable it from Settings -> Game Settings -> Somewhere Here.

Once the console comes up write "exec knife_binds" and press Enter.

If you’ve done everything correctly it should print out Hello World! on to the console.

Adding knife binds


This is the actual bind!

give weapon_knife_m9_bayonet;mp_drop_knife_enable 1;ent_fire weapon_knife addoutput "classname weapon_knifegg"

The above line is three console commands chained together, that’s why its separated by semi colons and enclosed in double quotes.

This can be directly copied & pasted to the console and it will work.

But I’m not going to type this in console everytime I want to switch my knife. That’s where binds come in.

So why don’t we just go ahead and bind the damn thing? It’s not that simple. Binds don’t work if there’s double quotes in the command.

So if we write a bind for this, it will look like

bind "KP_END" "give weapon_knife_m9_bayonet;mp_drop_knife_enable 1; \
            ent_fire weapon_knife addoutput "classname weapon_knifegg""

The bind command takes in two parameters , here the key is KP_END. The string `"classname weapon_knifegg"` is enclosed in double quotes. Hence, the double quote for the actual bind command ends prematurely which will throw an error and as far as reddit know Valve doesn't provide escape characters for cofig commands.

What now?

A simple workaround


Since the command cannot be bound directly, it can be replaced by a filename and that file will hold the actual command.

Not the best workaround, but it works.

Create a file with the knife bind command and save it as m9bayonet.cfg (I’m using bayonet as an example)

give weapon_knife_m9_bayonet;mp_drop_knife_enable 1;ent_fire weapon_knife addoutput "classname weapon_knifegg"

Now create an alias for it inside the file that was created earlier (knife_binds.cfg)

alias m9bayonet "exec m9bayonet"

In the next line bind it to a key with the following command bind "KP_END" "use weapon_knife; drop; m9bayonet"

The knife_binds.cfg file should look like this

alias m9bayonet "exec m9bayonet"
bind "KP_END" "use weapon_knife; drop; m9bayonet"

Where m9bayonet is the alias to load the command inside the file m9bayonet.cfg

Once you’ve finished binding, start an offline game with bots other than DM, run exec knife_binds from the console. And it should work.

Full script

This is what the finished script looks like

sv_cheats 1
mp_items_prohibited 0

// Print list of knives
echo ** List of Available Knifes **
echo bayonet, flip, gut, karambit, m9bayonet, tactical, butterfly, falchion, bowie, shadow, ursus, jack, stiletto, talon, survival, classic,  nomad, paracord, skeleton, spectral, spanner, hammer, axe, fists, gold

// Create aliases from file
alias bayonet "exec custom/knives/bayonet"
alias m9bayonet "exec custom/knives/m9bayonet"
alias flip "exec custom/knives/flip"
alias gut "exec custom/knives/gut"
alias karambit "exec custom/knives/karambit"
alias tactical "exec custom/knives/tactical"
alias butterfly "exec custom/knives/butterfly"
alias falchion "exec custom/knives/falchion"
alias bowie "exec custom/knives/bowie"
alias shadow "exec custom/knives/shadow"
alias ursus "exec custom/knives/ursus"
alias jack "exec custom/knives/jack"
alias stiletto "exec custom/knives/stiletto"
alias talon "exec custom/knives/talon"
alias survival "exec custom/knives/canis"
alias classic "exec custom/knives/classic"
alias nomad "exec custom/knives/nomad"
alias paracord "exec custom/knives/paracord"
alias skeleton "exec custom/knives/skeleton"
alias spectral "exec custom/knives/spectral"
alias spanner "exec custom/knives/spanner"
alias hammer "exec custom/knives/hammer"
alias axe "exec custom/knives/axe"
alias fists "exec custom/knives/fists"
alias gold "exec custom/knives/gold"

// Binds
bind "KP_END" "use weapon_knife; drop; m9bayonet"
bind "KP_DOWNARROW" "use weapon_knife; drop; butterfly"
bind "KP_PGDN" "use weapon_knife; drop; skeleton"
bind "KP_LEFTARROW" "use weapon_knife; drop; karambit"
bind "KP_5" "use weapon_knife; drop; gut"
bind "KP_RIGHTARROW" "use weapon_knife; drop; nomad"
bind "KP_HOME" "use weapon_knife; drop; shadow"
bind "KP_UPARROW" "use weapon_knife; drop; jack"
bind "KP_PGUP" "use weapon_knife; drop; spectral"

// Debug
echo 
echo +++ knife_binds.cfg executed successfully +++ 
echo

PS: The download link is at the top of the article.