MelloTrainer
A FiveM (GTA5 Modded Multiplayer) Trainer Made by TheStonedTurtle. This is a server-side trainer written in Lua with a NUI written with HTML, CSS, and JS.
Installation
- Drag and drop the mellotrainer folder into the resources folder of your server.
- Add start mellotrainer to your server.cfg file.
- Restart your server.
Note
As of v0.4.0, players are required to be logged into the Steam client in order for the new vehicle/skin save system to work.
Controls
Key | Action |
F1 | Open/Close the trainer |
Arrow Keys | Move up,down,left, and right respectively. |
Enter | Select the current trainer option |
Backspace | Go back to the previous menu |
F2 | Toggle No-Clip Mode |
F3 | Teleport to Current Way Point |
Z | Toggle Between Big & Small Minimap |
No Clip Controls
Key | Action |
F2 | Toggle No-Clip Mode |
Shift | Switch No-Clip Movement Speed |
Q | Move Upwards |
Z | Move Downwards |
W | Move Forwards |
S | Move Backwards |
A | Rotate Left |
D | Rotate Right |
Features
- Admin Menu w/ Working Permissions
- Admin Only Trainer Options (Time/Weather, syncs with online players)
- General Settings (Map Blips, Player Blips, Overhead Names, etc)
- Online Players Menu w/ Spectate & Teleport Option
- Player Death Messages
- Player Join/Leave Notifications
- Player Skin Changing and Customization
- Player Skin Save & Load System
- Player Toggle Options (God Mode, ETC)
- Vehicle Spawning & Spawning Options
- Vehicle Customization and Modifications
- Vehicle Save & Load System
- Weapon Spawning
- Weapon Attachments/Infinite ammo
- Voice Overlay & Options (Proximity/Channel/Toggle)
- Noclip Abilities with Admin Only Toggle
Credits:
Development Information:
This section is only intended for people with LUA experience and a basic understanding of JSON/HTML Attributes. The below information should be used to help understand what every attribute does and how to add new dynamic menus and option using them.
Trainer Option Attributes:
Attribute | Explanation |
data-action | The action to callback to lua via a NUICallback. Space delimited values with the first value being the name of the NUICallback. |
data-hover | Exact same as data-action but this triggers when they change to the option instead of selecting the option. |
data-state | Holds a "ON"/"OFF" value for toggle options. |
data-toggle | Global boolean lua variable to sync data-state with. |
data-sub | ID of the new menu to show when selected. |
data-share | Information to share with the sub menu action options.(won't do anything unless data-sub is also specified) |
data-shareid | Updates the submenu ID to this if it exists. Useful for ensuring that a menu that is used my multiple different options will return to the correct place within the trainer. |
data-require | Used for permission checks for data-action and data-sub events. See Below |
Trainer Div Attributes:
Attribute | Explanation |
data-container | Prevents this div from being turned into a menu by JS. |
data-parent | The ID of the parent element so if they try to go back |
data-staticmenu | A menu that will be created from static JSON by JS. This will require updating JS so it is recommended you use data-dynamicmenu instead. |
data-dynamicmenu | Holds the name of the NUI Callback that will return a JSON object to populate the current menu with (includes sub menus). See JSON format below. |
data-sharedinfo | Usually added by JS from the data-share attribute of the option. This information will be appended to the end of every data-action and data-hover when requested. |
JSON/Table Format
{
"menuName": "Example Text",
"data": {
"action": "String",
"sub": "String",
"state": "String"
},
"submenu": []
}
Atribute | Explanation |
---|
menuName |
The text to show in the menu |
data |
An object containg key value pairs for all data-* attributes to be added to new menu option |
submenu |
An Array of of objects that are formatted in the exact same way as the current object. Used for creating linked sub menus. |
JSON Editing
I created a website hosted on my github.io pages for editing the Mello Trainer JSON. It is not the best website and may have performance issues but it accomplishes the required task. Please read the above JSON information before trying/asking questions about this editor.
TheStonedTurtle.github.io
Custom Privileges
To create custom privileges within mello trainer using data-require you can follow the below template. This works for data-action and data-sub but does not support data-hover events. Note: This can be done without triggering a server event.
Client.lua
Add the below to any client lua file.
```
-- Request Cop Status
RegisterNUICallback("requirecop", function(data, cb)
TriggerServerEvent("mellotrainer:requestCopStatus")
end)
-- Recieve Cop Status
RegisterNetEvent("mellotrainer:copstatus")
AddEventHandler("mellotrainer:copstatus", function(status)
if(status)then
SendNUIMessage({customprivilegecheck = true})
else
drawNotification("~r~Permission Denied!")
end
end)
```
Server.lua
Add the below to any server lua file.
```
RegisterServerEvent('mellotrainer:requestCopStatus')
AddEventHandler('mellotrainer:requestCopStatus', function(id)
local result = false
-- Logic to check if they are a cop here
TriggerClientEvent("mellotrainer:copstatus",source,result)
end)
```