Skip to content

Commit

Permalink
fix: use SetEntityCoords correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Aug 25, 2024
1 parent ebff1a0 commit a8ad5e7
Showing 1 changed file with 51 additions and 84 deletions.
135 changes: 51 additions & 84 deletions server-data/resources/[bpt_addons]/bpt_teleport/warehouses.lua
Original file line number Diff line number Diff line change
@@ -1,93 +1,60 @@
ESX = exports["es_extended"]:getSharedObject()

CreateThread(function()
while true do
Wait(0)
local playerCoords = GetEntityCoords(PlayerPedId(), true)
-- import enter check
if
GetDistanceBetweenCoords(
playerCoords.x,
playerCoords.y,
playerCoords.z,
1025.393433,
-2398.905518,
29.903320,
true
) <= 3.0
then
ESX.ShowHelpNotification(TranslateCap("press_to_enter"))
if IsControlPressed(0, 51) then
DoScreenFadeOut(1000)
Wait(1500)
SetEntityCoords(PlayerPedId(), 1022.123108, -2398.377930, 30.122314)
Wait(1000)
DoScreenFadeIn(1000)
end
end
while true do
Wait(0)
local playerCoords = GetEntityCoords(PlayerPedId(), true)
-- import enter check
if GetDistanceBetweenCoords(playerCoords.x, playerCoords.y, playerCoords.z, 1025.393433, -2398.905518, 29.903320, true) <= 3.0 then
ESX.ShowHelpNotification(TranslateCap("press_to_enter"))
if IsControlPressed(0, 51) then
DoScreenFadeOut(1000)
Wait(1500)
SetEntityCoords(PlayerPedId(), 1022.123108, -2398.377930, 30.122314, false, false, false, true)
Wait(1000)
DoScreenFadeIn(1000)
end
end

-- import exit
if
GetDistanceBetweenCoords(
playerCoords.x,
playerCoords.y,
playerCoords.z,
1022.123108,
-2398.377930,
30.122314,
true
) <= 3.0
then
ESX.ShowHelpNotification(TranslateCap("press_to_exit"))
if IsControlPressed(0, 51) then
DoScreenFadeOut(1000)
Wait(1500)
SetEntityCoords(PlayerPedId(), 1025.459351, -2398.865967, 29.903320, 239.736)
Wait(1000)
DoScreenFadeIn(1000)
end
end
end
-- import exit
if GetDistanceBetweenCoords(playerCoords.x, playerCoords.y, playerCoords.z, 1022.123108, -2398.377930, 30.122314, true) <= 3.0 then
ESX.ShowHelpNotification(TranslateCap("press_to_exit"))
if IsControlPressed(0, 51) then
DoScreenFadeOut(1000)
Wait(1500)
SetEntityCoords(PlayerPedId(), 1025.459351, -2398.865967, 29.903320, false, false, false, true)
Wait(1000)
DoScreenFadeIn(1000)
end
end
end
end)

-- Unicorn
CreateThread(function()
while true do
Wait(0)
local playerCoords = GetEntityCoords(PlayerPedId(), true)
if
GetDistanceBetweenCoords(playerCoords.x, playerCoords.y, playerCoords.z, 132.608, -1293.978, 28.269, true)
<= 3.0
then
ESX.ShowHelpNotification(TranslateCap("press_to_enter"))
if IsControlPressed(0, 51) then
DoScreenFadeOut(1000)
Wait(1500)
SetEntityCoords(PlayerPedId(), 126.742, -1278.386, 28.569)
Wait(1000)
DoScreenFadeIn(1000)
end
end
-- import exit
if
GetDistanceBetweenCoords(
playerCoords.x,
playerCoords.y,
playerCoords.z,
132.540665,
-1290.329712,
29.263062,
true
) <= 3.0
then
ESX.ShowHelpNotification(TranslateCap("press_to_exit"))
if IsControlPressed(0, 51) then
DoScreenFadeOut(1000)
Wait(1500)
SetEntityCoords(PlayerPedId(), 132.527481, -1294.153809, 29.263062)
Wait(1000)
DoScreenFadeIn(1000)
end
end
end
while true do
Wait(0)
local playerCoords = GetEntityCoords(PlayerPedId(), true)
if GetDistanceBetweenCoords(playerCoords.x, playerCoords.y, playerCoords.z, 132.608, -1293.978, 28.269, true) <= 3.0 then
ESX.ShowHelpNotification(TranslateCap("press_to_enter"))
if IsControlPressed(0, 51) then
DoScreenFadeOut(1000)
Wait(1500)
SetEntityCoords(PlayerPedId(), 126.742, -1278.386, 28.569, false, false, false, true)
Wait(1000)
DoScreenFadeIn(1000)
end
end
-- import exit
if GetDistanceBetweenCoords(playerCoords.x, playerCoords.y, playerCoords.z, 132.540665, -1290.329712, 29.263062, true) <= 3.0 then
ESX.ShowHelpNotification(TranslateCap("press_to_exit"))
if IsControlPressed(0, 51) then
DoScreenFadeOut(1000)
Wait(1500)
SetEntityCoords(PlayerPedId(), 132.527481, -1294.153809, 29.263062, false, false, false, true)
Wait(1000)
DoScreenFadeIn(1000)
end
end
end
end)

0 comments on commit a8ad5e7

Please sign in to comment.