Main/resources/[tools]/qb-teleport/client/main.lua

147 lines
6.4 KiB
Lua
Raw Permalink Normal View History

2025-06-07 08:51:21 +02:00
-- Variables
local QBCore = exports['qb-core']:GetCoreObject()
local PlayerData = QBCore.Functions.GetPlayerData()
-- Functions
local function DrawText3D(x, y, z, text)
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextEntry("STRING")
SetTextCentre(true)
AddTextComponentString(text)
SetDrawOrigin(x,y,z, 0)
DrawText(0.0, 0.0)
local factor = (string.len(text)) / 370
DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75)
ClearDrawOrigin()
end
-- Events
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
PlayerData = QBCore.Functions.GetPlayerData()
end)
RegisterNetEvent('QBCore:Client:OnPlayerUnload', function()
PlayerData = {}
end)
-- Threads
-- verlassene_autopsie Teleport
CreateThread(function()
-- Blip entfernt
while true do
Wait(0)
local pos = GetEntityCoords(PlayerPedId(), true)
-- Enter
if #(pos - vector3(Config['verlassene_autopsie'].outsideLocation.x, Config['verlassene_autopsie'].outsideLocation.y, Config['verlassene_autopsie'].outsideLocation.z)) < 1.3 then
DrawText3D(Config['verlassene_autopsie'].outsideLocation.x, Config['verlassene_autopsie'].outsideLocation.y, Config['verlassene_autopsie'].outsideLocation.z + 1, "~g~E~w~ - Verlassene Autopsie betreten")
if IsControlJustReleased(0, 38) then
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Wait(10)
end
SetEntityCoords(PlayerPedId(), Config['verlassene_autopsie'].insideLocation.x, Config['verlassene_autopsie'].insideLocation.y, Config['verlassene_autopsie'].insideLocation.z)
SetEntityHeading(PlayerPedId(), Config['verlassene_autopsie'].insideLocation.w)
DoScreenFadeIn(500)
end
end
-- Exit
if #(pos - vector3(Config['verlassene_autopsie'].insideLocation.x, Config['verlassene_autopsie'].insideLocation.y, Config['verlassene_autopsie'].insideLocation.z)) < 1.3 then
DrawText3D(Config['verlassene_autopsie'].insideLocation.x, Config['verlassene_autopsie'].insideLocation.y, Config['verlassene_autopsie'].insideLocation.z + 1, "~g~E~w~ - Verlassene Autopsie verlassen")
if IsControlJustReleased(0, 38) then
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Wait(10)
end
SetEntityCoords(PlayerPedId(), Config['verlassene_autopsie'].outsideLocation.x, Config['verlassene_autopsie'].outsideLocation.y, Config['verlassene_autopsie'].outsideLocation.z)
SetEntityHeading(PlayerPedId(), Config['verlassene_autopsie'].outsideLocation.w)
DoScreenFadeIn(500)
end
end
end
end)
-- Penthouse Teleport
CreateThread(function()
-- Blip entfernt
while true do
Wait(0)
local pos = GetEntityCoords(PlayerPedId(), true)
-- Enter Penthouse
if #(pos - vector3(Config['penthouse'].outsideLocation.x, Config['penthouse'].outsideLocation.y, Config['penthouse'].outsideLocation.z)) < 1.3 then
DrawText3D(Config['penthouse'].outsideLocation.x, Config['penthouse'].outsideLocation.y, Config['penthouse'].outsideLocation.z + 1, "~g~E~w~ - To Enter the Penthouse")
if IsControlJustReleased(0, 38) then
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Wait(10)
end
SetEntityCoords(PlayerPedId(), Config['penthouse'].insideLocation.x, Config['penthouse'].insideLocation.y, Config['penthouse'].insideLocation.z)
SetEntityHeading(PlayerPedId(), Config['penthouse'].insideLocation.w)
DoScreenFadeIn(500)
end
end
-- Exit Penthouse
if #(pos - vector3(Config['penthouse'].insideLocation.x, Config['penthouse'].insideLocation.y, Config['penthouse'].insideLocation.z)) < 1.3 then
DrawText3D(Config['penthouse'].insideLocation.x, Config['penthouse'].insideLocation.y, Config['penthouse'].insideLocation.z + 1, "~g~E~w~ - To exit the Penthouse")
if IsControlJustReleased(0, 38) then
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Wait(10)
end
SetEntityCoords(PlayerPedId(), Config['penthouse'].outsideLocation.x, Config['penthouse'].outsideLocation.y, Config['penthouse'].outsideLocation.z)
SetEntityHeading(PlayerPedId(), Config['penthouse'].outsideLocation.w)
DoScreenFadeIn(500)
end
end
end
end)
-- Weedfarm
CreateThread(function()
-- Blip war bereits auskommentiert
while true do
Wait(0)
local pos = GetEntityCoords(PlayerPedId(), true)
-- Enter Weedfarm
if #(pos - vector3(Config['weed'].outsideLocation.x, Config['weed'].outsideLocation.y, Config['weed'].outsideLocation.z)) < 1.3 then
DrawText3D(Config['weed'].outsideLocation.x, Config['weed'].outsideLocation.y, Config['weed'].outsideLocation.z + 1, "~g~E~w~ - To Enter the Weedfarm")
if IsControlJustReleased(0, 38) then
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Wait(10)
end
SetEntityCoords(PlayerPedId(), Config['weed'].insideLocation.x, Config['weed'].insideLocation.y, Config['weed'].insideLocation.z)
SetEntityHeading(PlayerPedId(), Config['weed'].insideLocation.w)
DoScreenFadeIn(500)
end
end
-- Exit Weedfarm
if #(pos - vector3(Config['weed'].insideLocation.x, Config['weed'].insideLocation.y, Config['weed'].insideLocation.z)) < 1.3 then
DrawText3D(Config['weed'].insideLocation.x, Config['weed'].insideLocation.y, Config['weed'].insideLocation.z + 1, "~g~E~w~ - To exit the Weedfarm")
if IsControlJustReleased(0, 38) then
DoScreenFadeOut(500)
while not IsScreenFadedOut() do
Wait(10)
end
SetEntityCoords(PlayerPedId(), Config['weed'].outsideLocation.x, Config['weed'].outsideLocation.y, Config['weed'].outsideLocation.z)
SetEntityHeading(PlayerPedId(), Config['weed'].outsideLocation.w)
DoScreenFadeIn(500)
end
end
end
end)
-- Exports
exports('SetTemplate', SetTemplate)