mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
fix: handling playerPed & weaponHash variable
This commit is contained in:
@@ -460,9 +460,11 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
function self.removeWeapon(weaponName)
|
||||
local weaponLabel = nil
|
||||
local weaponHash = joaat(weaponName)
|
||||
local playerPed = GetPlayerPed(self.source)
|
||||
local weaponLabel, playerPed = nil, GetPlayerPed(self.source)
|
||||
|
||||
if not playerPed then
|
||||
return print("[^1ERROR^7] xPlayer.removeWeapon ^5invalid^7 player ped!")
|
||||
end
|
||||
|
||||
for k, v in ipairs(self.loadout) do
|
||||
if v.name == weaponName then
|
||||
@@ -472,6 +474,8 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
self.removeWeaponComponent(weaponName, v2)
|
||||
end
|
||||
|
||||
local weaponHash = joaat(v.name)
|
||||
|
||||
RemoveWeaponFromPed(playerPed, weaponHash)
|
||||
SetPedAmmo(playerPed, weaponHash, 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user