Libraries

Sign in to follow this  

42 files

  1. NativeUI

    NativeUI for RageMP!
    This can only be used Clientside!
    Documentation: Click
    Github: Click

    7797 downloads

       (13 reviews)

    16 comments

    Updated

  2. NativeUI Improved

    Improvements over the previous nativeui:
    Added `UIMenuDynamicListItem`. Descriptions are no longer cut off at 99 characters, but now support 99 * 3. `UIMenuListItem` and `UIMenuSliderItem` can now store extra data. Improved description line wrapping. Description caption is now only updated when necessary. Description background is now only updated (recalculated) when necessary. Bettered the position of the left arrow for list items. Added new badges (Sale, Arrows and Voice Icons). Added `Menu.RemoveItem(item: UIMenuItem)`. When binding an item to a menu, automatically add that item if it isn't in the menu items list already. Added `MenuOpen` event when `menu.Visible` is changed. When hovering over the currently selected ListItem's title text, the cursor will be MiddleFinger, just like in the original menus. `GoLeft` and `GoRight` now correctly handles disabled items. Added experimental automated menu pool system (It's a bit effy right now). MENUS ARE NO LONGER SHOWN BY DEFAULT. Added `closeChildren: boolean = false` parameter to `menu.Close()`. An optional parameter specifiing whether or not you want to close all children with the menu. NOTE BRIEFLY:
    The description and optimization updates for me saved over 20-30 FPS while a menu is open. You might want to be careful with menu pools right now. I haven't went deep into it but for simple menu pools it works GREAT. `MenuClose` event is NOT emitted when Visible is set to false. This is to allow users to reopen menus at it's same state, for e.g searching through a store. The GitHub will not match the file here. So please download the file from GitHub (dist/index.ts) or compile it yourself.  
    https://github.com/karscopsandrobbers/RAGEMP-NativeUI

    217 downloads

       (5 reviews)

    3 comments

    Updated

  3. UI | Only HTML / CSS Design

    This is a UI for food, drink, money... its only a design. maked with html and css,
    you must script it on your server.
     
    If your Server has more than 100 registered players, than you must make a link with my rage.mp profile on your website.

    1173 downloads

       (0 reviews)

    2 comments

    Updated

  4. Inventory API

    This resource provides an inventory API to server developers.
    This resource will not save anything on its own, it just provides you the functions to make your own inventory system using CEF/NativeUI/commands.
     
    Installing
    Put the files you downloaded in their respective places Read the documentation and examples to set up some items etc. All done  
    Features
    Easy to use (hopefully!) Events Custom attributes for items (see examples)  
    Inventory API
    const invAPI = require("../inventory-api"); /** * Adds an item to the inventory system. * @param {string} key Item identifier, such as "item_medkit". * @param {string} name Item name, such as "Medkit". * @param {string} description Item description, such as "Gives you 10 health". * @param {function} [onUse] Optional - Function that gets called when the item is used. * @param {function} [nameFunc] Optional - Function that gets called when getItemName() is used. * @param {function} [descFunc] Optional - Function that gets called when getItemDescription() is used. * @return {object} The added item, will be null if there are any mistakes. * @fires itemDefined */ invAPI.addItem(key, name, description, onUse, nameFunc, descFunc); /** * Returns whether the specified key is a registered or not. * @param {string} key Item identifier, such as "item_medkit". * @return {Boolean} True if registered, false otherwise. */ invAPI.hasItem(key); /** * Returns the specified item. * @param {string} key Item identifier, such as "item_medkit". * @return {object} The item at the specified key, will be undefined if the key isn't registered. */ invAPI.getItem(key); /** * Returns all registered item identifiers. * @return {string[]} An array of registered item identifiers. */ invAPI.getAllItems(); /** * Returns the human readable name of the specified item. * @param {string} key Item identifier, such as "item_medkit". * @param {string} [data] Optional - An object that has item attributes. * @return {string} Human readable item name. */ invAPI.getItemName(key, data); /** * Returns the description of the specified item. * @param {string} key Item identifier, such as "item_medkit". * @param {string} [data] Optional - An object that has item attributes. * @return {string} Item's description. */ invAPI.getItemDescription(key, data);  
    Inventory API Events
    /** * itemDefined * This event is called when an item is added to the system with invAPI.addItem() * @param {string} key Item identifier. * @param {string} name Human readable name of the item. * @param {string} description Description of the item. */ invAPI.on("itemDefined", (key, name, description) => { // Example: console.log(`Item defined, key: ${key} | name: ${name} | description: ${description}`); }); /** * itemAdded * This event is called when a player receives an item. * @param {player} player The player who received the item. * @param {string} key Item identifier. * @param {number} amount Amount the player received. * @param {object} data Item attributes. */ invAPI.on("itemAdded", (player, key, amount, data) => { // Example: console.log(`${player.name} received ${amount}x ${key}.`); }); /** * itemUsed * This event is called when a player uses an item. * @param {player} player The player who used the item. * @param {number} invIdx Index of the item in player's inventory. * @param {string} key Item identifier. * @param {object} data Item attributes. */ invAPI.on("itemUsed", (player, invIdx, key, data) => { // Example: console.log(`${player.name} used ${key}.`); }); /** * itemRemoved * This event is called when an item is removed from a player's inventory. * @param {player} player The player who lost an item. * @param {number} invIdx Index of the item that got removed in player's inventory. * @param {string} key Item identifier. * @param {number} amount Removed item amount. * @param {object} data Item attributes. */ invAPI.on("itemRemoved", (player, invIdx, key, amount, data) => { // Example: console.log(`${player.name} lost ${amount}x ${key}.`); }); /** * itemRemovedCompletely * This event is called when an item is no longer in a player's inventory. * @param {player} player The player who lost an item. * @param {string} key Item identifier. * @param {object} data Item attributes. */ invAPI.on("itemRemovedCompletely", (player, key, data) => { // Example: console.log(`${player.name} no longer has ${key} (${data ? "with data" : "without data"}) in their inventory.`); }); /** * inventoryReplaced * This event is called when a player's inventory array gets changed by player.setInventory() * @param {player} player The player who had an inventory change. * @param {object[]} oldInventory The player's old inventory array. * @param {object[]} newInventory The player's new inventory array. */ invAPI.on("inventoryReplaced", (player, oldInventory, newInventory) => { // Example: console.log(`${player.name} had their inventory replaced. (Old item count: ${oldInventory.length}, new: ${newInventory.length})`); });  
    Player API
    /** * Returns the inventory array of the player. * @return {object[]} An array that holds all items of the player. */ player.getInventory(); /** * Replaces the inventory array of the player with the specified one. * @param {Array} newInventory An array that's going to be the new inventory of the player. * @return {Boolean} True if successful, false otherwise. * @fires inventoryReplaced */ player.setInventory(newInventory); /** * Returns whether the player has the specified item or not. * @param {string} itemKey Item identifier. * @return {Boolean} True if player has the item, false otherwise. */ player.hasItem(itemKey); /** * Same as hasItem but for items with custom attributes. * @param {string} itemKey Item identifier. * @param {object} data An object that has item attributes. * @return {Boolean} True if player has the item, false otherwise. */ player.hasItemWithData(itemKey, data); /** * Gets the item's index in the player's inventory. * @param {string} itemKey Item identifier. * @return {number} Index of the item, -1 if not found. */ player.getItemIndex(itemKey); /** * Same as getItemIndex but for items with custom attributes. * @param {string} itemKey Item identifier. * @param {object} data An object that has item attributes. * @return {number} Index of the item, -1 if not found. */ player.getItemIndexWithData(itemKey, data); /** * Gets how many of the specified item exists in the player's inventory. * @param {string} itemKey Item identifier. * @return {number} Item amount. */ player.getItemAmount(itemKey); /** * Same as getItemAmount but for items with custom attributes. * @param {string} itemKey Item identifier. * @param {object} data An object that has item attributes. * @return {number} Item amount. */ player.getItemAmountWithData(itemKey, data); /** * Gets total amount of items the player has in their inventory. * @return {number} Amount of all items. */ player.getTotalItemAmount(); /** * Gives the specified item to the player. * @param {string} itemKey Item identifier. * @param {number} amount Amount to give. * @param {object} [data] Optional - An object that has item attributes. * @return {Boolean} True if successful, false otherwise. * @fires itemAdded */ player.giveItem(itemKey, amount, data); /** * Uses the item at the specified index of the player's inventory array. * @param {number} itemIdx Index of the item in player's inventory array. * @return {Boolean} True if successful, false otherwise. * @fires itemUsed */ player.useItem(itemIdx); /** * Removes the item at the specified index of the player's inventory array. * @param {number} itemIdx Index of the item in player's inventory array. * @param {number} [amount] Optional - Amount to remove. * @return {Boolean} True if successful, false otherwise. * @fires itemRemoved * @fires itemRemovedCompletely */ player.removeItem(itemIdx, amount);  
    Examples
    Full Test Script (used during development): https://gist.github.com/root-cause/6f15f0ee2276872c2d15a5333fed6a10
    Name/Description Function Test Script: https://gist.github.com/root-cause/500b6e197348e941aeebfa8f883486bb
    Source code is available on GitHub in case you don't want to download: https://github.com/root-cause/ragemp-inventory-api

    907 downloads

       (10 reviews)

    2 comments

    Updated

  5. Custom Sound CEF

    Simple CEF to play custom mp3's in the background. The CEF autodestroys after the sound has finished to not use our beloved PC resources.
     
    Copy client_packages and packages content in their respective directory, then import them.
    You can put your mp3's inside client_packages/Sound/sounds/ and trigger them with their filename. Only mp3 is supported right now, although ogg works as well, it's easily exchangeable and/or extensible to allow for both.
    As of right now, you can play a sound with the "/playsound NAME" command. You can use this as you want, this is only a barebones example to show how it works.
    I have not experimented when it comes to max sound length / filesize. I'd like to know though

    214 downloads

       (1 review)

    2 comments

    Submitted

  6. [DISCONTINUED] Ajcom

    This library is discontinued and lacks some features. I'm working on a new remote call library which is faster and more secure
    Asynchronous Javascript Communication is a module to allow easy communication between server, client and CEF/browser. This module lets you call server handlers from clients (and vice versa) without dealing with adding and managing custom event handlers.
    You can easily call a handler and get your callback called as soon as everything is returned from the handler in a promise like way! Let's see how it works in action:
    // server side const ajcom = require("./ajcom") ajcom.register("getServerName", hCtx => { return mp.config.name }) // client side const ajcom = require("./[package name]/ajcom.js") mp.events.add("guiReady", () => { ajcom.callServer("getServerName").then((ctx, serverName) => { mp.gui.chat.push(`Welcome to ${serverName} ragemp server!`) }) }) That's all! Not convinced yet? See how the above code is done without ajcom:
    // server side mp.events.add("getServerName", (player) => { player.call("gotServerName", [mp.config.name]) }) // client side mp.events.add("gotServerName", (serverName) => { mp.gui.chat.push(`Welcome to ${serverName} ragemp server!`) }) mp.events.add("guiReady", () => { mp.events.callRemote("getServerName") }) See? It eases the event handling mess. But there's a lot more to ajcom. You can easily handle errors happening on handler's side or any of the callbacks, set delays and other stuff. The full documentation is available here
    Please post your questions and issues to the forum post
    Github repo

    72 downloads

       (2 reviews)

    1 comment

    Updated

  7. Login Window | Design

    Login Window Design 

    414 downloads

       (0 reviews)

    1 comment

    Updated

  8. Native Menu

    Here is an open-source native menu implementation for Rage-MP. (the documentation is not ready)
    https://github.com/BlueDadjun/Native-Menu-RageMP

    529 downloads

       (2 reviews)

    1 comment

    Updated

  9. Synced Time Progression

    I posted this in the forum, but it is probably better suited here.
     
    This is a very simple script that gives the same time progression experience as single player mode. The source for the time is current GMT time and the calculation rolls this time into an in-game day 24 hour period that lasts 48 minutes (IRL time). Note that as the calculations are based off GMT (and not local time) all clients using this will have the same in game time (dependent on whether their computer's time and timezone is set up correctly).
     
    To use it, simply copy the file somewhere and "require" it in your client_resources script.
     
    There's nothing to configure.
     
    Known Bugs:
    Because the date is not recalculated, it continues to reflect the current real world date regardless of how many in game 24 hour periods there are within the game.

    332 downloads

       (1 review)

    1 comment

    Updated

  10. Efficient Attachment Sync

    Most of the server developers (ones that don't patiently wait for *something large*, though this resource is powerful enough) use their own server-side object attachments implementation that represents some large JSON with all the object and attachment information. This resource lets you cache "static attachments" in the client-side code so thanks to efficient utilization of the shared data it just uses a small shared variable to do the attachment processing without any need to create server-side objects nor send its data.
     
    For example, if you want to attach a specific object to specific ped bone with spefic bone offset and object rotation, this will only use a ~4-8 byte shared variable keeping it accurate. User-made implementations I have seen before usually take ~100 bytes per an object.
     
    API: Client-side
    mp.attachmentMngr.register(attachmentId, model, bone, offset, rotation) mp.attachmentMngr.addLocal(attachmentId) (synced!) mp.attachmentMngr.removeLocal(attachmentId) (synced!)  
    API: Server-side
    player.addAttachment(attachmentId, remove) player.hasAttachment(attachmentId)  
    Example Resource
    There's an example resource in /client-packages/epic-attachments folder. It lets you toggle attachments (there are like 30 attachments) using a NativeUI-based menu. Thanks to root for his contributions made to the example resource.
     
     
     

    1272 downloads

       (10 reviews)

    1 comment

    Updated

  11. Weapon Tint Sync

    This resource provides serverside weapon tint API for developers and syncs applied weapon tints.
     
    Installing
    Put the files you downloaded in their respective places Add require('weapontints') to client_packages/index.js All done  
    Serverside API
    PRO TIP: Check RAGEMP Wiki for tints.
    /** * Sets the tint of the player's specified weapon. * @param {Number} weaponHash The weapon hash. * @param {Number} tintIndex The tint index. * @throws {TypeError} If any of the arguments is not a number. */ player.setWeaponTint(weaponHash, tintIndex); /** * Gets the tint of the player's specified weapon. * @param {Number} weaponHash The weapon hash. * @returns {Number} Tint of the specified weapon. * @throws {TypeError} If weaponHash argument is not a number. */ player.getWeaponTint(weaponHash); /** * Returns an object that contains all weapon tints of the player. Key: weapon hash | Value: tint index * @returns {Object} */ player.getAllWeaponTints(); /** * Resets tints of the player's all weapons. */ player.resetAllWeaponTints();  
    Example Commands
    These are the commands I used while testing this script.
    // Example: /settint carbinerifle 3 mp.events.addCommand("settint", (player, _, weapon, tint) => { weapon = mp.joaat(`weapon_${weapon}`); tint = Number(tint); player.setWeaponTint(weapon, tint); }); // Example: /gettint carbinerifle mp.events.addCommand("gettint", (player, _, weapon) => { const weaponHash = mp.joaat(`weapon_${weapon}`); player.outputChatBox(`Tint of ${weapon}: ${player.getWeaponTint(weaponHash)}`); }); mp.events.addCommand("resettints", (player) => { player.resetAllWeaponTints(); });  
    Notes
    If there are any reproducible bugs, feel free to report them. This resource will be obsolete after 0.4's weapon attachment/customization API arrives.

    359 downloads

       (3 reviews)

    1 comment

    Submitted

  12. Zone API

    This resource adds 3 functions to the serverside mp.world object that provides zone name and type information.
     
    Serverside API
    /** * Returns the name of the area/zone at specified coords, ignores heights. * @param {object} coords An object with "x" and "y" properties. * @return {string} Zone name. */ mp.world.getNameOfZone2D(coords); /** * Returns the name of the area/zone at specified coords. * @param {object} coords An object with "x", "y" and "z" properties, such as mp.Vector3. * @return {string} Zone name. */ mp.world.getNameOfZone3D(coords); /** * Returns the type of the area/zone at specified coords. * @param {object} coords An object with "x" and "y" properties. * @return {string} Zone type, either "city" or "countryside". */ mp.world.getTypeOfZone(coords);  
    Example
    const coords = new mp.Vector3(1823.961, 4708.14, 42.4991); // Grapeseed Bunker console.log(`Name 2D: ${mp.world.getNameOfZone2D(coords)}`); // Expected output: Grapeseed console.log(`Name 3D: ${mp.world.getNameOfZone3D(coords)}`); // Expected output: Grapeseed console.log(`Zone Type: ${mp.world.getTypeOfZone(coords)}`); // Expected output: countryside  
    Notes
    Available on GitHub: https://github.com/root-cause/ragemp-zone-api N.O.O.S.E area returns Tataviam Mountains instead. There might be other areas with inaccuracies, feel free to share a fix in comments/send a pull request.

    42 downloads

       (3 reviews)

    0 comments

    Updated

  13. Login Window | Only HTML / CSS Design

    This is a Login window, its only a design. maked with html and css,
    you must script it on your server.
     
    If your Server has more than 100 registered players, than you must make a link with my rage.mp profile on your website.

    425 downloads

       (3 reviews)

    0 comments

    Updated

  14. camerasManager

    This is a tool for using cameras.
    ONLY CLIENTSIDE;
    Using: 
    const camerasManager = require('./camerasManager.js'); //creating camera /** @param {String} - camera name @param {String} - type camera @param {Vector3} - position @param {Vector3} - rotation @param {Number} - fov */ const kemperrr_camera = camerasManager.createCamera('kemperrr_the_best?', 'default', new mp.Vector3(0, 0, 100), new mp.Vector3(), 50); //destroy camera /** @param {Camera} - destroyed camera */ camerasManager.destroyCamera(kemperrr_camera); //get camera by name /** @param {String} camera name */ const kemperrr_camera = camerasManager.getCamera('kemperrr_the_best?'); //activate camera /** @param {Camera} - camera to activate @param {Boolean} - toggle */ camerasManager.setActiveCamera(kemperrr_camera, true); //deactivate camera /** @param {Camera} - camera to activate @param {Boolean} - toggle */ camerasManager.setActiveCamera(kemperrr_camera, false); //activate with interpolation /** @param {Camera} - camera to activate @param {Vector3} - where the camera will fly @param {Vector3} - New camera rotation @param {Number} - The time for which the camera will fly by @param {Number} - hz @param {Number} - hz */ camerasManager.setActiveCameraWithInterp(kemperrr_camera, new mp.Vector3(100, 200, 100), new mp.Vector3(0, 0, 90), 5000, 0, 0); //get gameplay camera const gameplayCamera = camerasManager.gameplayCam; mp.game.notify(JSON.stringify(gameplayCamera.getDirection())); //get current active camera const activeCamera = camerasManager.activeCamera; mp.game.notify(JSON.stringify(activeCamera.getCoord())); //events //an event is triggered when any camera starts interpolating camerasManager.on('startInterp', (camera) => { mp.game.notify(JSON.stringify(camera.getCoord())); }); //the event is triggered when any camera has completed interpolation camerasManager.on('stopInterp', (camera) => { mp.game.notify(JSON.stringify(camera.getCoord())); });

    283 downloads

       (1 review)

    0 comments

    Updated

  15. mp.game.data

    Requires RAGE Multiplayer 1.1.0 and above.
    This resource adds wrappers for these natives:
    _GET_TATTOO_COLLECTION_DATA GET_SHOP_PED_COMPONENT GET_SHOP_PED_PROP GET_DLC_WEAPON_DATA GET_DLC_WEAPON_COMPONENT_DATA GET_PED_HEAD_BLEND_DATA GET_WEAPON_HUD_STATS GET_WEAPON_COMPONENT_HUD_STATS Before 1.1.0, you couldn't use these natives because they needed pointers to their respective structures but since 1.1 allows developers to use ArrayBuffers, that is no longer a problem. Thing is, you still need to create a buffer, invoke the native and read the data from your buffer. (too much work)
    This resource is made to prevent that.
     
    Installing
    Put gamedata into your server's client_packages directory, then add require('gamedata'); to client_packages/index.js.
     
    Clientside API
    This resource extends "mp.game" by adding a "data" object that contains multiple functions.
    /* Returns information about a decoration/tattoo. characterType: * 0 = Michael * 1 = Franklin * 2 = Trevor * 3 = MPMale * 4 = MPFemale decorationIndex: * Decoration/tattoo index between 0 and _GET_NUM_DECORATIONS(characterType). Returned object: * { lockHash, id, collection, preset, cost, eFacing, updateGroup, textLabel } This native was researched & documented by TomGrobbe. (https://github.com/TomGrobbe) */ mp.game.data.getTattooCollectionData(characterType, decorationIndex); /* Returns information about a clothing item. componentHash: * Obtained by GET_HASH_NAME_FOR_COMPONENT. Returned object: * { lockHash, uniqueNameHash, locate, drawableIndex, textureIndex, unk1, eCompType, unk2, unk3, textLabel } */ mp.game.data.getShopPedComponent(componentHash); /* Returns information about a clothing item. (prop) propHash: * Obtained by GET_HASH_NAME_FOR_PROP. Returned object: * { lockHash, uniqueNameHash, locate, propIndex, textureIndex, unk1, eAnchorPoint, unk2, unk3, textLabel } */ mp.game.data.getShopPedProp(propHash); /* Returns information about a ped's headblend data. entityOrHandle: * Entity (mp.players.local) or handle (mp.players.local.handle) of the ped you want to get headblend data of. Returned object: * { shapeFirstId, shapeSecondId, shapeThirdId, skinFirstId, skinSecondId, skinThirdId, shapeMix, skinMix, thirdMix, isParent } */ mp.game.data.getPedHeadBlendData(entityOrHandle); /* Returns information about a weapon's HUD stats. weaponHash: * Hash of the weapon you want to get HUD stats of. Returned object: * { hudDamage, hudSpeed, hudCapacity, hudAccuracy, hudRange } */ mp.game.data.getWeaponHudStats(weaponHash); /* Returns information about a weapon component's HUD stats. componentHash: * Hash of the weapon component you want to get HUD stats of. Returned object: * { hudDamage, hudSpeed, hudCapacity, hudAccuracy, hudRange } */ mp.game.data.getWeaponComponentHudStats(componentHash); /* Returns information about a DLC weapon. dlcWeaponIndex: * DLC weapon index between 0 - GET_NUM_DLC_WEAPONS(). Returned object: * { lockHash, weaponHash, weaponHash2, cost, ammoCost, ammoType, defaultClipSize, textLabel, weaponDesc, weaponTT, weaponUppercase } */ mp.game.data.getDlcWeaponData(dlcWeaponIndex); /* Returns information about a DLC weapon's component. dlcWeaponIndex: * DLC weapon index between 0 - GET_NUM_DLC_WEAPONS(). dlcWeaponComponentIndex: * DLC weapon component index between 0 - GET_NUM_DLC_WEAPON_COMPONENTS(dlcWeaponIndex). Returned object: * { attachBone, isDefault, lockHash, componentHash, unk, cost, textLabel, componentDesc } */ mp.game.data.getDlcWeaponComponentData(dlcWeaponIndex, dlcWeaponComponentIndex);  
    Example Script
    Writes bunch of information to the console. (which you can access by pressing F11)
    mp.keys.bind(0x75, false, () => { // First freemode male tattoo const tattooData = mp.game.data.getTattooCollectionData(3, 0); if (tattooData) { mp.console.logInfo(`Tattoo data: ${JSON.stringify(tattooData)}`); } // Players top const component = 11; const componentHash = mp.game.invoke("0x0368B3A838070348", mp.players.local.handle, component, mp.players.local.getDrawableVariation(component), mp.players.local.getTextureVariation(component)); const topData = mp.game.data.getShopPedComponent(componentHash); if (topData) { mp.console.logInfo(`Top data: ${JSON.stringify(topData)}`); } // Players hat const prop = 0; const propHash = mp.game.invoke("0x5D6160275CAEC8DD", mp.players.local.handle, prop, mp.players.local.getPropIndex(prop), mp.players.local.getPropTextureIndex(prop)); const hatData = mp.game.data.getShopPedProp(propHash); if (hatData) { mp.console.logInfo(`Hat data: ${JSON.stringify(hatData)}`); } // Headblend mp.players.local.setHeadBlendData(21, 2, 0, 21, 2, 0, 0.75, 0.5, 0.0, false); const blendData = mp.game.data.getPedHeadBlendData(mp.players.local.handle); if (blendData) { mp.console.logInfo(`Headblend data: ${JSON.stringify(blendData)}`); } // Current weapon HUD stats const weaponData = mp.game.data.getWeaponHudStats(mp.players.local.weapon); if (weaponData) { mp.console.logInfo(`Current weapon HUD stats: ${JSON.stringify(weaponData)}`); } // COMPONENT_AT_MUZZLE_04 HUD stats const componentData = mp.game.data.getWeaponComponentHudStats(mp.game.joaat("COMPONENT_AT_MUZZLE_04")); if (componentData) { mp.console.logInfo(`Component HUD stats: ${JSON.stringify(componentData)}`); } // DLC weapon data const dlcWeaponIndex = 7; const dlcWeaponData = mp.game.data.getDlcWeaponData(dlcWeaponIndex); if (dlcWeaponData) { mp.console.logInfo(`DLC weapon data: ${JSON.stringify(dlcWeaponData)}`); // First component of weapon const dlcWeaponCompData = mp.game.data.getDlcWeaponComponentData(dlcWeaponIndex, 0); if (dlcWeaponCompData) { mp.console.logInfo(`DLC weapon first component data: ${JSON.stringify(dlcWeaponCompData)}`); } } });  
    Notes
    If mp.game.invoke fails (trying to get non-DLC item data/invalid params etc.), return value of the function will be null. Most non-DLC items (core GTAV weapons like Pistol, Assault Rifle etc, initial freemode tattoos, initial freemode clothes) are not supported by the natives. Strings returned by the functions (textLabel, componentDesc etc.) are GXT entries. You're supposed to use them with getLabelText.

    43 downloads

       (2 reviews)

    0 comments

    Submitted

  16. Better Clientside Commands

    This resource extends clientside mp.events object to make clientside command handling easier, which means no more splitting strings to use with if/else if or switch/case in playerCommand event
     
    Installing
    Put mp-commands into your server's client_packages directory, then add require('mp-commands'); to client_packages/index.js.
     
    Clientside API
    /** * Adds a clientside command. * @param {string} name Name of the command. * @param {function} handlerFn Function that will run when the command is used. * @throws {TypeError} name argument must be a string. * @throws {TypeError} handlerFn argument must be a function. * @throws {Error} Command with the given name already exists. */ mp.events.addCommand(name, handlerFn); /** * Returns clientside command names. * @return {string[]} */ mp.events.getCommandNames(); /** * Removes a clientside command. * @param {string} name Name of the command to remove. * @return {boolean} */ mp.events.removeCommand(name); /** * Removes all clientside commands. */ mp.events.removeAllCommands(); /** * (v2.0.0) Adds a console command. * @param {string} name Name of the console command. * @param {function} handlerFn Function that will run when the console command is used. * @throws {TypeError} name argument must be a string. * @throws {TypeError} handlerFn argument must be a function. * @throws {Error} Console command with the given name already exists. */ mp.console.addCommand(name, handlerFn); /** * (v2.0.0) Returns console command names. * @return {string[]} */ mp.console.getCommandNames(); /** * (v2.0.0) Removes a console command. * @param {string} name Name of the console command to remove. * @return {boolean} */ mp.console.removeCommand(name); /** * (v2.0.0) Removes all console commands. */ mp.console.removeAllCommands();  
    Example
    /* Looks like it's serverside code but it's not, updates GTA V's cash display. Usage: /updmoney [amount] */ mp.events.addCommand("updmoney", function (amount) { amount = Number(amount); if (!Number.isInteger(amount)) { mp.gui.chat.push("Invalid amount."); return; } mp.game.stats.statSetInt(mp.game.joaat("SP0_TOTAL_CASH"), amount, false); }); mp.events.addCommand("cmds", function () { mp.gui.chat.push(`Commands: ${mp.events.getCommandNames().join(", ")}`); });  
    Example (Console)
    NOTE: Console is a RAGE Multiplayer 1.1 feature, which means code below won't work on stable/prerelease/0.3.7 branch.
    // Write "hat 123 0" to the console and press enter to give yourself a cool helmet. mp.console.addCommand("hat", function (drawable, texture = 0) { drawable = Number(drawable); texture = Number(texture); if (!Number.isInteger(drawable) || !Number.isInteger(texture)) { mp.console.logError("Invalid drawable/texture."); return; } if (drawable < 0) { mp.players.local.clearProp(0); } else { mp.players.local.setPropIndex(0, drawable, texture, true); } }); // Write "cmds" to the console to see available console commands. mp.console.addCommand("cmds", function() { mp.console.logInfo(`Console commands: ${mp.console.getCommandNames().join(", ")}`); });  
    Notes
    I recommend loading mp-commands as the first script in client_packages/index.js so the functions become available in other scripts. Command names are case sensitive.

    26 downloads

       (4 reviews)

    0 comments

    Updated

  17. ZoneManager

    RageMP-ZoneManager
    A very useful client-side system which let you create four squares or hexagons in any shape like colshapes which support Z axis
    GIT REPO
    Why i needed something like this
    I was creating a traffic system which needed me to be able to check if a guy entered any crossroads and colshapes wasn't the thing i wanted + i wanted to sell farms by their shape and some of them wasn't shaped exaclty foursquare and i needed a little more, so i craeted this script to be able to make those things possible easily.
    Features
    You can create 4 types of zone which are defined az mp.zones.types in the script. You can loop through your zones and remove them. You can register zones by desired name. You may delete any zone any time. Server-side events also included. It supports Z axis which is still not very clever since it's not a big deal, all i needed was to prevent people to trigger some events from above the ground Have 4 testing functions which let you draw your zone on the map to see how it fits You can now register zones by any vector pointes above 2 Functions (Client-Side)
    /* Check if a zone is registered by it's name and it's dimension */ mp.zones.isZoneRegistered(zoneName, dimension) /* Unregister a zone by it's name and dimension */ mp.zones.unRegisterZone(zoneName, dimension) /* Register a zone by a list of vectors, height , zoneName, type, dimension Vectors: an arrayList of vectors depending on the type of the zone you are choosing to create for example if you are creating a 2PointZone all you need is 2 Vectors inside an array which are the starting point and the ending point and you have to pass height as -1 since it's not used in that type of zone if you are creating a 4PointZone you need to have an arrayList of vectors with 4 Vectors inside and height is used this time, same as 4PointZone in 6PointZone you need to pass 6 vectors and the height. Returns ZoneObject (contains name, type, positions, and zone.data [which never used it my self]) */ mp.zones.registerZone(Vectors, height, zoneName, type, dimension) /* Get ZoneObject by it's name and dimension */ mp.zones.getZoneByName(zoneName, dimension) /* Draw a 2PointZone for testing Requires 2 vectors */ mp.zones.drawZoneBy2(startPosition, endPosition) /* Draw a 4PointZone for testing Requires 4 vectors and height */ mp.zones.drawZoneBy4(Vectors, height) /* Draw a 6PointZone for testing Requires 6 vectors and height */ mp.zones.drawZoneBy6(Vectors, height) /* Draw a NPointZone for testing Requires array of vectors and height Unlimited number of points supported by this code */ mp.zones.drawZoneByN(Vectors, height) /* Check whether a point on the map is inside the zone or not */ mp.zones.isPointInZone(point, zoneName, dimension) /* This is a list of registered zone names used for looping through zones */ mp.zones.registered Events (Server-Side/Client-Side)
    On client side the player parameter is mostly the local player it self.
    /* mp.events.add('ZoneManager_PlayerEnterZone', (player, zoneName) => { //Your Code }) mp.events.add('ZoneManager_PlayerExitZone', (player, zoneName) => { //Your Code }) */ Changelog
    4/1/2020 - v0.0.1 - Added support for dimension - Addes support for NPointZone type which let you create zones by any number of points - Changed some functions to support dimensions, if you already used the script you may need to change them - getZoneByName now returns undefined if the zone on the dimension does not exists (this thing existed before but i forgot to mention it before)

    34 downloads

       (4 reviews)

    0 comments

    Updated

  18. Custom chat

    This is a simple example of using a custom chat in RAGE MP.
    You can set time of hide chat from chat.js:
    hide_chat: 15000 // in milliseconds  

    1612 downloads

       (3 reviews)

    0 comments

    Updated

  19. Attachment Sync (C#)

    Source code : https://github.com/J4YT/RAGE-Multiplayer-Attachment-Sync

    C# Attachment sync for RAGE Multiplayer Server and Client. 
    Equivalent for the Efficient Attachment System made by ragempdev and rootcause
    https://rage.mp/files/file/144-efficient-attachment-sync
    Credits to DasNiels for the server-side Efficient Attachment Sync C#
    https://github.com/DasNiels/EfficientAttachmentSyncCSharp
    It has only been tested on RAGE Multiplayer 1.1
     

    26 downloads

       (3 reviews)

    0 comments

    Updated

  20. Popup Window | Only HTML / CSS Design

    This is a Popup Window, its only a design. maked with html and css,
    you must script it on your server.
     
    If your Server has more than 100 registered players, than you must make a link with my rage.mp profile on your website.

    105 downloads

       (0 reviews)

    0 comments

    Updated

  21. Simple ATM | Only HTML / CSS Design

    This is a ATM Menu, its only a design. maked with html and css,
    you must script it on your server.
     
    If your Server has more than 100 registered players, than you must make a link with my rage.mp profile on your website.

    388 downloads

       (3 reviews)

    0 comments

    Updated

  22. Death Screen with Loading | Only HTML / CSS Design

    This is a Death-Screen Loading-Screen, its only a design. maked with html and css,
    you must script it on your server.
     
    If your Server has more than 100 registered players, than you must make a link with my rage.mp profile on your website.

    542 downloads

       (2 reviews)

    0 comments

    Updated

  23. Playerinteraction Menu | Only HTML / CSS Design

    This is a Playerinteraction Menu its only a design. maked with html and css,
    you must script it on your server.
     
    If your Server has more than 100 registered players, than you must make a link with my rage.mp profile on your website.

    910 downloads

       (2 reviews)

    0 comments

    Updated

  24. Inventory | Only HTML / CSS Design

    This is a Inventory, its only a design. maked with html and css,
    you must script it on your server.
     
    If your Server has more than 100 registered players, than you must make a link with my rage.mp profile on your website.

    488 downloads

       (0 reviews)

    0 comments

    Updated

  25. Speedometer | Only HTML / CSS Design

    This is a Speedometer, its only a design. maked with html and css,
    you must script it on your server.
     
    If your Server has more than 100 registered players, than you must make a link with my rage.mp profile on your website.

    456 downloads

       (2 reviews)

    0 comments

    Updated

Sign in to follow this