Author Topic: Adding a script to a file  (Read 528 times)

I have a simple script that works by typing it into the console.  Now, I would like to add that same script into a file and be loaded by the game.  How do I go about doing this?

Your Add-On must be placed inside a folder that is named with an underscore, following the convention. ("Weapon_Gun", "Weapon_Rocket_Launcher", "Vehicle_Jeep", "Script_MyFirstScript")

It then needs a description.txt file, formatted with Title: and Author: fields, as well as a short description. (Look at other Add-Ons)

If your script is a server-side script (e.g. /commands, messages, anything using or affecting gameplay objects, new weapons/items/vehicles), then put that part of your script in a file named server.cs. Open and edit these files with any plain text editor, such as Notepad. Server-side scripts are loaded when you start the server, if enabled in the Add-Ons menu.

If your script is a client-side script (e.g. GUIs), then put that part of your script in a file named client.cs. Open and edit these files with any plain text editor, such as Notepad. Client-side scripts are loaded when you start up the game for the first time. It won't execute on a dedicated server. If there is only a clientside portion to your file, it won't show up in the Add-Ons menu.

Thanks, that was very helpful.

That should be posted as a sticky. People are always asking for help then realise they're missing something in their folder.