fix(qb-core): add global CreateUsableItem alias for qs-inventory compatibility
qs-inventory apelează CreateUsableItem ca funcție globală, dar qb-core definea doar QBCore.Functions.CreateUseableItem (cu 'e'). Adăugat alias global + fix 16 stringuri sparte în items.lua care blocau parsarea.
This commit is contained in:
BIN
resources/[framework]/[addons]/[quasar]/qs-armor/.fxap
Normal file
BIN
resources/[framework]/[addons]/[quasar]/qs-armor/.fxap
Normal file
Binary file not shown.
@@ -0,0 +1,93 @@
|
||||
--[[
|
||||
Hi dear customer or developer, here you can fully configure your server's
|
||||
framework or you could even duplicate this file to create your own framework.
|
||||
|
||||
If you do not have much experience, we recommend you download the base version
|
||||
of the framework that you use in its latest version and it will work perfectly.
|
||||
]]
|
||||
|
||||
if Config.Framework ~= 'esx' then
|
||||
return
|
||||
end
|
||||
|
||||
ESX = exports['es_extended']:getSharedObject()
|
||||
|
||||
function GetPlayerData()
|
||||
return ESX.GetPlayerData()
|
||||
end
|
||||
|
||||
local first = true
|
||||
RegisterNetEvent('esx:playerLoaded', function()
|
||||
if first then
|
||||
first = false
|
||||
CreateThread(function()
|
||||
Wait(1000)
|
||||
GetPlayerData(function(PlayerData)
|
||||
PlayerJob = PlayerData.job
|
||||
SetPedArmour(PlayerPedId(), PlayerData.metadata['armor'])
|
||||
currentarmor = PlayerData.metadata['armor']
|
||||
startedsync = true
|
||||
Wait(100)
|
||||
if Config.VestTexture then
|
||||
local ped = PlayerPedId()
|
||||
local PlayerData = GetPlayerData()
|
||||
local GetArmor = GetPedArmour(ped)
|
||||
currentVest = GetPedDrawableVariation(ped, 9)
|
||||
currentVestTexture = GetPedTextureVariation(ped, 9)
|
||||
if GetArmor >= 1 then
|
||||
SetVest()
|
||||
elseif GetArmor >= 51 then
|
||||
SetHeavyVest()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
function SendTextMessage(msg, type)
|
||||
if type == 'inform' then
|
||||
lib.notify({
|
||||
title = 'Inventory',
|
||||
description = msg,
|
||||
type = 'inform'
|
||||
})
|
||||
end
|
||||
if type == 'error' then
|
||||
lib.notify({
|
||||
title = 'Inventory',
|
||||
description = msg,
|
||||
type = 'error'
|
||||
})
|
||||
end
|
||||
if type == 'success' then
|
||||
lib.notify({
|
||||
title = 'Inventory',
|
||||
description = msg,
|
||||
type = 'success'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function ProgressBar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel)
|
||||
if lib.progressCircle({
|
||||
duration = duration,
|
||||
label = label,
|
||||
position = 'bottom',
|
||||
useWhileDead = useWhileDead,
|
||||
canCancel = canCancel,
|
||||
disable = disableControls,
|
||||
anim = {
|
||||
dict = animation.animDict,
|
||||
clip = animation.anim,
|
||||
flag = animation?.flags
|
||||
},
|
||||
prop = prop
|
||||
}) then
|
||||
onFinish()
|
||||
else
|
||||
if onCancel then
|
||||
onCancel()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,112 @@
|
||||
--[[
|
||||
Hi dear customer or developer, here you can fully configure your server's
|
||||
framework or you could even duplicate this file to create your own framework.
|
||||
|
||||
If you do not have much experience, we recommend you download the base version
|
||||
of the framework that you use in its latest version and it will work perfectly.
|
||||
]]
|
||||
|
||||
if Config.Framework ~= 'qb' then
|
||||
return
|
||||
end
|
||||
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
function GetPlayerData()
|
||||
return QBCore.Functions.GetPlayers()
|
||||
end
|
||||
|
||||
local first = true
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
||||
if first then
|
||||
first = false
|
||||
CreateThread(function()
|
||||
Wait(1000)
|
||||
GetPlayerData(function(PlayerData)
|
||||
PlayerJob = PlayerData.job
|
||||
SetPedArmour(PlayerPedId(), PlayerData.metadata['armor'])
|
||||
currentarmor = PlayerData.metadata['armor']
|
||||
startedsync = true
|
||||
Wait(100)
|
||||
if Config.VestTexture then
|
||||
local ped = PlayerPedId()
|
||||
local PlayerData = QS.GetPlayerData()
|
||||
local GetArmor = GetPedArmour(ped)
|
||||
currentVest = GetPedDrawableVariation(ped, 9)
|
||||
currentVestTexture = GetPedTextureVariation(ped, 9)
|
||||
if GetArmor >= 1 then
|
||||
SetVest()
|
||||
elseif GetArmor >= 51 then
|
||||
SetHeavyVest()
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
function SendTextMessage(msg, type)
|
||||
if type == 'inform' then
|
||||
lib.notify({
|
||||
title = 'Inventory',
|
||||
description = msg,
|
||||
type = 'inform'
|
||||
})
|
||||
end
|
||||
if type == 'error' then
|
||||
lib.notify({
|
||||
title = 'Inventory',
|
||||
description = msg,
|
||||
type = 'error'
|
||||
})
|
||||
end
|
||||
if type == 'success' then
|
||||
lib.notify({
|
||||
title = 'Inventory',
|
||||
description = msg,
|
||||
type = 'success'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function ShowHelpNotification(msg)
|
||||
BeginTextCommandDisplayHelp('STRING')
|
||||
AddTextComponentSubstringPlayerName(msg)
|
||||
EndTextCommandDisplayHelp(0, 0, false, -1)
|
||||
end
|
||||
|
||||
function DrawText3D(x, y, z, text)
|
||||
SetTextScale(0.4, 0.4)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(1)
|
||||
SetTextColour(255, 255, 255, 215)
|
||||
SetTextEntry('STRING')
|
||||
SetTextCentre(true)
|
||||
AddTextComponentString(text)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
function ProgressBar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel)
|
||||
if lib.progressCircle({
|
||||
duration = duration,
|
||||
label = label,
|
||||
position = 'bottom',
|
||||
useWhileDead = useWhileDead,
|
||||
canCancel = canCancel,
|
||||
disable = disableControls,
|
||||
anim = {
|
||||
dict = animation.animDict,
|
||||
clip = animation.anim,
|
||||
flag = animation?.flags
|
||||
},
|
||||
prop = prop
|
||||
}) then
|
||||
onFinish()
|
||||
else
|
||||
if onCancel then
|
||||
onCancel()
|
||||
end
|
||||
end
|
||||
end
|
||||
BIN
resources/[framework]/[addons]/[quasar]/qs-armor/client/main.lua
Normal file
BIN
resources/[framework]/[addons]/[quasar]/qs-armor/client/main.lua
Normal file
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
fx_version 'adamant'
|
||||
|
||||
game 'gta5'
|
||||
|
||||
lua54 'yes'
|
||||
|
||||
shared_scripts {
|
||||
'@ox_lib/init.lua',
|
||||
'shared/*.lua',
|
||||
'locales/*.lua',
|
||||
}
|
||||
|
||||
server_scripts {
|
||||
'server/**/**/**.lua'
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
'client/**/**/**.lua'
|
||||
}
|
||||
|
||||
escrow_ignore {
|
||||
'shared/config.lua',
|
||||
'locales/*.lua',
|
||||
'client/custom/framework/*.lua',
|
||||
'server/custom/framework/*.lua',
|
||||
}
|
||||
|
||||
dependencies {
|
||||
'qs-inventory', -- Required.
|
||||
'/server:4752', -- ⚠️PLEASE READ⚠️ This requires at least server build 4700 or higher
|
||||
}
|
||||
|
||||
dependency '/assetpacks'
|
||||
@@ -0,0 +1,8 @@
|
||||
Locales['de'] = {
|
||||
["ARMOR_NOTIFICATION_ALREADY_HAVE"] = "Du hast schon eine Weste an",
|
||||
["ARMOR_NOTIFICATION_DONT_HAVE"] = "Du hast keine Weste!",
|
||||
|
||||
["ARMOR_PROGRESS_USE_ARMOR"] = "Kugelsichere Weste Anziehen ...",
|
||||
["ARMOR_PROGRESS_USE_HEAVYARMOR"] = "Schwere Weste Anziehen ...",
|
||||
["ARMOR_PROGRESS_REMOVE_ARMOR"] = "Weste ausziehen ...",
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Locales['en'] = {
|
||||
["ARMOR_NOTIFICATION_ALREADY_HAVE"] = "You already have a bulletproof vest",
|
||||
["ARMOR_NOTIFICATION_DONT_HAVE"] = "You don't have a bulletproof vest",
|
||||
|
||||
["ARMOR_PROGRESS_USE_ARMOR"] = "Placing Armor ...",
|
||||
["ARMOR_PROGRESS_USE_HEAVYARMOR"] = "Placing Heavy Armor ...",
|
||||
["ARMOR_PROGRESS_REMOVE_ARMOR"] = "Removing Armor ...",
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Locales['es'] = {
|
||||
["ARMOR_NOTIFICATION_ALREADY_HAVE"] = "Ya tienes un chaleco antibalas",
|
||||
["ARMOR_NOTIFICATION_DONT_HAVE"] = "No tienes un chaleco antibalas",
|
||||
|
||||
["ARMOR_PROGRESS_USE_ARMOR"] = "Colocando Armor...",
|
||||
["ARMOR_PROGRESS_USE_HEAVYARMOR"] = "Colocando Heavy Armor...",
|
||||
["ARMOR_PROGRESS_REMOVE_ARMOR"] = "Quitando Armor...",
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
Locales['it'] = {
|
||||
["ARMOR_NOTIFICATION_ALREADY_HAVE"] = "Hai già un giubbotto anti-proiettile",
|
||||
["ARMOR_NOTIFICATION_DONT_HAVE"] = "Non hai un giubbotto anti-proiettile",
|
||||
|
||||
["ARMOR_PROGRESS_USE_ARMOR"] = "Indossando giubbotto anti-proiettile...",
|
||||
["ARMOR_PROGRESS_USE_HEAVYARMOR"] = "Indossando giubbotto anti-proiettile pesante...",
|
||||
["ARMOR_PROGRESS_REMOVE_ARMOR"] = "Togliendo armatura...",
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
--[[
|
||||
Hi dear customer or developer, here you can fully configure your server's
|
||||
framework or you could even duplicate this file to create your own framework.
|
||||
|
||||
If you do not have much experience, we recommend you download the base version
|
||||
of the framework that you use in its latest version and it will work perfectly.
|
||||
]]
|
||||
|
||||
if Config.Framework ~= 'esx' then
|
||||
return
|
||||
end
|
||||
|
||||
ESX = exports['es_extended']:getSharedObject()
|
||||
|
||||
function RegisterUsableItem(name, cb)
|
||||
exports['qs-inventory']:CreateUsableItem(name, cb)
|
||||
end
|
||||
|
||||
function GetPlayerFromId(source)
|
||||
return ESX.GetPlayerFromId(source)
|
||||
end
|
||||
|
||||
function GetIdentifier(source)
|
||||
return ESX.GetPlayerFromId(source).identifier
|
||||
end
|
||||
|
||||
function AddItem(source, item, count, slot)
|
||||
exports['qs-inventory']:AddItem(source, item, count, slot)
|
||||
end
|
||||
|
||||
function RemoveItem(source, item, count)
|
||||
local xPlayer = GetPlayerFromId(source)
|
||||
xPlayer.removeInventoryItem(item, count)
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
--[[
|
||||
Hi dear customer or developer, here you can fully configure your server's
|
||||
framework or you could even duplicate this file to create your own framework.
|
||||
|
||||
If you do not have much experience, we recommend you download the base version
|
||||
of the framework that you use in its latest version and it will work perfectly.
|
||||
]]
|
||||
|
||||
if Config.Framework ~= 'qb' then
|
||||
return
|
||||
end
|
||||
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
function RegisterUsableItem(name, cb)
|
||||
exports['qs-inventory']:CreateUsableItem(name, cb)
|
||||
end
|
||||
|
||||
function GetPlayerFromId(player)
|
||||
return QBCore.Functions.GetPlayer(player)
|
||||
end
|
||||
|
||||
function GetIdentifier(player)
|
||||
return QBCore.Functions.GetPlayer(player).PlayerData.citizenid
|
||||
end
|
||||
|
||||
function AddItem(source, item, count, slot)
|
||||
exports['qs-inventory']:AddItem(source, item, count, slot)
|
||||
end
|
||||
|
||||
function RemoveItem(source, item, count)
|
||||
local xPlayer = GetPlayerFromId(source)
|
||||
xPlayer.Functions.RemoveItem(item, count)
|
||||
end
|
||||
BIN
resources/[framework]/[addons]/[quasar]/qs-armor/server/main.lua
Normal file
BIN
resources/[framework]/[addons]/[quasar]/qs-armor/server/main.lua
Normal file
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,103 @@
|
||||
Config = {}
|
||||
Locales = {}
|
||||
local esxHas = GetResourceState('es_extended') == 'started'
|
||||
local qbHas = GetResourceState('qb-core') == 'started'
|
||||
local qbxHas = GetResourceState('qbx_core') == 'started'
|
||||
|
||||
Config.Framework = esxHas and 'esx' or qbHas and 'qb' or qbxHas and 'qb' or 'esx'
|
||||
|
||||
--[[
|
||||
Set the primary language for the resource.
|
||||
Choose one of the default languages located in locales/*.
|
||||
If your desired language is not listed, feel free to create your own!
|
||||
]]
|
||||
|
||||
Config.Language = 'en'
|
||||
|
||||
--[[
|
||||
General configuration settings for the resource.
|
||||
Customize each option as needed.
|
||||
]]
|
||||
|
||||
Config.Progressbar = { -- Timer durations for progress bars (in milliseconds).
|
||||
UseArmor = 5000, -- Duration for applying regular armor.
|
||||
UseHeavyArmor = 5000, -- Duration for applying heavy armor.
|
||||
ResetArmor = 2500 -- Duration for removing the armor.
|
||||
}
|
||||
|
||||
Config.SetPedArmour = { -- Amount of armor applied to the player.
|
||||
UseArmor = 50, -- Armor value for regular armor.
|
||||
UseHeavyArmor = 100, -- Armor value for heavy armor.
|
||||
ResetArmor = 0 -- Armor value when the vest is removed.
|
||||
}
|
||||
|
||||
--[[
|
||||
Command used to remove the player's vest.
|
||||
]]
|
||||
|
||||
Config.ResetArmor = 'resetarmor' -- Command to reset/remove your vest.
|
||||
|
||||
--[[
|
||||
Configuration to check if a player has a vest equipped.
|
||||
]]
|
||||
|
||||
Config.VestTexture = true -- Should vest textures be used? (true = Yes, false = No)
|
||||
Config.CheckVest = {
|
||||
check = false, -- Enable automatic vest checks? (true = Yes, false = No)
|
||||
time = 30000 -- Frequency of checks (in milliseconds). Ignored if check = false.
|
||||
}
|
||||
|
||||
--[[
|
||||
Vest configuration based on player gender.
|
||||
Customize the vest components for both male and female characters.
|
||||
]]
|
||||
|
||||
Config.Vest = {
|
||||
male = {
|
||||
['bproof_1'] = 6, -- Main vest component ID for males.
|
||||
['bproof_2'] = 1 -- Secondary vest texture ID for males.
|
||||
},
|
||||
female = {
|
||||
['bproof_1'] = 0, -- Main vest component ID for females.
|
||||
['bproof_2'] = 0 -- Secondary vest texture ID for females.
|
||||
},
|
||||
|
||||
maleHeavy = {
|
||||
['bproof_1'] = 27, -- Main heavy vest component ID for males.
|
||||
['bproof_2'] = 2 -- Secondary heavy vest texture ID for males.
|
||||
},
|
||||
|
||||
femaleHeavy = {
|
||||
['bproof_1'] = 6, -- Main heavy vest component ID for females.
|
||||
['bproof_2'] = 0 -- Secondary heavy vest texture ID for females.
|
||||
}
|
||||
}
|
||||
|
||||
--[[
|
||||
Editable functions to handle vest application or removal.
|
||||
These functions are only executed if VestTexture is set to true.
|
||||
]]
|
||||
|
||||
function SetVest() -- Function to apply the regular vest texture.
|
||||
local isMale = GetEntityModel(PlayerPedId()) == joaat('mp_m_freemode_01')
|
||||
local vest = isMale and Config.Vest.male or Config.Vest.female
|
||||
SetPedComponentVariation(PlayerPedId(), 9, vest['bproof_1'], vest['bproof_2'], 0)
|
||||
end
|
||||
|
||||
function SetHeavyVest() -- Function to apply the heavy vest texture.
|
||||
local isMale = GetEntityModel(PlayerPedId()) == joaat('mp_m_freemode_01')
|
||||
local vest = isMale and Config.Vest.maleHeavy or Config.Vest.femaleHeavy
|
||||
SetPedComponentVariation(PlayerPedId(), 9, vest['bproof_1'], vest['bproof_2'], 0)
|
||||
end
|
||||
|
||||
function RemoveVest() -- Function to remove the vest texture.
|
||||
SetPedComponentVariation(PlayerPedId(), 9, 0, 1, 0)
|
||||
end
|
||||
|
||||
--[[
|
||||
Debug mode configuration.
|
||||
When enabled, detailed debug prints/logs are displayed for development purposes.
|
||||
Use this only during development/testing phases.
|
||||
]]
|
||||
|
||||
Config.Debug = false
|
||||
Binary file not shown.
Reference in New Issue
Block a user