Scripts
207 files
-
Speedometer
By Katu__
Install
Copy "speedometer" folder to client_packages.
Add "require('./speedometer/index.js');" to your index.js in client_packages, and you should be good to go!
1064 downloads
(3 reviews)0 comments
Submitted
-
Colored Headlights
By rootcause
This script adds the colored xenon headlights feature from Arena War DLC.
Installing
Put coloredhlights into your server's client_packages directory, then add require('coloredhlights'); to client_packages/index.js.
Using
Set the headlightColor shared variable of a vehicle to the headlight color ID you want. Command example:
// /hcolor 10 should make your vehicle's headlights pink mp.events.addCommand("hcolor", (player, _, colorId) => { if (player.vehicle) { player.vehicle.data.headlightColor = Number(colorId); } else { player.outputChatBox("You're not in a vehicle!"); } });
Headlight Colors
Since Rockstar didn't make headlight colors RGB, you can only use a set of numbers as color IDs.
0 = White 1 = Blue 2 = Light Blue 3 = Green 4 = Light Green 5 = Light Yellow 6 = Yellow 7 = Orange 8 = Red 9 = Light Pink 10 = Pink 11 = Purple 12 = Light Purple Color IDs higher than 12 will force xenon headlights to use their default color.
Notes
Since this script toggles the xenon headlights mod (toggleMod 22), it may not work with your car customization script. Color IDs lower than 0 and color ID 255 will disable the feature (revert headlights back to normal from xenon) until you set a valid color again.1056 downloads
(7 reviews)0 comments
Submitted
-
n0minal's Interior Browser (client-side only!)
By n0minal
n0minal's Interior Browser
Hello Dear Ragers,
Today I bring you guys a simple - but useful - browser for interiors to preview.
I spent something like ~2 hours to make it, so it might contain bugs, if you find a bug please post it in here or contact me by PM and I'll fix it as soon as possible.
Commands ⌨️
There are two commands (and binds for it):
/interior (or shortened: /i): Loads the Interior Browser menu, in which you can interact and select an interior to preview. /leave (or shortened: /l): Leaves the current interior and gets teleported back to your first position when you called the browser for the first time. The Script 📰
Download the .zip file and extract it inside your client-packages folder, after that, create (or edit) a index.js file in your client_packages root folder with the following content:
//requires interior-browser package require("interior-browser"); and you're ready to go!
Github Link: https://github.com/n0minal/interior-browser That's all,
See you on the next release!
1054 downloads
-
Color Chat
By Lokote1998
This simple script gives the player a random color for the chat when he joins.
If you already have a chat, i recommend you removing it & modifying this one to make it look like your old chat or merge them.
1035 downloads
(2 reviews)0 comments
Submitted
-
Levels
By rootcause
Installing
Put the files you downloaded in their respective places Add require('levels') to client_packages/index.js Open packages/levels/database.js and put your MySQL config All done
API
/* Player level and XP is accessed through currentLevel and currentXP shared data keys. You should not change the value of these shared data keys, just use them to get data and use the API to set data. */ player.data.currentLevel OR player.getVariable("currentLevel") // returns level of the player player.data.currentXP OR player.getVariable("currentXP") // returns XP of the player /* setLevel(newLevel) Sets the player's level to newLevel. (will also change player's XP to level XP) */ player.setLevel(newLevel) /* setXP(newXP) Sets the player's experience to newXP. (will update player's level) */ player.setXP(newXP) /* changeXP(xpAmount) Changes the player's experience by xpAmount. (will update player's level) */ player.changeXP(xpAmount) /* hasReachedMaxLevel() Returns whether the player has reached max level or not. */ player.hasReachedMaxLevel() /* saveLevelAndXP() Saves the player's level and XP data. Automatically called a player disconnects. */ player.saveLevelAndXP()
Events
These events are called on serverside when a player's level or XP changes.
/* playerXPChange This event is called when a player's XP changes. */ mp.events.add("playerXPChange", (player, oldXP, newXP, difference) => { // code }); /* playerLevelChange This event is called when a player's level changes. */ mp.events.add("playerLevelChange", (player, oldLevel, newLevel) => { // code });
Example Script
Here's a script that lets you change your level/XP and writes it to console:
mp.events.addCommand("setlevel", (player, newLevel) => { newLevel = Number(newLevel); if (!isNaN(newLevel)) { player.setLevel(newLevel); } else { player.outputChatBox("SYNTAX: /setlevel [new level]"); } }); mp.events.addCommand("changexp", (player, amount) => { amount = Number(amount); if (!isNaN(amount)) { player.changeXP(amount); } else { player.outputChatBox("SYNTAX: /changexp [amount]"); } }); mp.events.addCommand("setxp", (player, amount) => { amount = Number(amount); if (!isNaN(amount)) { player.setXP(amount); } else { player.outputChatBox("SYNTAX: /setxp [new xp amount]"); } }); mp.events.add("playerXPChange", (player, oldXP, newXP, difference) => { console.log(`${player.name} ${difference < 0 ? "lost" : "gained"} some XP. Old: ${oldXP} - New: ${newXP} - Difference: ${difference}`); }); mp.events.add("playerLevelChange", (player, oldLevel, newLevel) => { console.log(`${player.name} had a level change. Old: ${oldLevel} - New: ${newLevel}`); });
Credits
Unknown Modder - RP List IllusiveTea - Rank bar scaleform
Notes
This script will load and save level and XP data of players on its own but a function to save player data yourself is provided. Like said before, don't change the values of currentLevel and currentXP shared data keys. Maximum reachable level is 7999 but a player can earn XP until his rank bar is full, kinda reaching 8000. Use player.hasReachedMaxLevel() to detect if a player is level 7999 and his rank bar is full.
1017 downloads
(6 reviews)0 comments
Submitted
-
Easy Whitelist
By XCRON
RAGEMP-EasyWhitelist
This is a basic whitelist system for your server. Just place it in the packages folder & it works!
Installation
Just place the folder "easy-whitelist" in the packages folder.
How to add users to the whitelist
Go in the packages folder > then "easy-whitelist" > and edit the file account.json
There you have to add the SocialClub ID. Restart Server & its done.
Github: https://github.com/XCRON-DEV/RAGEMP-EasyWhitelist
For questions or help DM me here.
995 downloads
-
Rappelling
By rootcause
Requires RAGE Multiplayer 1.1.0 and above.
Installing
Put rappel into your server's client_packages directory, then add require('rappel'); to client_packages/index.js.
RAGE Multiplayer's 1.1 will sync the rappelling action so there isn't any need for server-side files.
Using
Get in a helicopter with FLAG_ALLOWS_RAPPEL (Maverick, Police Maverick and Annihilator) flag as passenger and do /rappel.
* Credits to Trevor Productions on YouTube for the preview image.
987 downloads
(7 reviews)0 comments
Submitted
-
Shortcuts (Animations) on Numpad
By SnillocTV
Load this Variables on Login:
gm.mysql.handle.query("SELECT * FROM shortcuts WHERE charId = ?", [player.data.charId], function (err10,res10) { if (err10) console.log("Error in loadShortcuts: "+err10); if (res10.length > 0) { res10.forEach(function (shortcutData) { player.data.numpad1A = shortcutData.num1animA; player.data.numpad1B = shortcutData.num1animB; player.data.numpad1C = shortcutData.num1animC; player.data.numpad1D = shortcutData.num1animD; player.data.numpad1Name = shortcutData.num1name; player.data.numpad2A = shortcutData.num2animA; player.data.numpad2B = shortcutData.num2animB; player.data.numpad2C = shortcutData.num2animC; player.data.numpad2D = shortcutData.num2animD; player.data.numpad2Name = shortcutData.num2name; player.data.numpad3A = shortcutData.num3animA; player.data.numpad3B = shortcutData.num3animB; player.data.numpad3C = shortcutData.num3animC; player.data.numpad3D = shortcutData.num3animD; player.data.numpad3Name = shortcutData.num3name; player.data.numpad4A = shortcutData.num4animA; player.data.numpad4B = shortcutData.num4animB; player.data.numpad4C = shortcutData.num4animC; player.data.numpad4D = shortcutData.num4animD; player.data.numpad4Name = shortcutData.num4name; player.data.numpad5A = shortcutData.num5animA; player.data.numpad5B = shortcutData.num5animB; player.data.numpad5C = shortcutData.num5animC; player.data.numpad5D = shortcutData.num5animD; player.data.numpad5Name = shortcutData.num5name; player.data.numpad6A = shortcutData.num6animA; player.data.numpad6B = shortcutData.num6animB; player.data.numpad6C = shortcutData.num6animC; player.data.numpad6D = shortcutData.num6animD; player.data.numpad6Name = shortcutData.num6name; player.data.numpad7A = shortcutData.num7animA; player.data.numpad7B = shortcutData.num7animB; player.data.numpad7C = shortcutData.num7animC; player.data.numpad7D = shortcutData.num7animD; player.data.numpad7Name = shortcutData.num7name; player.data.numpad8A = shortcutData.num8animA; player.data.numpad8B = shortcutData.num8animB; player.data.numpad8C = shortcutData.num8animC; player.data.numpad8D = shortcutData.num8animD; player.data.numpad8Name = shortcutData.num8name; player.data.numpad9A = shortcutData.num9animA; player.data.numpad9B = shortcutData.num9animB; player.data.numpad9C = shortcutData.num9animC; player.data.numpad9D = shortcutData.num9animD; player.data.numpad9Name = shortcutData.num9name; }); } });
Contact:
You can Contact me on Discord for Questions. https://discord.gg/epD7fsv
I can make Scripts for you write me on Discord please German my english is so Bad : SnillocTV
978 downloads
-
Scaleform Vehicle Spawner
By Yaann
This is a vehicle spawner menu made entirely under Scaleform, the native GUI for GTA V, based on Flash, which makes up nearly all of the displays used in the game. This menu works similar to vehicle websites in GTA Online, like Legendary Motorsport, note that this is not a modification of an existing Scaleform but a brand new custom one made entirely from scratch 👌!
I made this mostly as an exercise to mimic the games' UI functionalities by using Rockstar's own tools (and also showcase to you guys, other alternatives to opening web browsers in your game), however this is just one of the many examples that can be used with Scaleform, so I'm plaining in making more experiments with it.
This Scaleform features:
Updated vehicle list. Built-in cursor with supported mouse inputs and scroll. Multiple pages. Selectable buttons. Improved Scaleform code to handle return variables. Image import from .ytd files. Requirement but optional :
Better Clientside Commands by rootcause to call the menu on client-side but you can replace the call by a server-side command or a button prompt.
Github Repository, with the Scaleform source code included. So you can try your hands on Scaleform, it's not as hard as it looks like, trust me!
Vehicle images taken from the Rage MP Wiki and the GTA Wiki.
[Obligatory Certified Halal logo here]
966 downloads
-
Smooth Throttle Script
By notsosmart
This resource will stop your vehicle from constantly skidding when acceleration. It will also stop you from reversing when you're braking. You will come to a complete stop and then you have to press reverse again to actually reverse. Automatic brake lights are included.
Note that you can hold your handbrake (space bar) down and accelerate and this will temporarily remove the throttle limiter.
964 downloads
- Smooth
- acceleration
- (and 5 more)
-
FireDepartment
By spacefrog
I made this script for beginners in c# so they can hopefully learn someting for it.
I'm not a pro in programming but i hope i can help someone with it.
I did not test this with other players but it should work.
Commands:
/teleport "to get to the fire department" /start1 "on the white colshape to start a fire" /stopfireid "to stop the fire or just extinguish it."
When you are on a mission you can heal your self on the green colshape.
When you start a fire it random selected one of the 6 main spawn points from that point it random create new spawn points and check if its reachable for the player.
961 downloads
- Fire fighter
- Fire Department
- (and 1 more)
(1 review)0 comments
Updated
-
SAMP Dialogs
By adri1
SA-MP Dialogs for RAGE MP (C# clientside).
This is my first resource so may contains bugs...
You must enable C# clientside!
Usage is simple: examples in Test.cs
Dialog(string dialog_name, string dialog_caption, string dialog_info, string[] dialog_buttons, string[] dialog_list_items = null, string dialog_input = null, string dialog_password_input = null)
935 downloads
-
Example of proper DLC Pack mapping loading
By Scr1m
An example of proper DLC Pack mapping loading without issues on first connection to the server.
Installation
Extract all archive files to the server packages root folder.
Note
The game might get frozen for up to 10 seconds (faster on SSD) on first connection, that's the time taken by the game to reload DLC mapping. Mapping will work properly after that though.
929 downloads
(2 reviews)0 comments
Updated
-
Job Taxi
By Idle
Job Taxi:
1. Call taxi;
2. Set the route by coordinates;
3. Accept call;
4. Good system of money calculation;
5. Reasonableness of the main features.
922 downloads
(1 review)0 comments
Updated
-
[SCALEFORM] Chat
By Captien
This resource introduces the known chat scaleform from GTA:O. This chat supports (TEAM, LOCAL, GLOBAL) chats.
CONTROLS:
T (GLOBAL chat) Y (TEAM chat) U (LOCAL chat) alt + shift (Changes language from English to the secondary mapped language) PAGE_UP (Scroll history up) works only when input is opened PAGE_DOWN (Scroll history down) works only when input is opened Known Issues:
Message colors aren't supported due to scaleform Chat supports extra language besides English, but the language should be mapped Language Mapping:
For more information about how to language map, please click here
API:
Client-side API
// Client side // Property getter/setter Boolean (Disables/Enables chat input) mp.gui.chat.disabledInput = true; mp.gui.chat.disabledInput // Property getter Boolean (Check if chat is open) mp.gui.chat.enabled; // Function to clear localPlayer's chat feed mp.gui.chat.clear(); // Trigger chat's visibility (visible: Boolean); mp.gui.chat.visible(visible); /* * msg: string * scope: string (message's scope (Author [scope] msg)) * author: string (Default: [SERVER]) * authorColor: int hudColorID (https://wiki.rage.mp/index.php?title=Fonts_and_Colors) (Default: white) */ mp.gui.chat.sendMessage(msg, scope, author, authorColor); /* * Registers command locally for client. * name: string (command name) * arg1: command's arguement */ mp.gui.chat.addCommand(name, function (arg1, arg2) { // do whatever... }); /* * Removes command locally for client. * name: string (command name) */ mp.gui.chat.removeCommand(name); Server-side API
/* * Sends message to all players in server * msg: string * scope: string (message's scope (Author [scope] msg)) * author: string (Default: [SERVER]) * authorColor: int hudColorID (https://wiki.rage.mp/index.php?title=Fonts_and_Colors) (Default: white) */ mp.players.announce(msg, scope, author, authorColor); /* * Sends messaage to all players in specified dimension * dimension: int * msg: string * scope: string (message's scope (Author [scope] msg)) * author: string (Default: [SERVER]) * authorColor: int hudColorID (https://wiki.rage.mp/index.php?title=Fonts_and_Colors) (Default: white) */ mp.players.announceInDimension(dimension, msg, scope, author, authorColor); /* * Sends messaage to all players in specified dimension * position: Vector3 * range: int * msg: string * scope: string (message's scope (Author [scope] msg)) * author: string (Default: [SERVER]) * authorColor: int hudColorID (https://wiki.rage.mp/index.php?title=Fonts_and_Colors) (Default: white) */ mp.players.announceInRange(position, range, msg, scope, author, authorColor); /* * Registers commands in chat * name: string (command name) * player: command executer * arg1: Arguement after command */ mp.events.addChatCommand(name, function (player, arg1, arg2) { // Do what you want... }); /* * Removes command from server * name: string (command name) */ mp.events.removeChatCommand(name); /* * Sends message to all players in server * msg: string * scope: string (message's scope (Author [scope] msg)) * author: string (Default: [SERVER]) * authorColor: int hudColorID (https://wiki.rage.mp/index.php?title=Fonts_and_Colors) (Default: white) */ player.sendChatMessage(msg, scope, author, authorColor); // Clears player's chat player.clearChat(); Teams resource is supported.
If you have any issues don't hesitate to contact me on Discord/Forums DM.
You're not allowed to redistribute this resource without my permission.
901 downloads
(8 reviews)0 comments
Updated
-
Global Voice Chat
By ragempdev
The most trivial example usage of the recently introduced built-in voice chat API: global chat. It connects you to all players when you join the server and vice-versa.
Press F4 to toggle local player's muted state.
As of 24th Oct 2018 you need to use "testing_voice" branch to utilize voice chat API.
897 downloads
(5 reviews)0 comments
Updated
-
[v0.3.5] Implementing Custom NameTags
By heyMad
Hi everyone!
In need of a custom script for a Custom NameTag, I found the @hartority script, however, it was an outdated project and it had been made for version 0.2 of RageMP, with some references already removed, well, I bring you today the corrected code.
Requirements:
RageMP server files. Nothing more! Just have fun. Introduction: This script is a reliable edition of the one produced by @hartority with only a few references to the RageMP library, so all code is credit @hartority. Let's start: 1. Go to "client_packages" folder in "RAGEMP/server-files" directory, usually: 2. Create a JavaScript archive (.js) named "customtag.js", example:
3. Inside the "customtag.js" paste this code:
4. Save "customtag.js" file, and open "index.js" in "C:\RAGEMP\server-files\client_packages" directory and put this:
End! Just test it and tell me if something goes wrong
Usage example:
The original code topic of @hartority:
Thanks for all feedbacks,
mad
thanks @hartority for your commitment
if you do not authorize this topic, please let me know
886 downloads
-
Character Previewer
By MarkCavalli
This resource will help work with player clothes. I hope, someone will add all clothes screens to wiki 😀
860 downloads
(2 reviews)0 comments
Updated
-
Player List
By rootcause
Requires RAGE Multiplayer 1.1.0 and above.
This resource adds a GTA Online like player list to your server.
Installing
Put playerlist into your server's client_packages directory, then add require('playerlist'); to client_packages/index.js.
Controls
Z = Toggle player list visibility.
PageUp = Move to the next page.
PageDown = Move to the previous page.
Customization
You have the ability to customize how a player is displayed in the list. Here's a list of shared variable keys used for customization:
PlayerListColor = This shared variable is used to specify which background color the player will have in the list. Uses an integer (HUD color ID), so go check the wiki.
PlayerListTag = This shared variable is used to give players a crew/clan tag next to their name in the list. Setting this value to more than 5 characters isn't recommended since the scaleform displays up to 5 characters. (deprecated in 2.0)
Crew Tag API (Serverside - v2.0 and above)
// Sets the crew tag of a player. // "tag" being empty will reset player's crew tag. // "tag" should not be more than 4 or 5 characters to prevent visual annoyances player.setCrewTag(tag, { crewIsPrivate, // Boolean - makes the crew tag background a rectangle if true, indicates player owned clans crewIsRockstar, // Boolean - adds the Rockstar Games logo to the crew tag display if true playerCrewRank, // Number - player's rank in their crew, refer to crew ranks list below, ignored if crewIsPrivate is false crewTagColor // Array of numbers (red, green, blue) - the crew color }); // Resets the crew tag of a player. player.resetCrewTag(); // Crew ranks Leader = 0 (100% crew color "strip" display) Commissioner = 1 (80% crew color "strip" display) Lieutenant = 2 (60% crew color "strip" display) Representative = 3 (40% crew color "strip" display) Muscle = 4 (20% crew color "strip" display) Member = 5 (no crew color "strip" display)
Various crew tags:
Credits
TomGrobbe - mp_mm_card_freemode scaleform research
@rgnbgnhnd @Jer - Testing
Notes
This script uses mp.gui.chat.show function to toggle chat visibility when a player opens/closes the player list. Meaning if you have a custom chat, this resource might fail to toggle chat visibility.
Source code is available on GitHub in case you don't want to download: https://github.com/root-cause/ragemp-playerlist
854 downloads
(6 reviews)0 comments
Updated
-
Kill Feed
By rootcause
Simple kill feed script that displays recent deaths on the server.
Installing
Put the files you downloaded in their respective places Add require('killfeed') to client_packages/index.js All done
Notes
Even though this is a kill feed script, you can send other messages to players by passing a string (your message) to pushToKillFeed event. The kill feed is located below the ammo counter HUD element. The kill feed displays 5 items (variable: maxKillFeedItems) and will display an item for 30 seconds. (variable: killFeedItemRemoveTime) Not all death reasons are detected but weaponData.json covers most cases. Default kill feed font might not support all characters.846 downloads
-
[Real 3D] Server-side Sound API
By fakeskill
Description:
This resources provides the ability to create/control sound in 3D via custom API.
A slightly redesigned version of the Sound API, with real synced 3d effect.
API:
// Client-side mp.game.audio.playSound3D(veh_id, url, range, volume, track_length) /* * veh_id: int(Required) [Vehicle RemoteID] * url: string (Required) [Links and local package:// protocol are supported] * range: int (Optional, Default: 60) * volume: int (Optional, Default: 1) [Range: 0 to 1] * track_length: int (Optional, Default: 180) [Current track length in seconds] */ /// EVENTS: // (Client) /* * EventName: audioFinish * params: soundID (Vehicle's RemoteID that is finished Playing) */ /* * EventName: audioError * params: soundID (Vehicle's RemoteID that had error), errorObject {code: 'error code', error: 'error description'} */ // (Server) /* * EventName: sound:create * params: id, (Vehicle's RemoteID) url, range, volume, track_length */ /* * EventName: sound:destroy * params: id (Vehicle's RemoteID) */ /* * EventName: sound:pause * params: id (Vehicle's RemoteID) */ /* * EventName: sound:resume * params: id (Vehicle's RemoteID) */ /* * EventName: sound:setVolume * params: id (Vehicle's RemoteID), volume */ // Example let vehicleId = mp.players.local.vehicle.remoteId; mp.game.audio.playSound3D(vehicleId, 'http://rfcmedia.streamguys1.com/MusicPulse.mp3', 20, 1, 60); mp.events.callRemote('sound:pause', vehicleId); mp.events.callRemote('sound:resume', vehicleId); mp.events.callRemote('sound:destroy', vehicleId); If you have any issues or suggestions, you know the usual routine.
Credits:
- Thanks to Captien for his 3D sound API.
Media:
828 downloads
(4 reviews)0 comments
Updated
-
Helicam
By GL1TCH1337
This script provides working helicam which has 3 different modes (normal, thermal, night vision), plate recognition system and zoom feature. I have used this script on my own server and never experienced an issue but since I have extracted it from my own gamemode, if you come across a issue, post a comment below, I will try to fix things.
Usage
Right Mouse Button: Changes mode (normal, thermal, night vision) Space: Locks to a vehicle and shows its plate and model. Installing
Put the files you downloaded in their respective places Add require('helicam') to client_packages/index.js Call "enablehelicam" event from serverside or via keydown event. Credits
davwheat - FiveM version of this script.
823 downloads
-
BanAPI
By rootcause
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()
822 downloads
-
Timer Bars
By rootcause
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;
817 downloads
