-
Posts
254 -
Joined
-
Last visited
-
Days Won
164
Content Type
Profiles
Forums
Downloads
Everything posted by rootcause
-
Version 1.0.0
805 downloads
Ban system that supports temporarily/permanently banning names, social club names, IP addresses and HWIDs. Installing Put banapi into your server's packages directory Open banapi/database.js and put your MySQL config All done API /* getUnixTimestamp() Returns the current Unix timestamp. */ mp.bans.getUnixTimestamp() /* formatUnixTimestamp(unixTimestamp) Converts a Unix timestamp to "day/month/year hour:minute:second" format. Returns a string. */ mp.bans.formatUnixTimestamp(unixTimestamp) /* add(value, banType, reason, endUnixTimestamp) Adds a ban to the bans table, the ban will be permanent if endUnixTimestamp is -1. You need to provide the value like a player's serial, IP or name. endUnixTimestamp must be seconds, NOT milliseconds. Just use the provided getUnixTimestamp() This won't terminate the banned player's connection. Can be used for offline banning. Returns a promise. */ mp.bans.add(value, banType, reason, endUnixTimestamp) /* banPlayer(playerID, banType, reason, endUnixTimestamp) Bans the specified player, the ban will be permanent if endUnixTimestamp is -1. The script will get the value, you just need to provide a player ID and ban type. endUnixTimestamp must be seconds, NOT milliseconds. Just use the provided getUnixTimestamp() This will terminate the banned player's connection. Returns a promise. */ mp.bans.banPlayer(playerID, banType, reason, endUnixTimestamp) /* getInfo(banID) Gets information about the specified ban ID. Returns a promise. */ mp.bans.getInfo(banID) /* remove(banID) Removes the specified ban ID from the bans table. Returns a promise. */ mp.bans.remove(banID) Ban Types 0 = Name ban, player's current name will be banned. (player.name property) 1 = Social Club name ban, player's current social club name will be banned. (player.socialClub property) 2 = IP ban, player's current IP address will be banned. (player.ip property) 3 = HWID ban, player's current HWID will be banned. (player.serial property) Example Commands /* Usage: /ban 5 0 60 Take a break Will nameban the player ID 5 (if there is a player with ID 5) for 60 minutes with the reason "Take a break". */ mp.events.addCommand("ban", (player, _, target, type, minutes, ...reason) => { target = Number(target); type = Number(type); minutes = Number(minutes); let fullReason = reason.join(' '); let targetPlayer = mp.players.at(target); if (targetPlayer) { mp.bans.banPlayer(targetPlayer.id, type, fullReason, mp.bans.getUnixTimestamp() + (minutes * 60)).then((banID) => { player.outputChatBox(`Banned ${targetPlayer.name} with the reason '${fullReason}' for ${minutes} minutes.`); console.log(`${player.name} banned ${targetPlayer.name} for ${minutes} minutes. (${fullReason}) BanID: ${banID}`); }).catch((err) => { player.outputChatBox(`Error occurred while banning ${targetPlayer.name}.`); player.outputChatBox(`Error: ${err.message}`); }); } else { player.outputChatBox(`No player with the ID ${target} found.`); } }); /* Usage: /baninfo 3 Will show information about ban ID 3 (if it exists) */ mp.events.addCommand("baninfo", (player, banID) => { banID = Number(banID); mp.bans.getInfo(banID).then((banInfo) => { if (banInfo) { player.outputChatBox(`Ban Information (BanID ${banInfo.ID})`); player.outputChatBox(`Type: ${banInfo.Type}`); player.outputChatBox(`Value: ${banInfo.Value}`); player.outputChatBox(`Reason: ${banInfo.Reason}`); player.outputChatBox(`Is Permanent: ${banInfo.LiftTimestamp == -1}`); if (banInfo.LiftTimestamp > -1) player.outputChatBox(`Ends: ${mp.bans.formatUnixTimestamp(banInfo.LiftTimestamp)}`); } else { player.outputChatBox(`BanID ${banID} expired or doesn't exist.`); } }).catch((err) => { player.outputChatBox(`Error occurred while getting BanID ${banID}.`); player.outputChatBox(`Error: ${err.message}`); }); }); /* Usage: /removeban 5 Will remove the ban with specified ID (if it exists) */ mp.events.addCommand("removeban", (player, banID) => { banID = Number(banID); mp.bans.remove(banID).then((success) => { if (success) { player.outputChatBox(`BanID ${banID} is now history...`); } else { player.outputChatBox(`Couldn't remove BanID ${banID}, probably expired or doesn't exist.`); } }).catch((err) => { player.outputChatBox(`Error occurred while removing BanID ${banID}.`); player.outputChatBox(`Error: ${err.message}`); }); }); Notes This script will handle banned players when they join. (kick if they're still banned, remove ban if their ban expired) Don't use JS timestamps as they are milliseconds, use the provided mp.bans.getUnixTimestamp() -
Version 1.0.1
432 downloads
This script was originally made by EnforcerZhukov for singleplayer. (you can find it here) All credit goes to him. I added extra stuff such as remembering firing mode (until you disconnect) per weapon, safety mode, HUD item and sound effects. Installing & Using Put guncontrol into your server's client_packages directory, then add require('guncontrol'); to index.js. Press F6 key to switch between firing modes. Firing Modes Auto: Default GTA shooting. Burst: Shoot 3 bullets every time you fire. (not supported on all weapons) Single: Shoot 1 bullet every time you fire. (not supported on all weapons) Safe: Disables shooting. -
Version 1.0.2
2137 downloads
This resource adds GTAO style player blip/icon to streamed in players. Their icon will be removed when they stream out. You can change the color of player blips by setting blipColor using Entity::data or Entity::setVariable on serverside. For a list of blip colors, visit the wiki page about blips. Installing Put playerblips into your server's client_packages directory, then add require('playerblips'); to index.js.- 6 reviews
-
- 11
-
-
Version 1.0.1
788 downloads
This resource lets you control the blackout feature of GTA V. Installing Put the files you downloaded in their respective places Add require('blackout') to client_packages/index.js All done API // Serverside (synced to every player) mp.world.blackout.enabled // get mp.world.blackout.enabled = true/false // set // Clientside (only for a client) mp.game.blackout.enabled // get mp.game.blackout.enabled = true/false // set You can also trigger SetBlackoutState event with the first argument being the new state of blackout. Example // Toggle blackout mode with /toggleblackout (Serverside) mp.events.addCommand("toggleblackout", (player) => { mp.world.blackout.enabled = !mp.world.blackout.enabled; player.outputChatBox(`Blackout ${mp.world.blackout.enabled ? `enabled` : `disabled`}.`); }); // Toggle blackout mode with F8 key (Clientside) mp.keys.bind(0x77, false, () => { mp.game.blackout.enabled = !mp.game.blackout.enabled; mp.gui.chat.push(`Blackout ${mp.game.blackout.enabled ? `enabled` : `disabled`}.`); });- 1 review
-
- 2
-
-
Version 1.1.0
1227 downloads
This script reads outfits from scriptmetadata.meta and lets you use them in game. There are currently 1382 outfits for both male and female freemode characters. Using: /outfit [id] Updating scriptmetadata.meta scriptmetadata.meta gets more outfits with every update, here's how you can update it: OpenIV: Go to update\update.rpf\common\data Right click on scriptmetadata.meta Select save content/export Take the extracted file and replace it with the one your server is using CodeWalker RPF Explorer: Go to update\update.rpf\common\data Right click on scriptmetadata.meta Select extract raw Take the extracted file and replace it with the one your server is using Notes Some outfit IDs might do nothing, ask Rockstar In RAGE version 0.3, drawable IDs above 255 aren't supported so you might have some weird looking outfits. From what I heard this is not a problem in upcoming 0.4. Credits to OpenIV and CodeWalker devs, this script wouldn't be possible without their efforts. -
Update 1: Removed tint data from melee weapons and throwable weapons as they were useless Added IsDefault to components, it will be true if the component is equipped on the weapon by default (this is mostly the case for default clips and scopes on sniper rifles)
-
Information library about the game's weapons. Contains Weapon Hash Weapon Hash Key (you can use this with joaat functions to generate hash) Weapon Name GXT (game text, use with getLabelText to get localized string) Weapon Description GXT (game text, use with getLabelText to get localized string) Weapon Name (in English) Weapon Description (in English) Weapon Group Weapon Model Hash Key (this is the model you can spawn as a prop, use with joaat functions to generate hash) Weapon Default Clip Size Weapon Ammo Type (won't exist if the weapon doesn't have an ammo type) Weapon Components --> Component Hash --> Component Hash Key (you can use this with joaat functions to generate hash) --> Component Name GXT (game text, use with getLabelText to get localized string) --> Component Description GXT (game text, use with getLabelText to get localized string) --> Component Name (in English) --> Component Description (in English) --> Component Model Hash Key (this is the model you can spawn as a prop, use with joaat functions to generate hash) --> Component Ammo Type (won't exist if the component doesn't have an ammo type) --> Component Is Default Weapon Tints --> Tint Name GXT (game text, use with getLabelText to get localized string) --> Tint Name (in English) Weapon Livery Colors --> Livery Color GXT (game text, use with getLabelText to get localized string) --> Livery Color Name (in English) Weapon DLC Name (mpgunrunning etc., this will be "core" for stock weapons) Example "1593441988": { "HashKey": "WEAPON_COMBATPISTOL", "NameGXT": "WT_PIST_CBT", "DescriptionGXT": "WTD_PIST_CBT", "Name": "Combat Pistol", "Description": "A compact, lightweight, semi-automatic pistol designed for law enforcement and personal defense. 12-round magazine with option to extend to 16 rounds.", "Group": "GROUP_PISTOL", "ModelHashKey": "W_PI_COMBATPISTOL", "DefaultClipSize": 12, "AmmoType": "AMMO_PISTOL", "Components": { "119648377": { "HashKey": "COMPONENT_COMBATPISTOL_CLIP_01", "NameGXT": "WCT_CLIP1", "DescriptionGXT": "WCD_CP_CLIP1", "Name": "Default Clip", "Description": "Standard capacity for Combat Pistol.", "ModelHashKey": "w_pi_combatpistol_mag1", "IsDefault": true }, "3598405421": { "HashKey": "COMPONENT_COMBATPISTOL_CLIP_02", "NameGXT": "WCT_CLIP2", "DescriptionGXT": "WCD_CP_CLIP2", "Name": "Extended Clip", "Description": "Extended capacity for Combat Pistol.", "ModelHashKey": "w_pi_combatpistol_mag2", "IsDefault": false }, "899381934": { "HashKey": "COMPONENT_AT_PI_FLSH", "NameGXT": "WCT_FLASH", "DescriptionGXT": "WCD_FLASH", "Name": "Flashlight", "Description": "Aids low light target acquisition.", "ModelHashKey": "w_at_pi_flsh", "IsDefault": false }, "3271853210": { "HashKey": "COMPONENT_AT_PI_SUPP", "NameGXT": "WCT_SUPP", "DescriptionGXT": "WCD_PI_SUPP", "Name": "Suppressor", "Description": "Reduces noise and muzzle flash.", "ModelHashKey": "w_at_pi_supp", "IsDefault": false }, "3328527730": { "HashKey": "COMPONENT_COMBATPISTOL_VARMOD_LOWRIDER", "NameGXT": "WCT_VAR_GOLD", "DescriptionGXT": "WCD_VAR_CBP", "Name": "Yusuf Amir Luxury Finish", "Description": "", "ModelHashKey": "w_pi_combatpistol_luxe", "IsDefault": false } }, "Tints": [ { "NameGXT": "WM_TINT0", "Name": "Black tint" }, { "NameGXT": "WM_TINT1", "Name": "Green tint" }, { "NameGXT": "WM_TINT2", "Name": "Gold tint" }, { "NameGXT": "WM_TINT3", "Name": "Pink tint" }, { "NameGXT": "WM_TINT4", "Name": "Army tint" }, { "NameGXT": "WM_TINT5", "Name": "LSPD tint" }, { "NameGXT": "WM_TINT6", "Name": "Orange tint" }, { "NameGXT": "WM_TINT7", "Name": "Platinum tint" } ], "LiveryColors": [], "DLC": "core" } Notes The information was generated using game files, if there are mistakes feel free to report them. Click me
-
Version 0.0.1
10441 downloads
Custom character creator resource, use /creator to access it. Installing Put the files you downloaded in their respective places Download & install NativeUI if you haven't yet, this script needs it Add require('charcreator') to client_packages/index.js All done Notes There might be bugs here and there especially on clientside The code is pretty messy right now, will be improved in the future -
-
Version 1.0.1-NativeUI
254 downloads
This resource lets you preview many of the available timecycle modifiers in GTA V. Installing Download & install the latest BasicMenu or NativeUI if you haven't already, this script needs it Drop the timecycpreview folder to your server's client_packages Add require('timecycpreview') to client_packages/index.js All done Controls Page Up - Increase timecycle modifier strength Page Down - Decrease timecycle modifier strength F9 - Show/hide the menu -
Version 1.1.1
2199 downloads
Just a small script that displays your location and vehicle speed (if you're in one) next to the mini map. https://github.com/glitchdetector/fivem-minimap-anchor - credits for minimap anchor code Notes You can disable speed display feature by setting useSpeedo to false. Location and speed won't be displayed if your radar is disabled or hidden. Speed unit changes based on your Measurement System setting of GTA V, which you can find in Settings -> Display -> Measurement System. -
Version 1.4.0
7875 downloads
Installing Put the files you downloaded in their respective places Download & install NativeUI if you haven't yet, this script needs it Add require('vspawner') to client_packages/index.js All done Controls F4 Key - show/hide menu Left Arrow - previous page Right Arrow - next page ESC - close menu Credits https://github.com/n-n1ks/rage.mp-freeroam - Vehicle spawn/model change stuff -
Version 1.1.0
807 downloads
Released a better version here: Adds timer bars from GTA V/Online. Installing Drop the timerbars folder to your server's client_packages folder, then you can use const barlibrary = require('timerbars'); to add timer bars. (don't forget to check examples) TimerBar Properties A timer bar has these properties: title | Title (left text) of the timer bar. (string) useProgressBar | Progress bar of the timer bar. If set to true, a progress bar will be drawn instead of right text. (bool) text | Text (right text) of the timer bar, useless if useProgressBar is true. (string) progress | Progress of the timer bar, useless if useProgressBar is false. (float between 0.0 - 1.0) textColor | Text color of the timer bar. (rgba array or HUD color ID) pbarBgColor | Progress bar's background color. (rgba array or HUD color ID) pbarFgColor | Progress bar's foreground color. (rgba array or HUD color ID) visible | Visibility of the timer bar. (bool) usePlayerStyle | If set to true, timer bar title will be displayed like a GTA Online player name. (bool) You can check this wiki page for HUD color IDs. Examples const timerBarLib = require("timerbars"); // lets create some progress bars let timeBar = new timerBarLib.TimerBar("TIME LEFT"); timeBar.text = "33:27"; let teamBar = new timerBarLib.TimerBar("TEAM MEMBERS LEFT"); teamBar.text = "4"; let healthBar = new timerBarLib.TimerBar("BOSS HEALTH", true); healthBar.progress = 0.8; healthBar.pbarFgColor = [224, 50, 50, 255]; healthBar.pbarBgColor = [112, 25, 25, 255]; let rewardBar = new timerBarLib.TimerBar("REWARD"); rewardBar.text = "$500000"; rewardBar.textColor = [114, 204, 114, 255]; // f7 to toggle visibility of bars mp.keys.bind(0x76, false, () => { timeBar.visible = !timeBar.visible; teamBar.visible = !teamBar.visible; healthBar.visible = !healthBar.visible; rewardBar.visible = !rewardBar.visible; }); // f8 will change health bar's value to something random mp.keys.bind(0x77, false, () => { healthBar.progress = Math.random(); }); const timerBarLib = require("timerbars"); let eventTime = new timerBarLib.TimerBar("EVENT TIME LEFT", false); eventTime.text = "01:40"; let thirdPlace = new timerBarLib.TimerBar("3rd: PlayerName3", false); thirdPlace.text = "9 kills"; thirdPlace.textColor = 107; // HUD_COLOUR_BRONZE thirdPlace.usePlayerStyle = true; let secondPlace = new timerBarLib.TimerBar("2nd: PlayerName2", false); secondPlace.text = "12 kills"; secondPlace.textColor = 108; // HUD_COLOUR_SILVER secondPlace.usePlayerStyle = true; let firstPlace = new timerBarLib.TimerBar("1st: AimbotNub", false); firstPlace.text = "30 kills"; firstPlace.textColor = 109; // HUD_COLOUR_GOLD firstPlace.usePlayerStyle = true; -
Version 1.1.0
1644 downloads
Installing Put the files you downloaded in their respective places Download & install Scaleform Messages if you haven't yet, this script needs it Add require('wasted') to client_packages/index.js All done Notes This script will make the players wait 8 seconds before spawning at the closest hospital. This script was not tested on a gamemode with custom death behavior, you might want to do some changes. Video Preview -
Version 2.1.0
2331 downloads
Now with 200% more color. Clientside Functions: mp.game.ui.notifications.show(message, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) mp.game.ui.notifications.showWithPicture(title, sender, message, notifPic, icon = 0, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) Serverside Functions: player.notify(message, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) player.notifyWithPicture(title, sender, message, notifPic, icon = 0, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) As Events: BN_Show(message, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) BN_ShowWithPicture(title, sender, message, notifPic, icon = 0, flashing = false, textColor = -1, bgColor = -1, flashColor = [77, 77, 77, 200]) Example: // Clientside mp.game.ui.notifications.show("Normal message with custom text and background color.", false, 15, 20); mp.game.ui.notifications.showWithPicture("New Message", "Facebook", "You got some more of that data?", "CHAR_FACEBOOK", 1, false, 0, 139); // Serverside player.notify("This message is red which means you're doing something wrong.", false, 6); player.notifyWithPicture("Title", "Ammu-Nation", "Ammunation has all the equipment you need to protect your family from the evils of a liberal society! Fixed, mounted, and shoulder-held submachine guns. Mortars! Surface-to-air and all manner of heat-seeking missiles!", "CHAR_AMMUNATION"); Icons: You can specify an icon ID for picture notifications, here's a list of them: 0, 4, 5, 6 = No Icon 1 = Speech Bubble 2 = Message 3 = Friend Request 7 = Arrow 8 = RP 9 = Money Notes: textColor and bgColor parameters want a HUD color ID which you can find here. (it is a bit outdated now though) You can find notification pictures here. If you can't see picture notifications, you must enable Phone Alerts from Settings > Notifications > Phone Alerts. This script changes player.notify on serverside. -
Version 1.0.1
1850 downloads
This resource lets players choose their walking style. Selected walking style is synced to other players. Installing Put the files you downloaded in their respective places Download & install BasicMenu or NativeUI if you haven't yet, this script needs it Add require('walkingstyles') to client_packages/index.js All done Controls F5 Key - Show/hide walking style menu. Adding/Removing Walking Styles You can add/remove walking styles by changing walkingStyles array inside packages/walkingstyles/index.js, make sure your AnimSet is valid! -
/save [name (optional)] command to save your/your vehicle's position and heading/rotation to a file just like in SA-MP. You can find the saved positions inside savedpos.txt on the server folder. Code: const fs = require("fs"); const saveFile = "savedpos.txt"; mp.events.addCommand("save", (player, name = "No name") => { let pos = (player.vehicle) ? player.vehicle.position : player.position; let rot = (player.vehicle) ? player.vehicle.rotation : player.heading; fs.appendFile(saveFile, `Position: ${pos.x}, ${pos.y}, ${pos.z} | ${(player.vehicle) ? `Rotation: ${rot.x}, ${rot.y}, ${rot.z}` : `Heading: ${rot}`} | ${(player.vehicle) ? "InCar" : "OnFoot"} - ${name}\r\n`, (err) => { if (err) { player.notify(`~r~SavePos Error: ~w~${err.message}`); } else { player.notify(`~g~Position saved. ~w~(${name})`); } }); }); What the output looks like: Position: -422.9187316894531, 1133.0765380859375, 325.8547058105469 | Heading: 344.207763671875 | OnFoot - No name Position: -411.07977294921875, 1180.73681640625, 325.0368957519531 | Rotation: 1.4606590270996094, 0.7490195631980896, 75.47509765625 | InCar - No name Position: -1087.9407958984375, 4912.0634765625, 214.6710968017578 | Heading: 222.96522521972656 | OnFoot - Altruist Camp
- 4 replies
-
- 20
-
-
-
Version 1.2.0
1061 downloads
This project is discontinued, consider using NativeUI instead. Bare-bones menu script. Installing: Put basicmenu into your server's client_packages directory, then you can add const whatever = require("basicmenu"); to the clientside scripts that you want to add a menu. Example code explains this better. Properties & Functions: BasicMenu title | Get & Set | Title of the menu. (string) x | Get & Set | X position of the menu. (float) y | Get & Set | Y position of the menu. (float) items | Get & Set | An array containing all items of the menu. (MenuItem array) hoverItem | Get & Set | Index of the item you're hovering on with your cursor, -1 if not hovering on anything. (int) visible | Get & Set | Visibility of the menu. (bool) disableESC | Get & Set | Allow/disallow menu from being closed by pressing ESC key. (bool) titleFont | Get & Set | Font ID of the title. (int) titleColor | Get & Set | Text color of the title. (array containing rgba) itemsPerPage | Get & Set | How many items are visible on a page of the menu. (int) currentPage | Get & Set | Current page of the menu. (int) setBanner(lib, banner) | Sets the menu's banner to another texture, setBanner("shopui_title_carmod", "shopui_title_carmod") will set the menu banner to be Los Santos Customs one for example. MenuItem title | Get & Set | Title of the item. (string) disabled | Get & Set | Whether the item is able to be selected or not. (bool) textColor | Get & Set | Color of the item's title. (array containing rgba) bgColor | Get & Set | Color of the item's background. (array containing rgba) icon | Get & Set | ID of the item's icon. (int) font | Get & Set | Font ID of the title. (int) outline | Get & Set | Outline of the item. (bool) shadow | Get & Set | Shadow of the item. (bool) rightText | Get & Set | Right text of the item. (string) Icon IDs: You can put icons to menu items (even though there are only 3 options) if you want to. Just do myMenuItem.icon = desired icon ID. MenuItemIcons.None (0) = No icon MenuItemIcons.Lock (1) = Lock icon MenuItemIcons.Tick (2) = Tick/checkmark icon Events: There are three events, see example for how to use them. OnMenuItemSelected(menu, selectedMenuItem, selectedMenuItemIndex) /* Will be called when a menu item is clicked on/selected. menu - The menu that contained the selected item. (BasicMenu) selectedMenuItem - The menu item that was selected. (MenuItem) selectedMenuItemIndex - Index of the menu item on the selected menu. (int) */ OnMenuPageChanged(menu, oldPage, newPage) /* Will be called when a menu's page is changed. menu - The menu that had a page change. (BasicMenu) oldPage - Old page. (int) newPage - New page. (int) */ OnMenuClosed(menu) /* Will be called when a menu is closed. menu - The menu that was closed. (BasicMenu) */ Controls: Hovering on an item and left clicking - select item ESC - close menu (if disableESC isn't set to true) Left Arrow - previous page Right Arrow - next page Example Script: const menuLib = require("basicmenu"); // Creating a menu // you can just do: let exampleMenu = new menuLib.BasicMenu("Test Menu", 0.5, 0.4); let exampleMenu = new menuLib.BasicMenu("Test Menu", 0.5, 0.4, "commonmenu", "interaction_bgd", { itemSelected: function(item, itemIndex) { mp.gui.chat.push(`MenuEvent(${this.title}) - itemSelected: ${item.title} - ${itemIndex}`); }, pageChanged: function(oldPage, newPage) { mp.gui.chat.push(`MenuEvent(${this.title}) - pageChanged: ${oldPage} to ${newPage}`); }, closed: function() { mp.gui.chat.push(`MenuEvent(${this.title}) - close`); } }); exampleMenu.itemsPerPage = 5; // make the menu show 5 items per page, this is default by 10 let normalItem = new menuLib.MenuItem("Normal Item"); normalItem.rightText = "Free"; exampleMenu.items.push(normalItem); let redBackground = new menuLib.MenuItem("Red Background Item", [255, 255, 255, 255], [255, 0, 0, 200]); redBackground.rightText = "~g~$500"; exampleMenu.items.push(redBackground); let greenText = new menuLib.MenuItem("Green Text Item", [0, 255, 0, 255]); exampleMenu.items.push(greenText); // You won't be able to click on disabled items. let disabledItem = new menuLib.MenuItem("Disabled Item"); disabledItem.disabled = true; exampleMenu.items.push(disabledItem); let itemWithIcon = new menuLib.MenuItem("Item with Icon", [255, 255, 255, 255], [0, 0, 0, 200], function() { mp.gui.chat.push("You selected the item with icon, why?"); }); itemWithIcon.icon = menuLib.MenuItemIcons.Tick; itemWithIcon.rightText = "Pretty cool"; exampleMenu.items.push(itemWithIcon); let disabledWithIcon = new menuLib.MenuItem("Top Secret"); disabledWithIcon.disabled = true; disabledWithIcon.icon = menuLib.MenuItemIcons.Lock; exampleMenu.items.push(disabledWithIcon); // You can disable ESC menu closing by using disableESC property. exampleMenu.disableESC = true; // This is important as menus are not visible by default. exampleMenu.visible = true; // Events // OnMenuItemSelected, will be called when a menu item is clicked on. mp.events.add("OnMenuItemSelected", (menu, selectedItem, selectedItemIndex) => { mp.gui.chat.push(`Item selected on menu (${menu.title}) - ${selectedItem.title} (Index: ${selectedItemIndex})`); }); // OnMenuPageChanged, will be called when a menu's current page changes. mp.events.add("OnMenuPageChanged", (menu, oldPage, newPage) => { mp.gui.chat.push(`Menu page changed (${menu.title}) - ${oldPage} to ${newPage}`); }); // OnMenuClosed, will be called when a menu item is closed. mp.events.add("OnMenuClosed", (menu) => { mp.gui.chat.push(`Menu closed (${menu.title})`); }); // F6 key will toggle the visibility of exampleMenu mp.keys.bind(0x75, false, () => { exampleMenu.visible = !exampleMenu.visible; }); -
- 3 comments
-
- animation
- animations
- (and 4 more)
-
Version 1.0.2
3834 downloads
This resource probably won't get future updates, check out Currency API instead. Easy to use money system for your server. It handles saving&loading and provides you a custom data key to get/set a player's money. Installing Put the files you downloaded in their respective places Add require('moneyapi') to client_packages/index.js Open packages/moneyapi/constants.js and put your MySQL info (maybe edit the settings too while you're at it...) Congrats, you're all done Settings (packages/moneyapi/constants.js): startingMoney use this setting to change how much money players start with. Default: 0 autoSaveInterval use this setting to change how frequent auto saving happens (in minutes), you can set it to 0 if you want to disable auto saving. Default: 5 Example You can access a player's money from customMoney property using either .data.customMoney or .getVariable("customMoney"). mp.events.addCommand("smoney", (player, _, money) => { // set the player's money to the specified amount money = parseInt(money); if (!isNaN(money)) { player.data.customMoney = money; } else { player.outputChatBox("Invalid amount specified."); } }); mp.events.addCommand("cmoney", (player, _, amount) => { // change the player's money by the specified amount amount = parseInt(amount); if (!isNaN(amount)) { player.data.customMoney += amount; } else { player.outputChatBox("Invalid amount specified."); } }); mp.events.addCommand("buyhp", (player) => { // refill a player's health for $100 if (player.data.customMoney >= 100) { player.health = 100; player.data.customMoney -= 100; player.outputChatBox("Refilled health for $100."); } else { player.outputChatBox("You don't have $100."); } }); Notes First of all, thanks to @Donboo for their MySQL example which you can find here. This script won't save while the server is shutting down but will save player money when they disconnect or when autosave happens. This script uses an int(11) field to store a player's money. If you think $2147483647 isn't enough, you might want to change it. For some reason, MoneyAPI HUD elements will be off position in 1914x1080 windowed resolution. This script won't update the money display on the ESC/pause menu. (This note is obsolete if you're using the GameHUD version) -
Version 1.0.0
526 downloads
This resource adds a way to make the local player hold a mugshot board with custom text on it, the custom text and animation won't be synced to others. You can also use this resource to understand how rendertarget system works which lets you display scaleform on certain game objects. Installing: Put policetext into your server's client_packages directory, then add require('policetext/index.js'); to index.js. Available functions/events: mp.players.local.mugshotboard.show -> mp.events.call("ShowMugshotBoard") -> Params: title, topText, midText, bottomText, rank = -1 mp.players.local.mugshotboard.hide -> mp.events.call("HideMugshotBoard") -> Params: - And you can access if the local player has a mugshot board or not by using the hasMugshotBoard global variable. Clientside example (pressing F10 will give your character a mugshot board, pressing it again will remove it): mp.keys.bind(0x79, false, () => { if (!hasMugshotBoard) { mp.players.local.mugshotboard.show(mp.players.local.name, "Top Text", "Mid Text", "Bottom Text", 15); } else { mp.players.local.mugshotboard.hide(); } });
