Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/17/19 in Files

  1. Version 1.1.0

    532 downloads

    Hello, I thought it would be a opportunity to introduce some basic scaleform scripts that would help out some users with their development aka. use less CEF for simple stuff. This resource introduces the ability to give button instructions that supports controls (Meaning it'll detect your input whether its a gamepad or keyboard...). API You can always have a look at the Controls to get their ID. Using the resource is very simple to use and it supports different uses of customization: You can adjust style between Horizontal (1) and Vertical (-1) You can adjust background color with RGBA (Note you'll need to add it in array form) or HEX. Bulk support for buttons. new hud(style, color) /* * style: -1 for horizontal view, 1 for vertical view * color: HEX or RGBA [255, 255, 255, 255] */ hudClassInstance.addButton(title, controlID); /* * title: any text * controlID: you can find a list of controlID on wiki */ hudClassInstance.addButtons({ anyName: controlID1, anyName2: controlID2 }); /* * Bulk support for adding buttons */ hudClassInstance.removeButton(titleOrControlID); /* * titleOrControlID: remove button by its title or controlID */ hudClassInstance.removeButton(titleOrControlID); /* * removes all buttons */ hudClassInstance.toggleHud(state); /* * state: Boolean toggling visibility */ hudClassInstance.changeStyle(style); /* * style: -1 for horizontal and 1 for vertical */ hudClassInstance.setBackgroundColor(color); /* * color: HEX string or RGBA Array */ hudClassInstance.changeButtonTitle(index, newTitle); /* * index: controlID or currentButton title. (if custom button you can type its name t_buttonName) * newTitle: string */ hudClassInstance.changeButtonControl(index, newControl); /* * index: controlID or currentButton title. (if custom button you can type its name t_buttonName) * newControl: controlID or custom control (t_buttonName) */ If you have any issues, you know as usual contact me on Forums or discord. Any suggestions please add it in your review. If you liked the resource show me your support to produce some useful resources in the future.
    3 points
  2. Version 1.0.0

    1854 downloads

    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.
    1 point
  3. Version 1.0.0

    3863 downloads

    Design by @CommanderDonkey, link here. For install just copy files to your server. Don't forget edit index.js into client_packages if you have more resources.
    1 point
×
×
  • Create New...