Hello, I’m starting
(Google Translate)
Could someone help me put a freeze with seconds to not that the players gravestones to the ground for teleport?
I use the simpletp script
key_to_teleport = 38
positions = {
{{611.78, 4.98, 43.01, 0}, {-448.06, 6008.16, 30.76, 0}, "Karakol"}, -- Outside the Sheriff's Station
{{625.18, -3.13, 43.47, 0}, {624.86, 3.72, 89.34, 0}, "Toplanti Odasi"},
{{-447.4, 6001.33, 30.8, 0}, {618.03, -11.6, 89.38, 0}, "Ofis"},
--[[
{{x, y, z, Heading}, {x, y, z, Heading}, "Text to show when in the area."},
]]
}
-----------------------------------------------------------------------------
-------------------------DO NOT EDIT BELOW THIS LINE-------------------------
-----------------------------------------------------------------------------
local player = GetPlayerPed(-1)
Citizen.CreateThread(function ()
while true do
Citizen.Wait(5)
local player = GetPlayerPed(-1)
local playerLoc = GetEntityCoords(player)
for i,location in ipairs(positions) do
teleport_text = location[3]
loc1 = {
x=location[1][1],
y=location[1][2],
z=location[1][3],
heading=location[1][4]
}
loc2 = {
x=location[2][1],
y=location[2][2],
z=location[2][3],
heading=location[2][4]
}
DrawMarker(1, loc1.x, loc1.y, loc1.z, 0, 0, 0, 0, 0, 0, 1.501, 1.5001, 0.5001, 0, 0, 255, 200, 0, 0, 0, 0)
DrawMarker(1, loc2.x, loc2.y, loc2.z, 0, 0, 0, 0, 0, 0, 1.501, 1.5001, 0.5001, 0, 0, 255, 200, 0, 0, 0, 0)
if CheckPos(playerLoc.x, playerLoc.y, playerLoc.z, loc1.x, loc1.y, loc1.z, 2) then
alert(teleport_text)
if IsControlJustReleased(1, key_to_teleport) then
if IsPedInAnyVehicle(player, true) then
SetEntityCoords(GetVehiclePedIsUsing(player), loc2.x, loc2.y, loc2.z)
SetEntityHeading(GetVehiclePedIsUsing(player), loc2.heading)
else
SetEntityCoords(player, loc2.x, loc2.y, loc2.z)
SetEntityHeading(player, loc2.heading)
end
end
elseif CheckPos(playerLoc.x, playerLoc.y, playerLoc.z, loc2.x, loc2.y, loc2.z, 2) then
alert(teleport_text)
if IsControlJustReleased(1, key_to_teleport) then
if IsPedInAnyVehicle(player, true) then
SetEntityCoords(GetVehiclePedIsUsing(player), loc1.x, loc1.y, loc1.z)
SetEntityHeading(GetVehiclePedIsUsing(player), loc1.heading)
else
SetEntityCoords(player, loc1.x, loc1.y, loc1.z)
SetEntityHeading(player, loc1.heading)
end
end
end
end
end
end)
function CheckPos(x, y, z, cx, cy, cz, radius)
local t1 = x - cx
local t12 = t1^2
local t2 = y-cy
local t21 = t2^2
local t3 = z - cz
local t31 = t3^2
return (t12 + t21 + t31) <= radius^2
end
function alert(msg)
SetTextComponentFormat("STRING")
AddTextComponentString(msg)
DisplayHelpTextFromStringLabel(0,0,1,-1)
end