Fixed #709 throwing weapons, fixed throwing weapons missing components, added player join msg

This commit is contained in:
ElPumpo
2020-04-24 15:18:16 +02:00
parent 990feb9ca9
commit cb9038c911
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -286,7 +286,7 @@ AddEventHandler('esx:createPickup', function(pickupId, label, coords, type, name
if type == 'item_weapon' then
local weaponHash = GetHashKey(name)
ESX.Streaming.RequestWeaponAsset(weaponHash)
local pickupObject = CreateWeaponObject(weaponHash, 50, coords, true, 1.0, 0)
local pickupObject = CreateWeaponObject(weaponHash, 50, coords.x, coords.y, coords.z, true, 1.0, 0)
SetWeaponObjectTintIndex(pickupObject, tintIndex)
for k,v in ipairs(components) do
+3 -4
View File
@@ -252,6 +252,7 @@ function loadESXPlayer(identifier, playerId)
xPlayer.triggerEvent('esx:createMissingPickups', ESX.Pickups)
xPlayer.triggerEvent('esx:registerSuggestions', ESX.RegisteredCommands)
print(('[es_extended] [^2INFO^7] A player with name "%s^7" has connected to the server with assigned player id %s'):format(xPlayer.getName(), playerId))
end)
end
@@ -302,7 +303,6 @@ AddEventHandler('esx:giveInventoryItem', function(target, type, itemName, itemCo
if type == 'item_standard' then
local sourceItem = sourceXPlayer.getInventoryItem(itemName)
local targetItem = targetXPlayer.getInventoryItem(itemName)
if itemCount > 0 and sourceItem.count >= itemCount then
if targetXPlayer.canCarryItem(itemName, itemCount) then
@@ -419,8 +419,7 @@ AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount)
if xPlayer.hasWeapon(itemName) then
local _, weapon = xPlayer.getWeapon(itemName)
local _, weaponObject = ESX.GetWeapon(itemName)
local pickupLabel
local components, pickupLabel = ESX.Table.Clone(weapon.components)
xPlayer.removeWeapon(itemName)
if weaponObject.ammo and weapon.ammo > 0 then
@@ -432,7 +431,7 @@ AddEventHandler('esx:removeInventoryItem', function(type, itemName, itemCount)
xPlayer.showNotification(_U('threw_weapon', weapon.label))
end
ESX.CreatePickup('item_weapon', itemName, weapon.ammo, pickupLabel, playerId, weapon.components, weapon.tintIndex)
ESX.CreatePickup('item_weapon', itemName, weapon.ammo, pickupLabel, playerId, components, weapon.tintIndex)
end
end
end)