diff --git a/client/client.lua b/client/client.lua index 58234c8..3294c20 100644 --- a/client/client.lua +++ b/client/client.lua @@ -1,5 +1,3 @@ -ESX = exports["es_extended"]:getSharedObject() - if Config.AntiWeaponPunch then CreateThread(function() while true do diff --git a/client/menu.lua b/client/menu.lua index 2ad78a3..2334fa2 100644 --- a/client/menu.lua +++ b/client/menu.lua @@ -1,14 +1,15 @@ RegisterNetEvent('msk_weaponammo:openAttachmentMenu') AddEventHandler('msk_weaponammo:openAttachmentMenu', function() - if Config.Menu:match('ESX') then + if Config.Menu == 'ESX' then OpenAttachmentMenuESX() -- ESX Menu - elseif Config.Menu:match('NativeUI') then + elseif Config.Menu == 'NativeUI' then OpenAttachmentMenuNativeUI() -- NativeUI - elseif Config.Menu:match('RageMenu') then - OpenAttachmentMenuRageMenu() -- RageMenu end end) +---------------------------------------------------------------- +-- ESX Menu +---------------------------------------------------------------- OpenAttachmentMenuESX = function() local playerPed = PlayerPedId() local hash = GetSelectedPedWeapon(playerPed) @@ -56,9 +57,10 @@ OpenAttachmentMenuESX = function() end) end ----- NativeUI ---- - -if Config.Menu:match('NativeUI') then +---------------------------------------------------------------- +-- NativeUI Menu +---------------------------------------------------------------- +if Config.Menu == 'NativeUI' then local _menuPool = nil CreateThread(function() @@ -124,50 +126,4 @@ 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 b85fee0..dc105ef 100644 --- a/config.lua +++ b/config.lua @@ -1,17 +1,14 @@ Config = {} ---------------------------------------------------------------- Config.Locale = 'de' -Config.VersionChecker = true Config.Debug = true +Config.VersionChecker = true ---------------------------------------------------------------- -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.Menu = 'NativeUI' -- Set to 'ESX' if you want ESX Menu || Set to 'NativeUI' if you want NativeUI Config.AntiWeaponPunch = true -- Set false if you don't want to use this Config.Animation = true -- Set false if you dont want an animation -Config.SavePlayer = { - enable = true, - version = 'legacy' -- Set to '1.2' or 'legacy' // For ESX 1.2 set to '1.2', for ESX Legacy set 'legacy' -} +Config.SavePlayer = true Config.enableMaxAmmo = true -- Set false to deactivate this feature Config.checkMaxAmmo = { @@ -55,8 +52,7 @@ Config.WeaponAmmoClips = { -- Will give this many bullets to player ['throwableclip'] = 5, -- CUSTOM ITEMS // Add them in server_items.lua - ['polweaclip'] = 30, -- All Weapontypes - ['polweabox'] = 150, -- All Weapontypes + ['itemname'] = true, } ---------------------------------------------------------------- -- Set true if you like to remove item when used @@ -74,10 +70,19 @@ Config.Removeables = { -- Weapon Attachments ['scope'] = true, + ['scope_holo'] = true, + ['scope_small'] = true, + ['scope_medium'] = true, + ['scope_large'] = true, + ['scope_advanced'] = true, ['grip'] = true, ['flashlight'] = true, + ['clip_default'] = true, ['clip_extended'] = true, + ['clip_drum'] = true, + ['clip_box'] = true, ['suppressor'] = true, + ['compensator'] = true, ['luxary_finish'] = true, ['attachment_remover'] = false, -- This item removes Weapon Components and opens the Menu // recommended set to false @@ -91,8 +96,7 @@ Config.Removeables = { ['tint_platinum'] = true, -- CUSTOM ITEMS // Add them in server_items.lua - ['polweaclip'] = true, - ['polweabox'] = true, + ['itemname'] = true, } ---------------------------------------------------------------- -- Please don't TOUCH if you don't know what you are doing!! diff --git a/fxmanifest.lua b/fxmanifest.lua index 46ff1be..1e2f199 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,11 +4,12 @@ games { 'gta5' } author 'Musiker15 - MSK Scripts' name 'msk_weaponammo' description 'Ammunition, Components & Tints' -version '8.7.3' +version '8.8.0' lua54 'yes' shared_scripts { + '@es_extended/imports.lua', '@msk_core/import.lua', 'config.lua', 'translation.lua' @@ -16,7 +17,6 @@ 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' } diff --git a/server/server.lua b/server/server.lua index 2efd97c..86731cf 100644 --- a/server/server.lua +++ b/server/server.lua @@ -1,6 +1,3 @@ -ESX = exports["es_extended"]:getSharedObject() - --- Events RegisterNetEvent('msk_weaponammo:addWeaponClip') AddEventHandler('msk_weaponammo:addWeaponClip', function(weaponName, clip) local src = source @@ -19,7 +16,7 @@ AddEventHandler('msk_weaponammo:addWeaponClip', function(weaponName, clip) logging('debug', ('Ammo in Weapon: %s, Ammo in Clip: %s, Ammo after Relaod: %s, MaxAmmo in Config: %s'):format(v.ammo, ammo, v.ammo + ammo, Config.checkMaxAmmo[clip])) if (v.ammo + ammo) <= Config.checkMaxAmmo[clip] then - xPlayer.triggerEvent('msk_weaponammo:runAnimation') + TriggerClientEvent('msk_weaponammo:runAnimation', src) xPlayer.addWeaponAmmo(weaponName, ammo) TriggerClientEvent('msk_weaponammo:updateAmmo', src, weaponName, ammo) Config.Notification(src, Translation[Config.Locale]['used_clip']:format(hasItem.label)) @@ -37,7 +34,7 @@ AddEventHandler('msk_weaponammo:addWeaponClip', function(weaponName, clip) end else logging('debug', ('Weapon: %s, Item: %s, Ammo: %s'):format(weaponName, clip, ammo)) - xPlayer.triggerEvent('msk_weaponammo:runAnimation') + TriggerClientEvent('msk_weaponammo:runAnimation', src) xPlayer.addWeaponAmmo(weaponName, ammo) TriggerClientEvent('msk_weaponammo:updateAmmo', src, weaponName, ammo) Config.Notification(src, Translation[Config.Locale]['used_clip']:format(hasItem.label)) @@ -129,11 +126,7 @@ MSK.Register('msk_weaponammo:getItem', function(source, weaponName) end end - if match then - return items[1] - else - return false - end + return match and items[1] or false end) -- Add/Remove Weapon Tints @@ -235,22 +228,16 @@ function items_contains(items, item) end function saveESXPlayer(xPlayer) - if not Config.SavePlayer.enable then return end - - if Config.SavePlayer.version:match('1.2') then - ESX.SavePlayer(xPlayer) - elseif Config.SavePlayer.version:match('legacy') then - local Core = exports.es_extended.getCoreObject() -- exports('getCoreObject', function() return Core end) - Core.SavePlayer(xPlayer) - end + if not Config.SavePlayer then return end + MySQL.update("UPDATE users SET loadout = ? WHERE identifier = ?", {json.encode(xPlayer.getLoadout(true)), xPlayer.identifier}) end GithubUpdater = function() - GetCurrentVersion = function() + local GetCurrentVersion = function() return GetResourceMetadata(GetCurrentResourceName(), "version") end - isVersionIncluded = function(Versions, cVersion) + local isVersionIncluded = function(Versions, cVersion) for k, v in pairs(Versions) do if v.version == cVersion then return true diff --git a/server/server_items.lua b/server/server_items.lua index fb1efb3..7099306 100644 --- a/server/server_items.lua +++ b/server/server_items.lua @@ -3,29 +3,40 @@ AddEventHandler('onResourceStart', function(resource) local items = MySQL.query.await("SELECT name FROM items") local itemList = { -- This items will be uploaded to database automatically - {name = 'weaclip', label = 'Weapon Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'weabox', label = 'Weapon Box', weight = 2, rare = 0, can_remove = 1}, - {name = 'pistolclip', label = 'Pistol Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'smgclip', label = 'SMG Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'shotgunclip', label = 'Shotgun Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'rifleclip', label = 'Rifle Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'mgclip', label = 'MG Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'sniperclip', label = 'Sniper Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'throwableclip', label = 'Throwable Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'scope', label = 'Scope', weight = 1, rare = 0, can_remove = 1}, - {name = 'grip', label = 'Grip', weight = 1, rare = 0, can_remove = 1}, - {name = 'flashlight', label = 'Flashlight', weight = 1, rare = 0, can_remove = 1}, - {name = 'clip_extended', label = 'Extended Clip', weight = 1, rare = 0, can_remove = 1}, - {name = 'suppressor', label = 'Suppressor', weight = 1, rare = 0, can_remove = 1}, - {name = 'attachment_remover', label = 'Attachement Remover', weight = 1, rare = 0, can_remove = 1}, - {name = 'luxary_finish', label = 'Luxury Finish', weight = 1, rare = 0, can_remove = 1}, - {name = 'tint_green', label = 'Green', weight = 1, rare = 0, can_remove = 1}, - {name = 'tint_gold', label = 'Gold', weight = 1, rare = 0, can_remove = 1}, - {name = 'tint_pink', label = 'Pink', weight = 1, rare = 0, can_remove = 1}, - {name = 'tint_army', label = 'Army', weight = 1, rare = 0, can_remove = 1}, - {name = 'tint_lspd', label = 'LSPD', weight = 1, rare = 0, can_remove = 1}, - {name = 'tint_orange', label = 'Orange', weight = 1, rare = 0, can_remove = 1}, - {name = 'tint_platinum', label = 'Platinum', weight = 1, rare = 0, can_remove = 1} + {name = 'weaclip', label = Translation[Config.Locale]['weaclip'], weight = 1, rare = 0, can_remove = 1}, + {name = 'weabox', label = Translation[Config.Locale]['weabox'], weight = 2, rare = 0, can_remove = 1}, + {name = 'pistolclip', label = Translation[Config.Locale]['pistolclip'], weight = 1, rare = 0, can_remove = 1}, + {name = 'smgclip', label = Translation[Config.Locale]['smgclip'], weight = 1, rare = 0, can_remove = 1}, + {name = 'shotgunclip', label = Translation[Config.Locale]['shotgunclip'], weight = 1, rare = 0, can_remove = 1}, + {name = 'rifleclip', label = Translation[Config.Locale]['rifleclip'], weight = 1, rare = 0, can_remove = 1}, + {name = 'mgclip', label = Translation[Config.Locale]['mgclip'], weight = 1, rare = 0, can_remove = 1}, + {name = 'sniperclip', label = Translation[Config.Locale]['sniperclip'], weight = 1, rare = 0, can_remove = 1}, + {name = 'throwableclip', label = Translation[Config.Locale]['throwableclip'], weight = 1, rare = 0, can_remove = 1}, + + {name = 'attachment_remover', label = Translation[Config.Locale]['component_remover'], weight = 1, rare = 0, can_remove = 1}, + {name = 'scope', label = Translation[Config.Locale]['component_scope'], weight = 1, rare = 0, can_remove = 1}, + {name = 'scope_holo', label = Translation[Config.Locale]['component_scope_holo'], weight = 1, rare = 0, can_remove = 1}, + {name = 'scope_small', label = Translation[Config.Locale]['component_scope_small'], weight = 1, rare = 0, can_remove = 1}, + {name = 'scope_medium', label = Translation[Config.Locale]['component_scope_medium'], weight = 1, rare = 0, can_remove = 1}, + {name = 'scope_large', label = Translation[Config.Locale]['component_scope_large'], weight = 1, rare = 0, can_remove = 1}, + {name = 'scope_advanced', label = Translation[Config.Locale]['component_scope_advanced'], weight = 1, rare = 0, can_remove = 1}, + {name = 'grip', label = Translation[Config.Locale]['component_grip'], weight = 1, rare = 0, can_remove = 1}, + {name = 'flashlight', label = Translation[Config.Locale]['component_flashlight'], weight = 1, rare = 0, can_remove = 1}, + {name = 'clip_default', label = Translation[Config.Locale]['component_clip_default'], weight = 1, rare = 0, can_remove = 1}, + {name = 'clip_extended', label = Translation[Config.Locale]['component_clip_extended'], weight = 1, rare = 0, can_remove = 1}, + {name = 'clip_drum', label = Translation[Config.Locale]['component_clip_drum'], weight = 1, rare = 0, can_remove = 1}, + {name = 'clip_box', label = Translation[Config.Locale]['component_clip_box'], weight = 1, rare = 0, can_remove = 1}, + {name = 'suppressor', label = Translation[Config.Locale]['component_suppressor'], weight = 1, rare = 0, can_remove = 1}, + {name = 'compensator', label = Translation[Config.Locale]['component_compensator'], weight = 1, rare = 0, can_remove = 1}, + {name = 'luxary_finish', label = Translation[Config.Locale]['component_luxary_finish'], weight = 1, rare = 0, can_remove = 1}, + + {name = 'tint_green', label = Translation[Config.Locale]['tint_green'], weight = 1, rare = 0, can_remove = 1}, + {name = 'tint_gold', label = Translation[Config.Locale]['tint_gold'], weight = 1, rare = 0, can_remove = 1}, + {name = 'tint_pink', label = Translation[Config.Locale]['tint_pink'], weight = 1, rare = 0, can_remove = 1}, + {name = 'tint_army', label = Translation[Config.Locale]['tint_army'], weight = 1, rare = 0, can_remove = 1}, + {name = 'tint_lspd', label = Translation[Config.Locale]['tint_lspd'], weight = 1, rare = 0, can_remove = 1}, + {name = 'tint_orange', label = Translation[Config.Locale]['tint_orange'], weight = 1, rare = 0, can_remove = 1}, + {name = 'tint_platinum', label = Translation[Config.Locale]['tint_platinum'], weight = 1, rare = 0, can_remove = 1} } if items then @@ -37,9 +48,12 @@ AddEventHandler('onResourceStart', function(resource) local insertItem = MySQL.query.await("INSERT INTO items (name, label, weight, rare, can_remove) VALUES ('" .. v.name .. "', '" .. v.label .. "', '" .. v.weight .. "', '" .. v.rare .. "', '" .. v.can_remove .. "');") if insertItem then - logging('debug', '^2 Successfully ^3 inserted ^2 Item ^3 ' .. v.name .. ' ^2 in ^3 items ^0') + logging('debug', '^2Successfully ^3inserted ^2Item ^3' .. v.name .. ' ^2in ^3items ^0') print('^1Please restart your Server! Otherwise the Items won\'t work!^0') end + else + -- Update Label + -- MySQL.update("UPDATE items SET label = ? WHERE name = ?", {v.label, v.name}) end end end @@ -53,21 +67,8 @@ end) -- !!! You can add Weapon Clips and Weapon Components !!! -- !!! You have to configure them in the config.lua !!! --- xPlayer.triggerEvent('msk_weaponammo:checkItem', 'itemname') -- Weapon Clip --- xPlayer.triggerEvent('msk_weaponammo:addComponent', 'itemname') -- Weapon Component - - -ESX.RegisterUsableItem('polweaclip', function(source) -- Requested by spotxgrphy - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'polweaclip') -end) - -ESX.RegisterUsableItem('polweabox', function(source) -- Requested by spotxgrphy - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'polweabox') -end) +-- TriggerClientEvent('msk_weaponammo:checkItem', source, 'itemName') -- Weapon Clip +-- TriggerClientEvent('msk_weaponammo:addComponent', source, 'itemName') -- Weapon Component ---------------------------------------------------------------- -------------------- ORIGINAL ITEMS ---------------------------- @@ -75,57 +76,39 @@ end) -- Usable Items ESX.RegisterUsableItem('weaclip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'weaclip') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'weaclip') end) ESX.RegisterUsableItem('weabox', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'weabox') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'weabox') end) ESX.RegisterUsableItem('pistolclip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'pistolclip') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'pistolclip') end) ESX.RegisterUsableItem('smgclip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'smgclip') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'smgclip') end) ESX.RegisterUsableItem('shotgunclip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'shotgunclip') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'shotgunclip') end) ESX.RegisterUsableItem('rifleclip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'rifleclip') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'rifleclip') end) ESX.RegisterUsableItem('mgclip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'mgclip') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'mgclip') end) ESX.RegisterUsableItem('sniperclip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'sniperclip') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'sniperclip') end) ESX.RegisterUsableItem('throwableclip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:checkItem', 'throwableclip') + TriggerClientEvent('msk_weaponammo:checkItem', source, 'throwableclip') end) ---------------------------------------------------------------- @@ -133,39 +116,63 @@ end) ---------------------------------------------------------------- ESX.RegisterUsableItem('scope', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addComponent', 'scope') + TriggerClientEvent('msk_weaponammo:addComponent', source, 'scope') +end) + +ESX.RegisterUsableItem('scope_holo', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'scope_holo') +end) + +ESX.RegisterUsableItem('scope_small', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'scope_small') +end) + +ESX.RegisterUsableItem('scope_medium', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'scope_medium') +end) + +ESX.RegisterUsableItem('scope_large', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'scope_large') +end) + +ESX.RegisterUsableItem('scope_advanced', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'scope_advanced') end) ESX.RegisterUsableItem('grip', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addComponent', 'grip') + TriggerClientEvent('msk_weaponammo:addComponent', source, 'grip') end) ESX.RegisterUsableItem('flashlight', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addComponent', 'flashlight') + TriggerClientEvent('msk_weaponammo:addComponent', source, 'flashlight') +end) + +ESX.RegisterUsableItem('clip_default', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'clip_default') end) ESX.RegisterUsableItem('clip_extended', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addComponent', 'clip_extended') + TriggerClientEvent('msk_weaponammo:addComponent', source, 'clip_extended') +end) + +ESX.RegisterUsableItem('clip_drum', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'clip_drum') +end) + +ESX.RegisterUsableItem('clip_box', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'clip_box') end) ESX.RegisterUsableItem('suppressor', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addComponent', 'suppressor') + TriggerClientEvent('msk_weaponammo:addComponent', source, 'suppressor') +end) + +ESX.RegisterUsableItem('compensator', function(source) + TriggerClientEvent('msk_weaponammo:addComponent', source, 'compensator') end) ESX.RegisterUsableItem('luxary_finish', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addComponent', 'luxary_finish') + TriggerClientEvent('msk_weaponammo:addComponent', source, 'luxary_finish') end) ---------------------------------------------------------------- @@ -173,45 +180,31 @@ end) ---------------------------------------------------------------- ESX.RegisterUsableItem('tint_green', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addTint', 'tint_green') + TriggerClientEvent('msk_weaponammo:addTint', source, 'tint_green') end) ESX.RegisterUsableItem('tint_gold', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addTint', 'tint_gold') + TriggerClientEvent('msk_weaponammo:addTint', source, 'tint_green') end) ESX.RegisterUsableItem('tint_pink', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addTint', 'tint_pink') + TriggerClientEvent('msk_weaponammo:addTint', source, 'tint_green') end) ESX.RegisterUsableItem('tint_army', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addTint', 'tint_army') + TriggerClientEvent('msk_weaponammo:addTint', source, 'tint_green') end) ESX.RegisterUsableItem('tint_lspd', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addTint', 'tint_lspd') + TriggerClientEvent('msk_weaponammo:addTint', source, 'tint_green') end) ESX.RegisterUsableItem('tint_orange', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addTint', 'tint_orange') + TriggerClientEvent('msk_weaponammo:addTint', source, 'tint_green') end) ESX.RegisterUsableItem('tint_platinum', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:addTint', 'tint_platinum') + TriggerClientEvent('msk_weaponammo:addTint', source, 'tint_green') end) ---------------------------------------------------------------- @@ -219,7 +212,5 @@ end) ---------------------------------------------------------------- ESX.RegisterUsableItem('attachment_remover', function(source) - local xPlayer = ESX.GetPlayerFromId(source) - - xPlayer.triggerEvent('msk_weaponammo:openAttachmentMenu') + TriggerClientEvent('msk_weaponammo:openAttachmentMenu', source) end) \ No newline at end of file diff --git a/translation.lua b/translation.lua index 43b90ad..96bc639 100644 --- a/translation.lua +++ b/translation.lua @@ -1,5 +1,3 @@ -Translation = {} ----------------------------------------------------------------- Translation = { ['de'] = { ['used_clip'] = 'Du hast ~y~%s~s~ verwendet.', @@ -34,6 +32,40 @@ Translation = { ['remove_luxary_finish'] = 'Entferne Luxus Design', ['tint'] = 'Farbe', ['remove_tint'] = 'Entferne Farbe', + + -- Items + ['weaclip'] = 'Magazin', + ['weabox'] = 'Magazinbox', + ['pistolclip'] = 'Pistolenmagazin', + ['smgclip'] = 'SMG Magazin', + ['shotgunclip'] = 'Shotgun Magazin', + ['rifleclip'] = 'Gewehr Munition', + ['mgclip'] = 'MG Munition', + ['sniperclip'] = 'Sniper Magazin', + ['throwableclip'] = 'Throwables Munition', + ['component_remover'] = 'Waffenkomponenten Entferner', + ['component_scope'] = 'Zielfernrohr', + ['component_scope_holo'] = 'Holographisches Zielfernrohr', + ['component_scope_small'] = 'Kleines Zielfernrohr', + ['component_scope_medium'] = 'Mittleres Zielfernrohr', + ['component_scope_large'] = 'Großes Zielfernrohr', + ['component_scope_advanced'] = 'Fortgeschrittenes Zielfernrohr', + ['component_grip'] = 'Griff', + ['component_flashlight'] = 'Lichtaufsatz', + ['component_clip_default'] = 'Standart Magazin', + ['component_clip_extended'] = 'Erweiterters Magazin', + ['component_clip_drum'] = 'Trommelmagazin', + ["component_clip_box"] = "Kastenmagazin", + ['component_suppressor'] = 'Schalldämpfer', + ['component_compensator'] = 'Kompensator', + ['component_luxary_finish'] = 'Luxuswaffenlackierung', + ['tint_green'] = 'Grün', + ['tint_gold'] = 'Gold', + ['tint_pink'] = 'Pink', + ['tint_army'] = 'Army', + ['tint_lspd'] = 'LSPD', + ['tint_orange'] = 'Orange', + ['tint_platinum'] = 'Platinum', }, ['en'] = { ['used_clip'] = 'You have used ~y~%s~s~.', @@ -68,41 +100,39 @@ Translation = { ['remove_luxary_finish'] = 'Remove Luxury Finish', ['tint'] = 'Color', ['remove_tint'] = 'Remove Color', - }, - ['pl'] = { - - ['used_clip'] = 'Użyłeś ~y~%s~s~ Magazynek.', - ['used_attachment'] = 'Użyłeś ~y~%s~s~ Części.', - ['added_tint'] = 'Pokolorowałeś swoją Broń ~y~%s~s~.', - ['used_attachment_remover'] = 'Usunąłeś ~y~%s~s~.', - ['removed_tint'] = 'Usunąłeś kolor ze swojej Broni.', - - ['check_maxammo'] = 'Masz już wystarczająco dużo kul w swojej broni.', - ['no_weapon'] = 'Nie masz broni w ręku.', - ['not_correct_weapon'] = 'Ta amunicja nie nadaje się do tej broni.', - ['no_component'] = "Nie masz tego komponentu.", - ['not_correct_component'] = 'Ten komponent nie nadaje się do tej broni.', - ['no_ammo'] = 'Nie masz przy sobie magazynka.', - ['has_component'] = 'Masz już ten komponent zamontowany na broni.', - - -- Menu -- - ['weapon_components'] = 'Komponenty do broni', - ['components'] = 'Komponenty', - ['remove_components'] = 'Usuń elementy broni', - ['scope'] = 'Celownik', - ['grip'] = 'Uchwyt', - ['flashlight'] = 'Lataraka', - ['clip_extended'] = 'Powiększony Magazynek', - ['suppressor'] = 'Tłumik', - ['luxary_finish'] = 'Luksusowa skórka', - ['remove_scope'] = 'Usuń celownik', - ['remove_grip'] = 'Usuń chwyt', - ['remove_flashlight'] = 'Usuń latarke', - ['remove_clip_extended'] = 'Usuń powiększony magazynek', - ['remove_suppressor'] = 'Usuń tłumik', - ['remove_luxary_finish'] = 'Usuń skórkę ', - ['tint'] = 'Kolor', - ['remove_tint'] = 'Usuń kolor', + -- Items + ['weaclip'] = 'Clip', + ['weabox'] = 'Clip Box', + ['pistolclip'] = 'Pistolclip', + ['smgclip'] = 'SMG Clip', + ['shotgunclip'] = 'Shotgun Clip', + ['rifleclip'] = 'Rifle Clip', + ['mgclip'] = 'MG Clip', + ['sniperclip'] = 'Sniper Clip', + ['throwableclip'] = 'Throwables Clip', + ['component_remover'] = 'Weaponcomponent Remover', + ['component_scope'] = 'Scope', + ['component_scope_holo'] = 'Holographic Scope', + ['component_scope_small'] = 'Small Scope', + ['component_scope_medium'] = 'Medium Scope', + ['component_scope_large'] = 'Large Scope', + ['component_scope_advanced'] = 'Advanced Scope', + ['component_grip'] = 'Grip', + ['component_flashlight'] = 'Flashlight', + ['component_clip_default'] = 'Default Clip', + ['component_clip_extended'] = 'Extended Clip', + ['component_clip_drum'] = 'Drum Clip', + ["component_clip_box"] = "Box Clip", + ['component_suppressor'] = 'Suppressor', + ['component_compensator'] = 'Compensator', + ['component_luxary_finish'] = 'Luxury Finish', + ['tint_green'] = 'Green', + ['tint_gold'] = 'Gold', + ['tint_pink'] = 'Pink', + ['tint_army'] = 'Army', + ['tint_lspd'] = 'LSPD', + ['tint_orange'] = 'Orange', + ['tint_platinum'] = 'Platinum', }, } \ No newline at end of file