mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 01:38:52 +00:00
Removed xPlayer.removeWeapon() second argument
This commit is contained in:
+2
-9
@@ -190,19 +190,12 @@ AddEventHandler('esx:setWeaponTint', function(weaponName, weaponTintIndex)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removeWeapon')
|
||||
AddEventHandler('esx:removeWeapon', function(weaponName, ammo)
|
||||
AddEventHandler('esx:removeWeapon', function(weaponName)
|
||||
local playerPed = PlayerPedId()
|
||||
local weaponHash = GetHashKey(weaponName)
|
||||
|
||||
RemoveWeaponFromPed(playerPed, weaponHash)
|
||||
|
||||
if ammo then
|
||||
local pedAmmo = GetAmmoInPedWeapon(playerPed, weaponHash)
|
||||
local finalAmmo = math.floor(pedAmmo - ammo)
|
||||
SetPedAmmo(playerPed, weaponHash, finalAmmo)
|
||||
else
|
||||
SetPedAmmo(playerPed, weaponHash, 0) -- remove leftover ammo
|
||||
end
|
||||
SetPedAmmo(playerPed, weaponHash, 0) -- remove leftover ammo
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:removeWeaponComponent')
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ files {
|
||||
|
||||
'html/img/accounts/bank.png',
|
||||
'html/img/accounts/black_money.png',
|
||||
'html/img/accounts/money.png',
|
||||
'html/img/accounts/money.png'
|
||||
}
|
||||
|
||||
exports {
|
||||
|
||||
@@ -403,7 +403,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
return 0
|
||||
end
|
||||
|
||||
self.removeWeapon = function(weaponName, ammo)
|
||||
self.removeWeapon = function(weaponName)
|
||||
local weaponLabel
|
||||
|
||||
for k,v in ipairs(self.loadout) do
|
||||
@@ -420,7 +420,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
|
||||
if weaponLabel then
|
||||
self.triggerEvent('esx:removeWeapon', weaponName, ammo)
|
||||
self.triggerEvent('esx:removeWeapon', weaponName)
|
||||
self.triggerEvent('esx:removeInventoryItem', weaponLabel, false, true)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user