function DrawText3D(x, y, z, text, scale) local onScreen, _x, _y = World3dToScreen2d(x, y, z) local pX, pY, pZ = table.unpack(GetGameplayCamCoords()) SetTextScale(scale, scale) SetTextFont(4) SetTextProportional(1) SetTextEntry("STRING") SetTextCentre(true) SetTextColour(255, 255, 255, 215) AddTextComponentString(text) DrawText(_x, _y) end
local maksimumMesafe = 3
local asansorTextBoyut = 0.40
local Asansorler = {
[1] = { konum1 = { x = 100, y = 100, z = 10 }, konum2 = { x = 100, y = 100, z = 20 } },
[2] = { konum1 = { x = 200, y = 200, z = 10 }, konum2 = { x = 200, y = 200, z = 20 } },
}
Citizen.CreateThread(function()
while true do
for _, i in pairs(Asansorler) do
local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local dst = GetDistanceBetweenCoords(x, y, z, i.konum1.x, i.konum1.y, i.konum1.z, true)
if dst <= maksimumMesafe then
DrawMarker(2, i.konum1.x, i.konum1.y, i.konum1.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 255, 0, 40, 200, 0.0, false, true, 0.0, nil, nil, false)
DrawText3D(i.konum1.x, i.konum1.y, i.konum1.z, "~w~[~g~E~w~] Asansor Kullan", asansorTextBoyut)
if IsControlJustPressed(0, 38) then -- E tuşu :)
local ply = PlayerPedId()
DoScreenFadeOut(1000)
Citizen.Wait(1000)
SetEntityCoords(ply, i.konum2.x, i.konum2.y, i.konum2.z)
Citizen.Wait(1000)
DoScreenFadeIn(1000)
end
else
Citizen.Wait(1000)
end
end
end
end)
Citizen.CreateThread(function()
while true do
for _, i in pairs(Asansorler) do
local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local dst = GetDistanceBetweenCoords(x, y, z, i.konum2.x, i.konum2.y, i.konum2.z, true)
if dst <= maksimumMesafe then
DrawMarker(2, i.konum2.x, i.konum2.y, i.konum2.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 255, 0, 40, 200, 0.0, false, true, 0.0, nil, nil, false)
DrawText3D(i.konum2.x, i.konum2.y, i.konum2.z, "~w~[~g~E~w~] Asansor Kullan", asansorTextBoyut)
if IsControlJustPressed(0, 38) then -- E tuşu :)
local ply = PlayerPedId()
DoScreenFadeOut(1000)
Citizen.Wait(1000)
SetEntityCoords(ply, i.konum1.x, i.konum1.y, i.konum1.z)
Citizen.Wait(1000)
DoScreenFadeIn(1000)
end
else
Citizen.Wait(1100)
end
end
end
end)