Preparation:
Open your config.cfg (under the cstrike directory) with WordPad. Change the console ""0.000000""
console ""1"".
Then add
-console -zone 4096 -dev after the program address in the cstrike shortcut
For example: C: SierraHalf-Lifehl.exe -console -zone 4096 -dev
What is alias (macro)?
It can be said that the script is built on the basis of macros. This is also The first question we must understand
The general format of the macro is this:
alias [alias-name] ""[command 1]; [command 2]; [command #]....""
We can see that a macro is actually a collection of instructions, so any macro can also be applied to other macros.
Some of the most commonly used commands in scripts
menuselect # - # is a number from 1 to 9. This command indicates selecting the #th option in the menu. For example:
Example: alias joinct ""chooseteam; menuselect 2""
The content in the quotation marks means selecting the second item of the team menu, that is, the CT side
bind KEY COMMAND -
Define a specific command to a certain key. Note: 'COMMAND' can also be a macro.
For example: bind ""k"" "" kill""
Define the kill command to k, so that you commit suicide when you press k
Another example: bind ""k"" ""joinct""
p>You press k and you will join the CT side.
exec name.cfg -
Import a certain cfg file. HL will be automatically imported every time you enter the game. config.cfg and autoexec.cfg files.
wait -
Stay for a while. The wait in the script is to allow the previous instructions to be executed. How much wait to use depends on different computers. Depending on the network conditions, too much wait will cause lag, and too little wait may prevent the next instruction from being executed in time.
Simple macros
Let's look at some of the simplest macros first Let’s get familiar with the macros
Open autoexec.cfg and write the following lines:
alias hello ""say Welcome to CsChina.net!; wait; wait; kill; wait; < /p>
wait;say_team Welcome to CsChina.net!""
Let us take a look at the structure of this macro:
The quotation marks are an instruction set, in which say this The function of the command is to speak to everyone in the game, and say_team is to speak to all teammates
Note: Separate individual commands with semicolons;
This command set is defined as A macro named hello
Don’t worry, you must define the macro you just created to a certain key position before it can be used. Enter the game and type it in the control panel
bind ""k"" ""hello""
Okay, now let's press K to see the effect, hoho~~
Macro types and simple script production< /p>
We have already understood the basic concepts of scripting. Now let’s take a look at several types of macros and apply them to simple scripting
+/- aliases
+/- aliases
p>
The meaning is that when a key is pressed and held, one instruction set is executed, and when the key is released, another instruction set is executed (Note: the two instruction sets can be the same or unrelated)
Example:
alias +sayreload ""+reload;say_team Cover me while I reload!""
alias -sayreload ""-reload""
+/-
aliases can make your original simple actions more diverse, and if expanded, they can become more complex but more effective Meta
binds(
Meta binds
Meta Binds is actually a kind of +/- alias, but the difference is that Meta
binds redoes the key after releasing it Definition (←Archangel Note: This line is in red font.) Be sure to pay attention to this difference, which will be very helpful in understanding the two types of macros.
Let's look at a common example of making a quick buy and grab script:
Example:
alias preset1 ""buy; menuselect 4; menuselect 6; buy; menuselect 6; buyequip;
menuselect 2""
//Buy AWM, bullets and body armor
alias preset2 ""buy; menuselect 3; menuselect 1; buy; menuselect 6; buyequip;
menuselect 1;""
//Buy MP5, bullets and body armor
alias preset3 ""buy ; menuselect 2; menuselect 1; buy; menuselect 1;
menuselect 5; buy; menuselect 6; buy; menuselect 7; buyequip; menuselect 2""
//Buy M3, beretta, bullets, body armor with helmet
alias preset4 ""buy; menuselect 1; menuselect 3; buy; menuselect 7""
//Buy grenades and bullets
alias preset5 ""developer 1; echo Preset not set!; developer 0""
//The key combination is undefined in the upper left corner of the screen----Preset not set!
p>
Note: The meaning of the echo command is to display the information you defined in the upper left corner of the screen
alias preset6 ""developer 1; echo Preset not set!; developer 0""
alias preset7 ""developer 1; echo Preset not set!; developer 0""
alias preset8 ""developer 1; echo Preset not set!; developer 0""
< p>alias preset9 ""developer 1; echo Preset not set!; developer 0""alias preset10 ""developer 1; echo Preset not set!; developer 0""
//Same as above
alias +toggle ""bind 1 preset1; bind 2 preset2; bind 3 preset3; bind 4
preset4; bind 5 preset5; bind 6 preset6; bind 7 preset7; bind 8 preset8;
bind 9 preset9; bind 0 preset10""
alias -toggle ""bind 1 slot1; bind 2 slot2; bind 3 slot3; bind 4 slot4; bind < /p>
5 slot5; bind 6 slot6; bind 7 slot7; bind 8 slot8; bind 9 slot9; bind 0
slot0""
>
bind alt ""+toggle""
The last three lines of this script are the key. Their meaning is that when alt and a certain number key are pressed, the purchase defined in the first half of the script is executed. Gun command set, and when the alt key is released, the numeric keys return to their original function, that is, switching guns. This is the meaning of Meta
binds!
Its function is also obvious : It can save a lot of key positions and define more command sets on commonly used keys.
Toggles
The most typical example of Toggles (switches) is to switch searchlights and night lights on and off. Visual instrument. Let's make a Toggle that switches netgraph (status display, such as FPS) to get familiar with and study it
Example:
alias ngon ""developer 1; echo Net Graph on; developer 0 ; net_graph 3; bind n
ngoff""
alias ngoff ""developer 1; echo Net Graph off; developer 0; net_graph 0; bind
n ngon""
bind n ""ngon""
The function of this script is to use the n key to switch netgraph. Pay attention to the characteristics of Toggle. At the end of the first macro, The n key is defined to the next macro, which actually forms a kind of cycling, but this script is obviously not satisfactory because it cannot be added to the keyboard settings menu for faster adjustment, because: Please note !The key is defined (bind) twice. How to solve this problem? Just make slight changes.
Toggles(complex)
It is the improved Toggles. The advantage is that you only need to set one key, still taking the netgraph switch as an example
Example :
alias ngon ""developer 1; echo Net Graph on; developer 0; net_graph 3; alias
ng ngoff""
alias ngoff ""developer 1; echo Net Graph off; developer 0; net_graph 0;
alias ng ngon""
alias ng ""ngon""
bind n "" ng""
As you can see: the tails of the two macros have been changed from bind to alias, and the keys are defined separately in the third line. It is very clever, isn't it? hoho~~
Now we can directly define the key in the keyboard settings bar, and more importantly: after understanding this technique, we can enter the next lesson ----- Loop
Cycle aliases
The previous toggle is only a choice between two situations, namely on and off. What should we do when we face more choices? This requires Cycle
aliases, still look at the netgraph example, but this time, we have to use the n key to select different netgraph display forms.
Example:
alias ng1 ""developer 1; echo Net Graph on, setting 1; developer 0; net_graph
1; alias ng ng2""
alias ng2 ""developer 1; echo Net Graph on, setting 2; developer 0; net_graph
2; alias ng ng3""
alias ng3 ""developer 1; echo Net Graph on, setting 3; developer 0; net_graph
3; alias ng ng4""
alias ng4 ""developer 1; echo Net Graph off; developer 0; net_graph 0; alias
ng ng1""
alias ng ""ng1""
bind n ""ng""
We can see that at the end of each line, the key is defined to the next macro, which forms Loop.
Make your own key setting menu
In the previous chapter we mentioned adding your own options to the key setting menu
This is the end We will explain in detail in this section
Open the gfx folder in your half-lifecstrike directory and use WordPad to open the kb_act.lst file. You can see the following content: p>
""buyammo1"" ""Buy Primary Ammo (Optional)""
""buyammo2"" ""Buy Secondary Ammo (Optional)""
" "buyequip"" "Buy Equipment Menu (Optional)""
……………………
The left side is the name of the macro, and the right side is where you want the player to be Pairs seen in the menu
Explanation of this macro
Okay, now we have such a script
alias float_t ""float_on""
alias float_on ""alias float_t float_off; +moveup ""
alias float_off ""alias float_t float_on; -moveup""
Everyone who is already familiar with script production should see that this is a one-click swimming toggle
p>
How to add this toggle column to the menu? You must have noticed it, yes, just add this line at the bottom of kb_act.lst
""float_t"" ""Floating Toggler""
Everything is done. So simple, haha
Similarly, you can also add a trademark to your script in the menu and add the following line:
""blank"" ""You are running Version XXX of XXXX0""
After entering the game, you can see that your name is also branded in CS, handsome:>
In addition, the kb_act.lst file has a size limit, but I guess No one can write so many common console commands in CS1.5
First, add the -console parameter to your CS1.5 shortcut, enter the game, and press the ~ key (ESC The key below) opens the console and you can enter the command:
decalfrequency 30.............In seconds, the player's logo can be sprayed once every 30 seconds, no Upper limit time
mp_buytime 0.25............. In minutes, you can buy something within 15 seconds, 15~550 seconds
mp_c4timer 35.............In seconds, set the explosion time of the C4 bomb to 35 seconds, 15~90 seconds
mp_freezetime 4.... .......In seconds, the shopping before the start of each game is still for 4 seconds, 0~9 seconds
mp_roundtime 3..... .....Calculated in points, the time of each round is 3 minutes, 1~9 minutes
mp_timelimit 45.............Calculated in minutes, that is After 45 minutes, the game ends and the map is changed. There is no upper limit on the time.
sv_restartround 1............. Measured in seconds, set to refresh the SERVER after 1 second. There is no upper limit on the time< /p>
About changing the map:
changelevel .............Change the map immediately, and all USER will not leave the game
mp_maxrounds X............Change the map after X rounds
mp_winlimit X............ ...Any team that wins /p>
About kicking people:
users........................obtain player IP information
p>
status........................Lists player ID information
kick |〈#id〉. ..................Kick someone
banid 5 〈#id〉 kick............Kick someone, let He can't come in until 5 minutes, time 0=forever
mp_autokic
k 0.............Sleep and TK three times will not be automatically kicked out by the system
mp_autoteambalance 1..... .The number of teams on both sides is automatically balanced
mp_hostagepenalty 22..........After killing 22 hostages or teammates, the system will automatically kick you out
mp_limitteams 1.. .............If the maximum difference between the teams is 1 person, you cannot choose to join
mp_kickpercent 0.6............The number of people who vote to kick someone Will be kicked out if it reaches 60%
maxplayers........................The maximum number of players allowed in the game
bind podbotmenu .............Set the buttons of the robot console
addbot ............................. ...Make your own ideal robot
About the remote control:
sv_password .............Set the password to enter the game< /p>
retry.............................player reconnects to the current SERVER
rcon_password ... .............Set the transformation password
rcon_password ............Transform into AMD login console
p>rcon_address IP.............Enter the server when the number of players is full, but cannot play
rcon say xx|"xx". ........Issuing an announcement that can be viewed by anyone alive or dead, using "xx" has a good effect
rcon addip 0 ............. ....Reject a certain IP to enter the game, 0 means permanent, measured in minutes
rcon addid 0 kick......It is not allowed to set a certain WON ID Enter the game, the time setting is the same as above
About ghosts:
mp_fadetoblack 0............This way the screen will turn black after death so that the living can watch it Get the corpse
mp_chasecam 1.............Players who set observer mode can only follow others
mp_forcechasecam 0 ............ When someone dies: 0 free viewing, 1 following teammates, 2 sights in place
About mutual killing:
mp_friendlyfire 0. .. Set grenades not to hurt teammates
mp_friendly_genrade_damage 0.. Set grenades not to hurt teammates
mp_tkpunish 0.... .............Turn off the penalty for damaging friendly forces, and you will be forced to commit suicide in the next round
mp_falldamage 1.............You can jump off the building Suicide
Client only
About hobbies:
adjust_crosshair............The crosshair will change every time you hit it Color
exec 〈.cfg|.rc〉.............Read the specified file
hud_fastswitch 1...... ........Quickly change weapons, press the number to switch out directly, no need to click the mouse again
hud_centerid 1.............Display the character name Place in the middle of the screen
sensitivity 8............
.Mouse movement speed
zoom_sensitivity_ratio 1.2....Set the mouse movement speed when using the sniper scope
name "New name"...... .....Change the name, it can only be used when you are alive
timeleft............. Let you know how many minutes are left Change the map
net_graph 3.............Show the fps value of your machine
con_color “255 155 50”. .....yellow text
listplayers............shows player's numeric ID
listmaps. ..................Shows the map's numeric ID
vote ............. .........Players vote to kick people
votemap digital ID......Players vote to change maps
cmdlist......................List some console instructions (can be preceded by the letter of the instruction)
scr_conspeed 600. .............Set console text scrolling speed
drawradar.............Display Radar
hideradar.............Close radar
maps start... ............List the installed map file names, (only the file names starting with the specified letter are listed, * means all maps)
exit(quit).. .............Quit the game completely
cl_download_ingame 1.............Download other players’ LOGOs, stickers, etc.
volume 0.8.............Adjust the volume, the actual volume is (volume/hisound)
hisound 1.000000... ...........Set the maximum volume value, the actual volume is (volume/hisound)
bgmvolume 1.000000......Background sound effect music Volume level
kill........................suicide
About recording:
record filename.............Start recording a video
playdemo filename.dem..........play filename at normal speed .dem recording
stop........................Stop recording
CONSOLE backup command< /p>
SERVER side
pausable 0........................ prohibit the client from pressing pause
mp_consistency 1.............Restrict model changes, C4 or weapons are easily discovered
mp_flashlight 1............. You can use a flashlight
mp_footsteps 1.............Turn on footsteps
mp_startmoney 800..... ...Amount of money at start
sv_aim 0.............Autoaim off
<p>sv_bounce 1.............Various bonuses are open
sv_cheats 0............. ...... Can I use the default secret skill?
sv_gravity 800......Control gravity, 800 is normal gravity, -999 to 999999 p>
sv_stepsize 18............step size