diff --git a/Readme.md b/Readme.md index f7966e8..7ce1ebf 100644 --- a/Readme.md +++ b/Readme.md @@ -7,7 +7,7 @@ Usable Clips, Components & Tints **!!! We do not support inventories that have weapons as items !!!** ## Installation -If you are using ESX Menu and NOT NativeUI, go to `fxmanifest.lua` and delete `'@NativeUI/NativeUI.lua',` +If you are using ESX Menu and NOT one of the others, go to `fxmanifest.lua` and delete `'@NativeUI/NativeUI.lua',` and `'@ragemenu/ragemenu.lua'` If you are using ESX Legacy and NOT ESX 1.2 then do this: ```lua @@ -33,4 +33,9 @@ end) It should look like this: https://prnt.sc/-El6-xwHQgOp -**Please restart your Server after the Edits!** \ No newline at end of file +**Please restart your Server after the Edits!** + +## Requirements +* [ESX](https://github.com/esx-framework/esx_core) +* NativeUI *(optional)* +* [RageMenu](https://github.com/EnteNico/ragemenu) *(optional)* \ No newline at end of file diff --git a/client/menu.lua b/client/menu.lua index d2dab0e..951f4fd 100644 --- a/client/menu.lua +++ b/client/menu.lua @@ -4,10 +4,12 @@ AddEventHandler('msk_weaponammo:openAttachmentMenu', function() OpenAttachmentMenuESX() -- ESX Menu elseif Config.Menu:match('NativeUI') then OpenAttachmentMenuNativeUI() -- NativeUI + elseif Config.Menu:match('RageMenu') then + OpenAttachmentMenuRageMenu() -- RageMenu end end) -function OpenAttachmentMenuESX() +OpenAttachmentMenuESX = function() local playerPed = PlayerPedId() local hash = GetSelectedPedWeapon(playerPed) local weapon = ESX.GetWeaponFromHash(hash) @@ -81,7 +83,7 @@ if Config.Menu:match('NativeUI') then {name = Translation[Config.Locale]['tint'], desc = Translation[Config.Locale]['remove_tint'], type = 'tint'}, } - function OpenAttachmentMenuNativeUI() + OpenAttachmentMenuNativeUI = function() local playerPed = PlayerPedId() local hash = GetSelectedPedWeapon(playerPed) local weapon = ESX.GetWeaponFromHash(hash) @@ -112,4 +114,50 @@ if Config.Menu:match('NativeUI') then _menuPool:MouseEdgeEnabled(false) _menuPool:ControlDisablingEnabled(false) end +end + +-- RageMenu + +if Config.Menu:match('RageMenu') then + local mainMenu + + OpenAttachmentMenuRageMenu = function() + local playerPed = PlayerPedId() + local hash = GetSelectedPedWeapon(playerPed) + local weapon = ESX.GetWeaponFromHash(hash) + + if not weapon then Config.Notification(nil, Translation[Config.Locale]['no_weapon']) return end + + local Items = { + {name = Translation[Config.Locale]['scope'], desc = Translation[Config.Locale]['remove_scope'], comtype = 'scope', type = 'component'}, + {name = Translation[Config.Locale]['grip'], desc = Translation[Config.Locale]['remove_grip'], comtype = 'grip', type = 'component'}, + {name = Translation[Config.Locale]['flashlight'], desc = Translation[Config.Locale]['remove_flashlight'], comtype = 'flashlight', type = 'component'}, + {name = Translation[Config.Locale]['clip_extended'], desc = Translation[Config.Locale]['remove_clip_extended'], comtype = 'clip_extended', type = 'component'}, + {name = Translation[Config.Locale]['suppressor'], desc = Translation[Config.Locale]['remove_suppressor'], comtype = 'suppressor', type = 'component'}, + {name = Translation[Config.Locale]['luxary_finish'], desc = Translation[Config.Locale]['remove_luxary_finish'], comtype = 'luxary_finish', type = 'component'}, + {name = Translation[Config.Locale]['tint'], desc = Translation[Config.Locale]['remove_tint'], type = 'tint'}, + } + + mainMenu = RageMenu:CreateMenu(Translation[Config.Locale]['weapon_components'], '~b~'.. Translation[Config.Locale]['remove_components']) + local components = RageMenu:CreateMenu(Translation[Config.Locale]['components'], Translation[Config.Locale]['components']) + mainMenu:AddSubmenu(components, Translation[Config.Locale]['components'], '') + + for k, v in pairs(Items) do + components:AddButton(v.name, '~b~' .. v.desc):On('click', function(item) + if v.type == 'component' then + TriggerServerEvent('msk_weaponammo:removeWeaponComponent', weapon.name, v.comtype) + elseif v.type == 'tint' then + TriggerServerEvent('msk_weaponammo:removeWeaponTint', weapon.name) + end + end) + end + + RageMenu:OpenMenu(mainMenu) + end + + AddEventHandler('onResourceStop', function(resource) + if GetCurrentResourceName() == resource then + RageMenu:Close(mainMenu) + end + end) end \ No newline at end of file diff --git a/config.lua b/config.lua index 2c28f8b..b85fee0 100644 --- a/config.lua +++ b/config.lua @@ -4,7 +4,7 @@ Config.Locale = 'de' Config.VersionChecker = true Config.Debug = true ---------------------------------------------------------------- -Config.Menu = 'NativeUI' -- Set to 'ESX' if you want ESX Menu || Set to 'NativeUI' if you want NativeUI || Read the Readme.md if you want to use ESX Menu +Config.Menu = 'RageMenu' -- Set to 'ESX' if you want ESX Menu || Set to 'NativeUI' if you want NativeUI || Set to 'RageMenu' if you want RageMenu Config.AntiWeaponPunch = true -- Set false if you don't want to use this Config.Animation = true -- Set false if you dont want an animation diff --git a/fxmanifest.lua b/fxmanifest.lua index 44c1660..829c3dc 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,17 +4,10 @@ games { 'gta5' } author 'Musiker15 - MSK Scripts' name 'msk_weaponammo' description 'Ammunition, Components & Tints' -version '8.7.1' +version '8.7.2' lua54 'yes' -escrow_ignore { - 'config.lua', - 'translation.lua', - 'client/*.lua', - 'server/*.lua' -} - shared_scripts { '@msk_core/import.lua', 'config.lua', @@ -23,6 +16,7 @@ shared_scripts { client_scripts { '@NativeUI/NativeUI.lua', -- Remove this if you don't use NativeUI // Go to menu.lua and remove ALL of the NativeUI Code + '@ragemenu/ragemenu.lua', -- Remove this if you don't use RageMenu // Go to menu.lua and remove ALL of the RageMenu Code 'client/*.lua' }