| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 971 人关注过本帖
标题:CS命令及脚本代码汇总
只看楼主 加入收藏
flyue
Rank: 10Rank: 10Rank: 10
来 自:江南西道
等 级:贵宾
威 望:19
帖 子:3465
专家分:1563
注 册:2006-6-20
结帖率:100%
收藏
 问题点数:0 回复次数:1 
CS命令及脚本代码汇总
I have been asked several times to give out my Script menu, So I have decided to write a tutorial on how to make one yourself. So instead of it just being handed to you, you will learn more things about HL scripting, new features, and you will have your very own Script Menu.


Section 1: The commands used in a basic Script Menu
Section 2: Getting started
Section 3: The Menu itself
Section 4: Adding a Submenu


--------------------------------------------------------------------------------


Section 1: The commands used in a basic Script Menu.

Clear:
     Clears the console so nothing else will show up on your screen other then your menu.

Contimes:
     How far down your menu will be displayed.

          Example:
               Contimes 25

     Set to 25, your menu will show 25 lines down from the top of your screen.

Con_Notifytime:
     Tells HL how long to keep the menu/echo on your screen.

          Example:
               Con_Notifytime 25

     This will make the menu stay on the screen for 25 sec.

Echo:
     Writes text into the console, this is used for letting yourself know that your script has been executed.

          Example:
               Echo "Script Menu Loaded"

     When your menu is executed it will say in console Script Menu Loaded

Exec:
     Executes a Script from a config (.cfg) file.

          Example:
               Exec menu.cfg

Bind:
     Sets a key you choose to do something.

          Example:
               Bind a "+left"

     That sets your 'A' key to move left.


Alias:
     Binds commands together in an alias to perform multiple tasks at the hit of one button.

          Example:
               Alias bob "say I Own You All; say You can't stop me!"
               Bind I "bob"

     That sets the 'I' key to say I Own You All and after that say You can't stop me!

Developer:
     Debugs console messages. '1' is On, '0' is Off. You need to turn Developer mode on before an echo and off after an echo or a set of echoes.

Wait:
     Pauses for 1 tick during running an alias or script.


These are all the commands that will be used in this Menu.


--------------------------------------------------------------------------------


Section 2: Getting started.

     First off you need a good scripting program. I recommend using notepad. Make a Directory for your menu e.g. a folder called Menu or something. I will be referring everything to the folder name as 'Menu'. You will be saving all the configs for the menu into this folder. Be prepared to have a lot of scripts, all depending on how much you want your menu to do will determine how many scripts you are going to have.

     I will try to go through this as slow as possible so you will have a good understanding of how everything works together. But basically all a Script Menu is echoes that appear on your screen to act as a menu and bind's your keys to do what the menu shows. Another name for Script Menu would be called an Echo Menu. Ok enough talk let's get down to scripting.

     I'm going to use the basic number keys up top for your buttons. Mainly everyone has their number keys set to slot 1, slot2, and so on. If you have them set differently then you will just replace my example with the slot commands to the commands you have set. So for starters you will have to make sure you get the commands for 0-9 and make an alias.


     alias rebind_num "bind 1 slot1; bind 2 slot2; bind 3 slot3; bind 4 slot4; bind 5 slot5; bind 6 slot6; bind 7 slot7; bind 8 slot8; bind 9 slot9; bind 0 slot10"


Now you need to have your numbers bound so they will execute the command you want when you have your menu open.


     alias menu_bind "bind 1 but1; bind 2 but2; bind 3 but3; bind 4 but4; bind 5 but5; bind 6 but6; bind 7 but7; bind 8 but8; bind 9 but9; bind 0 but10"


All right with this alias it will bind your number keys to do the function you want.

You need to add the command contimes to your script. I recommend setting it to 25.


     contimes "25"


This tells it to show the menu 25 lines down.

You need to add developer into your main script for all the echo's. I like to make it so I don't have to write developer 1/0 all the time so I make a shorter alias that does the same thing.


     alias dev1 "developer 1"
     alias dev0 "developer 0"


Now you need to set a key to turn your menu on and off.


     alias menu "menu_on"
     alias menu_on "con_notifytime 25; menu_bind; clear; exec menu/menu1.cfg; alias menu menu_off"
     alias menu_off "con_notifytime 5; rebind_num; clear; dev1; echo Menu Off; dev0; alias menu menu_on"
     bind v "menu"


