Hi, how can I change the coords of the text, for example it looks like this,
![image](https://user-images.githubusercontent.com/120829076/208263245-df932282-7274-45c7-9951-ebe33db4d0e5.png)
And I want to have the Blue text more UP than the red text I´ve got like this.
-- @desc Client-side /me handling
-- @author Elio
-- @Version 3.0
local c = Config -- Pre-load the config
local lang = Languages[Config.language] -- Pre-load the language
local peds = {}
-- Localization
local GetGameTimer = GetGameTimer
-- @desc Draw text in 3d
-- @param coords world coordinates to where you want to draw the text
-- @param text the text to display
local function draw3dText(coords, text)
local camCoords = GetGameplayCamCoord()
local dist = #(coords - camCoords)
-- Experimental math to scale the text down
local scale = 200 / (GetGameplayCamFov() * dist)
-- Format the text
SetTextColour(c.color.r, c.color.g, c.color.b, c.color.a)
SetTextScale(0.0, c.scale * scale)
SetTextFont(c.font)
SetTextDropshadow(0, 0, 0, 0, 55)
SetTextDropShadow()
SetTextCentre(true)
-- Diplay the text
BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName(text)
SetDrawOrigin(coords, 0)
EndTextCommandDisplayText(0.0, 0.0)
ClearDrawOrigin()
end
-- @desc Display the text above the head of a ped
-- @param ped the target ped
-- @param text the text to display
local function displayText(ped, text)
local playerPed = PlayerPedId()
local playerPos = GetEntityCoords(playerPed)
local targetPos = GetEntityCoords(ped)
local dist = #(playerPos - targetPos)
local los = HasEntityClearLosToEntity(playerPed, ped, 17)
if dist <= c.dist and los then
local exists = peds[ped] ~= nil
peds[ped] = {
time = GetGameTimer() + c.time,
text = text
}
if not exists then
local display = true
while display do
Wait(0)
local pos = GetOffsetFromEntityInWorldCoords(ped, 0.0, 0.0, 1.0)
draw3dText(pos, peds[ped].text)
display = GetGameTimer() <= peds[ped].time
end
peds[ped] = nil
end
end
end
-- @desc Trigger the display of teh text for a player
-- @param text text to display
-- @param target the target server id
local function onShareDisplay(text, target)
local player = GetPlayerFromServerId(target)
if player ~= -1 or target == GetPlayerServerId(PlayerId()) then
local ped = GetPlayerPed(player)
displayText(ped, text)
end
end
-- Register the event
RegisterNetEvent('3ddo:shareDisplay', onShareDisplay)
-- Add the chat suggestion
TriggerEvent('chat:addSuggestion', '/' .. lang.commandName, lang.commandDescription, lang.commandSuggestion)