forked from Simnation/Main
38 lines
1.2 KiB
Lua
38 lines
1.2 KiB
Lua
![]() |
local klingelPunkte = {
|
||
|
{ coords = vector3(-1131.6201, 390.6628, 70.7966), text = "Drücke ~g~E~w~ zum Klingeln" },
|
||
|
{ coords = vector3(-1090.2689, 372.3344, 68.7242), text = "Drücke ~g~E~w~ zum Klingeln" },
|
||
|
-- Weitere Punkte hier hinzufügen
|
||
|
}
|
||
|
|
||
|
local klingelRadius = 2.0
|
||
|
|
||
|
Citizen.CreateThread(function()
|
||
|
while true do
|
||
|
Wait(0)
|
||
|
local playerCoords = GetEntityCoords(PlayerPedId())
|
||
|
for _, punkt in pairs(klingelPunkte) do
|
||
|
local dist = #(playerCoords - punkt.coords)
|
||
|
if dist < klingelRadius then
|
||
|
DrawText3D(punkt.coords.x, punkt.coords.y, punkt.coords.z + 0.2, punkt.text)
|
||
|
if IsControlJustReleased(0, 38) then -- Taste E
|
||
|
TriggerServerEvent('klingel:benachrichtige')
|
||
|
lib.notify({ title = 'Klingel', description = 'Du hast geklingelt.', type = 'inform' })
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end)
|
||
|
|
||
|
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)
|
||
|
ClearDrawOrigin()
|
||
|
end
|