Jump to content

Some help


Mark0

Recommended Posts

  
  
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 by Guest
Link to comment

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

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