Search
Username:
Password:

Register or Reset Password

SUBMISSIONS
Counter Strike
   New Maps
   New Tutorials
   New Skins
   New GUI's
   New Sounds
   New Threads
Other
   Media
   Gamers
   Clans
   Studios
Alternate binds when holding a key
Difficulty: Advanced
Category: CS:S > ScriptingAuthor(s): J2K

//===================================
//Alternate bindings when holding a key (Shift + Key)!
//===================================


Hey all! Jay is back with another cool scripting tutorial! This one will teach you how to make scripts that can change what a key does while holding Ctrl, Alt or Shift!

For example, in Microsoft Word if you hit the s key, the letter s is displayed on screen. If you hold the Ctrl key and press s, it will save the document. We are going to learn how to mimic this behavior with some innovative scripting!

//===================================
//Part 1 - Choose your keys and commands.
//===================================


I'll try to keep this as simple as possible.

First of all, decide what key you will hold to change what your second key will do. For this example, i will use Ctrl.

Then decide on what key you want to use for two different commands, depending on whether or not the Ctrl key is being held.

//===================================
//Part 2 - The script
//===================================


For this example, I will be using the P key to buy grenades. Holding the Ctrl key will change which grenade is purchased when i press P.

alias flashy "buy flashbang;"
alias nadey "buy hegrenade;"

The above two commands give us shortcuts to buying the weapons later in the script, to keep things tidy.

alias +alternatebuys "bind P flashy;"
alias -alternatebuys "bind P nadey;"

+alternatebuys binds the P key to buy a flashbang, until the Ctrl key is released.
-alternatebuys binds the P key back to buying a HE Grenade, when the control key is released.

//===================================
//Part 3 - The binds
//===================================


Now we have come to the part where we have to bind our script. Be sure to use your own key selections from the script if you did not use the example keys!

bind ctrl +alternatebuys
bind P nadey


As you can see, the ctrl key now gives us the opportunity to make an alternate buy menu on the same keys as our standard buy menu! For a bigger, better example, check out my personal alternate buy menu script below!

PS: Don't forget, this is in no way limited to buy menus, you can use this in conjunction with any commands you wish!

//===================================
//Double buy menu by J2K!
//===================================


//Buy menu shortcuts
alias dgl "buy deagle;"
alias usp "buy usp;"
alias m4ak "buy m4a1; buy ak47;"
alias augsig "buy aug; buy sg552;"
alias scout "buy scout;"
alias mp5 "buy mp5;"
alias mactmp "buy mac10; buy tmp;"
alias awp "buy awp;"
alias refill "buy vest; buy vesthelm; buy defuser; buy secammo; buy primammo;"
alias refillmax "refill; buy hegrenade; buy smokegrenade; buy flashbang; buy flashbang;"

//The alternator
alias +buymenu2 "bind f refill2; bind c dgl; bind x augsig; bind z scout;"
alias -buymenu2 "bind f refill; bind c usp; bind x m4ak; bind z awp;"

//The binds
bind f refill
bind c usp
bind x m4ak
bind z awp
bind alt +buymenu2

That script above gives me 8 different buy scripts on 4 keys, and as you practice it becomes second nature to hold alt when buying if you want to access the second half of the buy menu.

Hope people enjoy this one!

Jay.


Added: 1 year agoTags: multiple, alternate, binds
Feedback (6)
jeffysan .
Inactive.Y2M
Posted 3 months ago
Amazing tutorial, opens up new possibilities towards scripting and organizing multiple scripts. Very fantastic job, man.
- Inactive.
GrimReaper .
Fear the ReaperY2M
Posted 10 months ago
Very useful tutorial.
kfceater .
i needs a 6 digitY2M
Posted 1 year ago
Pros: Helpful
Cons: For buying scripts only
Improvements: Make it for regular scripts as well
Notes: good job with the tutorial
:.
ModeratorY2M
Posted 1 year ago
Good tutorial.
.
I like boobsY2M
Posted 1 year ago
Well written and really useful.
- I like boobs
Sheeprider .
Fuck computersY2M
Posted 1 year ago
Nice. Very useful way to keep your binds organized.
Add Feedback
Provide constructive feedback. What is "constructive"?
You cannot post yet!
Get involved on FPSB by posting your thoughts. Give authors your feedback to help them develop.

To post in this submission register or login.
Assessment
The community's verdict.
User Rating [+]
9.6/10
bScore
9.6/10
You cannot assess yet!
Moderating FPSB is in your hands - when you assess a submission your vote determines its success or failure.

To vote on this submission register or login.
Stamps
This Tutorial in a nutshell...
Handy & Well Written
You cannot stamp yet!
Stamps let you apply characteristics to submissions to help others understand them.

To stamp this submission register or login.

Brought to you by...
Sabotage Studios
Originality, Creativity, Simplicity
Membership: On Request
Primary Skills: ?
Inception: 2 years ago
Vote for Studio
Like this tut? Vote Sabotage Studios for one or more monthly awards.
You must login or register to access this!
Related Tutorials