Author Topic: slash commands  (Read 4811 times)

i need to know how to make it so when you type
 /help it shows a thing like
 rules n stuf
 ,/..,##@@
 &$$T$$$$
 #$$%$#%
%$#%$#%
   
except instead of  $@$@#$ it has words                                           

Make a file in your Add-Ons folder called, for instance, "script_rules.cs" Makes sure that it's extension is .cs

Open up the file with wordpad and copy + paste this:

Code: [Select]
function ServerCmdHelp(%client)
{

messageClient(%client,"","\c6RULES GO HERE");
messageClient(%client,"","\c6RULES GO HERE");
messageClient(%client,"","\c6RULES GO HERE");


}
For each line, have another messageClient. Replace 'RULES GO HERE' with the rules. KEEP THE QUOTATIONS.

To color your rules, put this below your rules function:

Code: [Select]
function ServerCmdColors(%client)
{
messageClient(%client,"","\c00 \c11 \c22 \c33 \c44 \c55 \c66 \c77 \c88 \c99");
}

Type /colors ingame to see the colors. To change the colors in the code, replace the '\c6' with the number of course. For instance, if you wanted the color of '1' change it to '\c1'

btw all commandtoserver are auto made into / commands by BL

Code: [Select]
function ServerCmdColors(%client)
{
messageClient(%client,"","\c00 \c11 \c22 \c33 \c44 \c55 \c66 \c77 \c88 \c99");
}

/colortest does nearly the same thing. (SAdmin only but for some reason messages all)

To change the name of your command change this area(in red)
function ServerCmdHelp(%client)
to whatever you want the /___ to be. so that is /help. If I changed it to
function servercmdPONY(%client)
it becomes /pony.

ok now how do i chang playertypes whith /commands like /$%$#$@
makes you playertype #@@@#

Code: [Select]
function serverCmdNoJets(%client){
%player = %client.player;
if(isObject(%player)){
%player.setDataBlock(PlayerNoJet);
%client.ApplyBodyParts();
%client.ApplyBodyColors();
}
}

1 moar thing can i put all theas in same file

You can have as many functions as you like in a file. If you release mods then it's best to have similar things in the same file - everything to do with the Gun script is contained in the Weapon_Gun.cs file not spread across the game. The only exception is Support_ files which contain many generic effects for several mods to use.

how do i update script whithout restarting bl

exec("add-ons/filename.cs");


ok iv a prob
my file is called script_rules.cs
it is in add-ons in ccwin in my documents

and i type exec("add-ons/script_rules.cs");
and it says  missing file: script_rules.cs!

You're typing the wrong filepath.