Wenn ich ein Item wegwerfe tauchen die bei andren Spielern am Boden auf wie kann ich dass unterbinden bzw. dass Items überhaupt wenn man sie wegwirft sofort verschwinden?
Danke
Wenn ich ein Item wegwerfe tauchen die bei andren Spielern am Boden auf wie kann ich dass unterbinden bzw. dass Items überhaupt wenn man sie wegwirft sofort verschwinden?
Danke
--[[RegisterNetEvent('esx:createPickup')
AddEventHandler('esx:createPickup', function(pickupId, label, coords, type, name, components, tintIndex)
local function setObjectProperties(object)
SetEntityAsMissionEntity(object, true, false)
PlaceObjectOnGroundProperly(object)
FreezeEntityPosition(object, true)
SetEntityCollision(object, false, true)
pickups[pickupId] = {
obj = object,
label = label,
inRange = false,
coords = vector3(coords.x, coords.y, coords.z)
}
end
if type == 'item_weapon' then
local weaponHash = GetHashKey(name)
ESX.Streaming.RequestWeaponAsset(weaponHash)
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
local component = ESX.GetWeaponComponent(name, v)
GiveWeaponComponentToWeaponObject(pickupObject, component.hash)
end
setObjectProperties(pickupObject)
else
ESX.Game.SpawnLocalObject('prop_money_bag_01', coords, setObjectProperties)
end
end)
RegisterNetEvent('esx:createMissingPickups')
AddEventHandler('esx:createMissingPickups', function(missingPickups)
for pickupId,pickup in pairs(missingPickups) do
TriggerEvent('esx:createPickup', pickupId, pickup.label, pickup.coords, pickup.type, pickup.name, pickup.components, pickup.tintIndex)
end
end)
RegisterNetEvent('esx:registerSuggestions')
AddEventHandler('esx:registerSuggestions', function(registeredCommands)
for name,command in pairs(registeredCommands) do
if command.suggestion then
TriggerEvent('chat:addSuggestion', ('/%s'):format(name), command.suggestion.help, command.suggestion.arguments)
end
end
end)
RegisterNetEvent('esx:removePickup')
AddEventHandler('esx:removePickup', function(pickupId)
if pickups[pickupId] and pickups[pickupId].obj then
ESX.Game.DeleteObject(pickups[pickupId].obj)
pickups[pickupId] = nil
end
end)]]
--[[Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = PlayerPedId()
local playerCoords, letSleep = GetEntityCoords(playerPed), true
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer(playerCoords)
for pickupId,pickup in pairs(pickups) do
local distance = #(playerCoords - pickup.coords)
if distance < 5 then
local label = pickup.label
letSleep = false
if distance < 1 then
if IsControlJustReleased(0, 38) then
if IsPedOnFoot(playerPed) and (closestDistance == -1 or closestDistance > 3) and not pickup.inRange then
pickup.inRange = true
local dict, anim = 'weapons@first_person@aim_rng@generic@projectile@sticky_bomb@', 'plant_floor'
ESX.Streaming.RequestAnimDict(dict)
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
Citizen.Wait(1000)
TriggerServerEvent('esx:onPickup', pickupId)
PlaySoundFrontend(-1, 'PICK_UP', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false)
end
end
label = ('%s~n~%s'):format(label, _U('threw_pickup_prompt'))
end
ESX.Game.Utils.DrawText3D({
x = pickup.coords.x,
y = pickup.coords.y,
z = pickup.coords.z + 0.25
}, label, 1.2, 1)
elseif pickup.inRange then
pickup.inRange = false
end
end
if letSleep then
Citizen.Wait(500)
end
end
end)]]
Alles anzeigen
Da einfach ausklammern.