Mark0 Posted December 10, 2012 Share Posted December 10, 2012 (edited) function ( ) if source == Button then showdx = dxDrawText("test", 421, 30, 911, 68, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) end ) addEventHandler("onClientRender", g_localPlayer, showdx ) setTimer ( showdx, 100, 0 ) Edited December 10, 2012 by Guest Link to comment
uhm Posted December 10, 2012 Share Posted December 10, 2012 nah dawg you gotsa like call dxDrawText every onClientRender call check dat wiki page for dxDrawText and then throw dat timer overboard dat make no sense and to remove that thing use removeEventHandler Link to comment
Mark0 Posted December 10, 2012 Author Share Posted December 10, 2012 can you explain more Link to comment
uhm Posted December 10, 2012 Share Posted December 10, 2012 try this function drawText() -- A function to draw the text we want dxDrawText("test", 421, 30, 911, 68, tocolor(255, 255, 255, 255), 1, "default", "left", "top", false, false, true, false, false) end function startText() addEventHandler("onClientRender", getRootElement(), drawText) end function stopText() removeEventHandler("onClientRender", getRootElement(), drawText) end --THAT_ATM_BUTTON = guiCreateButton( this already exists somewhere probably ) addEventHandler ( "onClientGUIClick", THAT_ATM_BUTTON, startText, false ) Steps in logical order: 1) Add the event When player click on this, Do enable the handler that gets called everytime a frame is drawn and something should appear on screen 2) Add the event When a frame is drawn, Do your dxDraw functions 3) Done. 4) To remove that text, remove that handler for When a frame... by calling stopText() Also check out Remp's awesome resource for this kind of stuff that also generates lua code https://community.multitheftauto.com/index.php?p= ... ils&id=141 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now