BriGhtx3 Posted January 10, 2012 Share Posted January 10, 2012 function createTheOverallText(text) local x,y = guiGetScreenSize() addEventHandler("onClientRender",getRootElement(), function() msgBack = dxDrawRectangle(0,y/20,x,y/20,tocolor(0,0,0,80)) local txtw = dxGetTextWidth(text, 0.78, "bankgothic") msgText = dxDrawText ( text, x/2 - txtw / 2, y/23, x, y, tocolor ( 0,0,0, 255 ), 0.78, "bankgothic" ) end ) setTimer( function() removeEventHandler("onClientRender",getRootElement(), function() msgBack = dxDrawRectangle(0,y/20,x,y/20,tocolor(0,0,0,80)) local txtw = dxGetTextWidth(text, 0.78, "bankgothic") msgText = dxDrawText ( text, x/2 - txtw / 2, y/23, x, y, tocolor ( 0,0,0, 255 ), 0.78, "bankgothic" ) end ) end, 5000,1 ) end addEvent("overalltext",true) addEventHandler("overalltext",getRootElement(),createTheOverallText) It doesn't remove the text after 5 seconds -.- I call the function like this : triggerClientEvent("overalltext",getRootElement(), stringWithAllParameters) Link to comment
Thelastride Posted January 10, 2012 Share Posted January 10, 2012 (edited) function drawText() local x,y = guiGetScreenSize() msgBack = dxDrawRectangle(0,y/20,x,y/20,tocolor(0,0,0,80)) local txtw = dxGetTextWidth(text, 0.78, "bankgothic") msgText = dxDrawText ( dtext, x/2 - txtw / 2, y/23, x, y, tocolor ( 0,0,0, 255 ), 0.78, "bankgothic" ) end function createTheOverallText(text) dtext = text addEventHandler("onClientRender",getRootElement(), drawText ) setTimer(removeEventHandler,5000,1,"onClientRender",getRootElement(),drawText) end addEvent("overalltext",true) addEventHandler("overalltext",getRootElement(),createTheOverallText) setTimer arguments were at wrongplace.Use this one Edited January 10, 2012 by Guest Link to comment
BriGhtx3 Posted January 10, 2012 Author Share Posted January 10, 2012 Thank You I tried to integrate a function in a function which actually works But anyway thanks Link to comment
Thelastride Posted January 10, 2012 Share Posted January 10, 2012 You are welcome.Yup it works but you put arguments before in setTimer. 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