Jump to content

dxDrawText Error


SoManyTears

Recommended Posts

Hello,

I'm trying to add text on the ped.everything is good.text appears but when I approach the ped, the error comes from debug.

ERROR :[Resources]\missionsped\client.Lua:199: attempt to perform arithmetic on local 'sy'  (a nil value)

How can ı solve this problem ? 

function pedText() 
        local x, y, z = getElementPosition( dealer )  --ped position
        local x2, y2, z2 = getElementPosition(localPlayer) --player position
        local yakinlas = getDistanceBetweenPoints3D(x,y,z, x2, y2, z2)
        if yakinlas < 4 then   
           local x2, y2, z2 = getElementPosition(localPlayer) 
           lcal sx, sy = getScreenFromWorldPosition(x, y, z+0.9, 0.06)  
           local yakinlas = getDistanceBetweenPoints3D(x,y,z, x2, y2, z2)
           local yaziboyut = 0.9
           dxDrawText ( "Drug Dealer" , sx, sy - 30, sx, sy - 30, tocolor(255,255,255), math.min ( 0.3*(150/yakinlas)*1.4,1.3 - (0.5 + math.sin(math.rad(getTickCount())) / 3) / 12) * yaziboyut, "default-bold", "center", "bottom", false, false, false, true )
        end
	end	
--end 
addEventHandler("onClientRender", root, pedText)

 

Link to comment
  • IIYAMA locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...