The alias menu is to toggle the menu on and off.

In the alias menu_on it sets how long the menu stays on screen, binds your number keys for your functions, clears the console so nothing else will appear, executes the looks of the menu (that will be in the other script called menu1.cfg), and makes alias menu menu_off.

In alias menu_off it sets how long something should stay on the screen, rebinds your number keys to what you had them before, clears the console, echo's on the screen Menu Off and makes alias menu menu_on

I have it set to the key 'v' to turn the menu On/Off. You may change this if you like.
You may want to put an echo into your script just to know that it loaded.


     echo "Menu Loaded"


Ok this is what you should have in your first script that will be executed.


     contimes "25"

     echo "Menu Loaded"

     alias dev1 "developer 1"
     alias dev0 "developer 0"

     alias rebind_num "bind 1 slot1; bind 2 slot2; bind 3 slot3; bind 4 slot4; bind 5 slot5; bind 6 slot6; bind 7 slot7; bind 8 slot8; bind 9 slot9; bind 0 slot10"

     alias menu_bind "bind 1 but1; bind 2 but2; bind 3 but3; bind 4 but4; bind 5 but5; bind 6 but6; bind 7 but7; bind 8 but8; bind 9 but9; bind 0 but10"

     alias menu "menu_on"
     alias menu_on "con_notifytime 25; menu_bind; clear; exec menu/menu1.cfg; alias menu menu_off"
     alias menu_off "con_notifytime 5; rebind_num; clear; dev1; echo Menu Off; dev0; alias menu menu_on"
     bind v "menu"


     Ok now you have your First Script, save this into your Menu folder to whatever you want as a config file .cfg. If you don't know how to save it as a config file then I suggest you read the Beginners Tutorial. Now we can get started on the looks of you Menu.


--------------------------------------------------------------------------------


Section 3: The Menu itself

     Now the looks are all echo's, that's all it is. So you need to know what you are going to have in your menu. Lets make this a Text Menu. Ok the first step you need to do is make the alias with the commands each number key is going to do when the menu is on.


     alias but1 "but10; say I Own YouR SoRrY AsSeS!"
     alias but2 "but10; say You can't take the heat!"
     alias but3 "but10; say I need back up"
     alias but4 "but10; say I'm going to beat your ass to the ground!"
     alias but5 "but10; say My AK47 is Better then your AK47 :-D"
     alias but6 "but10; say My Clan Site is http://
     alias but7 "but10; say Server Stats website http://
     alias but8 "but10; say To Contact Admin email blah@
     alias but9 "but10; say Server IP: 419078478190"
     alias but10 "menu"


Now all that are the commands, now we need to make the looks of the menu on the screen with the echo command.


     alias m1 "echo 1 - I Own YouR.."
     alias m2 "echo 2 - Cant take the heat."
     alias m3 "echo 3 - Need Back Up"
     alias m4 "echo 4 - Beat you to the ground!"
     alias m5 "echo 5 - My AK is better."
     alias m6 "echo 6 - Clan Website."
     alias m7 "echo 7 - Stats Website."
     alias m8 "echo 8 - Admin Email."
     alias m9 "echo 9 - Server IP"
     alias m0 "echo 0 - Close


Now on the screen you will see something like this.


     1 - I Own YouR..
     2 - Cant take the heat.
     3 - Need Back Up
     4 - Beat you to the ground!
     5 - My AK is better.
     6 - Clan Website.
     7 - Stats Website.
     8 - Admin Email.
     9 - Server IP
     0 - Close


Now you need to make one alias that has the entire echo's in it.


     alias submenu "m1;m2;m3;m4;m5;m6;m7;m8;m9;m10"


Now for it to show up on the screen you put clear to clear the console, dev1 for the echoes, submenu to show all the echoes/menu, and dev0 to end the echo's.


     clear
     dev1
     submenu
     dev0


