Hello, I am trying to get my 3dtext to display only when near a source of the player having it on them like if another player goes near another player or if they go into a certain marker.
function Draw3DText(x, y, z, text)
local onScreen,_x,_y=World3dToScreen2d(x,y,z)
local px,py,pz=table.unpack(GetGameplayCamCoords())
local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1)
local scale = (1/dist)*1
local fov = (1/GetGameplayCamFov())*100
local scale = 1.1
if onScreen then
SetTextScale(0.0*scale, 0.25*scale)
SetTextFont(2)
SetTextProportional(1)
-- SetTextScale(0.0, 0.55)
SetTextColour(0, 0, 0, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(2, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x,_y)
local factor = (string.len(text)) / 370
DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 41, 11, 41, 68)
end
end
I am having issues making a marker display this I can add a while true thing but I’m still unsure about the marker on the ground trigging that and when they leave that marker. and when someone triggers it can make a marker under them invisible so anyone who walks near them will display the 3dtextdisplay
I tried this but its just super unnecessary and doesn’t solve the issue
Citizen.CreateThread(function()
while true do
local player = PlayerId()
local plyPed = GetPlayerPed(player)
local plyPos = GetEntityCoords(plyPed, false)
if insidemarkercheck == true and stage1 == false and stage2 == false then
end
if insidemarkercheck == false and stage1 == false and stage2 == false then
end
if insidemarkercheck == true and stage1 == true and stage2 == false then
Draw3DText(1153.9860839844, -781.12658691406, 57.598682403564 + 0.2, tostring("~w~We are still looking over your vehicle ~o~Come back later"))
end
if insidemarkercheck == true and stage1 == false and stage2 == true then
Draw3DText(1153.9860839844, -781.12658691406, 57.598682403564 + 0.2, tostring("~w~Your vehicle has been finished and is ~r~ready for pickup"))
end
Citizen.Wait(0)
end
end)