From a1d4d8623f83b2ad65877deddee77a54e79585c3 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 23 Aug 2017 14:38:35 +0100 Subject: [PATCH] 0.4.5 (#3) * Beta * SNS Pistol Fix * changelog start * Added version check * Updated version-check.lua * Added directory check to data-saving,lua, also some cleaning up * Version Check Cleanup * Local Saving Toggle System * Spacing and other shit * Cleaned up warning message * Organised sokme fules, added steam only config option * Organised all of the files * Missed some files, woops * Cleaned up config * Changed client_script to client_scripts * Noclip File Rough Draft * Noclip Basic * Copyrights/Delete License * Create LICENSE * Basic Noclip Working * Time Crash Fix * Fixed startup wait and sent saving config setting to client * Added change speed to noclip (LSHIFT) * Cleaned up cl_noclip.lua * Fixed data saving toggle * Fixed my noclip mistake, change down key to Z * Added basic kick, started world menu * Rough ban mockup (needs work) * Added temp ban, changed DATASAVE:GetSteamId * Started cl_world.lua * Fixed kick and ban * Changed keys due to conflicts with controller Teleport to waypoint is now F7 Noclip mode is now F8 * I'm a doughnut * Potential controller confliction fix? F1 - open trainer F2 - Noclip F3 - Teleport to waypoint * Fixed controller confliction! * Added gradient, modified colours * Updated changelog * Revert "Added gradient, modified colours" This reverts commit 1f7ecfd13fd9dd5207b49814143f448562f19d97. * WolfKnight's Modified CSS Updates The Gradient was too bright * v 0.4.5 * Readme & Changelog Update * Noclip Menu Created new JS events (resettrainer and removeSelectedClass) globalized the `showtrainer` variable to help with noclip menu * Admin Only Noclip Toggle * adminStatus fix * Remove Toggle Notification * v0.4.5 * v0.4.5 file structure --- Changelog.md | 26 ++ LICENSE | 2 +- README.md | 47 +++- mellotrainer/__resource.lua | 44 ++-- mellotrainer/{admin.lua => cl_admin.lua} | 159 ++++++++++++- mellotrainer/{general.lua => cl_general.lua} | 38 ++- mellotrainer/{map.lua => cl_map.lua} | 24 +- mellotrainer/cl_noclip.lua | 223 ++++++++++++++++++ mellotrainer/{player.lua => cl_player.lua} | 24 +- ...player-online.lua => cl_player_online.lua} | 23 +- .../{player-skin.lua => cl_player_skin.lua} | 24 +- .../{settings.lua => cl_settings.lua} | 24 +- ...ions.lua => cl_settings_notifications.lua} | 23 +- ...ttings-voice.lua => cl_settings_voice.lua} | 24 +- mellotrainer/{utils.lua => cl_utils.lua} | 19 ++ .../{variables.lua => cl_variables.lua} | 24 +- .../{vehicles.lua => cl_vehicles.lua} | 24 +- mellotrainer/{weapons.lua => cl_weapons.lua} | 24 +- mellotrainer/cl_world.lua | 36 +++ mellotrainer/data-saving.lua | 161 ------------- mellotrainer/nui/trainer.css | 9 +- mellotrainer/nui/trainer.html | 30 ++- mellotrainer/nui/trainer.js | 16 +- .../{admin-server.lua => sv_admin.lua} | 59 ++++- mellotrainer/{config.lua => sv_config.lua} | 85 ++++++- mellotrainer/sv_data_saving.lua | 220 +++++++++++++++++ mellotrainer/sv_main.lua | 51 ++++ 27 files changed, 1168 insertions(+), 295 deletions(-) rename mellotrainer/{admin.lua => cl_admin.lua} (55%) rename mellotrainer/{general.lua => cl_general.lua} (83%) rename mellotrainer/{map.lua => cl_map.lua} (97%) create mode 100644 mellotrainer/cl_noclip.lua rename mellotrainer/{player.lua => cl_player.lua} (92%) rename mellotrainer/{player-online.lua => cl_player_online.lua} (92%) rename mellotrainer/{player-skin.lua => cl_player_skin.lua} (95%) rename mellotrainer/{settings.lua => cl_settings.lua} (94%) rename mellotrainer/{settings-notifications.lua => cl_settings_notifications.lua} (90%) rename mellotrainer/{settings-voice.lua => cl_settings_voice.lua} (80%) rename mellotrainer/{utils.lua => cl_utils.lua} (77%) rename mellotrainer/{variables.lua => cl_variables.lua} (92%) rename mellotrainer/{vehicles.lua => cl_vehicles.lua} (98%) rename mellotrainer/{weapons.lua => cl_weapons.lua} (91%) create mode 100644 mellotrainer/cl_world.lua delete mode 100644 mellotrainer/data-saving.lua rename mellotrainer/{admin-server.lua => sv_admin.lua} (51%) rename mellotrainer/{config.lua => sv_config.lua} (57%) create mode 100644 mellotrainer/sv_data_saving.lua create mode 100644 mellotrainer/sv_main.lua diff --git a/Changelog.md b/Changelog.md index 01e5c84..5e1f3ea 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,29 @@ +

v0.4.5 (08-22-2017)

+New Noclip Mode, Admin kick & temp ban, and some bug fixes. + +

Changes

+ + +

Additions

+ + + + +

v0.4.0 (08-15-2017)

New vehicle and skin saving system, a few bug fixes. diff --git a/LICENSE b/LICENSE index b42ccfd..3a9c8c2 100644 --- a/LICENSE +++ b/LICENSE @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.md b/README.md index fb677b5..5f683fc 100644 --- a/README.md +++ b/README.md @@ -18,26 +18,51 @@ As of v0.4.0, players are required to be logged into the Steam client in order f - + + + + +
KeyAction
F6Open/Close the trainer
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
+ + + +

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

diff --git a/mellotrainer/__resource.lua b/mellotrainer/__resource.lua index a5fee76..1681312 100644 --- a/mellotrainer/__resource.lua +++ b/mellotrainer/__resource.lua @@ -13,29 +13,25 @@ files { "nui/Roboto-Black.ttf" } -client_script 'utils.lua' - -client_scripts { - "variables.lua", -- Create all default variables. - "general.lua", -- User Managment/Trainer Controls/Global Functions - "map.lua", -- Map Blips. - "player.lua", -- Player Toggles & Options - "settings.lua", -- General Settings (Player Blips etc) - "settings-voice.lua", -- Handles all voice-chat related settings - "settings-notifications.lua", -- Handles Player & Death Notifications - "player-skin.lua", -- Player Skins & Props - "player-online.lua", -- Other Player Options (Teleport/Spectate) - "vehicles.lua", -- Vehicle Spawning/Modifications - "weapons.lua", -- Weapon Spawning/Attachments - "admin.lua" -- Handles Admin Menu Access & Options +client_scripts { + 'cl_utils.lua', -- Clientsided utilites. + 'cl_variables.lua', -- Create all default variables. + 'cl_general.lua', -- User Managment/Trainer Controls/Global Functions + 'cl_map.lua', -- Map Blips. + 'cl_player.lua', -- Player Toggles & Options + 'cl_settings.lua', -- General Settings (Player Blips etc) + 'cl_settings_voice.lua', -- Handles all voice-chat related settings + 'cl_settings_notifications.lua', -- Handles Player & Death Notifications + 'cl_player_skin.lua', -- Player Skins & Props + 'cl_player_online.lua', -- Other Player Options (Teleport/Spectate) + 'cl_vehicles.lua', -- Vehicle Spawning/Modifications + 'cl_weapons.lua', -- Weapon Spawning/Attachments + 'cl_admin.lua', -- Handles Admin Menu Access & Options + 'cl_noclip.lua', -- Handles all No Clip features + 'cl_world.lua' -- World stuff, teleportation } - - -server_script 'config.lua' -server_script 'data-saving.lua' - - -server_scripts{ - "admin-server.lua" -- Handles Cross-Player Admin Commands -} \ No newline at end of file +server_script 'sv_config.lua' -- MelloTrainer config file +server_script 'sv_main.lua' -- Main serversided file +server_script 'sv_data_saving.lua' -- Data saving system +server_script 'sv_admin.lua' -- Handles Cross-Player Admin Commands \ No newline at end of file diff --git a/mellotrainer/admin.lua b/mellotrainer/cl_admin.lua similarity index 55% rename from mellotrainer/admin.lua rename to mellotrainer/cl_admin.lua index 272e732..d70ed17 100644 --- a/mellotrainer/admin.lua +++ b/mellotrainer/cl_admin.lua @@ -1,8 +1,144 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] + + +--[[------------------------------------------------------------------------ + Player Management +------------------------------------------------------------------------]]-- +function GetNetworkPlayers() + local players = {} + + for i = 0, 31 do + if ( NetworkIsPlayerActive( i ) ) then + table.insert( players, i ) + end + end + + if ( next( players ) == nil ) then return nil else return players end +end + +--[[ function GeneratePlayerBans( id ) + local bans = { 0.016667, 0.085, 0.17, 0.25, 0.5, 1, 2, 3, 4, 5, 8, 10, 15, 20, 30, 40, 60, 120, 240, 480 } + local options = {} + + for k, v in pairs( bans ) do + local option = { + [ "menuName" ] = tostring( v ) .. " hours", + [ "data" ] = { + [ "action" ] = "adminban " .. id .. " " .. v + } + } + + table.insert( options, option ) + end + + return options +end ]]-- + +function GeneratePlayerAdminMenus( id ) + local serverid = GetPlayerServerId( id ) + + local kick = { + [ "menuName" ] = "Kick", + [ "data" ] = { + [ "action" ] = "adminkick " .. serverid + } + } + + local kick_reason = { + [ "menuName" ] = "Kick (specify reason)", + [ "data" ] = { + [ "action" ] = "adminkick input " .. serverid + } + } + + local temp_ban = { + [ "menuName" ] = "Temp Ban", + [ "data" ] = { + [ "action" ] = "admintempban " .. serverid + } + } + + --[[ local banOptions = GeneratePlayerBans( serverid ) + local ban = { + [ "menuName" ] = "Ban", + [ "data" ] = { + [ "sub" ] = 3 + }, + [ "submenu" ] = banOptions + } ]]-- + + local options = { kick, kick_reason, temp_ban } + + return options +end + +RegisterNUICallback( "playermanagement", function( data, cb ) + local players = GetNetworkPlayers() + local validOptions = {} + + for k, v in pairs( players ) do + local playerOptions = GeneratePlayerAdminMenus( v ) + + table.insert( validOptions, { + [ "menuName" ] = GetPlayerName( v ), + [ "data" ] = { + [ "sub" ] = GetPlayerServerId( v ) + }, + [ "submenu" ] = playerOptions + } ) + end + + local customJSON = "{}" + + if ( getTableLength( validOptions ) > 0 ) then + customJSON = json.encode( validOptions, { indent = true } ) + end + + SendNUIMessage( { + createmenu = true, + menuName = "playermanagement", + menudata = customJSON + } ) + + if ( cb ) then cb( "ok" ) end +end ) + +RegisterNUICallback( "adminkick", function( data, cb ) + if ( data.action == "input" ) then + local id = tonumber( data.data[3] ) + local reason = requestInput( "", 60 ) + + if ( reason ) then + TriggerServerEvent( 'mellotrainer:adminKick', id, "Kicked: " .. reason ) + end + else + local id = tonumber( data.action ) + + TriggerServerEvent( 'mellotrainer:adminKick', id, "Kicked: You have been kicked from the server." ) + end +end ) + +RegisterNUICallback( "admintempban", function( data, cb ) + local id = tonumber( data.action ) + TriggerServerEvent( 'mellotrainer:adminTempBan', id ) +end ) -- _______ _ ____ _ _ @@ -16,13 +152,21 @@ -- Forward one hour function getForwardTime() - return {h=GetClockHours() + 1,m= GetClockMinutes(),s=GetClockSeconds()} + local hour = GetClockHours() + 1 + if(hour == 24)then + hour = 0 + end + return {h=hour,m=GetClockMinutes(),s=GetClockSeconds()} end -- Back one hour function getReverseTime() - return {h=GetClockHours() - 1,m= GetClockMinutes(),s=GetClockSeconds()} + local hour = GetClockHours() - 1 + if(hour < 0)then + hour = 23 + end + return {h=hour,m=GetClockMinutes(),s=GetClockSeconds()} end @@ -184,7 +328,6 @@ Citizen.CreateThread(function() if NetworkIsSessionStarted() then TriggerServerEvent( "mellotrainer:firstJoinProper", PlayerId() ) - TriggerServerEvent( 'wk:AddPlayerToDataSave' ) return end end diff --git a/mellotrainer/general.lua b/mellotrainer/cl_general.lua similarity index 83% rename from mellotrainer/general.lua rename to mellotrainer/cl_general.lua index b408683..dd7f155 100644 --- a/mellotrainer/general.lua +++ b/mellotrainer/cl_general.lua @@ -1,8 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] local settings = {} @@ -115,7 +128,7 @@ Citizen.CreateThread(function() end) -- should the trainer be shown? -local showtrainer = false +showtrainer = false -- Constantly check for trainer movement. @@ -123,24 +136,27 @@ Citizen.CreateThread( function() while true do Citizen.Wait( 0 ) - if ( IsControlJustReleased( 1, 167 ) or IsDisabledControlJustReleased( 1, 167 ) ) and not IsPauseMenuActive() and not blockinput and ((settings["adminOnlyTrainer"] == true and adminStatus == true) or settings["adminOnlyTrainer"] == false) then -- f6 - if not showtrainer then - showtrainer = true + if ( IsControlJustReleased( 0, 288 ) or IsDisabledControlJustReleased( 0, 288 ) ) and GetLastInputMethod( 0 ) and not IsPauseMenuActive() and not blockinput and ((settings["adminOnlyTrainer"] == true and adminStatus == true) or settings["adminOnlyTrainer"] == false) then -- f6 + showtrainer = not showtrainer + if showtrainer then SendNUIMessage({ showtrainer = true }) else - showtrainer = false SendNUIMessage({ hidetrainer = true }) end end - if IsControlJustReleased(1, 170) and not blockinput and ((settings["adminOnlyTrainer"] == true and adminStatus == true) or settings["adminOnlyTrainer"] == false) then -- f3 + if ( IsControlJustReleased( 0, 170 ) or IsDisabledControlJustReleased( 0, 170 ) ) and GetLastInputMethod( 0 ) and not blockinput and ((settings["adminOnlyTrainer"] == true and adminStatus == true) or settings["adminOnlyTrainer"] == false) then -- f3 teleportToWaypoint() end + if ( IsControlJustReleased( 0, 289 ) or IsDisabledControlJustReleased( 0, 289 ) ) and GetLastInputMethod( 0 ) and ((settings["adminOnlyNoclip"] == true and adminStatus == true) or settings["adminOnlyNoclip"] == false) then + toggleNoClipMode() + end + if showtrainer and not blockinput then if ( IsControlJustPressed( 1, 199 ) or IsControlJustPressed( 1, 200 ) ) then showtrainer = false diff --git a/mellotrainer/map.lua b/mellotrainer/cl_map.lua similarity index 97% rename from mellotrainer/map.lua rename to mellotrainer/cl_map.lua index 81a3f68..2ea7582 100644 --- a/mellotrainer/map.lua +++ b/mellotrainer/cl_map.lua @@ -1,9 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. - +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] function createAllMapBlips() open1 = AddBlipForCoord(2448.48, 4977.57, 57.4330); diff --git a/mellotrainer/cl_noclip.lua b/mellotrainer/cl_noclip.lua new file mode 100644 index 0000000..bfc85d3 --- /dev/null +++ b/mellotrainer/cl_noclip.lua @@ -0,0 +1,223 @@ +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * + * Credits to @Oui (Lambda Menu). Converted by @TheStonedTurtle +---------------------------------------------------------------------------]] + + +-- Animation Variables +local loadedAnims = false +local noclip_ANIM_A = "amb@world_human_stand_impatient@male@no_sign@base" +local noclip_ANIM_B = "base" + +-- Noclip Variables +local in_noclip_mode = false +local travelSpeed = 4 +local curLocation +local curRotation +local curHeading +local target + +function createNoClipMenuOptions() + local options = {"Noclip Toggle: F2","W = Move Forward","S = Move Backwards","A = Rotate Left","D = Rotate Right","Q = Move Upwards","Z = Move Downwards","Shift = Change Speed"} + local speeds = { "Slowest", "Slower", "Slow", "Normal", "Fast", "Faster", "Fastest" } + local menuOpts = {} + for index,value in pairs(options)do + local item = {["menuName"] = value} + table.insert(menuOpts, 1, item) + end + + local curSpeed = {["menuName"] = "Current Speed = "..(speeds[travelSpeed] or "NA")} + table.insert(menuOpts, 1, curSpeed) + + return menuOpts +end + +function refreshNoClipMenu() + local menuOpts = createNoClipMenuOptions() + local customJSON = json.encode( menuOpts, { indent = true } ) + + SendNUIMessage({ + showtrainer = true, -- Refreshes the trainer/ensures its visible. + createmenu = true, + menuName = "noclipmenu", + menudata = customJSON, + removeSelectedClass = true + }) + showtrainer = true -- Sync state with cl_general.lua +end + + +function toggleNoClipMode() + if(in_noclip_mode)then + turnNoClipOff() + else + turnNoClipOn() + end +end + +function turnNoClipOff() + local playerPed = PlayerPedId() + local inVehicle = IsPedInAnyVehicle( playerPed, false ) + + if ( inVehicle ) then + local veh = GetVehiclePedIsUsing( playerPed ) + SetEntityInvincible( veh, false ) + else + ClearPedTasksImmediately( playerPed ) + end + + SetUserRadioControlEnabled( true ) + SetPlayerInvincible( PlayerId(), false ) + SetEntityInvincible( target, false ) + + in_noclip_mode = false + + SendNUIMessage({ + resettrainer = true + }) + + showtrainer = false -- Sync state with cl_general.lua + blockinput = false -- Allow Trainer Access Again +end + +function turnNoClipOn() + blockinput = true -- Prevent Trainer access while in noclip mode. + local playerPed = PlayerPedId() + local inVehicle = IsPedInAnyVehicle( playerPed, false ) + + if ( not inVehicle ) then + _LoadAnimDict( noclip_ANIM_A ) + loadedAnims = true + end + + -- Update starting position for noclip + local x, y, z = table.unpack( GetEntityCoords( playerPed, false ) ) + curLocation = { x = x, y = y, z = z } + curRotation = GetEntityRotation( playerPed, false ) + curHeading = GetEntityHeading( playerPed ) + + in_noclip_mode = true + refreshNoClipMenu() +end + +-- Credits to @Oui (Lambda Menu) +function degToRad( degs ) + return degs * 3.141592653589793 / 180 +end + +-- Handles all No Clipping. +Citizen.CreateThread( function() + local rotationSpeed = 2.5 + local forwardPush = 1.8 + + local speeds = { 0.05, 0.2, 0.8, 1.8, 3.6, 5.4, 15.0 } + + local moveUpKey = 44 -- Q + local moveDownKey = 20 -- Z + local moveForwardKey = 32 -- W + local moveBackKey = 33 -- S + local rotateLeftKey = 34 -- A + local rotateRightKey = 35 -- D + local changeSpeedKey = 21 -- LSHIFT + + -- Sync Forward Push with Travel Speed. Only called when travelSpeed is updated. + function updateForwardPush() + forwardPush = speeds[ travelSpeed ] + + refreshNoClipMenu() + end + + -- Updates the players position + function handleMovement(xVect,yVect) + if ( IsControlJustPressed( 1, changeSpeedKey ) or IsDisabledControlJustPressed( 1, changeSpeedKey ) ) then + travelSpeed = travelSpeed + 1 + + if ( travelSpeed > getTableLength(speeds) ) then + travelSpeed = 1 + end + + updateForwardPush(); + end + + if ( IsControlPressed( 1, moveUpKey ) or IsDisabledControlPressed( 1, moveUpKey ) ) then + curLocation.z = curLocation.z + forwardPush / 2 + elseif ( IsControlPressed( 1, moveDownKey ) or IsDisabledControlPressed( 1, moveDownKey ) ) then + curLocation.z = curLocation.z - forwardPush / 2 + end + + if ( IsControlPressed( 1, moveForwardKey ) or IsDisabledControlPressed( 1, moveForwardKey ) ) then + curLocation.x = curLocation.x + xVect + curLocation.y = curLocation.y + yVect + elseif ( IsControlPressed( 1, moveBackKey ) or IsDisabledControlPressed( 1, moveBackKey ) ) then + curLocation.x = curLocation.x - xVect + curLocation.y = curLocation.y - yVect + end + + if ( IsControlPressed( 1, rotateLeftKey ) or IsDisabledControlPressed( 1, rotateLeftKey ) ) then + curHeading = curHeading + rotationSpeed + elseif ( IsControlPressed( 1, rotateRightKey ) or IsDisabledControlPressed( 1, rotateRightKey ) ) then + curHeading = curHeading - rotationSpeed + end + end + + while true do + Citizen.Wait( 0 ) + + if ( in_noclip_mode ) then + local playerPed = PlayerPedId() + + if ( IsEntityDead( playerPed ) ) then + turnNoClipOff() + + -- Ensure we get out of noclip mode + Citizen.Wait( 100 ) + else + target = playerPed + + -- Handle Noclip Movement. + local inVehicle = IsPedInAnyVehicle( playerPed, true ) + + if ( inVehicle ) then + target = GetVehiclePedIsUsing( playerPed ) + end + + SetEntityVelocity( playerPed, 0.0, 0.0, 0.0 ) + SetEntityRotation( playerPed, 0, 0, 0, 0, false ) + + -- Prevent Conflicts/Damage + SetUserRadioControlEnabled( false ) + SetPlayerInvincible( PlayerId(), true ) + SetEntityInvincible( target, true ) + + -- Play animation on foot. + if ( not inVehicle ) then + TaskPlayAnim( playerPed, noclip_ANIM_A, noclip_ANIM_B, 8.0, 0.0, -1, 9, 0, 0, 0, 0 ) + end + + local xVect = forwardPush * math.sin( degToRad( curHeading ) ) * -1.0 + local yVect = forwardPush * math.cos( degToRad( curHeading ) ) + + handleMovement( xVect, yVect ) + + -- Update player postion. + SetEntityCoordsNoOffset( target, curLocation.x, curLocation.y, curLocation.z, true, true, true ) + SetEntityHeading( target, curHeading - rotationSpeed ) + end + end + end +end ) \ No newline at end of file diff --git a/mellotrainer/player.lua b/mellotrainer/cl_player.lua similarity index 92% rename from mellotrainer/player.lua rename to mellotrainer/cl_player.lua index fd35c9a..d78e694 100644 --- a/mellotrainer/player.lua +++ b/mellotrainer/cl_player.lua @@ -1,9 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. - +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] diff --git a/mellotrainer/player-online.lua b/mellotrainer/cl_player_online.lua similarity index 92% rename from mellotrainer/player-online.lua rename to mellotrainer/cl_player_online.lua index 698fff5..ef6a20f 100644 --- a/mellotrainer/player-online.lua +++ b/mellotrainer/cl_player_online.lua @@ -1,8 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] local drawRouteTarget = nil diff --git a/mellotrainer/player-skin.lua b/mellotrainer/cl_player_skin.lua similarity index 95% rename from mellotrainer/player-skin.lua rename to mellotrainer/cl_player_skin.lua index 01def99..978390a 100644 --- a/mellotrainer/player-skin.lua +++ b/mellotrainer/cl_player_skin.lua @@ -1,9 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. - +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] -- Skin DB local components = { diff --git a/mellotrainer/settings.lua b/mellotrainer/cl_settings.lua similarity index 94% rename from mellotrainer/settings.lua rename to mellotrainer/cl_settings.lua index 4bb95fc..674bff3 100644 --- a/mellotrainer/settings.lua +++ b/mellotrainer/cl_settings.lua @@ -1,9 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. - +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] --Not Needed? --require("map.lua") -- Require map.lua so we can call the toggleMapBlips function. diff --git a/mellotrainer/settings-notifications.lua b/mellotrainer/cl_settings_notifications.lua similarity index 90% rename from mellotrainer/settings-notifications.lua rename to mellotrainer/cl_settings_notifications.lua index cec9af2..8b772b1 100644 --- a/mellotrainer/settings-notifications.lua +++ b/mellotrainer/cl_settings_notifications.lua @@ -1,8 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] local selfDeathMessage = "~o~You ~s~died." local deathSuicideMessage = "~o~You ~s~commited suicide." diff --git a/mellotrainer/settings-voice.lua b/mellotrainer/cl_settings_voice.lua similarity index 80% rename from mellotrainer/settings-voice.lua rename to mellotrainer/cl_settings_voice.lua index dc9e868..633eb60 100644 --- a/mellotrainer/settings-voice.lua +++ b/mellotrainer/cl_settings_voice.lua @@ -1,9 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. - +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] -- Update voice feature variables function updateVoiceDistanceVariables(distance) diff --git a/mellotrainer/utils.lua b/mellotrainer/cl_utils.lua similarity index 77% rename from mellotrainer/utils.lua rename to mellotrainer/cl_utils.lua index 8359684..6cede97 100644 --- a/mellotrainer/utils.lua +++ b/mellotrainer/cl_utils.lua @@ -1,3 +1,22 @@ +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] + function _LoadAnimDict( dict ) while ( not HasAnimDictLoaded( dict ) ) do RequestAnimDict( dict ) diff --git a/mellotrainer/variables.lua b/mellotrainer/cl_variables.lua similarity index 92% rename from mellotrainer/variables.lua rename to mellotrainer/cl_variables.lua index 3d9951b..21aa4be 100644 --- a/mellotrainer/variables.lua +++ b/mellotrainer/cl_variables.lua @@ -1,8 +1,22 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] + -- _____ __ _ _ __ __ _ _ _ -- | __ \ / _| | | | \ \ / / (_) | | | | diff --git a/mellotrainer/vehicles.lua b/mellotrainer/cl_vehicles.lua similarity index 98% rename from mellotrainer/vehicles.lua rename to mellotrainer/cl_vehicles.lua index 3b93928..6ef71cd 100644 --- a/mellotrainer/vehicles.lua +++ b/mellotrainer/cl_vehicles.lua @@ -1,9 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. - +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] local function _SetEntityAsNoLongerNeeded(entity) Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(entity)) diff --git a/mellotrainer/weapons.lua b/mellotrainer/cl_weapons.lua similarity index 91% rename from mellotrainer/weapons.lua rename to mellotrainer/cl_weapons.lua index 617d71c..1285add 100644 --- a/mellotrainer/weapons.lua +++ b/mellotrainer/cl_weapons.lua @@ -1,9 +1,21 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. - +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] local playerPed = GetPlayerPed(-1) diff --git a/mellotrainer/cl_world.lua b/mellotrainer/cl_world.lua new file mode 100644 index 0000000..22ff9f8 --- /dev/null +++ b/mellotrainer/cl_world.lua @@ -0,0 +1,36 @@ +--[[-------------------------------------------------------------------------- + + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + +--------------------------------------------------------------------------]]-- + +local locations = {} + +locations.safeHouses = { + { "Michael's Safehouse", -827.138, 176.368, 70.4999 }, + { "Franklin's Safehouse", -18.0355, -1456.94, 30.4548 }, + { "Franklin's Safehouse 2", 10.8766, 545.654, 175.419 }, + { "Trevor's Safehouse", 1982.13, 3829.44, 32.3662 }, + { "Trevor's Safehouse 2", -1157.05, -1512.73, 4.2127 }, + { "Trevor's Safehouse 3", 91.1407, -1280.65, 29.1353 }, + { "Michael's Safehouse Inside", -813.603, 179.474, 72.1548 }, + { "Franklin's Safehouse Inside", -14.3803, -1438.51, 31.1073 }, + { "Franklin's Safehouse 2 Inside", 7.11903, 536.615, 176.028 }, + { "Trevor's Safehouse Inside", 1972.61, 3817.04, 33.4278 }, + { "Trevor's Safehouse 2 Inside", -1151.77, -1518.14, 10.6327 }, + { "Trevor's Safehouse 3 Inside", 96.1536, -1290.73, 29.2664 } +} + diff --git a/mellotrainer/data-saving.lua b/mellotrainer/data-saving.lua deleted file mode 100644 index 1a62611..0000000 --- a/mellotrainer/data-saving.lua +++ /dev/null @@ -1,161 +0,0 @@ -os.execute( "mkdir mtsaves" ) - -DATASAVE = {} - -DATASAVE.dir = "mtsaves/" - -function DATASAVE:GetSteamId( source ) - local ids = GetPlayerIdentifiers( source ) - - for k, v in pairs( ids ) do - local start = string.sub( v, 1, 5 ) - - if ( start == "steam" ) then - return stringsplit( v, ":" )[2] - end - end - - return nil -end - -function DATASAVE:DoesFileExist( name ) - local dir = self.dir .. name - local file = io.open( dir, "r" ) - - if ( file ~= nil ) then - io.close( file ) - return true - else - return false - end -end - -function DATASAVE:CreateFile( name ) - local dir = self.dir .. name - - local file, err = io.open( dir, 'w' ) - - if ( not file ) then RconPrint( err ) end - - file:write( "{}" ) - file:close() -end - -function DATASAVE:LoadFile( name ) - local dir = self.dir .. name - - local file, err = io.open( dir, 'rb' ) - - if ( not file ) then RconPrint( err ) return nil end - - local contents = file:read( "*all" ) - - contents = json.decode( contents ) - - file:close() - - return contents -end - -function DATASAVE:WriteToFile( name, data, index ) - local dir = self.dir .. name - - local fileTable = self:LoadFile( name ) - - if ( not fileTable ) then return end - - if ( data == nil ) then - table.remove( fileTable, index ) -- table.remove reindexes all values after removing - else - fileTable[index] = data - end - - local fileString = json.encode( fileTable ) - - local file, err = io.open( dir, 'w+' ) - - if ( not file ) then RconPrint( err ) return end - - file:write( fileString ) - file:close() -end - -function DATASAVE:SendSaveData( source ) - local id = DATASAVE:GetSteamId( source ) - - if ( id ~= nil ) then - local vehicleData = {} - local skinData = {} - - local vehFileName = id .. "_vehicles.txt" - local skinFileName = id .. "_skins.txt" - - vehicleData = DATASAVE:LoadFile( vehFileName ) - skinData = DATASAVE:LoadFile( skinFileName ) - - if ( next( vehicleData ) ~= nil ) then - TriggerClientEvent( 'wk:RecieveSavedVehicles', source, vehicleData ) - end - - if ( next( skinData ) ~= nil ) then - TriggerClientEvent( 'wk:RecieveSavedSkins', source, skinData ) - end - else - RconPrint( "MELLOTRAINER: Attempted to load save data for " .. GetPlayerName( source ) .. ", but does not have a steam id.\n" ) - end -end - -RegisterServerEvent( 'wk:AddPlayerToDataSave' ) -AddEventHandler( 'wk:AddPlayerToDataSave', function() - local id = DATASAVE:GetSteamId( source ) - - if ( id ~= nil ) then - local vehFileName = id .. "_vehicles.txt" - local skinFileName = id .. "_skins.txt" - - local exists = DATASAVE:DoesFileExist( vehFileName ) and DATASAVE:DoesFileExist( skinFileName ) - - if ( exists ) then - RconPrint( "MELLOTRAINER: " .. GetPlayerName( source ) .. " has a save file.\n" ) - DATASAVE:SendSaveData( source ) - else - RconPrint( "MELLOTRAINER: " .. GetPlayerName( source ) .. " does not have a save file, creating one.\n" ) - - DATASAVE:CreateFile( vehFileName ) - DATASAVE:CreateFile( skinFileName ) - end - else - RconPrint( "MELLOTRAINER: " .. GetPlayerName( source ) .. " is not connecting with a steam id.\nPlayer will not have the ability to save/load.\n" ) - end -end ) - -RegisterServerEvent( 'wk:DataSave' ) -AddEventHandler( 'wk:DataSave', function( type, data, index ) - local id = DATASAVE:GetSteamId( source ) - - if ( id ~= nil ) then - local file = id .. "_" .. type .. ".txt" - DATASAVE:WriteToFile( file, data, index ) - else - RconPrint( "MELLOTRAINER: " .. GetPlayerName( source ) .. " attempted to save, but does not have a steam id.\n" ) - end -end ) - -function startsWith( string, start ) - return string.sub( string, 1, string.len( start ) ) == start -end - -function stringsplit( inputstr, sep ) - if sep == nil then - sep = "%s" - end - - local t = {} ; i = 1 - - for str in string.gmatch( inputstr, "([^" .. sep .. "]+)" ) do - t[i] = str - i = i + 1 - end - - return t -end \ No newline at end of file diff --git a/mellotrainer/nui/trainer.css b/mellotrainer/nui/trainer.css index c9f94c4..1ad9f3f 100644 --- a/mellotrainer/nui/trainer.css +++ b/mellotrainer/nui/trainer.css @@ -20,7 +20,7 @@ p { color: white; height: 40px; width: 350px; - background: rgba(0, 0, 0, 0.6); + background: rgba(0, 0, 0, 0.75); margin-top: -4px; padding-left: 5px; } @@ -39,7 +39,7 @@ p { } .traineroption.selected { - background: rgba(255, 255, 255, 0.7); + background: rgba(200, 200, 200, 0.95); color: gray; } @@ -98,7 +98,10 @@ p { width: 350px; margin-top: -4px; padding-left: 5px; - background: rgba(0, 0, 128, 0.8); + + background: rgba( 0, 0, 128, 0.95 ); + background: linear-gradient( to bottom, rgba( 0, 0, 255, 1 ), rgba( 0, 0, 128, 0.95 ) ); + text-shadow: 0 0 3px #e04040; justify-content: center; } diff --git a/mellotrainer/nui/trainer.html b/mellotrainer/nui/trainer.html index fc9512d..62cdcb4 100644 --- a/mellotrainer/nui/trainer.html +++ b/mellotrainer/nui/trainer.html @@ -41,6 +41,7 @@

Weapons

Vehicles

+

World

Settings

Admin Menu

About

@@ -856,6 +857,21 @@ + + +
+

Locations

+
+ +
+ +
+ +
+

Player Management

Change Weather

Change Time

- + + +
+
+
@@ -974,6 +995,11 @@

Backwards 1 hour

Specify hour (0-24)

+ + + +
+
-

Mello Trainer v0.4.0

+

Mello Trainer v0.4.5

Made By TheStonedTurtle

Special Thanks To:

WolfKnight

diff --git a/mellotrainer/nui/trainer.js b/mellotrainer/nui/trainer.js index 656b4c2..5d9e636 100644 --- a/mellotrainer/nui/trainer.js +++ b/mellotrainer/nui/trainer.js @@ -103,7 +103,14 @@ $(function() { resetTrainer(); container.show(); playSound("YES"); - } + } + + // Hide Trainer + if (item.resettrainer) { + resetTrainer() + container.hide(); + playSound("NO"); + } // Hide Trainer if (item.hidetrainer) { @@ -241,6 +248,11 @@ $(function() { } + // Remove Selected Class from element. + if(item.removeSelectedClass){ + $(".traineroption").eq(counter).removeClass("selected"); + } + }); }); @@ -1159,7 +1171,7 @@ var vehicle_bicycles = [{ "menuName" : "BMX","data":{"action": "BMX" }},{ "menuN // Weapon Spawning Database -var weaponDB = {"Melee":[{"menuName":"Knife","weaponName":"WEAPON_KNIFE","data":{"sub":0},"weapon":true,"submenu":[]},{"menuName":"Brass Knuckles","weaponName":"WEAPON_KNUCKLE","data":{"sub":1},"weapon":true,"submenu":[{"menuName":"Default","data":{"action":"COMPONENT_KNUCKLE_VARMOD_BASE"}},{"menuName":"Pimp","data":{"action":"COMPONENT_KNUCKLE_VARMOD_PIMP"}},{"menuName":"Ballas","data":{"action":"COMPONENT_KNUCKLE_VARMOD_BALLAS"}},{"menuName":"Dollars","data":{"action":"COMPONENT_KNUCKLE_VARMOD_DOLLAR"}},{"menuName":"Diamond","data":{"action":"COMPONENT_KNUCKLE_VARMOD_DIAMOND"}},{"menuName":"Hate","data":{"action":"COMPONENT_KNUCKLE_VARMOD_HATE"}},{"menuName":"Love","data":{"action":"COMPONENT_KNUCKLE_VARMOD_LOVE"}},{"menuName":"Player","data":{"action":"COMPONENT_KNUCKLE_VARMOD_PLAYER"}},{"menuName":"King","data":{"action":"COMPONENT_KNUCKLE_VARMOD_KING"}},{"menuName":"Vagos","data":{"action":"COMPONENT_KNUCKLE_VARMOD_VAGOS"}}]},{"menuName":"Nightstick","weaponName":"WEAPON_NIGHTSTICK","data":{"sub":2},"weapon":true,"submenu":[]},{"menuName":"Hammer","weaponName":"WEAPON_HAMMER","data":{"sub":3},"weapon":true,"submenu":[]},{"menuName":"Baseball Bat","weaponName":"WEAPON_BAT","data":{"sub":4},"weapon":true,"submenu":[]},{"menuName":"Golf Club","weaponName":"WEAPON_GOLFCLUB","data":{"sub":5},"weapon":true,"submenu":[]},{"menuName":"Crowbar","weaponName":"WEAPON_CROWBAR","data":{"sub":6},"weapon":true,"submenu":[]},{"menuName":"Bottle","weaponName":"WEAPON_BOTTLE","data":{"sub":7},"weapon":true,"submenu":[]},{"menuName":"Antique Dagger","weaponName":"WEAPON_DAGGER","data":{"sub":8},"weapon":true,"submenu":[]},{"menuName":"Hatchet","weaponName":"WEAPON_HATCHET","data":{"sub":9},"weapon":true,"submenu":[]},{"menuName":"Machete","weaponName":"WEAPON_MACHETE","data":{"sub":10},"weapon":true,"submenu":[]},{"menuName":"Flashlight","weaponName":"WEAPON_FLASHLIGHT","data":{"sub":11},"weapon":true,"submenu":[]},{"menuName":"Switchblade","weaponName":"WEAPON_SWITCHBLADE","data":{"sub":12},"weapon":true,"submenu":[{"menuName":"Variation 1","data":{"action":"COMPONENT_SWITCHBLADE_VARMOD_VAR1"}},{"menuName":"Variation 2","data":{"action":"COMPONENT_SWITCHBLADE_VARMOD_VAR2"}}]}],"Handguns":[{"menuName":"Pistol","weaponName":"WEAPON_PISTOL","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_PISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_PISTOL_VARMOD_LUXE"}}]},{"menuName":"Combat Pistol","weaponName":"WEAPON_COMBATPISTOL","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_COMBATPISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_COMBATPISTOL_VARMOD_LOWRIDER"}}]},{"menuName":"AP Pistol","weaponName":"WEAPON_APPISTOL","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_APPISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Gilded Gun Metal Finish","data":{"action":"COMPONENT_APPISTOL_VARMOD_LUXE"}}]},{"menuName":"Pistol .50","weaponName":"WEAPON_PISTOL50","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_PISTOL50_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Platinum Pearl Deluxe Finish","data":{"action":"COMPONENT_PISTOL50_VARMOD_LUXE"}}]},{"menuName":"SNS Pistol","weaponName":"WEAPON_SNSPISTOL","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[{"menuName":"COMPONENT_SNSPISTOL_CLIP_02","data":{"action":"Extended Magazine"}},{"menuName":"COMPONENT_SNSPISTOL_VARMOD_LOWRIDER","data":{"action":"Etched Wood Grip Finish"}}]},{"menuName":"Heavy Pistol","weaponName":"WEAPON_HEAVYPISTOL","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_HEAVYPISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_SUPP"}},{"menuName":"Etched Wood Grip Finish","data":{"action":"COMPONENT_HEAVYPISTOL_VARMOD_LUXE"}}]},{"menuName":"Vintage Pistol","weaponName":"WEAPON_VINTAGEPISTOL","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_VINTAGEPISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}}]},{"menuName":"Stungun","weaponName":"WEAPON_STUNGUN","data":{"sub":7},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Flaregun","weaponName":"WEAPON_FLAREGUN","data":{"sub":8},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Marksman Pistol","weaponName":"WEAPON_MARKSMANPISTOL","data":{"sub":9},"ammo":true,"weapon":true,"submenu":[{"menuName":"Variation 1","data":{"action":"COMPONENT_REVOLVER_VARMOD_BOSS"}},{"menuName":"Variation 2","data":{"action":"COMPONENT_REVOLVER_VARMOD_GOON"}}]},{"menuName":"Heavy Revolver","weaponName":"WEAPON_REVOLVER","data":{"sub":10},"ammo":true,"weapon":true,"submenu":[]}],"Submachine":[{"menuName":"Micro SMG","weaponName":"WEAPON_MICROSMG","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_MICROSMG_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MACRO"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_MICROSMG_VARMOD_LUXE"}}]},{"menuName":"SMG","weaponName":"WEAPON_SMG","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_SMG_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_SMG_CLIP_03"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MACRO_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_SMG_VARMOD_LUXE"}}]},{"menuName":"Assault SMG","weaponName":"WEAPON_ASSAULTSMG","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_ASSAULTSMG_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MACRO"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_ASSAULTSMG_VARMOD_LOWRIDER"}}]},{"menuName":"MG","weaponName":"WEAPON_MG","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_MG_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL_02"}}]},{"menuName":"Combat MG","weaponName":"WEAPON_COMBATMG","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_COMBATMG_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MEDIUM"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Combat PDW","weaponName":"WEAPON_COMBATPDW","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_COMBATPDW_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_COMBATPDW_CLIP_03"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Gusenberg Sweeper","weaponName":"WEAPON_GUSENBERG","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_GUSENBERG_CLIP_02"}}]},{"menuName":"Machine Pistol","weaponName":"WEAPON_MACHINEPISTOL","data":{"sub":7},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_MACHINEPISTOL_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_MACHINEPISTOL_CLIP_03"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}}]}],"Assault":[{"menuName":"Assault Rifle","weaponName":"WEAPON_ASSAULTRIFLE","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_ASSAULTRIFLE_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_ASSAULTRIFLE_CLIP_03"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MACRO"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_ASSAULTRIFLE_VARMOD_LUXE"}}]},{"menuName":"Carbine Rifle","weaponName":"WEAPON_CARBINERIFLE","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_CARBINERIFLE_CLIP_02"}},{"menuName":"Box Magazine","data":{"action":"COMPONENT_CARBINERIFLE_CLIP_03"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MEDIUM"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Rail Cover","data":{"action":"COMPONENT_AT_RAILCOVER_01"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_CARBINERIFLE_VARMOD_LUXE"}}]},{"menuName":"Advanced Rifle","weaponName":"WEAPON_ADVANCEDRIFLE","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_ADVANCEDRIFLE_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Gilded Gun Metal Finish","data":{"action":"COMPONENT_ADVANCEDRIFLE_VARMOD_LUXE"}}]},{"menuName":"Special Carbine","weaponName":"WEAPON_SPECIALCARBINE","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_SPECIALCARBINE_CLIP_02"}},{"menuName":"Beta C-Magazine","data":{"action":"COMPONENT_SPECIALCARBINE_CLIP_03"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MEDIUM"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Bullpup Rifle","weaponName":"WEAPON_BULLPUPRIFLE","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Compact Rifle","weaponName":"WEAPON_COMPACTRIFLE","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_COMPACTRIFLE_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_COMPACTRIFLE_CLIP_03"}}]}],"Shotguns":[{"menuName":"Pump Shotgun","weaponName":"WEAPON_PUMPSHOTGUN","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_SR_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_PUMPSHOTGUN_VARMOD_LOWRIDER"}}]},{"menuName":"Sawnoff Shotgun","weaponName":"WEAPON_SAWNOFFSHOTGUN","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Gilded Gun Metal Finish","data":{"action":"COMPONENT_SAWNOFFSHOTGUN_VARMOD_LUXE"}}]},{"menuName":"Bullpup Shotgun","weaponName":"WEAPON_BULLPUPSHOTGUN","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_BULLPUPRIFLE_CLIP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Gilded Gun Metal Finish","data":{"action":"COMPONENT_BULLPUPRIFLE_VARMOD_LOW"}}]},{"menuName":"Assault Shotgun","weaponName":"WEAPON_ASSAULTSHOTGUN","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_ASSAULTSHOTGUN_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}}]},{"menuName":"Musket","weaponName":"WEAPON_MUSKET","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Heavy Shotgun","weaponName":"WEAPON_HEAVYSHOTGUN","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_HEAVYSHOTGUN_CLIP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Double Barrel Shotgun","weaponName":"WEAPON_DBSHOTGUN","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[]}],"Snipers":[{"menuName":"Sniper Rifle","weaponName":"WEAPON_SNIPERRIFLE","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Advanced Scope","data":{"action":"COMPONENT_AT_SCOPE_MAX"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Etched Wood Grip Finish","data":{"action":"COMPONENT_SNIPERRIFLE_VARMOD_LUXE"}}]},{"menuName":"Heavy Sniper","weaponName":"WEAPON_HEAVYSNIPER","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Normal Scope","data":{"action":"COMPONENT_AT_SCOPE_LARGE"}}]},{"menuName":"Marksman Rifle","weaponName":"WEAPON_MARKSMANRIFLE","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_MARKSMANRIFLE_CLIP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_MARKSMANRIFLE_VARMOD_LUXE"}}]}],"Heavy":[{"menuName":"Grenade Launcher","weaponName":"WEAPON_GRENADELAUNCHER","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Grenade Launcher (Smoke)","weaponName":"WEAPON_GRENADELAUNCHER_SMOKE","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"RPG","weaponName":"WEAPON_RPG","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Stinger","weaponName":"WEAPON_STINGER","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Minigun","weaponName":"WEAPON_MINIGUN","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Firework Launcher","weaponName":"WEAPON_FIREWORK","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Railgun","weaponName":"WEAPON_RAILGUN","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Homing Launcher","weaponName":"WEAPON_HOMINGLAUNCHER","data":{"sub":7},"ammo":true,"weapon":true,"submenu":[]}],"Thrown":[{"menuName":"Grenade","weaponName":"WEAPON_GRENADE","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Sticky Bomb","weaponName":"WEAPON_STICKYBOMB","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Proximity Mine","weaponName":"WEAPON_PROXMINE","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Tear Gas","weaponName":"WEAPON_BZGAS","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Smoke Grenade","weaponName":"WEAPON_SMOKEGRENADE","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Molotov","weaponName":"WEAPON_MOLOTOV","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Fire Extinguisher","weaponName":"WEAPON_FIREEXTINGUISHER","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Jerry Can","weaponName":"WEAPON_PETROLCAN","data":{"sub":7},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Snowball","weaponName":"WEAPON_SNOWBALL","data":{"sub":8},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Flare","weaponName":"WEAPON_FLARE","data":{"sub":9},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Baseball","weaponName":"WEAPON_BALL","data":{"sub":10},"ammo":true,"weapon":true,"submenu":[]}]} +var weaponDB = {"Melee":[{"menuName":"Knife","weaponName":"WEAPON_KNIFE","data":{"sub":0},"weapon":true,"submenu":[]},{"menuName":"Brass Knuckles","weaponName":"WEAPON_KNUCKLE","data":{"sub":1},"weapon":true,"submenu":[{"menuName":"Default","data":{"action":"COMPONENT_KNUCKLE_VARMOD_BASE"}},{"menuName":"Pimp","data":{"action":"COMPONENT_KNUCKLE_VARMOD_PIMP"}},{"menuName":"Ballas","data":{"action":"COMPONENT_KNUCKLE_VARMOD_BALLAS"}},{"menuName":"Dollars","data":{"action":"COMPONENT_KNUCKLE_VARMOD_DOLLAR"}},{"menuName":"Diamond","data":{"action":"COMPONENT_KNUCKLE_VARMOD_DIAMOND"}},{"menuName":"Hate","data":{"action":"COMPONENT_KNUCKLE_VARMOD_HATE"}},{"menuName":"Love","data":{"action":"COMPONENT_KNUCKLE_VARMOD_LOVE"}},{"menuName":"Player","data":{"action":"COMPONENT_KNUCKLE_VARMOD_PLAYER"}},{"menuName":"King","data":{"action":"COMPONENT_KNUCKLE_VARMOD_KING"}},{"menuName":"Vagos","data":{"action":"COMPONENT_KNUCKLE_VARMOD_VAGOS"}}]},{"menuName":"Nightstick","weaponName":"WEAPON_NIGHTSTICK","data":{"sub":2},"weapon":true,"submenu":[]},{"menuName":"Hammer","weaponName":"WEAPON_HAMMER","data":{"sub":3},"weapon":true,"submenu":[]},{"menuName":"Baseball Bat","weaponName":"WEAPON_BAT","data":{"sub":4},"weapon":true,"submenu":[]},{"menuName":"Golf Club","weaponName":"WEAPON_GOLFCLUB","data":{"sub":5},"weapon":true,"submenu":[]},{"menuName":"Crowbar","weaponName":"WEAPON_CROWBAR","data":{"sub":6},"weapon":true,"submenu":[]},{"menuName":"Bottle","weaponName":"WEAPON_BOTTLE","data":{"sub":7},"weapon":true,"submenu":[]},{"menuName":"Antique Dagger","weaponName":"WEAPON_DAGGER","data":{"sub":8},"weapon":true,"submenu":[]},{"menuName":"Hatchet","weaponName":"WEAPON_HATCHET","data":{"sub":9},"weapon":true,"submenu":[]},{"menuName":"Machete","weaponName":"WEAPON_MACHETE","data":{"sub":10},"weapon":true,"submenu":[]},{"menuName":"Flashlight","weaponName":"WEAPON_FLASHLIGHT","data":{"sub":11},"weapon":true,"submenu":[]},{"menuName":"Switchblade","weaponName":"WEAPON_SWITCHBLADE","data":{"sub":12},"weapon":true,"submenu":[{"menuName":"Variation 1","data":{"action":"COMPONENT_SWITCHBLADE_VARMOD_VAR1"}},{"menuName":"Variation 2","data":{"action":"COMPONENT_SWITCHBLADE_VARMOD_VAR2"}}]}],"Handguns":[{"menuName":"Pistol","weaponName":"WEAPON_PISTOL","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_PISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_PISTOL_VARMOD_LUXE"}}]},{"menuName":"Combat Pistol","weaponName":"WEAPON_COMBATPISTOL","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_COMBATPISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_COMBATPISTOL_VARMOD_LOWRIDER"}}]},{"menuName":"AP Pistol","weaponName":"WEAPON_APPISTOL","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_APPISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Gilded Gun Metal Finish","data":{"action":"COMPONENT_APPISTOL_VARMOD_LUXE"}}]},{"menuName":"Pistol .50","weaponName":"WEAPON_PISTOL50","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_PISTOL50_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Platinum Pearl Deluxe Finish","data":{"action":"COMPONENT_PISTOL50_VARMOD_LUXE"}}]},{"menuName":"SNS Pistol","weaponName":"WEAPON_SNSPISTOL","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_SNSPISTOL_CLIP_02"}},{"menuName":"Etched Wood Grip Finish","data":{"action":"COMPONENT_SNSPISTOL_VARMOD_LOWRIDER"}}]},{"menuName":"Heavy Pistol","weaponName":"WEAPON_HEAVYPISTOL","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_HEAVYPISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_SUPP"}},{"menuName":"Etched Wood Grip Finish","data":{"action":"COMPONENT_HEAVYPISTOL_VARMOD_LUXE"}}]},{"menuName":"Vintage Pistol","weaponName":"WEAPON_VINTAGEPISTOL","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_VINTAGEPISTOL_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}}]},{"menuName":"Stungun","weaponName":"WEAPON_STUNGUN","data":{"sub":7},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Flaregun","weaponName":"WEAPON_FLAREGUN","data":{"sub":8},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Marksman Pistol","weaponName":"WEAPON_MARKSMANPISTOL","data":{"sub":9},"ammo":true,"weapon":true,"submenu":[{"menuName":"Variation 1","data":{"action":"COMPONENT_REVOLVER_VARMOD_BOSS"}},{"menuName":"Variation 2","data":{"action":"COMPONENT_REVOLVER_VARMOD_GOON"}}]},{"menuName":"Heavy Revolver","weaponName":"WEAPON_REVOLVER","data":{"sub":10},"ammo":true,"weapon":true,"submenu":[]}],"Submachine":[{"menuName":"Micro SMG","weaponName":"WEAPON_MICROSMG","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_MICROSMG_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MACRO"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_PI_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_MICROSMG_VARMOD_LUXE"}}]},{"menuName":"SMG","weaponName":"WEAPON_SMG","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_SMG_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_SMG_CLIP_03"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MACRO_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_SMG_VARMOD_LUXE"}}]},{"menuName":"Assault SMG","weaponName":"WEAPON_ASSAULTSMG","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_ASSAULTSMG_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MACRO"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_ASSAULTSMG_VARMOD_LOWRIDER"}}]},{"menuName":"MG","weaponName":"WEAPON_MG","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_MG_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL_02"}}]},{"menuName":"Combat MG","weaponName":"WEAPON_COMBATMG","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_COMBATMG_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MEDIUM"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Combat PDW","weaponName":"WEAPON_COMBATPDW","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_COMBATPDW_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_COMBATPDW_CLIP_03"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Gusenberg Sweeper","weaponName":"WEAPON_GUSENBERG","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_GUSENBERG_CLIP_02"}}]},{"menuName":"Machine Pistol","weaponName":"WEAPON_MACHINEPISTOL","data":{"sub":7},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_MACHINEPISTOL_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_MACHINEPISTOL_CLIP_03"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_PI_SUPP"}}]}],"Assault":[{"menuName":"Assault Rifle","weaponName":"WEAPON_ASSAULTRIFLE","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_ASSAULTRIFLE_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_ASSAULTRIFLE_CLIP_03"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MACRO"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_ASSAULTRIFLE_VARMOD_LUXE"}}]},{"menuName":"Carbine Rifle","weaponName":"WEAPON_CARBINERIFLE","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_CARBINERIFLE_CLIP_02"}},{"menuName":"Box Magazine","data":{"action":"COMPONENT_CARBINERIFLE_CLIP_03"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MEDIUM"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Rail Cover","data":{"action":"COMPONENT_AT_RAILCOVER_01"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_CARBINERIFLE_VARMOD_LUXE"}}]},{"menuName":"Advanced Rifle","weaponName":"WEAPON_ADVANCEDRIFLE","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_ADVANCEDRIFLE_CLIP_02"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Gilded Gun Metal Finish","data":{"action":"COMPONENT_ADVANCEDRIFLE_VARMOD_LUXE"}}]},{"menuName":"Special Carbine","weaponName":"WEAPON_SPECIALCARBINE","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_SPECIALCARBINE_CLIP_02"}},{"menuName":"Beta C-Magazine","data":{"action":"COMPONENT_SPECIALCARBINE_CLIP_03"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_MEDIUM"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Bullpup Rifle","weaponName":"WEAPON_BULLPUPRIFLE","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Compact Rifle","weaponName":"WEAPON_COMPACTRIFLE","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_COMPACTRIFLE_CLIP_02"}},{"menuName":"Drum Magazine","data":{"action":"COMPONENT_COMPACTRIFLE_CLIP_03"}}]}],"Shotguns":[{"menuName":"Pump Shotgun","weaponName":"WEAPON_PUMPSHOTGUN","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_SR_SUPP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_PUMPSHOTGUN_VARMOD_LOWRIDER"}}]},{"menuName":"Sawnoff Shotgun","weaponName":"WEAPON_SAWNOFFSHOTGUN","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Gilded Gun Metal Finish","data":{"action":"COMPONENT_SAWNOFFSHOTGUN_VARMOD_LUXE"}}]},{"menuName":"Bullpup Shotgun","weaponName":"WEAPON_BULLPUPSHOTGUN","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_BULLPUPRIFLE_CLIP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Gilded Gun Metal Finish","data":{"action":"COMPONENT_BULLPUPRIFLE_VARMOD_LOW"}}]},{"menuName":"Assault Shotgun","weaponName":"WEAPON_ASSAULTSHOTGUN","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_ASSAULTSHOTGUN_CLIP_02"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}}]},{"menuName":"Musket","weaponName":"WEAPON_MUSKET","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Heavy Shotgun","weaponName":"WEAPON_HEAVYSHOTGUN","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_HEAVYSHOTGUN_CLIP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Double Barrel Shotgun","weaponName":"WEAPON_DBSHOTGUN","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[]}],"Snipers":[{"menuName":"Sniper Rifle","weaponName":"WEAPON_SNIPERRIFLE","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Advanced Scope","data":{"action":"COMPONENT_AT_SCOPE_MAX"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP_02"}},{"menuName":"Etched Wood Grip Finish","data":{"action":"COMPONENT_SNIPERRIFLE_VARMOD_LUXE"}}]},{"menuName":"Heavy Sniper","weaponName":"WEAPON_HEAVYSNIPER","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Normal Scope","data":{"action":"COMPONENT_AT_SCOPE_LARGE"}}]},{"menuName":"Marksman Rifle","weaponName":"WEAPON_MARKSMANRIFLE","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[{"menuName":"Extended Magazine","data":{"action":"COMPONENT_MARKSMANRIFLE_CLIP_02"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Suppressor","data":{"action":"COMPONENT_AT_AR_SUPP"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}},{"menuName":"Yusuf Amir Luxury Finish","data":{"action":"COMPONENT_MARKSMANRIFLE_VARMOD_LUXE"}}]}],"Heavy":[{"menuName":"Grenade Launcher","weaponName":"WEAPON_GRENADELAUNCHER","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"Grenade Launcher (Smoke)","weaponName":"WEAPON_GRENADELAUNCHER_SMOKE","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[{"menuName":"Scope","data":{"action":"COMPONENT_AT_SCOPE_SMALL"}},{"menuName":"Flashlight","data":{"action":"COMPONENT_AT_AR_FLSH"}},{"menuName":"Grip","data":{"action":"COMPONENT_AT_AR_AFGRIP"}}]},{"menuName":"RPG","weaponName":"WEAPON_RPG","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Stinger","weaponName":"WEAPON_STINGER","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Minigun","weaponName":"WEAPON_MINIGUN","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Firework Launcher","weaponName":"WEAPON_FIREWORK","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Railgun","weaponName":"WEAPON_RAILGUN","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Homing Launcher","weaponName":"WEAPON_HOMINGLAUNCHER","data":{"sub":7},"ammo":true,"weapon":true,"submenu":[]}],"Thrown":[{"menuName":"Grenade","weaponName":"WEAPON_GRENADE","data":{"sub":0},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Sticky Bomb","weaponName":"WEAPON_STICKYBOMB","data":{"sub":1},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Proximity Mine","weaponName":"WEAPON_PROXMINE","data":{"sub":2},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Tear Gas","weaponName":"WEAPON_BZGAS","data":{"sub":3},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Smoke Grenade","weaponName":"WEAPON_SMOKEGRENADE","data":{"sub":4},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Molotov","weaponName":"WEAPON_MOLOTOV","data":{"sub":5},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Fire Extinguisher","weaponName":"WEAPON_FIREEXTINGUISHER","data":{"sub":6},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Jerry Can","weaponName":"WEAPON_PETROLCAN","data":{"sub":7},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Snowball","weaponName":"WEAPON_SNOWBALL","data":{"sub":8},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Flare","weaponName":"WEAPON_FLARE","data":{"sub":9},"ammo":true,"weapon":true,"submenu":[]},{"menuName":"Baseball","weaponName":"WEAPON_BALL","data":{"sub":10},"ammo":true,"weapon":true,"submenu":[]}]} // Vehicle Paint Options. diff --git a/mellotrainer/admin-server.lua b/mellotrainer/sv_admin.lua similarity index 51% rename from mellotrainer/admin-server.lua rename to mellotrainer/sv_admin.lua index 2151c13..2023a6f 100644 --- a/mellotrainer/admin-server.lua +++ b/mellotrainer/sv_admin.lua @@ -1,10 +1,59 @@ --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] +--[[------------------------------------------------------------------------ + Kick Player +------------------------------------------------------------------------]]-- +RegisterServerEvent( 'mellotrainer:adminKick' ) +AddEventHandler( 'mellotrainer:adminKick', function( id, reason ) + DropPlayer( id, reason ) +end ) + +--[[------------------------------------------------------------------------ + Temp Ban Player +------------------------------------------------------------------------]]-- +local tempBannedUsers = {} + +RegisterServerEvent( 'mellotrainer:adminTempBan' ) +AddEventHandler( 'mellotrainer:adminTempBan', function( id ) + local license = DATASAVE:GetIdentifier( id, "license" ) + + if ( license ~= nil ) then + tempBannedUsers[license] = true + DATASAVE:print( GetPlayerName( id ) .. " has been temporarily banned by " .. GetPlayerName( source ) .. "." ) + DropPlayer( id, "Banned: You have been temporarily banned." ) + end +end ) + +AddEventHandler( 'playerConnecting', function( name, setReason ) + local license = DATASAVE:GetIdentifier( source, "license" ) + + if ( license ~= nil ) then + if ( tempBannedUsers[license] ) then + DATASAVE:print( GetPlayerName( source ) .. " is temporarily banned, refusing connection." ) + setReason( "Banned: You have been temporarily banned." ) + CancelEvent() + end + end +end ) + -- _______ _ ____ _ _ -- |__ __(_) / __ \ | | (_) -- | | _ _ __ ___ ___ | | | |_ __ | |_ _ ___ _ __ ___ diff --git a/mellotrainer/config.lua b/mellotrainer/sv_config.lua similarity index 57% rename from mellotrainer/config.lua rename to mellotrainer/sv_config.lua index 389ce64..d71b83f 100644 --- a/mellotrainer/config.lua +++ b/mellotrainer/sv_config.lua @@ -1,4 +1,67 @@ +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] + + +--[[------------------------------------------------------------ + + MelloTrainer Config + +--------------------------------------------------------------]] + +--[[----------------------------------------------------------- + Name: localSaving + Toggles the vehicle and skin saving system. + Options: true, false +-------------------------------------------------------------]] +local localSaving = true + +--[[----------------------------------------------------------- + Name: steamOnly + Toggles steam only mode, if a player joins without a + steam id, it will kick them from the server. + Options: true, false +-------------------------------------------------------------]] +local steamOnly = true + +--[[----------------------------------------------------------- + Name: adminOnlyTrainer + Toggles admin only trainer, meaning only people + specified in the below admins table can use it. + Options: true, false +-------------------------------------------------------------]] local adminOnlyTrainer = false + +--[[----------------------------------------------------------- + Name: adminOnlyNoclip + Toggles if the Noclip Functionality should be + reserved for admins only + Options: true, false +-------------------------------------------------------------]] +local adminOnlyNoclip = false + +--[[----------------------------------------------------------- + List of identifiers that is used to grant admin + privledges within the trainer. MUST FOLLOW EXAMPLE FORMATS. + + How to get your Steam Hex value: +https://forum.fivem.net/t/how-to-steam-hex-value-pictures/41071 +-------------------------------------------------------------]] local admins = { "steam:110000106e1eac6", -- Add all steam hexs heres. "steam:110000103920a31", -- MUST FOLLOW EXAMPLE FORMAT @@ -9,22 +72,16 @@ local admins = { --local pvpEnabled = true --local maxPlayers = 32 - - --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. --- DO NOT TOUCHY, CONTACT Michael G/TheStonedTurtle if anything is broken. - - Config = {} Config.settings = { --pvpEnabled = pvpEnabled, --maxPlayers = maxPlayers, adminOnlyTrainer = adminOnlyTrainer, - admins = admins + admins = admins, + localSaving = localSaving, + steamOnly = steamOnly, + adminOnlyNoclip = adminOnlyNoclip } @@ -65,6 +122,14 @@ AddEventHandler('mellotrainer:firstJoinProper', function(id) TriggerClientEvent('mellotrainer:playerJoined', -1, id) TriggerClientEvent("mellotrainer:receiveConfigSetting", source, "adminOnlyTrainer", Config.settings.adminOnlyTrainer) + TriggerClientEvent( "mellotrainer:receiveConfigSetting", source, "localSaving", Config.settings.localSaving ) + TriggerClientEvent( "mellotrainer:receiveConfigSetting", source, "adminOnlyNoclip", Config.settings.adminOnlyNoclip ) + + + -- If local saving is turned on then ensure files are created for this person. + if(Config.settings.localSaving)then + DATASAVE:AddPlayerToDataSave(source) + end end) diff --git a/mellotrainer/sv_data_saving.lua b/mellotrainer/sv_data_saving.lua new file mode 100644 index 0000000..e7e1318 --- /dev/null +++ b/mellotrainer/sv_data_saving.lua @@ -0,0 +1,220 @@ +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] + +DATASAVE = {} + +DATASAVE.dir = "mtsaves/" + +function DATASAVE:DoesPathExist( path ) + if ( type( path ) ~= "string" ) then return false end + + local response = os.execute( "cd " .. path ) + + if ( response == true ) then + return true + end + + return false +end + +function DATASAVE:RunLaunchChecks() + local exists = self:DoesPathExist( "mtsaves" ) + + if ( not exists ) then + self:print( "mtsaves folder not found, attempting to create." ) + + os.execute( "mkdir mtsaves" ) + else + self:print( "mtsaves folder found!" ) + end +end + +function DATASAVE:GetIdentifier( source, identifier ) + local ids = GetPlayerIdentifiers( source ) + + for k, v in pairs( ids ) do + local id = stringsplit( v, ":" ) + local start = id[1] + + if ( start == identifier ) then + return id[2] + end + end + + return nil +end + +function DATASAVE:DoesFileExist( name ) + local dir = self.dir .. name + local file = io.open( dir, "r" ) + + if ( file ~= nil ) then + io.close( file ) + return true + else + return false + end +end + +function DATASAVE:CreateFile( name ) + local dir = self.dir .. name + + local file, err = io.open( dir, 'w' ) + + if ( not file ) then self:print( err ) end + + file:write( "{}" ) + file:close() +end + +function DATASAVE:LoadFile( name ) + local dir = self.dir .. name + + local file, err = io.open( dir, 'rb' ) + + if ( not file ) then self:print( err ) return nil end + + local contents = file:read( "*all" ) + + contents = json.decode( contents ) + + file:close() + + return contents +end + +function DATASAVE:WriteToFile( name, data, index ) + local dir = self.dir .. name + + local fileTable = self:LoadFile( name ) + + if ( not fileTable ) then return end + + if ( data == nil ) then + table.remove( fileTable, index ) -- table.remove reindexes all values after removing + else + fileTable[index] = data + end + + local fileString = json.encode( fileTable ) + + local file, err = io.open( dir, 'w+' ) + + if ( not file ) then self:print( err ) return end + + file:write( fileString ) + file:close() +end + +function DATASAVE:SendSaveData( source ) + local id = self:GetIdentifier( source, "steam" ) + + if ( id ~= nil ) then + local vehicleData = {} + local skinData = {} + + local vehFileName = id .. "_vehicles.txt" + local skinFileName = id .. "_skins.txt" + + vehicleData = self:LoadFile( vehFileName ) + skinData = self:LoadFile( skinFileName ) + + if ( next( vehicleData ) ~= nil ) then + TriggerClientEvent( 'wk:RecieveSavedVehicles', source, vehicleData ) + end + + if ( next( skinData ) ~= nil ) then + TriggerClientEvent( 'wk:RecieveSavedSkins', source, skinData ) + end + else + self:print( "Attempted to load save data for " .. GetPlayerName( source ) .. ", but does not have a steam id." ) + end +end + +function DATASAVE:print( text ) + RconPrint( "MELLOTRAINER: " .. text .. "\n" ) +end + +Citizen.CreateThread( function() + Citizen.Wait( 1000 ) -- just to reduce clutter in the console on startup + + if ( Config.settings.localSaving ) then + DATASAVE:RunLaunchChecks() + else + DATASAVE:print( "Local Saving is currently turned off." ) + end +end ) + + +function DATASAVE:AddPlayerToDataSave( source ) + local id = self:GetIdentifier( source, "steam" ) + + if ( id ~= nil ) then + local vehFileName = id .. "_vehicles.txt" + local skinFileName = id .. "_skins.txt" + + local exists = self:DoesFileExist( vehFileName ) and self:DoesFileExist( skinFileName ) + + if ( exists ) then + self:print( GetPlayerName( source ) .. " has a save file." ) + self:SendSaveData( source ) + else + self:print( GetPlayerName( source ) .. " does not have a save file, creating one." ) + + self:CreateFile( vehFileName ) + self:CreateFile( skinFileName ) + end + else + self:print( GetPlayerName( source ) .. " is not connecting with a steam id.\nPlayer will not have the ability to save/load." ) + end +end + + +RegisterServerEvent( 'wk:DataSave' ) +AddEventHandler( 'wk:DataSave', function( type, data, index ) + if ( Config.settings.localSaving ) then + local id = DATASAVE:GetIdentifier( source, "steam" ) + + if ( id ~= nil ) then + local file = id .. "_" .. type .. ".txt" + DATASAVE:WriteToFile( file, data, index ) + else + DATASAVE:print( GetPlayerName( source ) .. " attempted to save, but does not have a steam id." ) + end + end +end ) + +function startsWith( string, start ) + return string.sub( string, 1, string.len( start ) ) == start +end + +function stringsplit( inputstr, sep ) + if sep == nil then + sep = "%s" + end + + local t = {} ; i = 1 + + for str in string.gmatch( inputstr, "([^" .. sep .. "]+)" ) do + t[i] = str + i = i + 1 + end + + return t +end \ No newline at end of file diff --git a/mellotrainer/sv_main.lua b/mellotrainer/sv_main.lua new file mode 100644 index 0000000..8ea2a2d --- /dev/null +++ b/mellotrainer/sv_main.lua @@ -0,0 +1,51 @@ +--[[-------------------------------------------------------------------------- + * + * Mello Trainer + * (C) Michael Goodwin 2017 + * http://github.com/thestonedturtle/mellotrainer/releases + * + * This menu used the Scorpion Trainer as a framework to build off of. + * https://github.com/pongo1231/ScorpionTrainer + * (C) Emre Cürgül 2017 + * + * A lot of useful functionality has been converted from the lambda menu. + * https://lambda.menu + * (C) Oui 2017 + * + * Additional Contributors: + * WolfKnight (https://forum.fivem.net/u/WolfKnight) + * +---------------------------------------------------------------------------]] + +_VERSION = '0.4.5' + +--[[------------------------------------------------------------------------ + Version Check + Credits to EssentialMode +------------------------------------------------------------------------]]-- +PerformHttpRequest( "https://thestonedturtle.github.io/version.txt", function( err, text, headers ) + Citizen.Wait( 1000 ) -- just to reduce clutter in the console on startup + RconPrint( "\nCurrent MelloTrainer Version: " .. _VERSION) + RconPrint( "\nLatest MelloTrainer Version: " .. text) + + if ( text ~= _VERSION ) then + RconPrint( "\n\n\t|||||||||||||||||||||||||||||||||\n\t|| MelloTrainer is Outdated ||\n\t|| Download the latest version ||\n\t|| From the FiveM Forums ||\n\t|||||||||||||||||||||||||||||||||\n\n" ) + else + RconPrint( "\nMelloTrainer is up to date!\n" ) + end +end, "GET", "", { what = 'this' } ) + + +--[[------------------------------------------------------------------------ + Steam Only Connection +------------------------------------------------------------------------]]-- +AddEventHandler( 'playerConnecting', function( name, cb ) + if ( Config.settings.steamOnly ) then + local id = DATASAVE:GetIdentifier( source, "steam" ) + + if ( id == nil ) then + cb( "This server requires you to be logged into the Steam client." ) + CancelEvent() + end + end +end ) \ No newline at end of file