Flexxy Posted May 8, 2016 Share Posted May 8, 2016 Hey guys.. I've problem with dxDrawText because it's showing up only for sec and it's dissapears. I don't know how to make it longer does anyone knows how ? Ah ye I want it to be shown after driving into marker. Here's script which I wrote --dxDrawText local screenW, screenH = guiGetScreenSize() function tekst() if source == kaboommarker then dxDrawText("blablabla", (screenW * 0.0516) - 1, (screenH * 0.5130) - 1, (screenW * 0.3094) - 1, (screenH * 0.6130) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) + 1, (screenH * 0.5130) - 1, (screenW * 0.3094) + 1, (screenH * 0.6130) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) - 1, (screenH * 0.5130) + 1, (screenW * 0.3094) - 1, (screenH * 0.6130) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) + 1, (screenH * 0.5130) + 1, (screenW * 0.3094) + 1, (screenH * 0.6130) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", screenW * 0.0516, screenH * 0.5130, screenW * 0.3094, screenH * 0.6130, tocolor(18, 84, 235, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end end addEventHandler("onClientRender", root, tekst) addEventHandler("onClientMarkerHit", root, tekst) Link to comment
MACIEKW89 Posted May 8, 2016 Share Posted May 8, 2016 Hi, Try that: local screenW, screenH = guiGetScreenSize() function tekst() dxDrawText("blablabla", (screenW * 0.0516) - 1, (screenH * 0.5130) - 1, (screenW * 0.3094) - 1, (screenH * 0.6130) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) + 1, (screenH * 0.5130) - 1, (screenW * 0.3094) + 1, (screenH * 0.6130) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) - 1, (screenH * 0.5130) + 1, (screenW * 0.3094) - 1, (screenH * 0.6130) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) + 1, (screenH * 0.5130) + 1, (screenW * 0.3094) + 1, (screenH * 0.6130) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", screenW * 0.0516, screenH * 0.5130, screenW * 0.3094, screenH * 0.6130, tocolor(18, 84, 235, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end addEventHandler("onClientMarkerHit", root, function() if source==kaboommarker then addEventHandler("onClientRender", root, tekst) end end) Link to comment
Abdul KariM Posted May 8, 2016 Share Posted May 8, 2016 function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end --dxDrawText local screenW, screenH = guiGetScreenSize() function tekst() dxDrawText("blablabla", (screenW * 0.0516) - 1, (screenH * 0.5130) - 1, (screenW * 0.3094) - 1, (screenH * 0.6130) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) + 1, (screenH * 0.5130) - 1, (screenW * 0.3094) + 1, (screenH * 0.6130) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) - 1, (screenH * 0.5130) + 1, (screenW * 0.3094) - 1, (screenH * 0.6130) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", (screenW * 0.0516) + 1, (screenH * 0.5130) + 1, (screenW * 0.3094) + 1, (screenH * 0.6130) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("blablabla", screenW * 0.0516, screenH * 0.5130, screenW * 0.3094, screenH * 0.6130, tocolor(18, 84, 235, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end addEventHandler("onClientMarkerHit", resourceRoot, function ( player_ ) if ( player_ == getLocalPlayer ( ) ) and ( source == kaboommarker ) then if ( not isEventHandlerAdded ( "onClientRender", root , tekst ) ) then addEventHandler("onClientRender", root, tekst) end end end ) ; Link to comment
Flexxy Posted May 8, 2016 Author Share Posted May 8, 2016 @MACIEKW89 @Abdul KariM Thank you both for help ! It works now 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