Script pickup props fivem lua
Script pickup props fivem lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if holdingEntity and heldEntity then
local playerPed = PlayerPedId()
local headPos = GetPedBoneCoords(playerPed, 0x796e, 0.0, 0.0, 0.0)
DrawText3Ds(headPos.x, headPos.y, headPos.z + 0.5, "[Y] Drop Entity /
[U] Attach Ped")
if holdingCarEntity and not IsEntityPlayingAnim(playerPed,
'anim@mp_rollarcoaster', 'hands_up_idle_a_player_one', 3) then
RequestAnimDict('anim@mp_rollarcoaster')
while not HasAnimDictLoaded('anim@mp_rollarcoaster') do
Citizen.Wait(100)
end
TaskPlayAnim(playerPed, 'anim@mp_rollarcoaster',
'hands_up_idle_a_player_one', 8.0, -8.0, -1, 50, 0, false, false, false)
elseif (holdingPed or not holdingCarEntity) and not
IsEntityPlayingAnim(playerPed, 'anim@heists@box_carry@', 'idle', 3) then
RequestAnimDict('anim@heists@box_carry@')
while not HasAnimDictLoaded('anim@heists@box_carry@') do
Citizen.Wait(100)
end
TaskPlayAnim(playerPed, 'anim@heists@box_carry@', 'idle', 8.0, -
8.0, -1, 50, 0, false, false, false)
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = PlayerPedId()
local camPos = GetGameplayCamCoord()
local camRot = GetGameplayCamRot(2)
local direction = RotationToDirection(camRot)
local dest = vec3(camPos.x + direction.x * 10.0, camPos.y + direction.y *
10.0, camPos.z + direction.z * 10.0)
if hit == 1 then
entityType = GetEntityType(entityHit)
if entityType == 3 or entityType == 2 or entityType == 1 then
validTarget = true
local entityText = entityType == 3 and "Object" or (entityType == 2
and "Car" or "Ped")
local entityModel = GetEntityModel(entityHit)
local accessInfo = ""
if entityType == 2 then
if NetworkHasControlOfEntity(entityHit) then
accessInfo = ", Access: Yes"
else
accessInfo = ", Access: No"
NetworkRequestControlOfEntity(entityHit)
end
end
local entityInfo = "Entity Type: " .. entityText .. ", Entity: " ..
entityHit .. ", Model: " .. entityModel .. accessInfo
local headPos = GetPedBoneCoords(playerPed, 0x796e, 0.0, 0.0, 0.0)
DrawText3Ds(headPos.x, headPos.y, headPos.z + 0.5, entityInfo)
end
end
function RotationToDirection(rotation)
local adjustedRotation = vec3((math.pi / 180) * rotation.x, (math.pi / 180) *
rotation.y, (math.pi / 180) * rotation.z)
local direction = vec3(-math.sin(adjustedRotation.z) *
math.abs(math.cos(adjustedRotation.x)), math.cos(adjustedRotation.z) *
math.abs(math.cos(adjustedRotation.x)), math.sin(adjustedRotation.x))
return direction
end
if onScreen then
SetTextScale(0.0 * scale, 0.35 * scale)
SetTextFont(0)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextDropshadow(0, 0, 0, 0, 155)
SetTextEdge(2, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x, _y)
end
end