Jump to content

dxDrawText


1LoL1

Recommended Posts

How i can show text in dxDrawText? i always get nil

local screenW, screenH = guiGetScreenSize()

addEventHandler("onClientRender", getRootElement(), function(text)
local text2 = (getElementData(localPlayer, "text") or 0)
if (text2 >= 0) and (text2 <= 3999) then
text = 10
elseif (text2 >= 4000) and (text2 <= 5999) then
text = 35
elseif (text2 >= 6000) and (text2 <= 10000000) then
text = 70
end
dxDrawText(text, screenW * 0.0638, screenH * 0.3317, screenW * 0.3200, screenH * 0.3550, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
end)

 

Edited by 1LoL1
Link to comment

The problem is you only set the "text" variable if it falls within your ranges and if it does not then text does not exist.

So either add another line to your if else statements:

else
	text = text2

or rename "text2" to "text" which would also keep the variable contained within the function.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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