forked from Simnation/Main
ed
This commit is contained in:
parent
6a6c44143c
commit
e50a457657
31 changed files with 1135 additions and 764 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,176 +0,0 @@
|
|||
print'Pug Sling 2.1.3'
|
||||
|
||||
CreateThread(function()
|
||||
local InVehicle
|
||||
while true do
|
||||
Wait(100)
|
||||
local entering = GetVehiclePedIsTryingToEnter(PlayerPedId())
|
||||
if entering ~= 0 then
|
||||
TriggerEvent("Pug:ReloadGuns:sling", true)
|
||||
Wait(2000)
|
||||
end
|
||||
if IsPedInAnyVehicle(PlayerPedId()) then
|
||||
if not InVehicle then
|
||||
InVehicle = true
|
||||
TriggerEvent("Pug:ReloadGuns:sling", true)
|
||||
Wait(2000)
|
||||
end
|
||||
else
|
||||
InVehicle = false
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
if not Config.UseOldSlingScript then
|
||||
RegisterNetEvent('Pug:ReloadGuns:sling', function(bool)
|
||||
ResetAllWeaponsOnBack(bool)
|
||||
for _, v in pairs(GetGamePool('CObject')) do
|
||||
if IsEntityAttachedToEntity(PlayerPedId(), v) then
|
||||
SetEntityAsMissionEntity(v, true, true)
|
||||
DeleteObject(v)
|
||||
DeleteEntity(v)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
|
||||
Wait(3000)
|
||||
TriggerEvent("Pug:client:RegisterAllBackWeapons")
|
||||
end)
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function()
|
||||
Wait(3000)
|
||||
TriggerEvent("Pug:client:RegisterAllBackWeapons")
|
||||
end)
|
||||
|
||||
-- Change this to your notification script if needed
|
||||
function SlingNotify(msg, type, length)
|
||||
if Framework == "ESX" then
|
||||
FWork.ShowNotification(msg)
|
||||
elseif Framework == "QBCore" then
|
||||
FWork.Functions.Notify(msg, type, length)
|
||||
end
|
||||
end
|
||||
|
||||
-- INVENTORY HAS ITEM CHECK
|
||||
function CheckHasWeapon(Weapon)
|
||||
if GetResourceState("qs-inventory") == 'started' then
|
||||
local count = exports['qs-inventory']:Search(Weapon)
|
||||
if count > 0 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
elseif GetResourceState("qb-inventory") == 'started' then
|
||||
return exports['qb-inventory']:HasItem(Weapon)
|
||||
elseif GetResourceState("ps-inventory") == 'started' then
|
||||
return exports['ps-inventory']:HasItem(Weapon)
|
||||
elseif GetResourceState("ox_inventory") == 'started' then
|
||||
local count = exports.ox_inventory:GetItemCount(Weapon)
|
||||
if count > 0 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
elseif GetResourceState("tgiann-inventory") == 'started' then
|
||||
-- Fixed implementation for tgiann-inventory
|
||||
return exports["tgiann-inventory"]:HasItem(Weapon, 1)
|
||||
elseif GetResourceState("core_inventory") == 'started' then
|
||||
if Framework == "QBCore" then
|
||||
local citizenid = FWork.Functions.GetPlayerData().citizenid
|
||||
local Primary = exports['core_inventory']:getItems('primary-' .. citizenid, Weapon)
|
||||
local Secondry = exports['core_inventory']:getItems('secondry-' .. citizenid, Weapon)
|
||||
if Primary > 0 or Secondry > 0 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
elseif Framework == "QBCore" then
|
||||
local FinalValue = false
|
||||
local items = FWork.Functions.GetPlayerData().items
|
||||
for _, v in pairs(items) do
|
||||
if v.name ~= nil then
|
||||
if tostring(v.name) == tostring(Weapon) then
|
||||
FinalValue = true
|
||||
end
|
||||
end
|
||||
end
|
||||
return FinalValue
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function CheckJobVerified()
|
||||
local PlayerJob = Config.FrameworkFunctions.GetPlayer().PlayerData.job.name
|
||||
for _,v in pairs(Config.RackCapableJobs) do
|
||||
if tostring(v) == tostring(PlayerJob) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
RegisterCommand(Config.WeaponRackCommand, function()
|
||||
if CheckJobVerified() then
|
||||
--IS IN VEHICLE
|
||||
if IsPedInAnyVehicle(PlayerPedId()) then
|
||||
local veh = GetVehiclePedIsUsing(PlayerPedId())
|
||||
local plate = GetVehicleNumberPlateText(veh)
|
||||
--IS EMERGENCY VEHICLE
|
||||
if GetVehicleClass(veh) == 18 then
|
||||
if Framework == "ESX" then
|
||||
if GetResourceState("qb-inventory") == 'started' or GetResourceState("ps-inventory") == 'started' then
|
||||
TriggerEvent("inventory:client:SetCurrentStash", "Rack".. plate)
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "stash", "Rack" .. plate, {
|
||||
maxweight = Config.RackMaxWeight,
|
||||
slots = Config.RackSlots,
|
||||
})
|
||||
elseif GetResourceState("qs-inventory") == 'started' then
|
||||
exports['qs-inventory']:RegisterStash("Rack".. plate, Config.RackSlots, Config.RackMaxWeight)
|
||||
elseif GetResourceState("ox_inventory") == 'started' then
|
||||
TriggerServerEvent("Pug:server:SlingOpenOxInvRack", "Rack".. plate, Config.RackSlots, Config.RackMaxWeight)
|
||||
exports.ox_inventory:openInventory('stash', "Rack".. plate)
|
||||
end
|
||||
else
|
||||
FWork.Functions.Progressbar("reaching_rack", "Reaching for rack", 4000, false, true, {
|
||||
disableMovement = false,
|
||||
disableCarMovement = false,
|
||||
disableMouse = false,
|
||||
disableCombat = true,
|
||||
}, {
|
||||
animDict = "move_m@intimidation@cop@unarmed",
|
||||
anim = "idle",
|
||||
flags = 49,
|
||||
}, {}, {}, function()
|
||||
if GetResourceState("qb-inventory") == 'started' or GetResourceState("ps-inventory") == 'started' then
|
||||
TriggerEvent("inventory:client:SetCurrentStash", "Rack".. plate)
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "stash", "Rack" .. plate, {
|
||||
maxweight = Config.RackMaxWeight,
|
||||
slots = Config.RackSlots,
|
||||
})
|
||||
elseif GetResourceState("qs-inventory") == 'started' then
|
||||
exports['qs-inventory']:RegisterStash("Rack".. plate, Config.RackSlots, Config.RackMaxWeight)
|
||||
elseif GetResourceState("ox_inventory") == 'started' then
|
||||
TriggerServerEvent("Pug:server:SlingOpenOxInvRack", "Rack".. plate, Config.RackSlots, Config.RackMaxWeight)
|
||||
exports.ox_inventory:openInventory('stash', "Rack".. plate)
|
||||
end
|
||||
end, function() -- Cancel
|
||||
SlingNotify("Canceled", "error", 4500)
|
||||
end)
|
||||
end
|
||||
else
|
||||
SlingNotify(Config.LangT.EmergencyServiceVehicle, "error")
|
||||
end
|
||||
else
|
||||
SlingNotify(Config.LangT.MustBeInVehicle, "error")
|
||||
end
|
||||
else
|
||||
SlingNotify(Config.LangT.NotPolice, "error")
|
||||
end
|
||||
end)
|
||||
end
|
|
@ -1,288 +0,0 @@
|
|||
Config = {}
|
||||
Config.UseOldSlingScript = false -- MAKKE THIS TRUE IF YOU WANT TO USE THE OLD VERSION OF THE SCRIPT. VIDEO FOUND HERE: https://youtu.be/Pf-B03cmFtQ
|
||||
if not Config.UseOldSlingScript then
|
||||
---------- [Framework] ----------
|
||||
-- (DONT TOUCH THIS UNLESS YOU HAVE A CUSTOM FRAMEWORK)
|
||||
if GetResourceState('es_extended') == 'started' then
|
||||
Framework = "ESX" -- (ESX) or (QBCore)
|
||||
elseif GetResourceState('qb-core') == 'started' then
|
||||
Framework = "QBCore" -- (ESX) or (QBCore)
|
||||
end
|
||||
if Framework == "QBCore" then
|
||||
Config.CoreName = "qb-core" -- your core name
|
||||
FWork = exports[Config.CoreName]:GetCoreObject()
|
||||
elseif Framework == "ESX" then
|
||||
Config.CoreName = "es_extended" -- your core name
|
||||
FWork = exports[Config.CoreName]:getSharedObject()
|
||||
end
|
||||
------------------------------
|
||||
---------- [INTAGERS] ----------
|
||||
Config.LoopSpeed = 500 -- How fast the loop to check weapons runs. Lower numbers are lest optimized.
|
||||
Config.RackMaxWeight = 45000 -- Rack stash weight capacity.
|
||||
Config.RackSlots = 2 -- Rack stash amount of item slots available.
|
||||
Config.WeaponLimit = 4 -- Ammount of weapons/items that will show up on the player when they have the item or weapon
|
||||
Config.AmountOfTimesToCheckIfTheModelIsLoaded = 10 -- This value adjust the amount of times to check to see if a modle is loaded. The check runs every 100 milliseconds
|
||||
------------------------------
|
||||
---------- [STRINGS] ----------
|
||||
Config.WeaponRackCommand = "rack" -- /rack command to rack weapons into any service vehicles
|
||||
Config.WeaponSettingCommand = "setweapon" -- (GLOBAL POSITION FOR EVERYONE) /setweapon command to begin editing where the weapons/items should sit on the player
|
||||
Config.PersonalWeponSettingsCommand = "weaponposition" -- (PLAYERS PERSONAL POSITION THAT THEY SET HOW THEY LIKE) You can remove this command from the server.lua
|
||||
------------------------------
|
||||
---------- [TABLES] ----------
|
||||
Config.RackCapableJobs = { -- Jobs that can do the /rack command
|
||||
"leo",
|
||||
"police",
|
||||
"marshal",
|
||||
|
||||
}
|
||||
------------------------------
|
||||
Config.LangT = {
|
||||
DeleteFromConfig = "DELETE FROM CONFIG",
|
||||
Change = "CHANGE ",
|
||||
ToggleWeapons = "ALL WEAPONS ON/OFF",
|
||||
RotateZ = "ROTATE Z",
|
||||
Up = "UP",
|
||||
Down = "DOWN",
|
||||
Left = "LEFT",
|
||||
Right = "RIGHT",
|
||||
In = "In",
|
||||
Out = "Out",
|
||||
Rotate = "ROTATE",
|
||||
MustBeInVehicle = "You must be in a vehicle",
|
||||
NotPolice = "You are not a police Officer",
|
||||
EmergencyServiceVehicle = "Must be in a emergency service vehicle!",
|
||||
}
|
||||
-- THE ATTACHMENTS WORK BUT SOME SERVERS HAD CRASHING ISSUES WHEN THEY WERE UNHASHED. YOU CAN UNHASH THEM BUT IF YOU CRASH THEN HASH THEM BACK OUT.
|
||||
Config.WeaponsOnBack = {-- THE ATTACHMENTS WORK BUT SOME SERVERS HAD CRASHING ISSUES WHEN THEY WERE UNHASHED. YOU CAN UNHASH THEM BUT IF YOU CRASH THEN HASH THEM BACK OUT.
|
||||
-- Pistols
|
||||
|
||||
|
||||
-- Assault Rifles
|
||||
["weapon_carbinerifle"] = { -- THE ATTACHMENTS WORK BUT SOME SERVERS HAD CRASHING ISSUES WHEN THEY WERE UNHASHED. YOU CAN UNHASH THEM BUT IF YOU CRASH THEN HASH THEM BACK OUT.
|
||||
model = "w_ar_carbinerifle",
|
||||
--Attachments = {
|
||||
--["COMPONENT_CARBINERIFLE_CLIP_01"] = {Base = 'WAPClip',Component = "W_AR_CARBINERIFLE_MAG1"},
|
||||
--["COMPONENT_CARBINERIFLE_CLIP_02"] = {Base = 'WAPClip',Component = "W_AR_CARBINERIFLE_MAG2"},
|
||||
--["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr',Component = "W_AT_AR_FLSH"},
|
||||
--["COMPONENT_AT_SCOPE_MEDIUM"] = {Base = 'WAPScop',Component = "W_AT_SCOPE_MEDIUM"},
|
||||
--["COMPONENT_AT_AR_SUPP"] = {Base = 'WAPSupp', Component = "W_AT_AR_SUPP"},
|
||||
--["COMPONENT_AT_AR_AFGRIP"] = {Base = 'WAPGrip',Component = "W_AT_AR_AFGRIP"},
|
||||
--}
|
||||
},
|
||||
["weapon_carbinerifle_mk2"] = {
|
||||
model = "w_ar_carbineriflemk2",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_CARBINERIFLE_MK2_CLIP_01"] = {Base = 'WAPClip', Component = "w_ar_carbineriflemk2_mag1"},
|
||||
-- ["COMPONENT_CARBINERIFLE_MK2_CLIP_02"] = {Base = 'WAPClip', Component = "w_ar_carbineriflemk2_mag2"},
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_SIGHTS"] = {Base = 'WAPScop', Component = "w_at_sights_1"},
|
||||
-- ["COMPONENT_AT_AR_SUPP"] = {Base = 'WAPSupp', Component = "W_AT_AR_SUPP"},
|
||||
-- ["COMPONENT_AT_MUZZLE_01"] = {Base = 'WAPSupp', Component = "w_at_muzzle_1"},
|
||||
-- ["COMPONENT_AT_AR_AFGRIP_02"] = {Base = 'WAPGrip', Component = "w_at_afgrip_2"},
|
||||
-- ["COMPONENT_CARBINERIFLE_MK2_CAMO"] = {Base = 'Cosmetic', Component = "w_at_cr_camo1"},
|
||||
-- }
|
||||
},
|
||||
["weapon_specialcarbine"] = {
|
||||
model = "w_ar_specialcarbine",
|
||||
--Attachments = {
|
||||
--["COMPONENT_SPECIALCARBINE_CLIP_01"] = {Base = 'WAPClip', Component = "w_ar_specialcarbine_mag1"},
|
||||
--["COMPONENT_SPECIALCARBINE_CLIP_02"] = {Base = 'WAPClip', Component = "w_ar_specialcarbine_mag2"},
|
||||
--["COMPONENT_SPECIALCARBINE_CLIP_03"] = {Base = 'WAPClip', Component = "w_ar_specialcarbine_boxmag"},
|
||||
--["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
--["COMPONENT_AT_SCOPE_MEDIUM"] = {Base = 'WAPScop', Component = "w_at_scope_medium"},
|
||||
--["COMPONENT_AT_AR_SUPP_02"] = {Base = 'WAPSupp', Component = "w_at_ar_supp_02"},
|
||||
--["COMPONENT_AT_AR_AFGRIP"] = {Base = 'WAPGrip', Component = "W_AT_AR_AFGRIP"},
|
||||
--["COMPONENT_SPECIALCARBINE_VARMOD_LOWRIDER"] = {Base = 'Cosmetic', Component = "w_ar_specialcarbine_luxe"},
|
||||
--}
|
||||
},
|
||||
["weapon_advancedrifle"] = {
|
||||
model = "w_ar_advancedrifle",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_ADVANCEDRIFLE_CLIP_01"] = {Base = 'WAPClip', Component = "w_ar_advancedrifle_mag1"},
|
||||
-- ["COMPONENT_ADVANCEDRIFLE_CLIP_02"] = {Base = 'WAPClip', Component = "w_ar_advancedrifle_mag2"},
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_SCOPE_SMALL"] = {Base = 'WAPScop', Component = "w_at_scope_small"},
|
||||
-- ["COMPONENT_AT_AR_SUPP"] = {Base = 'WAPSupp', Component = "w_at_ar_supp"},
|
||||
-- }
|
||||
},
|
||||
|
||||
-- Sub Machine Guns
|
||||
["weapon_assaultsmg"] = {
|
||||
model = "w_sb_assaultsmg",
|
||||
--Attachments = {
|
||||
--["COMPONENT_ASSAULTSMG_CLIP_01"] = {Base = 'WAPClip', Component = "W_SB_ASSAULTSMG_Mag1"},
|
||||
--["COMPONENT_ASSAULTSMG_CLIP_02"] = {Base = 'WAPClip', Component = "W_SB_ASSAULTSMG_Mag2"},
|
||||
--["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
--["COMPONENT_AT_SCOPE_MACRO"] = {Base = 'WAPScop', Component = "w_at_scope_macro"},
|
||||
--["COMPONENT_AT_AR_SUPP_02"] = {Base = 'WAPSupp', Component = "w_at_ar_supp_02"},
|
||||
--}
|
||||
},
|
||||
["weapon_smg"] = {
|
||||
model = "w_sb_smg",
|
||||
--Attachments = {
|
||||
--["COMPONENT_SMG_CLIP_01"] = {Base = 'WAPClip', Component = "w_sb_smg_mag1"},
|
||||
--["COMPONENT_SMG_CLIP_02"] = {Base = 'WAPClip', Component = "w_sb_smg_mag2"},
|
||||
--["COMPONENT_SMG_CLIP_03"] = {Base = 'WAPClip', Component = "w_sb_smg_boxmag"},
|
||||
--["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
--["COMPONENT_AT_SCOPE_MACRO_02"] = {Base = 'WAPScop_2', Component = "w_at_scope_macro_2"},
|
||||
--["COMPONENT_AT_PI_SUPP"] = {Base = 'WAPSupp', Component = "w_at_pi_supp"},
|
||||
--}
|
||||
},
|
||||
["weapon_smg_mk2"] = {
|
||||
model = "w_sb_smgmk2",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_SMG_MK2_CLIP_01"] = {Base = 'WAPClip', Component = "w_sb_smgmk2_mag1"},
|
||||
-- ["COMPONENT_SMG_MK2_CLIP_02"] = {Base = 'WAPClip', Component = "w_sb_smgmk2_mag2"},
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_SIGHTS"] = {Base = 'WAPScop', Component = "w_at_sights_1"},
|
||||
-- ["COMPONENT_AT_SCOPE_SMALL"] = {Base = 'WAPScop', Component = "w_at_scope_small"},
|
||||
-- ["COMPONENT_AT_AR_AFGRIP_02"] = {Base = 'WAPGrip', Component = "w_at_afgrip_2"},
|
||||
-- }
|
||||
},
|
||||
["weapon_combatpdw"] = {
|
||||
model = "w_sb_pdw",
|
||||
--Attachments = {
|
||||
--["COMPONENT_SMG_MK2_CLIP_01"] = {Base = 'WAPClip', Component = "w_sb_smgmk2_mag1"},
|
||||
--["COMPONENT_SMG_MK2_CLIP_02"] = {Base = 'WAPClip', Component = "w_sb_smgmk2_mag2"},
|
||||
--["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
--["COMPONENT_AT_SIGHTS"] = {Base = 'WAPScop', Component = "w_at_sights_1"},
|
||||
--["COMPONENT_AT_SCOPE_SMALL"] = {Base = 'WAPScop', Component = "w_at_scope_small"},
|
||||
--["COMPONENT_AT_AR_AFGRIP_02"] = {Base = 'WAPGrip', Component = "w_at_afgrip_2"},
|
||||
--}
|
||||
},
|
||||
|
||||
|
||||
|
||||
-- Sniper Rifles
|
||||
["weapon_musket"] = { model = "w_ar_musket" },
|
||||
["weapon_sniperrifle"] = {
|
||||
model = "w_sr_sniperrifle",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_SNIPERRIFLE_CLIP_01"] = {Base = 'WAPClip', Component = "w_sr_sniperrifle_mag1"},
|
||||
-- ["COMPONENT_AT_SCOPE_LARGE"] = {Base = 'WAPScop', Component = "w_at_scope_large"},
|
||||
-- ["COMPONENT_AT_SCOPE_MAX"] = {Base = 'WAPScop', Component = "w_at_scope_max"},
|
||||
-- ["COMPONENT_AT_AR_SUPP_02"] = {Base = 'WAPSupp', Component = "w_at_ar_supp_02"},
|
||||
-- }
|
||||
},
|
||||
|
||||
-- Shotguns
|
||||
["weapon_combatshotgun"] = {
|
||||
model = "w_sg_pumpshotgunh4",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_ASSAULTSHOTGUN_CLIP_01"] = {Base = 'WAPClip', Component = "w_sg_assaultshotgun_mag1"},
|
||||
-- ["COMPONENT_ASSAULTSHOTGUN_CLIP_02"] = {Base = 'WAPClip', Component = "w_sg_assaultshotgun_mag2"},
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_AR_SUPP"] = {Base = 'WAPSupp', Component = "w_at_ar_supp"},
|
||||
-- ["COMPONENT_AT_AR_AFGRIP"] = {Base = 'WAPGrip', Component = "w_at_ar_afgrip"},
|
||||
-- }
|
||||
},
|
||||
["weapon_bullpupshotgun"] = {
|
||||
model = "w_sg_bullpupshotgun",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_AR_SUPP_02"] = {Base = 'WAPSupp', Component = "w_at_ar_supp_02"},
|
||||
-- ["COMPONENT_AT_AR_AFGRIP"] = {Base = 'WAPGrip', Component = "w_at_ar_afgrip"},
|
||||
-- }
|
||||
},
|
||||
["weapon_pumpshotgun"] = {
|
||||
model = "w_sg_pumpshotgun",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_SR_SUPP"] = {Base = 'WAPSupp', Component = "W_AT_AR_SUPP"},
|
||||
-- }
|
||||
},
|
||||
["weapon_heavyshotgun"] = {
|
||||
model = "w_sg_heavyshotgun",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_01"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_mag1"},
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_02"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_mag2"},
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_03"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_boxmag"},
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_AR_SUPP_02"] = {Base = 'WAPSupp', Component = "w_at_ar_supp_02"},
|
||||
-- ["COMPONENT_AT_AR_AFGRIP"] = {Base = 'WAPGrip', Component = "w_at_ar_afgrip"},
|
||||
-- }
|
||||
},
|
||||
["weapon_huntingrifle"] = {
|
||||
model = "w_sr_huntingrifle",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_01"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_mag1"},
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_02"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_mag2"},
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_03"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_boxmag"},
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_AR_SUPP_02"] = {Base = 'WAPSupp', Component = "w_at_ar_supp_02"},
|
||||
-- ["COMPONENT_AT_AR_AFGRIP"] = {Base = 'WAPGrip', Component = "w_at_ar_afgrip"},
|
||||
-- }
|
||||
},
|
||||
["weapon_crossbow"] = {
|
||||
model = "w_sr_crossbow",
|
||||
-- Attachments = {
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_01"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_mag1"},
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_02"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_mag2"},
|
||||
-- ["COMPONENT_HEAVYSHOTGUN_CLIP_03"] = {Base = 'WAPClip', Component = "w_sg_heavyshotgun_boxmag"},
|
||||
-- ["COMPONENT_AT_AR_FLSH"] = {Base = 'WAPFlshLasr', Component = "W_AT_AR_FLSH"},
|
||||
-- ["COMPONENT_AT_AR_SUPP_02"] = {Base = 'WAPSupp', Component = "w_at_ar_supp_02"},
|
||||
-- ["COMPONENT_AT_AR_AFGRIP"] = {Base = 'WAPGrip', Component = "w_at_ar_afgrip"},
|
||||
-- }
|
||||
},
|
||||
|
||||
|
||||
|
||||
-- Melee Weapons
|
||||
["weapon_machete"] = { model = "w_me_machette_lr" },
|
||||
["weapon_bat"] = { model = "w_me_bat" },
|
||||
["weapon_hatchet"] = { model = "w_me_hatchet" },
|
||||
|
||||
-- Items
|
||||
["cokebaggy"] = { model = "bkr_prop_coke_cutblock_01" },
|
||||
["markedbills"] = { model = "prop_money_bag_01" },
|
||||
["meth"] = { model = "hei_prop_pill_bag_01" },
|
||||
["weed_brick"] = { model = "bkr_prop_weed_drying_02a" },
|
||||
["fishingrod"] = { model = "prop_fishing_rod_02" },
|
||||
["fishingrod2"] = { model = "prop_fishing_rod_01" },
|
||||
["fishingrod3"] = { model = "prop_fishing_rod_01" },
|
||||
|
||||
-- Addon weapons
|
||||
-- ["weapon_crossbow"] = { model = "w_me_katana"},
|
||||
-- ["weapon_remington"] = { model = "w_sg_remington" },
|
||||
-- ["weapon_mp5"] = { model = "w_sb_mp5" },
|
||||
-- ["weapon_huntingrifle"] = { model = "w_sr_huntingrifle" },
|
||||
}
|
||||
------------------------------
|
||||
------------------------------
|
||||
--## DONT CHANGE ANY OF THESE ##--
|
||||
Config.FrameworkFunctions = {
|
||||
-- Client-side trigger callback
|
||||
TriggerCallback = function(...)
|
||||
if Framework == 'QBCore' then
|
||||
FWork.Functions.TriggerCallback(...)
|
||||
else
|
||||
FWork.TriggerServerCallback(...)
|
||||
end
|
||||
end,
|
||||
|
||||
-- Server-side register callback
|
||||
CreateCallback = function(...)
|
||||
if Framework == 'QBCore' then
|
||||
FWork.Functions.CreateCallback(...)
|
||||
else
|
||||
FWork.RegisterServerCallback(...)
|
||||
end
|
||||
end,
|
||||
|
||||
GetPlayer = function()
|
||||
local self = {}
|
||||
if Framework == 'QBCore' then
|
||||
player = FWork.Functions.GetPlayerData()
|
||||
self.PlayerData = { job = { name = player.job.name} }
|
||||
return self
|
||||
else
|
||||
player = FWork.GetPlayerData()
|
||||
self.PlayerData = { job = { name = player.job.name }}
|
||||
return self
|
||||
end
|
||||
return nil
|
||||
end,
|
||||
}
|
||||
------------------------------
|
||||
------------------------------
|
||||
end
|
|
@ -1,31 +0,0 @@
|
|||
lua54 'yes'
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
|
||||
author 'Discord: zpug'
|
||||
description 'pug-sling'
|
||||
version '2.1.3'
|
||||
|
||||
shared_scripts {
|
||||
'config.lua',
|
||||
'old-sling/config-old.lua',
|
||||
}
|
||||
|
||||
server_script 'server/main.lua'
|
||||
client_script {
|
||||
'client/main.lua',
|
||||
'client/open.lua',
|
||||
'old-sling/client-old.lua',
|
||||
}
|
||||
|
||||
file 'json/config-weapons.json'
|
||||
|
||||
escrow_ignore {
|
||||
'config.lua',
|
||||
'client/open.lua',
|
||||
'server/main.lua',
|
||||
'json/config-weapons.json',
|
||||
|
||||
'old-sling/config-old.lua',
|
||||
}
|
||||
dependency '/assetpacks'
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -1,107 +0,0 @@
|
|||
if Config.UseOldSlingScript then
|
||||
Config2 = {}
|
||||
Config2.CoreName = "qb-core" -- Only change this if you have changed your core name.
|
||||
Config2.Inventory = "qb-inventory" -- Inventory type (ox_inventory, qb-inventory, lj-inventory etc.)
|
||||
|
||||
Config2.LoopSpeed = 500 -- How fast the loop to check weapons runs. Lower numbers are lest optimized.
|
||||
|
||||
Config2.Placement = {
|
||||
["Back"] = {
|
||||
bone = 24816,
|
||||
x = 0.275, -- up and down
|
||||
y = -0.165, -- in and out
|
||||
z = 0.02, -- left and right
|
||||
x_rotation = 0.0,
|
||||
y_rotation = 0.0,
|
||||
z_rotation = 0.0
|
||||
},
|
||||
["Front"] = {
|
||||
bone = 10706,
|
||||
x = 0.0, -- up and down
|
||||
y = 0.19, -- in and out
|
||||
z = -0.25, -- left and right
|
||||
x_rotation = 0.0, -- flips the gun how you would want
|
||||
y_rotation = 75.0, -- tilts sideways
|
||||
z_rotation = 180.0 -- tilts into ped
|
||||
}
|
||||
}
|
||||
Config2.PlacementSecond = {
|
||||
["Back"] = {
|
||||
bone = 24816,
|
||||
x = 0.235, -- up and down
|
||||
y = -0.165, -- in and out
|
||||
z = -0.08, -- left and right
|
||||
x_rotation = 180.0, -- flips the gun how you would want
|
||||
y_rotation = 0.0, -- tilts sideways
|
||||
z_rotation = 0.0 -- tilts into ped
|
||||
},
|
||||
["Front"] = {
|
||||
bone = 24816,
|
||||
x = 0.275, -- up and down
|
||||
y = -0.165, -- in and out
|
||||
z = 0.02, -- left and right
|
||||
x_rotation = 0.0, -- flips the gun how you would want
|
||||
y_rotation = 0.0, -- tilts sideways
|
||||
z_rotation = 0.0 -- tilts into ped
|
||||
}
|
||||
}
|
||||
Config2.PlacementThird = {
|
||||
["Back"] = {
|
||||
bone = 10706,
|
||||
x = 0.0, -- up and down
|
||||
y = 0.19, -- in and out
|
||||
z = -0.25, -- left and right
|
||||
x_rotation = 0.0, -- flips the gun how you would want
|
||||
y_rotation = 75.0, -- tilts sideways
|
||||
z_rotation = 180.0 -- tilts into ped
|
||||
},
|
||||
["Front"] = {
|
||||
bone = 24816,
|
||||
x = 0.235, -- up and down
|
||||
y = -0.165, -- in and out
|
||||
z = -0.08, -- left and right
|
||||
x_rotation = 180.0, -- flips the gun how you would want
|
||||
y_rotation = 0.0, -- tilts sideways
|
||||
z_rotation = 0.0 -- tilts into ped
|
||||
}
|
||||
}
|
||||
|
||||
-- To add custom rotations to items or weapons all you need to do is add the "x_rotation = 0.0, y_rotation = 90.0, z_rotation = 0.0"
|
||||
-- as seen for the "weapon_machete" for example and adjust the values of the rotations.
|
||||
Config2.WeaponsOnBack = {
|
||||
-- assault rifles:
|
||||
["weapon_carbinerifle"] = { model = "w_ar_carbinerifle" },
|
||||
["weapon_compactrifle"] = { model = "w_ar_assaultrifle_smg" },
|
||||
["weapon_carbinerifle_mk2"] = { model = "w_ar_carbineriflemk2" },
|
||||
["weapon_assaultrifle"] = { model = "w_ar_assaultrifle" },
|
||||
["weapon_specialcarbine"] = { model = "w_ar_specialcarbine" },
|
||||
["weapon_bullpuprifle"] = { model = "w_ar_bullpuprifle" },
|
||||
["weapon_advancedrifle"] = { model = "w_ar_advancedrifle" },
|
||||
-- sub machine guns:
|
||||
["weapon_microsmg"] = { model = "w_sb_microsmg" },
|
||||
["weapon_assaultsmg"] = { model = "w_sb_assaultsmg" },
|
||||
["weapon_smg"] = { model = "w_sb_smg" },
|
||||
["weapon_smg_mk2"] = { model = "w_sb_smgmk2" },
|
||||
["weapon_gusenberg"] = { model = "w_sb_gusenberg" },
|
||||
-- sniper rifles:
|
||||
["weapon_sniperrifle"] = { model = "w_sr_sniperrifle" },
|
||||
-- shotguns:
|
||||
["weapon_sawnoffshotgun"] = { model = "w_sg_sawnoff" },
|
||||
["weapon_assaultshotgun"] = { model = "w_sg_assaultshotgun" },
|
||||
["weapon_bullpupshotgun"] = { model = "w_sg_bullpupshotgun" },
|
||||
["weapon_pumpshotgun"] = { model = "w_sg_pumpshotgun" },
|
||||
["weapon_musket"] = { model = "w_ar_musket" },
|
||||
["weapon_heavyshotgun"] = { model = "w_sg_heavyshotgun" },
|
||||
-- mele weapons
|
||||
["weapon_machete"] = { model = "w_me_machette_lr", x_rotation = 0.0, y_rotation = 90.0, z_rotation = 0.0 },
|
||||
["weapon_bat"] = { model = "w_me_bat", x_rotation = 0.0, y_rotation = 90.0, z_rotation = 0.0 },
|
||||
["coke_brick"] = { model = "bkr_prop_coke_cutblock_01", x_rotation = 0.0, y_rotation = 90.0, z_rotation = 90.0 },
|
||||
["markedbills"] = { model = "prop_money_bag_01", x_rotation = 0.0, y_rotation = 90.0, z_rotation = 0.0 },
|
||||
|
||||
-- Addon weapons
|
||||
["weapon_katana"] = { model = "w_me_katana", x_rotation = 0.0, y_rotation = 90.0, z_rotation = 0.0 },
|
||||
["weapon_remington"] = { model = "w_sg_remington" },
|
||||
["weapon_mp5"] = { model = "w_sb_mp5" },
|
||||
["weapon_huntingrifle"] = { model = "w_sr_huntingrifle" },
|
||||
}
|
||||
end
|
|
@ -1,40 +0,0 @@
|
|||
# pug-sling
|
||||
Advanced weapons slings for the qbcore framework. Any weapon in the players inventory will show up on there back.
|
||||
|
||||
# -- if you are using ox_inventory make sure to change Config.Inventory no other inventory name matters.
|
||||
|
||||
# -- If you are using illenium-appearance make sure to head to illenium-appearance/server/server.lua and replace these commands with these.
|
||||
lib.addCommand("reloadskin", { help = _L("commands.reloadskin.title") }, function(source)
|
||||
local src = source
|
||||
TriggerClientEvent("illenium-appearance:client:reloadSkin", src)
|
||||
Wait(500)
|
||||
TriggerClientEvent("Pug:ReloadGuns:sling", src)
|
||||
end)
|
||||
|
||||
lib.addCommand("clearstuckprops", { help = _L("commands.clearstuckprops.title") }, function(source)
|
||||
local src = source
|
||||
TriggerClientEvent("illenium-appearance:client:ClearStuckProps", src)
|
||||
Wait(500)
|
||||
TriggerClientEvent("Pug:ReloadGuns:sling", src)
|
||||
end)
|
||||
# --
|
||||
|
||||
# -- Support
|
||||
Full support provided in my discord here: https://discord.gg/jYZuWYjfvq
|
||||
# --
|
||||
|
||||
# -- My other scripts
|
||||
https://pug-webstore.tebex.io/
|
||||
# --
|
||||
|
||||
# -- Config file
|
||||
To add a new weapon you must change the first option to the qbcore shared.lua.
|
||||
# --
|
||||
|
||||
# -- Commands
|
||||
`/sling` - Will toggle the weapon placement on the front and back.
|
||||
# --
|
||||
|
||||
# -- Use this event to clear items stuck on players without removing the weapons on the players back
|
||||
TriggerEvent("Pug:ReloadGuns:sling")
|
||||
# --
|
|
@ -1,56 +0,0 @@
|
|||
# pug-sling 2.0
|
||||
|
||||
# -- If you are using illenium-appearance make sure to head to illenium-appearance/server/server.lua and replace these commands with these.
|
||||
lib.addCommand("reloadskin", { help = _L("commands.reloadskin.title") }, function(source)
|
||||
local src = source
|
||||
TriggerClientEvent("illenium-appearance:client:reloadSkin", src)
|
||||
Wait(500)
|
||||
TriggerClientEvent("Pug:ReloadGuns:sling", src)
|
||||
end)
|
||||
|
||||
lib.addCommand("clearstuckprops", { help = _L("commands.clearstuckprops.title") }, function(source)
|
||||
local src = source
|
||||
TriggerClientEvent("illenium-appearance:client:ClearStuckProps", src)
|
||||
Wait(500)
|
||||
TriggerClientEvent("Pug:ReloadGuns:sling", src)
|
||||
end)
|
||||
# --
|
||||
|
||||
# -- Use this event to clear items stuck on players without removing the weapons on the players back
|
||||
TriggerEvent("Pug:ReloadGuns:sling")
|
||||
# --
|
||||
|
||||
|
||||
Advanced Weapon Sling | Weapons On Back: For any questions please contact me here: https://discord.com/invite/jYZuWYjfvq
|
||||
|
||||
PREVIEW HERE: https://youtu.be/hluGYRiVY1E
|
||||
|
||||
This script is partially locked using escrow encryption. Most of the script is accessible in client/open.lua, and config.lua.
|
||||
|
||||
Full QBCore & ESX Compatibility.
|
||||
|
||||
This completely configurable script consist of:
|
||||
|
||||
● Wearable weapons and items that are placed onto the player when they have the set weapon or item anywhere within their inventory.
|
||||
● Advanced system controlling and moving around items/weapons in 3D space to get the best position of where the items/weapons should sit on the player.
|
||||
● Option for individual players to tailor the placement of items and weapons on their characters, enabling unique item positioning for each player. (QBCORE ONLY)
|
||||
● Full control over the items/weapons with the ability to adjust rotation, XYZ position, and edit the entire script from in-game without doing any code or configuring.
|
||||
● /rack Command Utilizes the custom weapon racking system, which is exclusively available for select jobs and used to store weapons in emergency service vehicles.
|
||||
● Version 1.0 comes with this script and is a completely different system shown off and explained in the video.
|
||||
● Anti-Car tornadoing mechanics designed to prevent car tornadoing from ever occurring on your server.
|
||||
● /weaponposition command for individual players to set personal weapon and item placements (optional).
|
||||
● /setweapon command to begin editing where the weapons/items should sit on the player.
|
||||
● Advanced checks to avoid and stop car tornadoing that occurs in every FiveM server.
|
||||
● 30 weapons and items pre-configured for you.
|
||||
● 0:00 ms ResMon for complete optimization.
|
||||
● qb-inventory support.
|
||||
● ox_inventory support.
|
||||
● qs-inventory support.
|
||||
● ps-inventory support.
|
||||
● Request inventory support and i will do it for this script if it is possible.
|
||||
|
||||
Requirements consist of:
|
||||
QBCore OR ESX (other frameworks will work but not supported)
|
||||
qb-inventory OR ox_inventory OR qs-inventory OR ps-inventory (any qb-inventory resource name changed will work)
|
||||
|
||||
1400 LINES OF CODE
|
|
@ -1,65 +0,0 @@
|
|||
|
||||
if not Config.UseOldSlingScript then
|
||||
Config.FrameworkFunctions.CreateCallback('Pug:server:GetWeaponConfig', function(source, cb)
|
||||
local File = LoadResourceFile(GetCurrentResourceName(), "./json/config-weapons.json")
|
||||
cb(File)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("Pug:server:SaveWeaponFile", function(JsonWeapons, Personal)
|
||||
local src = source
|
||||
if Personal then
|
||||
if Framework == "QBCore" then
|
||||
local Player = FWork.Functions.GetPlayer(src)
|
||||
if Player ~= nil then
|
||||
Player.Functions.SetMetaData("pug-weapondata", JsonWeapons)
|
||||
Player.Functions.Save()
|
||||
end
|
||||
else
|
||||
|
||||
end
|
||||
else
|
||||
local JsonWeapon = json.encode(JsonWeapons)
|
||||
SaveResourceFile(GetCurrentResourceName(), "./json/config-weapons.json", JsonWeapon)
|
||||
TriggerClientEvent("Pug:client:RegisterAllBackWeapons", -1, JsonWeapon)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
---------- [OX_INVENTORY RACK STASH SUPPORT] ----------
|
||||
local StashCreated = {}
|
||||
RegisterNetEvent("Pug:server:SlingOpenOxInvRack", function(StashName, Slots, Space)
|
||||
if not StashCreated[StashName] then
|
||||
StashCreated[StashName] = true
|
||||
exports.ox_inventory:RegisterStash(
|
||||
StashName,
|
||||
StashName,
|
||||
Slots,
|
||||
Space
|
||||
)
|
||||
end
|
||||
end)
|
||||
------------------------------
|
||||
|
||||
|
||||
---------- [Commands] ----------
|
||||
if Framework == "QBCore" then
|
||||
FWork.Commands.Add(Config.WeaponSettingCommand, "Adjust server weapons positions", {}, false, function(source, args)
|
||||
local src = source
|
||||
TriggerClientEvent("Pug:client:OpenSlingEditor",src)
|
||||
end,"admin")
|
||||
FWork.Commands.Add(Config.PersonalWeponSettingsCommand, "Adjust personal weapons positions", {}, false, function(source, args)
|
||||
local src = source
|
||||
TriggerClientEvent("Pug:client:OpenSlingEditor",src, true)
|
||||
end)
|
||||
else
|
||||
FWork.RegisterCommand(Config.WeaponSettingCommand, 'admin', function(xPlayer, args)
|
||||
local src = xPlayer.source
|
||||
TriggerClientEvent("Pug:client:OpenSlingEditor",src)
|
||||
end, true, {help = 'Create business menu', validate = true, arguments = {} })
|
||||
FWork.RegisterCommand(Config.PersonalWeponSettingsCommand, 'admin', function(xPlayer, args)
|
||||
local src = xPlayer.source
|
||||
TriggerClientEvent("Pug:client:OpenSlingEditor",src, true)
|
||||
end, true, {help = 'Create business menu', validate = true, arguments = {} })
|
||||
end
|
||||
------------------------------
|
||||
end
|
BIN
resources/[weapons]/[Scripts]/tgiann-weapons-on-back/.fxap
Normal file
BIN
resources/[weapons]/[Scripts]/tgiann-weapons-on-back/.fxap
Normal file
Binary file not shown.
|
@ -0,0 +1,28 @@
|
|||
config.useDefaultInventory = true
|
||||
|
||||
local function log(msg)
|
||||
print(string.format('\x1b[32m[tgiann-weapons-on-back]\x1b[0m %s', msg))
|
||||
end
|
||||
|
||||
-- Chezza Studios inventory works fine with normal esx(don't add to the list)
|
||||
local inventorys = {
|
||||
"tgiann-inventory",
|
||||
"mf-inventory",
|
||||
"ox_inventory",
|
||||
"core_inventory",
|
||||
"qs-inventory",
|
||||
"codem-inventory",
|
||||
"origen_inventory"
|
||||
}
|
||||
|
||||
for i = 1, #inventorys do
|
||||
local inventory = inventorys[i]
|
||||
local isStarted = GetResourceState(inventory) == "started"
|
||||
if isStarted then
|
||||
config[inventory] = true
|
||||
config.useDefaultInventory = false
|
||||
log(string.format("Started with %s inventory", inventory))
|
||||
end
|
||||
end
|
||||
|
||||
if config.useDefaultInventory then log(string.format("Started with %s default inventory", config.framework == "qb" and "QB" or "ESX")) end
|
|
@ -0,0 +1,89 @@
|
|||
if not config["codem-inventory"] then return end
|
||||
|
||||
local playerJob = ""
|
||||
local lastItems = {}
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
SetTimeout(2000, function() -- some waiting time because the character's inventory data is loaded later
|
||||
lastItems = exports['codem-inventory']:GetClientPlayerInventory()
|
||||
weaponCheck()
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('codem-inventory:client:additem')
|
||||
AddEventHandler('codem-inventory:client:additem', function(slot, data)
|
||||
lastItems[tostring(slot)] = data
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('codem-inventory:client:removeitemtoclientInventory')
|
||||
AddEventHandler('codem-inventory:client:removeitemtoclientInventory', function(slot, amount)
|
||||
slot = tostring(slot)
|
||||
if lastItems[slot] then
|
||||
local itemAmount = lastItems[slot].count or lastItems[slot].amount
|
||||
if itemAmount == amount then
|
||||
lastItems[slot] = nil
|
||||
end
|
||||
end
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('codem-inventory:client:clearinventory')
|
||||
AddEventHandler('codem-inventory:client:clearinventory', function()
|
||||
lastItems = {}
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('codem-inventory:client:setitembyslot')
|
||||
AddEventHandler('codem-inventory:client:setitembyslot', function(slot, itemData)
|
||||
lastItems[tostring(slot)] = itemData
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(lastItems) do
|
||||
if key == item.info?.serie or item.name then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck()
|
||||
if not lastItems then return end
|
||||
Wait(100)
|
||||
self.Functions.CheckWeaponIsRemoved()
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and item.type == "weapon" then
|
||||
self.Functions.AddWeapon({
|
||||
weapon = item.name,
|
||||
key = item?.info?.serie or item.name,
|
||||
attachments = config.tgiann_attachments and
|
||||
getTgiannAttachments(item.info.tgiattachments, joaat(item.name)) or item.info.attachments,
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,116 @@
|
|||
-- https://docs.c8re.store/core-inventory/api
|
||||
if not config.core_inventory then return end
|
||||
|
||||
local function splitStr(str, delimiter)
|
||||
local result = {}
|
||||
local from = 1
|
||||
local delim_from, delim_to = string.find(str, delimiter, from)
|
||||
while delim_from do
|
||||
result[#result + 1] = string.sub(str, from, delim_from - 1)
|
||||
from = delim_to + 1
|
||||
delim_from, delim_to = string.find(str, delimiter, from)
|
||||
end
|
||||
result[#result + 1] = string.sub(str, from)
|
||||
return result
|
||||
end
|
||||
|
||||
local playerJob = ""
|
||||
local invItems = {}
|
||||
local playerItems = {}
|
||||
|
||||
local function getInventoryItems()
|
||||
tgiCore.cbFunction('tgiann-weapons-on-back:core_inventory:server:getInventory', function(newPlayerItems)
|
||||
playerItems = newPlayerItems
|
||||
weaponCheck(true)
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('core_inventory:client:sync', function(inventory, data)
|
||||
local split = splitStr(inventory, '-')[1]
|
||||
if config.enableInv[split] then
|
||||
playerItems[split] = data.content
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData)
|
||||
if not PlayerData then return end
|
||||
playerJob = PlayerData.job.name
|
||||
getInventoryItems(PlayerData.identifier)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck(false)
|
||||
end)
|
||||
|
||||
if config.framework == "qb" then
|
||||
RegisterNetEvent('QBCore:Player:SetPlayerData', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
if not config.enableInv["content"] then return end
|
||||
playerItems["content"] = PlayerData?.items
|
||||
weaponCheck(true)
|
||||
end)
|
||||
else
|
||||
RegisterNetEvent('esx:addInventoryItem')
|
||||
AddEventHandler('esx:addInventoryItem', function(job)
|
||||
local PlayerData = exports["tgiann-core"]:getPlayerData()
|
||||
if not PlayerData then return end
|
||||
getInventoryItems(PlayerData.identifier)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removeInventoryItem')
|
||||
AddEventHandler('esx:removeInventoryItem', function(job)
|
||||
local PlayerData = exports["tgiann-core"]:getPlayerData()
|
||||
if not PlayerData then return end
|
||||
getInventoryItems(PlayerData.identifier)
|
||||
end)
|
||||
end
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(invItems) do
|
||||
if item and key == (item.metadata?.serial or item.name) then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck(updateData)
|
||||
if updateData then
|
||||
invItems = {}
|
||||
for _, inv in pairs(playerItems) do
|
||||
for _, item in pairs(inv) do
|
||||
invItems[#invItems + 1] = item
|
||||
end
|
||||
end
|
||||
end
|
||||
Wait(100)
|
||||
self.Functions.CheckWeaponIsRemoved()
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(invItems) do
|
||||
if item and string.find(string.lower(item.name), "weapon") then
|
||||
self.Functions.AddWeapon({
|
||||
weapon = item.name,
|
||||
key = item.metadata?.serial or item.name,
|
||||
attachments = config.tgiann_attachments and
|
||||
getTgiannAttachments(item.metadata.tgiattachments, joaat(item.name)) or item.metadata.attachments,
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,88 @@
|
|||
if config.framework ~= "esx" then return end
|
||||
if not config.useDefaultInventory then return end
|
||||
|
||||
local playerJob = ""
|
||||
local lastItems = {}
|
||||
|
||||
local function getInventoryItems()
|
||||
tgiCore.cbFunction('tgiann-weapons-on-back:esx_inv:server:getInventory', function(playerItems, loadout)
|
||||
local itemList = {}
|
||||
-- ESX is suck
|
||||
if loadout and #loadout > 0 then
|
||||
for i = 1, #loadout do
|
||||
itemList[#itemList + 1] = loadout[i]
|
||||
end
|
||||
end
|
||||
|
||||
if playerItems and #playerItems > 0 then
|
||||
for i = 1, #playerItems do
|
||||
if playerItems[i].count > 0 then
|
||||
itemList[#itemList + 1] = playerItems[i]
|
||||
end
|
||||
end
|
||||
end
|
||||
lastItems = itemList
|
||||
weaponCheck()
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:addInventoryItem')
|
||||
AddEventHandler('esx:addInventoryItem', function(job)
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removeInventoryItem')
|
||||
AddEventHandler('esx:removeInventoryItem', function(job)
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and key == item.name then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck()
|
||||
self.Functions.CheckWeaponIsRemoved()
|
||||
Wait(100)
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and string.find(string.lower(item.name), "weapon") then
|
||||
self.Functions.AddWeapon({
|
||||
weapon = item.name,
|
||||
key = item.name,
|
||||
attachments = config.tgiann_attachments and
|
||||
getTgiannAttachments(item?.info?.tgiattachments, joaat(item.name)) or item.components,
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,99 @@
|
|||
tgiCore = nil
|
||||
CreateThread(function()
|
||||
while not tgiCore do
|
||||
tgiCore = tgiCoreExports:getCore()
|
||||
Wait(200)
|
||||
end
|
||||
end)
|
||||
|
||||
local function LoadModel(model)
|
||||
if HasModelLoaded(model) then return end
|
||||
RequestModel(model)
|
||||
while not HasModelLoaded(model) do Wait(0) end
|
||||
end
|
||||
|
||||
self.Functions.AddAttachments = function(entity, weaponName, weaponHash, attachments)
|
||||
if not attachments then return end
|
||||
if config.tgiann_attachments then
|
||||
for _, data in pairs(attachments) do
|
||||
local model = GetWeaponComponentTypeModel(data.component)
|
||||
if model ~= 0 then
|
||||
LoadModel(model)
|
||||
GiveWeaponComponentToWeaponObject(entity, data.component)
|
||||
SetModelAsNoLongerNeeded(data.component)
|
||||
else
|
||||
SetWeaponObjectTintIndex(entity, data.component)
|
||||
end
|
||||
end
|
||||
elseif config.core_inventory then
|
||||
for _, data in pairs(attachments) do
|
||||
local model = GetWeaponComponentTypeModel(data.componentHash)
|
||||
if model ~= 0 then
|
||||
LoadModel(model)
|
||||
GiveWeaponComponentToWeaponObject(entity, data.componentHash)
|
||||
SetModelAsNoLongerNeeded(data.componentHash)
|
||||
else
|
||||
SetWeaponObjectTintIndex(entity, data.componentHash)
|
||||
end
|
||||
end
|
||||
elseif config.ox_inventory then
|
||||
if not oxItems then oxItems = exports.ox_inventory:Items() end
|
||||
for i = 1, #attachments do
|
||||
local components = oxItems[attachments[i]].client.component
|
||||
for v = 1, #components do
|
||||
local component = components[v]
|
||||
if DoesWeaponTakeWeaponComponent(weaponHash, component) then
|
||||
local model = GetWeaponComponentTypeModel(component)
|
||||
if model ~= 0 then
|
||||
LoadModel(model)
|
||||
GiveWeaponComponentToWeaponObject(entity, component)
|
||||
SetModelAsNoLongerNeeded(component)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif config.framework == "qb" then
|
||||
for _, data in pairs(attachments) do
|
||||
local model = GetWeaponComponentTypeModel(data.component)
|
||||
if model ~= 0 then
|
||||
LoadModel(model)
|
||||
GiveWeaponComponentToWeaponObject(entity, data.component)
|
||||
SetModelAsNoLongerNeeded(data.component)
|
||||
else
|
||||
SetWeaponObjectTintIndex(entity, data.component)
|
||||
end
|
||||
end
|
||||
else
|
||||
--ESX is suck
|
||||
for i = 1, #attachments do
|
||||
local componentData = tgiCore.core.GetWeaponComponent(weaponName, attachments[i])
|
||||
if componentData then
|
||||
local hash = componentData.hash
|
||||
local model = GetWeaponComponentTypeModel(hash)
|
||||
if model ~= 0 then
|
||||
LoadModel(model)
|
||||
GiveWeaponComponentToWeaponObject(entity, hash)
|
||||
SetModelAsNoLongerNeeded(hash)
|
||||
else
|
||||
SetWeaponObjectTintIndex(entity, hash)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function getTgiannAttachments(tgiattachments, weapon)
|
||||
local invSettings = exports["tgiann-attachment"]:inventoryConfig()
|
||||
if invSettings then
|
||||
return tgiattachments
|
||||
else
|
||||
local returnVal = nil
|
||||
local waitCb = true
|
||||
tgiCore.cbFunction("tgiann-attachment:getAttachment", function(data)
|
||||
returnVal = data
|
||||
waitCb = false
|
||||
end, weapon)
|
||||
while waitCb do Wait(10) end
|
||||
return returnVal
|
||||
end
|
||||
end
|
|
@ -0,0 +1,77 @@
|
|||
if not config["mf-inventory"] then return end
|
||||
|
||||
local playerJob = ""
|
||||
local lastItems = {}
|
||||
|
||||
local function getInventoryItems(identifier)
|
||||
exports["mf-inventory"]:getInventoryItems(identifier, function(items)
|
||||
lastItems = items
|
||||
weaponCheck()
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
getInventoryItems(PlayerData.identifier)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:addInventoryItem')
|
||||
AddEventHandler('esx:addInventoryItem', function(job)
|
||||
local PlayerData = exports["tgiann-core"]:getPlayerData()
|
||||
if not PlayerData then return end
|
||||
getInventoryItems(PlayerData.identifier)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removeInventoryItem')
|
||||
AddEventHandler('esx:removeInventoryItem', function(job)
|
||||
local PlayerData = exports["tgiann-core"]:getPlayerData()
|
||||
if not PlayerData then return end
|
||||
getInventoryItems(PlayerData.identifier)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and key == item.name then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck()
|
||||
if not lastItems then return end
|
||||
Wait(100)
|
||||
self.Functions.CheckWeaponIsRemoved(lastItems)
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and string.find(string.lower(item.name), "weapon") then
|
||||
self.Functions.AddWeapon({
|
||||
weapon = item.name,
|
||||
key = item.name,
|
||||
attachments = config.tgiann_attachments and
|
||||
getTgiannAttachments(item.metadata.tgiattachments, joaat(item.name)),
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,79 @@
|
|||
if not config.origen_inventory then return end
|
||||
|
||||
local origen_inventory = exports.origen_inventory
|
||||
local playerJob = ""
|
||||
local lastItems = {}
|
||||
|
||||
local function getInventoryItems()
|
||||
lastItems = origen_inventory:GetInventory()
|
||||
weaponCheck()
|
||||
end
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
--QB
|
||||
RegisterNetEvent('QBCore:Player:SetPlayerData', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
--ESX
|
||||
RegisterNetEvent('esx:addInventoryItem')
|
||||
AddEventHandler('esx:addInventoryItem', function()
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removeInventoryItem')
|
||||
AddEventHandler('esx:removeInventoryItem', function()
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(lastItems) do
|
||||
if key == item.info.serie then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck()
|
||||
if not lastItems then return end
|
||||
Wait(100)
|
||||
self.Functions.CheckWeaponIsRemoved()
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and item.type == "weapon" then
|
||||
self.Functions.AddWeapon({
|
||||
weapon = item.name,
|
||||
key = item.info.serie,
|
||||
attachments = config.tgiann_attachments and
|
||||
getTgiannAttachments(item.info.tgiattachments, joaat(item.name)) or item.info.attachments,
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,64 @@
|
|||
if not config.ox_inventory then return end
|
||||
|
||||
local playerJob = ""
|
||||
local lastItems = {}
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
lastItems = exports.ox_inventory:GetPlayerItems() or {}
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
AddEventHandler('ox_inventory:updateInventory', function(changes)
|
||||
for i, value in pairs(changes) do
|
||||
lastItems[i] = value or nil
|
||||
end
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and key == (item.metadata.serial or item.name) then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck()
|
||||
if not lastItems then return end
|
||||
Wait(100)
|
||||
self.Functions.CheckWeaponIsRemoved()
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and string.find(string.lower(item.name), "weapon") then
|
||||
self.Functions.AddWeapon({
|
||||
weapon = item.name,
|
||||
key = item.metadata.serial or item.name,
|
||||
attachments = config.tgiann_attachments and
|
||||
getTgiannAttachments(item.metadata.tgiattachments, joaat(item.name)) or item.metadata.components,
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,64 @@
|
|||
if config.framework ~= "qb" then return end
|
||||
if not config.useDefaultInventory then return end
|
||||
|
||||
local playerJob = ""
|
||||
local lastItems = {}
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
lastItems = PlayerData?.items
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Player:SetPlayerData', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
lastItems = PlayerData?.items
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(lastItems) do
|
||||
if key == item.info.serie then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck()
|
||||
if not lastItems then return end
|
||||
Wait(100)
|
||||
self.Functions.CheckWeaponIsRemoved()
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and item.type == "weapon" then
|
||||
self.Functions.AddWeapon({
|
||||
weapon = item.name,
|
||||
key = item.info.serie,
|
||||
attachments = config.tgiann_attachments and
|
||||
getTgiannAttachments(item.info.tgiattachments, joaat(item.name)) or item.info.attachments,
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,89 @@
|
|||
if not config["qs-inventory"] then return end
|
||||
|
||||
local playerJob = ""
|
||||
local lastItems = {}
|
||||
local isBussy = false
|
||||
|
||||
local function getInventoryItems()
|
||||
if isBussy then return end
|
||||
isBussy = true
|
||||
while exports['qs-inventory']:inInventory() do Wait(10) end -- getUserInventory not updating when inventory is open
|
||||
Wait(1000) -- getUserInventory is updating late
|
||||
lastItems = exports['qs-inventory']:getUserInventory()
|
||||
weaponCheck(playerJob, true)
|
||||
isBussy = false
|
||||
end
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
--ESX
|
||||
RegisterNetEvent('esx:addInventoryItem')
|
||||
AddEventHandler('esx:addInventoryItem', function()
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removeInventoryItem')
|
||||
AddEventHandler('esx:removeInventoryItem', function()
|
||||
getInventoryItems()
|
||||
end)
|
||||
|
||||
--QB
|
||||
RegisterNetEvent('QBCore:Player:SetPlayerData', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
lastItems = PlayerData?.items
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck(playerJob)
|
||||
end)
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and key == (item.info?.serie or item.name) then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck()
|
||||
Wait(100)
|
||||
self.Functions.CheckWeaponIsRemoved()
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(lastItems) do
|
||||
if item then
|
||||
local isWeapon = string.find(string.lower(item.name), "weapon")
|
||||
debug(item.name .. " Check For Add Weapon", "isWeapon: " .. tostring(isWeapon))
|
||||
if isWeapon then
|
||||
debug(item.name .. " Added")
|
||||
self.Functions.AddWeapon({
|
||||
weapon = item.name,
|
||||
key = item.info?.serie or item.name,
|
||||
attachments = config.tgiann_attachments and
|
||||
getTgiannAttachments(item.info.tgiattachments, joaat(item.name)) or item.info?.attachments,
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,62 @@
|
|||
if not config["tgiann-inventory"] then return end
|
||||
|
||||
local playerJob = ""
|
||||
local lastItems = {}
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLogout', function()
|
||||
self.Functions.RemoveAllWeapons()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('tgiCore:Client:OnPlayerLoaded', function(PlayerData)
|
||||
playerJob = PlayerData.job.name
|
||||
lastItems = exports["tgiann-inventory"]:GetPlayerItems()
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiann-inventory:inventoryUpdated')
|
||||
AddEventHandler('tgiann-inventory:inventoryUpdated', function(items)
|
||||
lastItems = items
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('tgiCore:Client:OnJobUpdate')
|
||||
AddEventHandler('tgiCore:Client:OnJobUpdate', function(job)
|
||||
self.Functions.RemoveAllWeapons()
|
||||
playerJob = job.name
|
||||
weaponCheck()
|
||||
end)
|
||||
|
||||
self.Functions.CheckWeaponIsRemoved = function()
|
||||
if not next(self.weapons) then return end
|
||||
for key, _ in pairs(self.weapons) do
|
||||
local success = false
|
||||
for _, item in pairs(lastItems) do
|
||||
if key == item?.info?.serie then
|
||||
success = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
self.Functions.RemoveWeapon(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function weaponCheck()
|
||||
if not lastItems then return end
|
||||
Wait(100)
|
||||
self.Functions.CheckWeaponIsRemoved()
|
||||
local isMale = GetEntityModel(PlayerPedId()) == `mp_m_freemode_01`
|
||||
for _, item in pairs(lastItems) do
|
||||
if item and item.type == "weapon" then
|
||||
self.Functions.AddWeapon({
|
||||
weapon = string.gsub(item.name, "_police", ""),
|
||||
key = item?.info?.serie or item.name,
|
||||
attachments = item?.info?.tgiattachments or {},
|
||||
playerJob = playerJob,
|
||||
isMale = isMale
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
Binary file not shown.
|
@ -0,0 +1,12 @@
|
|||
function canShow(targetPed)
|
||||
local isEntityVisible = IsEntityVisible(targetPed)
|
||||
local getEntityAlpha = GetEntityAlpha(targetPed)
|
||||
local pedIsVisible = isEntityVisible and getEntityAlpha == 255
|
||||
debug("pedIsVisible: " .. tostring(pedIsVisible), "ped:" .. targetPed, "isEntityVisible: " .. tostring(isEntityVisible), "getEntityAlpha: " .. getEntityAlpha)
|
||||
return pedIsVisible
|
||||
end
|
||||
|
||||
function debug(...)
|
||||
if not config.debug then return end
|
||||
print(...)
|
||||
end
|
|
@ -0,0 +1,206 @@
|
|||
--[[
|
||||
- this script needs tgiann-core script to work, you can download the script from your keymaster account
|
||||
Start tgiann-core script after es_extented/qb-core script and before tgiann-* scripts
|
||||
Adjust the tgiann-core config file according to the framework you are using
|
||||
|
||||
https://tgiann.gitbook.io/tgiann/scripts/tgiann-weapons-on-back
|
||||
|
||||
Note: If you want the weapons to be invisible while in Noclip, the character must be completely invisible. If your character is invisible to other players, other players cannot see these weapons.
|
||||
If you want to edit this, take a look at client/editable.lua
|
||||
]]
|
||||
|
||||
tgiCoreExports = exports["tgiann-core"]
|
||||
config = tgiCoreExports:getConfig()
|
||||
config.debug = false
|
||||
|
||||
config.tgiann_attachments = GetResourceState("tgiann-attachment") ~= "missing" -- https://tgiann.tebex.io/package/5399235
|
||||
|
||||
-- Weapon positions for male and female characters. You can add additional positions here if you like.
|
||||
config.positions = {
|
||||
male = {
|
||||
back = { -- We have set 3 positions for the back. You can add or remove extra positions if you like. This setting also applies to other positions.
|
||||
{ -- position 1
|
||||
bone = 24816,
|
||||
offset = vector3(0.285, -0.17, 0.13),
|
||||
rot = vector3(0.0, 170.0, 0.0),
|
||||
},
|
||||
{ -- position 2
|
||||
bone = 24816,
|
||||
offset = vector3(0.285, -0.17, 0.0),
|
||||
rot = vector3(0.0, 170.0, 0.0),
|
||||
},
|
||||
{ -- position 3
|
||||
bone = 24816,
|
||||
offset = vector3(0.285, -0.17, -0.13),
|
||||
rot = vector3(0.0, 170.0, 0.0),
|
||||
}
|
||||
},
|
||||
front = {
|
||||
{
|
||||
bone = 24818,
|
||||
offset = vector3(-0.03, 0.19, 0.0),
|
||||
rot = vector3(-10.0, 40.0, 5.0),
|
||||
}
|
||||
},
|
||||
right = {
|
||||
{
|
||||
bone = 11816,
|
||||
offset = vector3(-0.01, 0.02, 0.215),
|
||||
rot = vector3(-100.0, 60.0, 45.0),
|
||||
}
|
||||
},
|
||||
rLegBack = {
|
||||
{
|
||||
bone = 11816,
|
||||
offset = vector3(-0.15, -0.11, 0.22),
|
||||
rot = vector3(0.0, 95.0, 180.0),
|
||||
}
|
||||
},
|
||||
waist = {
|
||||
{
|
||||
bone = 11816,
|
||||
offset = vector3(-0.07, -0.13, 0.05),
|
||||
rot = vector3(180.0, -30.0, 10.0),
|
||||
}
|
||||
},
|
||||
-- You can add extra positions here if you like.
|
||||
-- The positions you add can be used in the `config.weaponPositions`, `config.weaponGroupPositions` and `config.weaponGroupJobPositions` settings.
|
||||
--[[ exampleCustomName = {
|
||||
{
|
||||
bone = 11816,
|
||||
offset = vector3(-0.07, -0.13, 0.05),
|
||||
rot = vector3(180.0, -30.0, 10.0),
|
||||
}
|
||||
}, ]]
|
||||
},
|
||||
female = {
|
||||
back = {
|
||||
{
|
||||
bone = 24816,
|
||||
offset = vector3(0.285, -0.15, 0.13),
|
||||
rot = vector3(0.0, 170.0, 0.0),
|
||||
},
|
||||
{
|
||||
bone = 24816,
|
||||
offset = vector3(0.285, -0.15, 0.0),
|
||||
rot = vector3(0.0, 170.0, 0.0),
|
||||
},
|
||||
{
|
||||
bone = 24816,
|
||||
offset = vector3(0.285, -0.15, -0.13),
|
||||
rot = vector3(0.0, 170.0, 0.0),
|
||||
}
|
||||
},
|
||||
front = {
|
||||
{
|
||||
bone = 24818,
|
||||
offset = vector3(-0.03, 0.21, 0.0),
|
||||
rot = vector3(-10.0, 40.0, 5.0),
|
||||
}
|
||||
},
|
||||
right = {
|
||||
{
|
||||
bone = 11816,
|
||||
offset = vector3(-0.09, 0.03, 0.18),
|
||||
rot = vector3(-105.0, 75.0, 45.0),
|
||||
}
|
||||
},
|
||||
rLegBack = {
|
||||
{
|
||||
bone = 11816,
|
||||
offset = vector3(-0.15, -0.11, 0.22),
|
||||
rot = vector3(0.0, 95.0, 180.0),
|
||||
}
|
||||
},
|
||||
waist = {
|
||||
{
|
||||
bone = 11816,
|
||||
offset = vector3(-0.07, -0.09, 0.05),
|
||||
rot = vector3(180.0, -30.0, 10.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-- Weapons in the list do not appear on the character
|
||||
config.disabledWeapons = {
|
||||
weapon_flashlight = true,
|
||||
weapon_knuckle = true,
|
||||
weapon_bottle = true,
|
||||
weapon_snowball = true,
|
||||
}
|
||||
|
||||
-- adjusts the location of the weapon regardless of its group
|
||||
config.weaponPositions = {
|
||||
--weapon_pistol = "right",
|
||||
}
|
||||
|
||||
-- adjusts the position of the weapon regardless of its group
|
||||
config.weaponCustomPositions = {
|
||||
male = {
|
||||
weapon_bat = {
|
||||
bone = 24816,
|
||||
offset = vector3(0.0, -0.15, 0.03),
|
||||
rot = vector3(0.0, 80.0, 0.0),
|
||||
}
|
||||
},
|
||||
female = {
|
||||
weapon_bat = {
|
||||
bone = 24816,
|
||||
offset = vector3(0.0, -0.15, 0.03),
|
||||
rot = vector3(0.0, 80.0, 0.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
--"waist" - "back" - "front" - "rigt" - "rLegBack" - "none"
|
||||
config.weaponGroupPostions = {
|
||||
[3539449195] = "back", --GROUP_DIGISCANNER
|
||||
[-37788308] = "rLegBack", --GROUP_FIREEXTINGUISHER
|
||||
[1175761940] = "none", --GROUP_HACKINGDEVICE
|
||||
[2725924767] = "back", --GROUP_HEAVY
|
||||
[-728555052] = "back", --GROUP_MELEE
|
||||
[3759491383] = "none", --GROUP_METALDETECTOR
|
||||
[1159398588] = "back", --GROUP_MG
|
||||
[3493187224] = "none", --GROUP_NIGHTVISION
|
||||
[431593103] = "none", --GROUP_PARACHUTE
|
||||
[1595662460] = "none", --GROUP_PETROLCAN
|
||||
[416676503] = "waist", --GROUP_PISTOL
|
||||
[970310034] = "front", --GROUP_RIFLE
|
||||
[860033945] = "back", --GROUP_SHOTGUN
|
||||
[-957766203] = "front", --GROUP_SMG
|
||||
[-1212426201] = "back", --GROUP_SNIPER
|
||||
[690389602] = "none", --GROUP_STUNGUN
|
||||
[1548507267] = "none", --GROUP_THROWN
|
||||
[75159441] = "back", --GROUP_TRANQILIZER
|
||||
[2685387236] = "none", --GROUP_UNARMED
|
||||
}
|
||||
|
||||
-- weapon locations for jobs
|
||||
config.weaponGroupJobPostions = {
|
||||
{
|
||||
jobs = { "police" }, -- u can add multible job name
|
||||
postions = {
|
||||
[3539449195] = "back", --GROUP_DIGISCANNER
|
||||
[-37788308] = "rLegBack", --GROUP_FIREEXTINGUISHER
|
||||
[1175761940] = "none", --GROUP_HACKINGDEVICE
|
||||
[2725924767] = "back", --GROUP_HEAVY
|
||||
[-728555052] = "back", --GROUP_MELEE
|
||||
[3759491383] = "none", --GROUP_METALDETECTOR
|
||||
[1159398588] = "back", --GROUP_MG
|
||||
[3493187224] = "none", --GROUP_NIGHTVISION
|
||||
[431593103] = "none", --GROUP_PARACHUTE
|
||||
[1595662460] = "none", --GROUP_PETROLCAN
|
||||
[416676503] = "right", --GROUP_PISTOL
|
||||
[970310034] = "front", --GROUP_RIFLE
|
||||
[860033945] = "front, --GROUP_SHOTGUN
|
||||
[-957766203] = "front", --GROUP_SMG
|
||||
[-1212426201] = "back", --GROUP_SNIPER
|
||||
[690389602] = "none", --GROUP_STUNGUN
|
||||
[1548507267] = "none", --GROUP_THROWN
|
||||
[75159441] = "back", --GROUP_TRANQILIZER
|
||||
[2685387236] = "none", --GROUP_UNARMED
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
config.enableInv = {
|
||||
["content"] = true,
|
||||
["primary"] = true,
|
||||
["secondry"] = true,
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
version '1.0.1'
|
||||
|
||||
lua54 'yes'
|
||||
|
||||
dependencies {
|
||||
'tgiann-core',
|
||||
}
|
||||
|
||||
escrow_ignore {
|
||||
'configs/*.lua',
|
||||
'checkInv.lua',
|
||||
'client/bridge/*.lua',
|
||||
'client/editable.lua',
|
||||
'server/bridge/*.lua'
|
||||
}
|
||||
|
||||
shared_script {
|
||||
'configs/*.lua',
|
||||
'checkInv.lua',
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
'client/*.lua',
|
||||
'client/bridge/*.lua'
|
||||
}
|
||||
|
||||
server_scripts {
|
||||
"server/server.lua",
|
||||
'server/bridge/*.lua',
|
||||
}
|
||||
|
||||
dependency '/assetpacks'
|
|
@ -0,0 +1,13 @@
|
|||
if not config.core_inventory then return end
|
||||
|
||||
tgiCore.cbFunction('tgiann-weapons-on-back:core_inventory:server:getInventory', function(source, cb)
|
||||
local src = source
|
||||
local xPlayer = tgiCore.getPlayer(src)
|
||||
if not xPlayer then return end
|
||||
local citizenid = tgiCore.getCid(xPlayer)
|
||||
local playerItems = {}
|
||||
for inv, canAdd in pairs(config.enableInv) do
|
||||
if canAdd then playerItems[inv] = exports['core_inventory']:getInventory(string.format("%s-%s", inv, citizenid)) end
|
||||
end
|
||||
cb(playerItems)
|
||||
end)
|
|
@ -0,0 +1,10 @@
|
|||
if config.framework ~= "esx" then return end
|
||||
if not config.useDefaultInventory then return end
|
||||
|
||||
-- esx is very bad, I can't access current inventory data from client
|
||||
tgiCore.cbFunction('tgiann-weapons-on-back:esx_inv:server:getInventory', function(source, cb)
|
||||
local src = source
|
||||
local xPlayer = tgiCore.getPlayer(src)
|
||||
if not xPlayer then return end
|
||||
cb(xPlayer.getInventory(), xPlayer.getLoadout())
|
||||
end)
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue