Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
Update v8.7.2
Browse files Browse the repository at this point in the history
* Added new RageMenu
  • Loading branch information
Musiker15 committed Sep 23, 2023
1 parent 1a28dd6 commit d46121e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 13 deletions.
9 changes: 7 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,4 +33,9 @@ end)

It should look like this: https://prnt.sc/-El6-xwHQgOp

**Please restart your Server after the Edits!**
**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)*
52 changes: 50 additions & 2 deletions client/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 2 additions & 8 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'
}

Expand Down

0 comments on commit d46121e

Please sign in to comment.