Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
local player = PlayerPedId()
local coords = GetEntityCoords(player)
local coords_plus = vector3(coords.x, coords.y, coords.z+1.2)
local r = 58
local g = 115
local b = 208
local a = 215
local my_string = "My text over head"
DrawText3D(coords_plus,my_string,scale_x,scale_y,r,g,b,a)
end
end)
function DrawText3D(coords, text, scale_x, scale_y, r, g, b, a)
local onScreen,_x,_y = World3dToScreen2d(coords)
local game_coords = GetGameplayCamCoord()
local dist = #(game_coords - coords)
local scale = (1/dist)*2
local fov = (1/GetGameplayCamFov())*100
local scale = scale*fov
if onScreen then
SetTextScale(scale_x, scale_y)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(r, g, b, a)
SetTextEntry("STRING")
SetTextCentre(1)
SetTextOutline()
AddTextComponentString(text)
DrawText(_x,_y)
end
end