Search
Username:
Password:
Register or Reset Password
Remove the ads!
  
A scripting tutorial
Difficulty: Beginner
Category: CS > ScriptingAuthor(s): chrisbitm

This is a Tutorial on Scripts: Now lets begin, shall we.

///////////////////////////////////////////////////////////////////////////////////////
The Basics
///////////////////////////////////////////////////////////////////////////////////////

First, go to Start>Run and type C:\Program Files\Steam\steamapps\user_name\counter-strike\cstrike
(This way, you can have easy access going into this folder).
(As Seen in Screen Shot A)

Now, view your folder. You should see one .cfg file that you should be concerned with. It is called, config.cfg. You should not worry about this file though. This file is for settings in game. For example, +mouse1 = fire. This, meaning, one click from the mouse button enables the weapon at hand to fire.
(As Seen in Screen Shot B)

Now, to get things further underway, there are a few other things that you should know about.

1. You do not need to make a file called, valve.rc

and

2. You do not need to save you custom settings and/or configurations in a file called, autoexec.cfg. You could but it really is not necessary.

I have tested this personally so there is no need to do any of the two above.

The reason why these are is this: remember the config.cfg file? Well, at the very bottom of this file is the command, exec userconfig.cfg.
(As Seen in Screen Shot C)

That command tells the game to execute the configuration file. Unfortunately, we do not have a file called, userconfig.cfg, but we will - soon enough.

Oh, yeah. All of this scripting stuff must be done in notepad.exc, and save this file titled, userconfig.cfg.
(As Seen in Screen Shot D)

//////////////////////////////////////////////////////////////////////////////////////
Binding
//////////////////////////////////////////////////////////////////////////////////////

Now, ask yourself - what is binding?

Binding is how you associate a command to a key (This is laments terms). Everything that happens in the game are associated commands.

For example: pressing w (Default) makes you move forward. Well, this command is +forward.

Now, to bind a key. Well, binding is very simple. This is the structure on how the bind works:

bind "command"

Of course, you can bind a key to several commands instead of one like so:

bind "command; command 2"

Of course, when you do this, make sure you put a space after the semi-colon or else the second command would not read - but the first command will. Also, you must code the command correctly. Please keep these 2 things in mind.

//////////////////////////////////////////////////////////////////////////////////////
Alias
//////////////////////////////////////////////////////////////////////////////////////

An alias associates a bunch of commands, like a bind, but the difference is that you assign a name to it.

The alias structure is not very much different than the binding structure.

For example:

alias xxx "command1; command2"

xxx = AnyName

Then, you must bind this to a key. Be it any key you want to.

Example:

bind f1 "xxx"

xxx= the name that you have assigned to the alias.

//////////////////////////////////////////////////////////////////////////////////////
Saving the script
//////////////////////////////////////////////////////////////////////////////////////
You can save all of this in the file, userconfig.cfg. Go to Start>Run and paste this into your cstrike folder.
(As Seen in Screen Shot E)

//////////////////////////////////////////////////////////////////////////////////////

That's it. P/M me for any questions and feedback
Added: 10 months agoTags: binding, valve.rc, autoexec.cfg, alias
Feedback (2)
chrisbitm .
You know that I am going to destroy you!Y2M
Posted 14 days ago
Posted by PrimaryfraG

I wanna make a script on "q" that changes weapon twice. But i dont know the command. Can you help me? Awesome tut anyway.


so you want to be able to switch between secondary and primary?

Lets say you have the secondary and switch to primary, are you saying you want to press q to switch back to your secondary (Last weapon used)?

anyways, thanks taking a liking to my tut.
PrimaryfraG .
BananiteY2M
Posted 15 days ago
I wanna make a script on "q" that changes weapon twice. But i dont know the command. Can you help me? Awesome tut anyway.
- Bananite
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.
No assessments made... please vote!
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...
No stamps recorded
You cannot stamp yet!
Stamps let you apply characteristics to submissions to help others understand them.

To stamp this submission register or login.





Added by...
chrisbitm .
You know that I am going to destroy you!
Ranked 1339th ( 1) with 1,436 points. 1 points behind Nov4cane .

[+] Donate
Related Tutorials