This is what it should look like when it's all done.


     alias but1 "but10; say I Own YouR SoRrY AsSeS!"
     alias but2 "but10; say You can't take the heat!"
     alias but3 "but10; say I need back up"
     alias but4 "but10; say I'm going to beat your ass to the ground!"
     alias but5 "but10; say My AK47 is Better then your AK47 :-D"
     alias but6 "but10; say My Clan Site is http://
     alias but7 "but10; say Server Stats website http://
     alias but8 "but10; say To Contact Admin email blah@
     alias but9 "but10; say Server IP: 419078478190"
     alias but10 "menu"

     alias m1 "echo 1 - I Own YouR.."
     alias m2 "echo 2 - Cant take the heat."
     alias m3 "echo 3 - Need Back Up"
     alias m4 "echo 4 - Beat you to the ground!"
     alias m5 "echo 5 - My AK is better."
     alias m6 "echo 6 - Clan Website."
     alias m7 "echo 7 - Stats Website."
     alias m8 "echo 8 - Admin Email."
     alias m9 "echo 9 - Server IP"
     alias m0 "echo 0 - Close"

     alias submenu "m1;m2;m3;m4;m5;m6;m7;m8;m9;m10"

     clear
     dev1
     submenu
     dev0


     Now you are all set with a new menu. Make sure you save this as menu1.cfg and save it into your Menu folder. Once you have done this, move your Menu folder into your cstrike Dir. Then go to your autoexec and add exec menu/menu1.cfg


--------------------------------------------------------------------------------


Section 4: Adding a Submenu.

     Ok say you want to do like a menu that has sections to it. Let's make an Admin menu. So you will want to have a map section, command section, and other things. All you have to do is make another script with the menu looks in it and execute it. I will give you a quick look at one.


     alias adm1 "exec Menu/admin/messages.cfg"
     alias adm2 "exec Menu/admin/quickad.cfg"
     alias adm3 "exec Menu/admin/serverset.cfg"
     alias adm4 "exec Menu/admin/torture.cfg"
     alias adm5 "exec Menu/admin/mapsmenu.cfg"
     alias adm6 "exec Menu/admin/matches.cfg"
     alias adm7 "exec Menu/admin/weapon.cfg"
     alias adm8 "adm10"
     alias adm9 "adm10"
     alias adm10 "adminmenu"

     alias ade1 "echo 1 - Admin Messages"
     alias ade2 "echo 2 - Quick Admin Functions"
     alias ade3 "echo 3 - Server Settings"
     alias ade4 "echo 4 - Torture!"
     alias ade5 "echo 5 - Change Maps"
     alias ade6 "echo 6 - Match Settings"
     alias ade7 "echo 7 - Weapons restrictions"
     alias ade10 "echo 0 - Close"

     alias submenu "ade1;ade2;ade3;ade4;ade5;ade6;ade7;ade8;ade9;ade10"

     clear
     dev1
     submenu
     dev0


     Now say you want to go into the Admin Messages, you would hit the number key 1 and that will execute the messages.cfg. The messages.cfg script looks like this.


     alias adm1 "adm10; admin_tsay Friendly Fire is on, be carefull."
     alias adm2 "adm10; admin_tsay Do not TK or you will be kick or banned from this server!"
     alias adm3 "adm10; admin_csay UnforgiveN OwNs YouR SoRrY AsSeS!"
     alias adm4 "adm10; admin_csay Do not Disrespect other people or be kick/ban!"
     alias adm5 "adm10; admin_csay He is AFK!"
     alias adm6 "adm10; admin_tsay Clan UnforgiveN website http://"
     alias adm7 "adm10; admin_tsay Server Stats website http://"
     alias adm8 "adm10; admin_csay To Contact Admin email blah@
     alias adm9 "adm10; admin_tsay Server IP: "

     alias me1 "echo 1 - Friendly Fire warning."
     alias me2 "echo 2 - Do not TK."
     alias me3 "echo 3 - UnforgiveN OwNs...."
     alias me4 "echo 4 - No Trash Talking"
     alias me5 "echo 5 - He's AFK."
     alias me6 "echo 6 - Clan Website."
     alias me7 "echo 7 - Stats Website."
     alias me8 "echo 8 - Admin Email."
     alias me9 "echo 9 - Server IP"

     alias submenu "me1;me2;me3;me4;me5;me6;me7;me8;me9;ade10"

     clear
     dev1
     submenu
     dev0
搜索更多相关主题的帖子: 脚本 Section 命令 Script Menu 
2008-02-17 19:17
joypc
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2007-1-30
收藏
得分:0 
很好很强大,现在看不懂。先收藏,留着以后能看懂的在看[bc10]
2008-02-18 05:42
快速回复:CS命令及脚本代码汇总
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020414 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved