Skip to content

Commit

Permalink
fix(client/items): set parachute if carried when disarming a weapon (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximus7474 committed Jun 7, 2024
1 parent 37551a2 commit 9f4b1a4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ RegisterNetEvent('ox_inventory:setPlayerInventory', function(currentDrops, inven
end

if client.parachute and GetPedParachuteState(playerPed) ~= -1 then
Utils.DeleteEntity(client.parachute)
Utils.DeleteEntity(client.parachute[1])
client.parachute = false
end

Expand Down
2 changes: 1 addition & 1 deletion modules/bridge/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function client.onLogout()
if not PlayerData.loaded then return end

if client.parachute then
Utils.DeleteEntity(client.parachute)
Utils.DeleteEntity(client.parachute[1])
client.parachute = false
end

Expand Down
2 changes: 1 addition & 1 deletion modules/items/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Item('parachute', function(data, slot)
GiveWeaponToPed(cache.ped, chute, 0, true, false)
SetPedGadget(cache.ped, chute, true)
lib.requestModel(1269906701)
client.parachute = CreateParachuteBagObject(cache.ped, true, true)
client.parachute = {CreateParachuteBagObject(cache.ped, true, true), slot?.metadata?.type or -1}
if slot.metadata.type then
SetPlayerParachuteTintIndex(PlayerData.id, slot.metadata.type)
end
Expand Down
7 changes: 7 additions & 0 deletions modules/weapon/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ function Weapon.Disarm(currentWeapon, noAnim)

Utils.WeaponWheel()
RemoveAllPedWeapons(cache.ped, true)

if client.parachute then
local chute = `GADGET_PARACHUTE`
GiveWeaponToPed(cache.ped, chute, 0, true, false)
SetPedGadget(cache.ped, chute, true)
SetPlayerParachuteTintIndex(PlayerData.id, client.parachute?[2] or -1)
end
end

function Weapon.ClearAll(currentWeapon)
Expand Down

0 comments on commit 9f4b1a4

Please sign in to comment.