Firecul / mellotrainer

A FiveM server side trainer
MIT License
2 stars 2 forks source link

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

  1. Drag and drop the mellotrainer folder into the resources folder of your server.
  2. Add start mellotrainer to your server.cfg file.
  3. 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

KeyAction
F1Open/Close the trainer
Arrow KeysMove up,down,left, and right respectively.
EnterSelect the current trainer option
BackspaceGo back to the previous menu
F2Toggle No-Clip Mode
F3Teleport to Current Way Point
ZToggle Between Big & Small Minimap

No Clip Controls

KeyAction
F2Toggle No-Clip Mode
ShiftSwitch No-Clip Movement Speed
QMove Upwards
ZMove Downwards
WMove Forwards
SMove Backwards
ARotate Left
DRotate Right

Features

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:

AttributeExplanation
data-actionThe action to callback to lua via a NUICallback. Space delimited values with the first value being the name of the NUICallback.
data-hoverExact same as data-action but this triggers when they change to the option instead of selecting the option.
data-stateHolds a "ON"/"OFF" value for toggle options.
data-toggleGlobal boolean lua variable to sync data-state with.
data-subID of the new menu to show when selected.
data-shareInformation to share with the sub menu action options.(won't do anything unless data-sub is also specified)
data-shareidUpdates 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-requireUsed for permission checks for data-action and data-sub events. See Below

Trainer Div Attributes:

AttributeExplanation
data-containerPrevents this div from being turned into a menu by JS.
data-parentThe ID of the parent element so if they try to go back
data-staticmenuA 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-dynamicmenuHolds 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-sharedinfoUsually 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": []
}

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) ```
AtributeExplanation
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.