Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/20/20 in all areas

  1. Version 1.0.0

    1020 downloads

    This script adds the colored xenon headlights feature from Arena War DLC. Installing Put coloredhlights into your server's client_packages directory, then add require('coloredhlights'); to client_packages/index.js. Using Set the headlightColor shared variable of a vehicle to the headlight color ID you want. Command example: // /hcolor 10 should make your vehicle's headlights pink mp.events.addCommand("hcolor", (player, _, colorId) => { if (player.vehicle) { player.vehicle.data.headlightColor = Number(colorId); } else { player.outputChatBox("You're not in a vehicle!"); } }); Headlight Colors Since Rockstar didn't make headlight colors RGB, you can only use a set of numbers as color IDs. 0 = White 1 = Blue 2 = Light Blue 3 = Green 4 = Light Green 5 = Light Yellow 6 = Yellow 7 = Orange 8 = Red 9 = Light Pink 10 = Pink 11 = Purple 12 = Light Purple Color IDs higher than 12 will force xenon headlights to use their default color. Notes Since this script toggles the xenon headlights mod (toggleMod 22), it may not work with your car customization script. Color IDs lower than 0 and color ID 255 will disable the feature (revert headlights back to normal from xenon) until you set a valid color again.
    1 point
  2. Disclaimer: If you dont know where to start, please go to: So, you got NodeJS and Visual Studio Code running? Good, let's start coding! Step 1: Files RESOURENAME is a placeholder. Name id how you want your Resource should be called, like Roleplay-Gamemode. Open Visual Studio Code in the C:/RAGEMP/server-files/packages folder. Then, create a folder named RESOURENAME (Change that). In that folder, we create a file called index.js. At that point, Visual Studio Code should look like this: Step 2: Making a base In RESOURENAME create a file called commands.js Now head to index.js and type in following: require("./commands.js"); With that statement, we tell our resource that it should load the file called commands.js. You can to that even for folders, like: require("./commands/vehicleCommand.js"); Step 3: Lets code! Javascript is a script language. That means, we don't need much constructers. Lets use that!: We want to make the simplest and most helpfull command: A /vehicle command! How we do that? Well, if you got into javascript, its not complicated. With the power of autocomplete, try to achieve following: mp.events.addCommand("vehicle", (player, vehicle) => { }); So, mp is a const. That means, its a variable that we cant change. events is a property of mp. And addCommand is a method. addCommand has the following usage: mp.events.addCommand(commandName, (player, args) => { }); commandName is self-explaining, player too. But whats args? args are our aguments. That means, we can add howmany we want. Our command above will be executed like this: /vehicle VEHICLEHASH //example: /vehicle Alpha So, got that? Lets move on! Now we want that a vehicle spawns if we use that command, todo so: mp.events.addCommand("vehicle", (player, vehicle) => { mp.vehicles.new(mp.joaat(vehicle), player.position); }); So, like before, mp is our const, vehicles is a property of mp. And new is a method. same for mp.joaat(). mp is our const, and joaat is a method that returns a number. player is a variable, and position a property. position is from type mp.Vector3. Vectors are positions in RAGEMP, and our function mp.vehicles.new has the following usage: mp.vehicles.new(model, position, options?); Whats options? ? If a variable has a ? behind, that means its optional. So you dont need to set that. Lets safe everything, and it should work! If you got questions, look at the Wiki! (https://wiki.rage.mp/index.php?title=Main_Page) Here are some usefull Wiki pages: https://wiki.rage.mp/index.php?title=Getting_Started_with_Commands https://wiki.rage.mp/index.php?title=Getting_Started_with_Client-side https://wiki.rage.mp/index.php?title=Getting_Started_with_Events Stay tuned for Part 3!
    1 point
×
×
  • Create New...