Jump to content

Libraries

59 files

  1. 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

    766 downloads

       (1 review)

    3 comments

    Submitted

  2. Colshape Handler

    Simple CommonJS singleton module to handle colshape entering and exiting.
    Copy the Colshapes folder inside packages inside your packages folder. See the Examples folder for an example.
    Simply create your colshape like this:
    const colshape = mp.colshapes.newSphere(34, 15, 69, 15, 0) colshape.name = 'example' and then pull in the colshapeHandler singleton to add it to the array the following:
    const colshapeHandler = require('../Colshapes/index').getInstance() colshapeHandler.addColshape('example') If a player enters the specified colshape, the colshape name will be pushed towards a colshapes array as a player property, like this. Definition of this is inside the "playerJoin" event in the Colshapes\index.js. The specified colshape name will then be removed from the array again if the player exits the colshape.
     
    player.colshapes = [];  

    83 downloads

       (0 reviews)

    0 comments

    Submitted

  3. rage-progressbar

    rage-progressbar

    Very simple Progress Bar to delay event execution.
     
    How to use:

    Put the "progress" folder inside "client_packages" into your "client_packages" folder (or wherever you have your client files).
    Import the "progress/index.js" in your main "index.js" like it is done in my main "index.js"
    You can then create a Progress Bar on the server-side with the following code:
    player.call('progress:start', [SECONDS, TASK, DIRECTION, EVENT, PARAMS]);
    SECONDS
    How many seconds is the Progress Bar running

    TASK
    String which is displayed inside the progress bar

    DIRECTION
    Is the event which is called after the bar has finished a server-side or client-side event

    EVENT
    The event to be called afterwards

    PARMS
    Additional params to send to the following event
     

    That's pretty much it. Customize it as you want, this is as basic as possible.
    "packages/Progress/index.js" contains an example with an example /progress command and a follow-up event.

    315 downloads

       (1 review)

    0 comments

    Updated

  4. RAGE MP + React

    To install all packages, use: yarn install or npm install.
    For running this example, use: yarn run start or npm start.
    For building project, use: yarn run build or npm run build.
     
    In client_packages is an example of how you can use compiled RAGE MP functions and React.
    Credits to Mispon(rage-mp-react-ui) for branch example.
     
    The principal difference between our examples is hot reload and more understandable example of code in my version.
    Repo: https://github.com/Corso-Project/RAGE-MP-React-Example

    388 downloads

       (0 reviews)

    0 comments

    Submitted

  5. [C# Server-Side] Events+Commands at Runtime

    Github page: https://github.com/robertnisipeanu/ragemp-server-events
     
    ragemp-server-events
    OOP Implementation of the RAGEMP server events (so you don't have to use [Command] or [ServerEvent] annotations). It allows you to add event handlers and commands at runtime.
    How to use
    Copy /client_packages/cs_packages/CustomCommands.cs to your server client resources (server-files/client_packages/cs_packages).
    From folder 'server' import Delegates.cs and Events.cs into your server-side project.
    Add using robearded; at the top of the files where you want to use my API.
    Use Events.*EventName* += EventHandler; to add an event handler and Events.AddCommand("*commandName*", CommandHandler); to add a command handler.
    Added events
    OnPlayerReady(Client client) -> This event is not available by default on the C# API If any other events will be custom implemented they will be added here ^
    Example
    You can find an example inside the 'example' folder.
    Need help?
    Please do not contact me if you didn't followed the above steps, I'm not gonna tell you again the steps in private when you have them here.
    If you need any other help, feel free to contact me on Discord at @rumble06#4127 or on RAGE.MP Forums at https://rage.mp/profile/45121-robearded/

    92 downloads

       (2 reviews)

    0 comments

    Updated

  6. Maze Bank UI with CSS

    A free Maze Bank UI. Have fun
     

    436 downloads

       (0 reviews)

    0 comments

    Submitted

  7. rage_utils

    A bunch of utility functions for rage (cross environment: server, client, browser) that are not easy to implement in JS specially for client and browser! Also you can use this package for projects other than rage.
    If you want a new feature in utilities that you think others might use too, submit an issue on github page
    Install instructions, features and documentation are all available on npm registery and github page
    I highly recommend visiting the linked pages and using npm/yarn for installing
     

    107 downloads

       (1 review)

    0 comments

    Updated

  8. Currency API

    This resource provides a currency API to server developers.
    This resource will not save anything on its own. I'd also recommend you to not have over 2 billion of any currency.
     
    Installing
    Put the files you downloaded in their respective places Check the documentation and examples All done  
    Currency API
    const currencyAPI = require("../currency-api");  
    /** * Adds a currency to the system. * @param {String} key Currency identifier. (such as vip_tokens) * @param {String} name Currency's human readable name. (such as VIP Tokens) * @param {Number} syncType Sharing type of the currency. (0 = not shared with clients, 1 = shared with everyone, 2 = shared with just the wallet owner) * @return {Object} The added currency object. * @fires currencyDefined */ currencyAPI.addCurrency(key, name, syncType); /** * Returns whether the specified key is a registered currency or not. * @param {String} key Currency identifier. * @return {Boolean} */ currencyAPI.hasCurrency(key); /** * Returns the specified currency's object. * @param {String} key Currency identifier. * @return {?Object} The currency object, will be undefined if the key isn't registered. */ currencyAPI.getCurrency(key); /** * Returns an iterator of all registered currency identifiers. * @return {Iterator.<String>} */ currencyAPI.getAllCurrencies(); /** * Returns the human readable name of the specified currency. * @param {String} key Currency identifier. * @return {String} Human readable name, will be "Invalid Currency" if the key isn't registered. */ currencyAPI.getCurrencyName(key); /** * Returns the sync type of the specified currency. * @param {String} key Currency identifier. * @return {Number} Sync type of the currency. (0 = not shared with clients, 1 = shared with everyone, 2 = shared with just the wallet owner) */ currencyAPI.getCurrencySyncType(key); /** * Returns the sync key of the specified currency. Sync key is used with player.setVariable() * @param {String} key Currency identifier. * @return {?String} Sync key of the currency, will be null if the key isn't registered. */ currencyAPI.getCurrencySyncKey(key);  
    Currency API Events
    /** * currencyDefined * This event is called when a currency is added to the system with currencyAPI.addCurrency * @param {String} key Currency identifier. * @param {String} name Human readable name of the currency. * @param {Number} syncType Sharing type of the currency. (0 = not shared with clients, 1 = shared with everyone, 2 = shared with just the wallet owner) * @param {String} syncKey If the currency is shared, this string will be used with player.setVariable() or player.setOwnVariable() to transfer data to clientside. */ currencyAPI.on("currencyDefined", (key, name, syncType, syncKey) => { // Your code here }); /** * walletReplaced * This event is called when a player's wallet object gets replaced by player.setWallet() * @param {Player} player The player who had a wallet change. * @param {Object} oldWallet Old wallet object of the player. * @param {Object} newWallet New wallet object of the player. */ currencyAPI.on("walletReplaced", (player, oldWallet, newWallet) => { // Your code here }); /** * currencyUpdated * This event is called when a player's wallet has a currency change. * @param {Player} player The player who had a currency change. * @param {String} currencyKey Currency identifier. * @param {Number} oldAmount The player's old amount of currency. * @param {Number} newAmount The player's new amount of currency. * @param {String} source Name of the function that triggered this update, will either be "setCurrency" or "changeCurrency". */ currencyAPI.on("currencyUpdated", (player, currencyKey, oldAmount, newAmount, source) => { // Your code here });  
    Player API
    /** * Returns the wallet object of the player. * @return {Object} */ player.getWallet(); /** * Replaces the wallet object of the player with the specified one. * @param {Object} newWallet * @return {Boolean} True if successful, false otherwise. * @fires walletReplaced */ player.setWallet(newWallet); /** * Returns the amount of specified currency the player has in their wallet. * @param {String} currencyKey Currency identifier. * @return {Number} */ player.getCurrency(currencyKey); /** * Sets the amount of specified currency the player has in their wallet. * @param {String} currencyKey Currency identifier. * @param {Number} newAmount New amount of specified currency. * @return {Boolean} True if successful, false otherwise. * @fires currencyUpdated */ player.setCurrency(currencyKey, newAmount); /** * Changes the amount of specified currency the player has in their wallet by specified amount. * @param {String} currencyKey Currency identifier. * @param {Number} amount * @return {Boolean} True if successful, false otherwise. */ player.changeCurrency(currencyKey, amount);  
    Examples
    Full Test Script, will update GTAV money hud if you give yourself "cash" currency. (Used during development)
    // SERVERSIDE CODE const currencyAPI = require("../currency-api"); const SYNC_TYPE_NONE = 0; const SYNC_TYPE_EVERYONE = 1; const SYNC_TYPE_PLAYER = 2; // Events currencyAPI.on("currencyDefined", (key, name, syncType, syncKey) => { const syncTypes = ["none", "everyone", "player"]; console.log(`Currency defined, key: ${key} | name: ${name} | syncType: ${syncTypes[syncType]} | syncKey: ${syncKey}`); }); currencyAPI.on("walletReplaced", (player, oldWallet, newWallet) => { console.log("=============================="); console.log(`${player.name} had their wallet replaced.`); console.log(`Old wallet currencies: ${Object.keys(oldWallet).join(",")}`); console.log(`New wallet currencies: ${Object.keys(newWallet).join(",")}`); console.log("=============================="); }); currencyAPI.on("currencyUpdated", (player, currencyKey, oldAmount, newAmount, source) => { const diff = newAmount - oldAmount; console.log(`${player.name} ${diff < 0 ? "lost" : "got"} ${Math.abs(diff)} ${currencyAPI.getCurrencyName(currencyKey)} (${currencyKey}). (caused by: ${source})`); }); // Register currencies currencyAPI.addCurrency("cash", "Money", SYNC_TYPE_PLAYER); // So that we can use currency_cash shared variable on clientside currencyAPI.addCurrency("vip_tokens", "VIP Currency", SYNC_TYPE_NONE); // Test commands const fs = require("fs"); const path = require("path"); // Do /savewallet to save your wallet to a JSON file. (file path will be printed to console) mp.events.addCommand("savewallet", (player) => { const saveDir = path.join(__dirname, "wallets"); if (!fs.existsSync(saveDir)) fs.mkdirSync(saveDir); const playerPath = path.join(saveDir, `${player.socialClub}.json`); fs.writeFileSync(playerPath, JSON.stringify(player.getWallet(), null, 2)); player.outputChatBox("Wallet saved."); console.log(`Player ${player.name} saved their wallet. (${playerPath})`); }); // Do /loadwallet to load your wallet from a JSON file. mp.events.addCommand("loadwallet", (player) => { const playerPath = path.join(__dirname, "wallets", `${player.socialClub}.json`); if (fs.existsSync(playerPath)) { player.setWallet(JSON.parse(fs.readFileSync(playerPath))); player.outputChatBox("Wallet loaded."); } else { player.outputChatBox("Wallet file not found."); } }); // Do /mytokens to see your VIP tokens currency amount. mp.events.addCommand("mytokens", (player) => { player.outputChatBox(`Your VIP tokens: ${player.getCurrency("vip_tokens")}`); }); // Do /wallet to list the currencies you have. mp.events.addCommand("wallet", (player) => { const wallet = player.getWallet(); player.outputChatBox("Your wallet:"); for (const [key, value] of Object.entries(wallet)) player.outputChatBox(`${currencyAPI.getCurrencyName(key)}: ${value}`); }); // Do /setcurrency [key] [amount] to set your currency amount. mp.events.addCommand("setcurrency", (player, _, currencyKey, amount) => { amount = Number(amount); if (player.setCurrency(currencyKey, amount)) { player.outputChatBox(`Set ${currencyAPI.getCurrencyName(currencyKey)} (${currencyKey}) to ${amount}.`); } else { player.outputChatBox("Failed to set currency."); } }); // Do /changecurrency [key] [amount] to change your currency amount by specified value. mp.events.addCommand("changecurrency", (player, _, currencyKey, amount) => { amount = Number(amount); if (player.changeCurrency(currencyKey, amount)) { player.outputChatBox(`${currencyAPI.getCurrencyName(currencyKey)} (${currencyKey}) changed by ${amount}.`); } else { player.outputChatBox("Failed to change currency."); } }); // Do /currencies to get all registered currency identifiers and their names. mp.events.addCommand("currencies", (player) => { for (const key of currencyAPI.getAllCurrencies()) { player.outputChatBox(`${key} - Name: ${currencyAPI.getCurrencyName(key)}`); } }); // CLIENTSIDE CODE mp.events.addDataHandler("currency_cash", (entity, value) => { if (entity.handle === mp.players.local.handle) { mp.game.stats.statSetInt(mp.game.joaat("SP0_TOTAL_CASH"), value, false); mp.gui.chat.push(`(clientside) currency_cash updated, new value: ${value}`); } }); Source code is available on GitHub in case you don't want to download: https://github.com/root-cause/ragemp-currency-api
    Thanks to Lorc for providing the resource icon: https://game-icons.net/1x1/lorc/cash.html

    1468 downloads

       (5 reviews)

    0 comments

    Updated

  9. Shared World Data

    If you ever used GTA Network's setWorldSyncedData/SetWorldSharedData, you probably have an idea of what this resource does. If you haven't used those, this resource lets you set variables that will be synced to all clients.
     
    Installing
    Put the files you downloaded in their respective places Add require('worlddata') to client_packages/index.js, preferably as the first module you require All done  
    Using
    There isn't much to it, you can do one of these to set shared data:
    mp.world.data.myDataKey = myValue; mp.world.data["myDataKey"] = myValue; you can do one of these to get shared data:
    mp.world.data.myDataKey mp.world.data["myDataKey"] and you can do one of these to remove shared data:
    delete mp.world.data.myDataKey; delete mp.world.data["myDataKey"]; (1.1) now you can do this to set multiple shared data at once, thanks to @kemperrr:
    mp.world.setData(updatedObject); // see examples You can use setting/deleting code on clientside as well but it won't affect the data on serverside. If anything your changes will get overriden when myDataKey is updated, so there's no point in using setting/deleting code on clientside.
     
    Events (Clientside)
    // worldDataReady is called when the player receives all shared data. mp.events.add("worldDataReady", () => { // Example, print all data keys to chat mp.gui.chat.push(`World data ready! ${Object.keys(mp.world.data).join(",")}`); }); // worldDataChanged is called when shared data changes. mp.events.add("worldDataChanged", (key, oldValue, newValue) => { // Example, show which data key changed with its old and new value mp.gui.chat.push(`World data changed: ${key} | old: ${oldValue} | new: ${newValue}`); }); // worldDataRemoved is called when shared data is removed. mp.events.add("worldDataRemoved", (key) => { // Example, show which data key got removed mp.gui.chat.push(`World data removed: ${key}`); });  
    Example (Serverside)
    let gameSeconds = 0; // Increase gameSeconds every second and update the world data every 5 seconds, for no reason... setInterval(() => { gameSeconds++; if (gameSeconds % 5 === 0) { // You can use mp.world.data["exampleVariable"] as well mp.world.data.exampleVariable = gameSeconds; console.log(`exampleVariable is now ${mp.world.data.exampleVariable}`); } }, 1000); // Will update serverUpdated, serverName, serverWebsite shared data. mp.world.setData({ "serverUpdated": Date.now(), "serverName": "RAGE Multiplayer Server #545" "serverWebsite": "https://rage.mp/" }); Source code is available on GitHub in case you don't want to download: https://github.com/root-cause/ragemp-world-data

    174 downloads

       (3 reviews)

    0 comments

    Updated

  10. 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

    2680 downloads

       (11 reviews)

    4 comments

    Updated

  11. GTA V: Web Fonts

    Here is the .woff version of the fonts of GTA 5 i could find on their website.

    224 downloads

       (1 review)

    0 comments

    Updated

  12. 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.

    1255 downloads

       (3 reviews)

    1 comment

    Submitted

  13. Weapon Component Sync

    This resource provides serverside weapon component API for developers and syncs applied weapon components.
     
    Installing
    Put the files you downloaded in their respective places Add require('weaponcomponents') to client_packages/index.js All done  
    Serverside API
    PRO TIP: Check RAGEMP Wiki or my weapon data resource for component names/hashes.
    /** * Adds the specified component to the player's specified weapon. * @param {Number} weaponHash The weapon's hash. * @param {Number} componentHash The component's hash. * @throws {TypeError} If any of the arguments is not a number. */ player.giveWeaponComponent(weaponHash, componentHash); /** * Returns whether the player's specified weapon has the specified component or not. * @param {Number} weaponHash The weapon's hash. * @param {Number} componentHash The component's hash. * @returns {Boolean} * @throws {TypeError} If any of the arguments is not a number. */ player.hasWeaponComponent(weaponHash, componentHash); /** * Returns the components of the player's specified weapon. * @param {Number} weaponHash The weapon's hash. * @returns {Number[]} An array of component hashes. * @throws {TypeError} If weaponHash argument is not a number. */ player.getWeaponComponents(weaponHash); /** * Removes the specified component from the player's specified weapon. * @param {Number} weaponHash The weapon's hash. * @param {Number} componentHash The component's hash. * @throws {TypeError} If any of the arguments is not a number. */ player.removeWeaponComponent(weaponHash, componentHash); /** * Removes all components of the player's specified weapon. * @param {Number} weaponHash The weapon's hash. * @throws {TypeError} If weaponHash argument is not a number. */ player.removeAllWeaponComponents(weaponHash); /** * Resets all components of the player's all weapons. */ player.resetAllWeaponComponents();  
    Example Commands
    1) /prosniper and /loudsniper
    Use /prosniper to get a sniper rifle with components and use /loudsniper to remove the suppressor.
    const sniperHash = mp.joaat("weapon_sniperrifle"); // Will give the player a sniper rifle and components (suppressor, advanced scope and luxury finish) mp.events.addCommand("prosniper", (player) => { player.giveWeapon(sniperHash, 9999); player.giveWeaponComponent(sniperHash, mp.joaat("COMPONENT_AT_AR_SUPP_02")); player.giveWeaponComponent(sniperHash, mp.joaat("COMPONENT_AT_SCOPE_MAX")); player.giveWeaponComponent(sniperHash, mp.joaat("COMPONENT_SNIPERRIFLE_VARMOD_LUXE")); }); // Will remove the suppressor from the player's sniper rifle mp.events.addCommand("loudsniper", (player) => { player.removeWeaponComponent(sniperHash, mp.joaat("COMPONENT_AT_AR_SUPP_02")); });  
    2) Test commands
    These are the commands I used while testing this script. 
    // /weapon is taken from freeroam gamemode mp.events.addCommand('weapon', (player, _, weaponName) => { if (weaponName.trim().length > 0) player.giveWeapon(mp.joaat(`weapon_${weaponName}`), 9999); else player.outputChatBox(`<b>Command syntax:</b> /weapon [weapon_name]`); }); // Example: /addcomp carbinerifle COMPONENT_CARBINERIFLE_CLIP_03 mp.events.addCommand("addcomp", (player, _, weapon, compName) => { player.giveWeaponComponent(mp.joaat("weapon_" + weapon), mp.joaat(compName)); }); // Example: /remcomp carbinerifle COMPONENT_CARBINERIFLE_CLIP_03 mp.events.addCommand("remcomp", (player, _, weapon, compName) => { player.removeWeaponComponent(mp.joaat("weapon_" + weapon), mp.joaat(compName)); }); // Example: /remallcomps carbinerifle mp.events.addCommand("remallcomps", (player, _, weapon) => { player.removeAllWeaponComponents(mp.joaat("weapon_" + weapon)); }); // Example: /resetcomps mp.events.addCommand("resetcomps", (player) => { player.resetAllWeaponComponents(); });  
    Notes
    Thanks to @ragempdev and @Jaimuzu for their contributions and help during the tests. 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. JS was a mistake.

    1855 downloads

       (6 reviews)

    1 comment

    Updated

  14. 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.
     
     
     

    4086 downloads

       (14 reviews)

    7 comments

    Updated

  15. cefManager

    A library to easier manage CEF windows.
    Creating a CEF Window
    Function is based on Promise because I need this in my own resources. Promise return a CEF window object.
    cef window name (string)
    url (string)
    parameters to exec (array) - take a look on Executing a function into a CEF Window for parameters
    cefManager.createCef(cef window name, url, parametersToExec).then(cef => {}) cefManager.createCef('hud', 'package://rage/browsers/hud/index.html').then(cef => {}) Executing a function into a CEF Window
    Again function is based on Promise but returns nothing.
    cef window name (string)
    [function name (string), args how much you need(number, string, boolean etc.)]
    cefManager.executeCef(cef window name, [function name, args]).then(() => {}) cefManager.executeCef('hud', ['console.log', mp.players.length]).then(() => {}) Checking if CEF with name exists
    cef window name (string)
    cefManager.existsCef(cef window name) const exists = cefManager.existsCef('hud') Get CEF window object
    cef window name (string)
    cefManager.getCef(cef window name) const cef = cefManager.getCef('hud') Get CEF window current URL
    cef window name (string)
    cefManager.getCurrentCefURL(cef window name) const url = cefManager.getCurrentCefURL('hud') Get CEF window URL which was set in creating CEF window
    cef window name (string)
    cefManager.getCefURL(cef window name) const url = cefManager.getCefURL('hud') Reload CEF window
    Again Promise
    cef window name (string)
    ignore cache (boolean) - true to ignore cache (Browser::reload)
    cefManager.reloadCef(cef window name, ignore cache) cefManager.reloadCef('hud', true).then(() => {})  
     
    ps. no support from me for this library, if something works bad fix it.

    137 downloads

       (0 reviews)

    0 comments

    Updated

  16. 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.

    581 downloads

       (1 review)

    1 comment

    Updated

  17. [C++] L5RP Framework

    I wish to share this framework for ragempcppsdk, that L5RP team has created while we were developing for ragemp. Using C++ for serverside
    This framework worth both on Windows and on Linux operating systems. (Haven't tested it on mac OS).
    This framework contains some additional util features which are not present in cppsdk by default:
    Callable system for parsing command/event/console input/socket input arguments. Script system, which helps developers to split the code into seperate scripts. Some utilities such as Player and Vehicle components to fully utilize script system. Threaded CURL support (Could be used to call api calls in website to load/save server data) Threaded TCP Socket support (Could be used to integrate server with 3rd party applications such as discord bot, live players map and a lot more) (Currently only works on linux) Has been designed with an possibility in mind that rage-mp could die and scripts code could be lifted to other modifications. (Of course integration layer would be needed to be developed, but the thing is that once that would be developed scripts code wouldn't need to change at all) Command and Event system. (Currently its done in a bit weird way, where each player has his own set of commands. But Its not really good time for me to go and refactor one of the core parts of the framework) A lot of small utilites that makes developer's life easier whilst developing on cppsdk. Some bugfixes which are not present in ragemp. Timer/Promise support. (Promise is the same thing as a timer, but only executes once) Threaded Console Input/Output. Console Output being done through spdlog, having different severity levels and being logged into file. Ideas for the future:
    Example gamemode utilizing functions from this framework. Support for multi-language scripts. Some kind of documentation for this framework. In order to download/review this framework please use git: https://gitlab.com/l5rp/l5rp-api
    If you have any suggestions or improvements for this framework feel free to contact me in ragemp discord or in comment section. I'll also be reviewing pull request section from time to time.

    453 downloads

       (3 reviews)

    0 comments

    Updated

  18. Voice Chat

    Hi, my realization voice chat on cef in the RAGE:MP
    Voice working by distance position (noice control), activation F8 (push and talk)
    Installing
    1. Read all .js comments and put code in your gamemode
    2. Prepare security Web Server and start peer js server, generate crt files and put with server in one folder
    3. Change all urls my web project on yours
    For peerjs server, use next package install: npm install fs peer
    P.s, i dont know would be new version that scripts, but if you want himself update and i can upload its here
    Date Build: 22 feb 2018

    1416 downloads

       (6 reviews)

    0 comments

    Updated

  19. 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

    744 downloads

       (2 reviews)

    2 comments

    Updated

  20. Login Window | Design

    Login Window Design 

    635 downloads

       (1 review)

    2 comments

    Updated

  21. PayCheck - Popup | Only HTML / CSS Design

    This is a PayCheck - Popup, 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.

    269 downloads

       (0 reviews)

    0 comments

    Updated

  22. Input Window | Only HTML / CSS Design

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

    197 downloads

       (0 reviews)

    0 comments

    Updated

  23. 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.

    739 downloads

       (3 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.

    842 downloads

       (0 reviews)

    0 comments

    Updated

  25. 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.

    1566 downloads

       (2 reviews)

    0 comments

    Updated


×
×
  • Create New...