Jump to content

dxDrawText


Lloyd Logan

Recommended Posts

Why does this instantly delete the text?

function drawText() 
        dxDrawText("You have successfully bought a vehicle!", 92, 158, 720, 195, tocolor(65, 205, 4, 255), 1.40, "pricedown", "left", "top", false, false, true, false, false) 
        setTimer ( function() 
        triggerEvent("destroy") 
    end, 5000, 1 ) 
    end 
addEvent("drawSuccess", true) 
addEventHandler("drawSuccess", root, drawText) 
  
  
function destroyText() 
    removeEventHandler("drawSuccess", getRootElement(), drawText) 
end 
addEvent("destroy", true) 
addEventHandler("destroy", root, destroyText) 

Link to post

you can make like this

function drawText() -- draw text 
        dxDrawText("You have successfully bought a vehicle!", 92, 158, 720, 195, tocolor(65, 205, 4, 255), 1.40, "pricedown", "left", "top", false, false, true, false, false) 
addEventHandler("onClientRender", root, drawText) 
  
 setTimer (removeEventHandler, 5000, 1, "onClientRender", getRootElement(), drawText) -- remove text 

OR

use Textdisplay

Link to post
function renderMyText ( ) 
    dxDrawText ( arguments ) 
end 
  
addCommandHandler ( "render", 
    function ( ) 
        addEventHandler ( "onClientRender", root, renderMyText ) -- Begin rendering our text  
    end 
) 
  
addCommandHandler ( "stoprender", 
    function ( ) 
        removeEventHandler ( "onClientRender", root, renderMyText ) -- Stop rendering our text  
    end 
) 

That's an example.

Link to post
function renderMyText ( ) 
    dxDrawText ( arguments ) 
end 
  
addCommandHandler ( "render", 
    function ( ) 
        addEventHandler ( "onClientRender", root, renderMyText ) -- Begin rendering our text  
    end 
) 
  
addCommandHandler ( "stoprender", 
    function ( ) 
        removeEventHandler ( "onClientRender", root, renderMyText ) -- Stop rendering our text  
    end 
) 

That's an example.

Thank you! All is working.

Link to post

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...