![]() The second argument is a function (represented by an arrow function in our example) that is the command handler, and the third argument is a boolean that specifies whether or not it should be a restricted command. We'll mainly care about the name on the second line ( RegisterCommand, as used in the JS code above), and the arguments.Īs you can see, the first argument is the command name. It looks a bit like this: // 0x5fa79b0f // RegisterCommand void REGISTER_COMMAND ( char * commandName, func handler, BOOL restricted) That means it must come from somewhere else!Īnd, guess what, it's actually REGISTER_COMMAND! Click that link, and you'll be led to the documentation for this native. Well, we (as in, the FiveM team) did, but not when guiding you, the reader, through this wondrously written marvel of a guide. Starting already, we see a call to a function. In it, put the following text using your favorite text editor: fx_version 'cerulean' game 'gta5' author 'An awesome dude' description 'An awesome, but short, description' version '1.0.0' resource_type 'gametype' adder but my owner was too lazy. Make a file called a (this is always Lua, even though you'll be writing a JS script) in your mymode folder. Since this is a game type, it'll need some extra information as well to teach mapmanager about the fact that this is a game type. Manifest filesĪ resource folder (you know, this mymode you made above) will need a manifest to be detected by FiveM. We'll call this folder mymode from now on. That means you'll need to have a folder like this by now, assuming a Windows development system: C:\your\path\to\cfx-server-data\resources\\mymode. In there, we'll make a resources//mymode folder, since we're making, well, a gametype using the mapmanager system. If you're working on your own resources, you'll probably want to make a resources/ directory - this one will be ignored by Git when updating the server-data root. Your server-data folder (assuming you already installed a server) should have a resources folder already, with a few resources in them already. ![]() ResourcesĪ resource is, simply said, a collection of files that can be individually started, stopped and restarted. However, you can use any code editor you'd like. ![]() ![]() We will be using Visual Studio Code, hereby VSCode, a popular code editor by Microsoft. Understanding of resources and manifest files.Prerequisitesīefore creating your first script with JavaScript, there are a couple of things you will need to set up and understand. In this quick and simple guide, we'll try to show you how to get started with a quick resource in JavaScript. Getting started with scripting for FiveM might be a tad overwhelming, given the wide range of possibilities and the sparsely spread documentation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |