client.lua
--positionTo = enter
--positionFrom = exit
local TeleportFromTo = {
["Example 1"] = {
positionTo = { ['x'] = 0.0, ['y'] = 0.0, ['z'] = 0.0, nom = "Enter Room"},
positionFrom = { ['x'] = 0.0, ['y'] = 0.0, ['z'] = 0.0, nom = "Exit Room"},
},
["Coke Process"] = {
positionTo = { ['x'] = 0.0, ['y'] = 0.0, ['z'] = 0.0, nom = "Enter Room"},
positionFrom = { ['x'] = 0.0, ['y'] = 0.0, ['z'] = 0.0, nom = "Exit Room"},
},
}
Drawing = setmetatable({}, Drawing)
Drawing.__index = Drawing
function Drawing.draw3DText(x,y,z,textInput,fontId,scaleX,scaleY,r, g, b, a)
local px,py,pz=table.unpack(GetGameplayCamCoords())
local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1)
local scale = (1/dist)*20
local fov = (1/GetGameplayCamFov())*100
local scale = scale*fov
SetTextScale(scaleX*scale, scaleY*scale)
SetTextFont(fontId)
SetTextProportional(1)
SetTextColour(r, g, b, a)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(2, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(textInput)
SetDrawOrigin(x,y,z+2, 0)
DrawText(0.0, 0.0)
ClearDrawOrigin()
end
function Drawing.drawMissionText(m_text, showtime)
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(m_text)
DrawSubtitleTimed(showtime, 1)
end
function msginf(msg, duree)
duree = duree or 500
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString(msg)
DrawSubtitleTimed(duree, 1)
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(2)
local pos = GetEntityCoords(GetPlayerPed(-1), true)
for k, j in pairs(TeleportFromTo) do
--msginf(k .. " " .. tostring(j.positionFrom.x), 15000)
if(Vdist(pos.x, pos.y, pos.z, j.positionFrom.x, j.positionFrom.y, j.positionFrom.z) < 5.0)then
DrawMarker(1, j.positionFrom.x, j.positionFrom.y, j.positionFrom.z - 1, 0, 0, 0, 0, 0, 0, 1.0001, 1.0001, .801, 255, 255, 255,255, 0, 0, 0,0)
if(Vdist(pos.x, pos.y, pos.z, j.positionFrom.x, j.positionFrom.y, j.positionFrom.z) < 5.0)then
Drawing.draw3DText(j.positionFrom.x, j.positionFrom.y, j.positionFrom.z - 1.100, j.positionFrom.nom, 1, 0.2, 0.1, 255, 255, 255, 215)
if(Vdist(pos.x, pos.y, pos.z, j.positionFrom.x, j.positionFrom.y, j.positionFrom.z) < 1.0)then
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString("Press [~p~E~w~] to exit.")
DrawSubtitleTimed(0, 1)
if IsControlJustPressed(1, 38) then
DoScreenFadeOut(500)
Citizen.Wait(2000)
SetEntityCoords(GetPlayerPed(-1), j.positionTo.x, j.positionTo.y, j.positionTo.z - 1)
DoScreenFadeIn(1500)
end
end
end
end
if(Vdist(pos.x, pos.y, pos.z, j.positionTo.x, j.positionTo.y, j.positionTo.z) < 2.0)then
DrawMarker(1, j.positionTo.x, j.positionTo.y, j.positionTo.z - 1, 0, 0, 0, 0, 0, 0, 1.0001, 1.0001, .801, 68, 68, 68,64, 0, 0, 0,0)
if(Vdist(pos.x, pos.y, pos.z, j.positionTo.x, j.positionTo.y, j.positionTo.z) < 1.0)then
Drawing.draw3DText(j.positionTo.x, j.positionTo.y, j.positionTo.z - 1.100, j.positionTo.nom, 1, 0.2, 0.1, 255, 255, 255, 215)
if(Vdist(pos.x, pos.y, pos.z, j.positionTo.x, j.positionTo.y, j.positionTo.z) < 1.0)then
ClearPrints()
SetTextEntry_2("STRING")
AddTextComponentString("Press [~p~E~w~] to enter.")
DrawSubtitleTimed(0, 1)
if IsControlJustPressed(1, 38) then
DoScreenFadeOut(500)
Citizen.Wait(2000)
SetEntityCoords(GetPlayerPed(-1), j.positionFrom.x, j.positionFrom.y, j.positionFrom.z - 1)
DoScreenFadeIn(1500)
end
end
end
end
end
end
end)