Creating Your First Script - Abel-Gaming/FiveM-Script-Creator GitHub Wiki
-
You will want to begin my downloading the FiveM Script Creator if you have not already done so.
-
After downloading the script creator, open up the program.
-
After opening the program, in the top left, click File > New Project. If you get the following message, select "Yes"
For this script, we will be creating a script that shows your YouTube channel name when you do /youtube in chat
-
Place your cursor on line 14, below "Tick += OnTick", like in the image below
-
Next, at the top, click "Insert" then "Register Command". You will notice some code has been placed on the editor. You might also get a notification box like the following:
-
Press "OK" on the notification box
-
Directly below the closing main bracket, paste the code that has been copied to your clipboard (CONTROL + V). Your editor should now look like this
-
Clean up and format the code if you wish. This will help keep your work organized. Make sure all code is tabbed properly. [THIS STEP IS OPTIONAL]
-
Now, in the private static void CommandAction area, we are going to do the code that will happen when /youtube is entered in the chat.
-
We will begin by placing our cursor the line under "//COMMAND CODE GOES HERE" like so:
-
Now we will go back to the "Insert" section at the top, select "Screen", then select "Show Notification"
-
You will notice some code has been added to the editor. Replace "NOTIFICATION TEXT GOES HERE" with your YouTube name or link.
-
You are now ready to export your script. Do so by going to File > Compile Mod > Name your mod when the save dialog appears, but be sure to put .net after the name. Please note that the name cannot contain spaces.
-
Click save. You have created your mod. The code for the __resource.lua and the code for the project can be found in the code section of this Github in the folder, "Creating Your First Script"
Video Tutorial: https://www.youtube.com/watch?v=_w_p5c8f5Ok