Biblioteka 'dx' wymaga renderowania co klatkę, więc dxDrawText musi być umieszczony w evencie onClientRender.
function showPremium()
local px,py,pz = getElementPosition(getLocalPlayer())
local x,y,z = getElementPosition(getLocalPlayer())
local distance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz)
if distance <= 10 then
local sx,sy = getScreenFromWorldPosition ( x, y, z+1.12, 0.05 )
if not sx then return end
local scale = 0.01/(0.01 * (distance / 1))
dxDrawText ( "Premium", sx, sy, sx, sy + 25, tocolor(255,230,100,255), math.min ( 0.07 *(180/distance),1.8), "clear-normal", "center", "bottom", false, false, false )
end
end
function premiumhud()
addEventHandler("onClientRender", localPlayer, showPremium)
end
addCommandHandler("premium", premiumhud)