The idea is to make an animation of the door opening, but when using SetEntityRotation the door is always placed with the same rotation even if it uses different values …
video
Debug code
function EntityInFront()
local pos = GetEntityCoords(GetPlayerPed(-1))
local entityWorld = GetOffsetFromEntityInWorldCoords(GetPlayerPed(-1), 0.0, 4.0, 0.0)
local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, 148.0266, -1044.364, 29.50693, 16, GetPlayerPed(-1), 0)
local a, b, c, d, result = GetRaycastResult(rayHandle)
return result
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local ped = GetPlayerPed(-1)
local posped = GetEntityCoords(ped)
if get3DDistance(start.x, start.y, start.z, posped.x, posped.y, posped.z) < 15.0 then
DrawMarker(1, start.x,start.y,start.z - 1, 0, 0, 0, 0, 0, 0, 3.5001, 3.5001, 0.6001,252,75,0, 255, 0, 0, 1, true)
if get3DDistance(start.x, start.y, start.z, posped.x, posped.y, posped.z) < 3.5 then
DisplayHelpText("Presiona ~INPUT_CONTEXT~ para iniciar el trabajo")
if IsControlJustPressed(1, 38) then
if not oneM then
entity = EntityInFront()
IsEntityAMissionEntity(entity)
SetEntityRotation(entity, 0, 0, 1, false, true)
oneM = true
print(oneM)
elseif oneM then
IsEntityAMissionEntity(entity)
SetEntityCoords(entity, 148.02660, -1044.36400, 29.50693)
SetEntityRotation(entity, 0, 0, 5, false, true)
oneM = false
print(oneM)
end
end
end
end
end
end)