BrastaSauce Posted April 5, 2014 Share Posted April 5, 2014 addEventHandler("onClientRender", root, function() local screenx, screeny, worldx, worldy, worldz = getCursorPosition() if (isCursorShowing() ) then if (screenx >= 924 and screenx <= 977) and (screeny >= 375 and screeny <=390) then redMessage = dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) else dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) end else dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) end addEventHandler("onClientGUIClick", redMessage, clickOnMessage) end ) So this is the command I have. It's nowhere near perfect, but I just want to know how to set a bind that would toggle the function on and off. Thanks. Link to comment
TrapLord Studios™ Posted April 5, 2014 Share Posted April 5, 2014 (edited) Okay try this: function drawStuff() dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) end local show = false addCommandHandler( "yourcommand", function( ) showMssg( not show ) end ) function showMssg( state ) if state then showCursor ( true ) addEventHandler( "onClientRender", root, drawStuff ) else showCursor ( false ) removeEventHandler( "onClientRender", root, drawStuff ) end show = state end showMssg( show ) Hope it help'd you can add what ever you want within the drawStuff function. Edited April 5, 2014 by Guest Link to comment
Castillo Posted April 5, 2014 Share Posted April 5, 2014 local show = false function drawStuff ( ) dxDrawText("Message", 924, 375, 977, 390, tocolor(255, 0, 0, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) end function showMsg ( ) show = ( not show ) if ( show ) then addEventHandler( "onClientRender", root, drawStat ) else removeEventHandler( "onClientRender", root, drawStat ) end showCursor ( show ) end bindKey ( "M", "down", showMsg ) 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