Bilal135 Posted August 2, 2015 Posted August 2, 2015 function dx_1() dxDrawRectangle(459, 0, 428, 37, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 470, 4, 508, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Don't forget to check out the site zombie-stampede.enjin.com", 518, 4, 877, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx_2() dxDrawRectangle(459, 0, 398, 53, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 470, 4, 508, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Lets keep the server running help support the server with a", 518, 4, 877, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("small donation. You will be rewarded.", 472, 28, 847, 47, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx_3() dxDrawRectangle(508, 0, 257, 33, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 518, 4, 556, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Remember to read the rules at F1.", 568, 4, 927, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx1() addEventHandler("onClientRender", root, dx_1) setTimer(function() removeEventHandler("onClientRender", root, dx_1) end, 1000, 0) end dx1() function dx2() setTimer(function() addEventHandler("onClientRender", root, dx_2) end, 2000, 0) removeEventHandler("onClientRender", root, dx_2) end dx2() function dx3() setTimer(function() addEventHandler("onClientRender", root, dx_3) end, 3000, 0) removeEventHandler("onClientRender", root, dx_3) end dx3() Error: lua 30 and lua 38 : addEventHandler ['onClientRender' with this function is already handled]
KariiiM Posted August 2, 2015 Posted August 2, 2015 Try this function dx_1() dxDrawRectangle(459, 0, 428, 37, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 470, 4, 508, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Don't forget to check out the site zombie-stampede.enjin.com", 518, 4, 877, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx_2() dxDrawRectangle(459, 0, 398, 53, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 470, 4, 508, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Lets keep the server running help support the server with a", 518, 4, 877, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("small donation. You will be rewarded.", 472, 28, 847, 47, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx_3() dxDrawRectangle(508, 0, 257, 33, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 518, 4, 556, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Remember to read the rules at F1.", 568, 4, 927, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx1() addEventHandler("onClientRender", root, dx_1) setTimer(function() removeEventHandler("onClientRender", root, dx_1) end, 1000, 0) end function dx2() addEventHandler("onClientRender", root, dx_2) setTimer(function() removeEventHandler("onClientRender", root, dx_2) end, 2000, 0) end function dx3() addEventHandler("onClientRender", root, dx_3) setTimer(function() removeEventHandler("onClientRender", root, dx_3) end, 3000, 0) end
John Smith Posted August 2, 2015 Posted August 2, 2015 Oh for fuck sake guys! Just look at damn 3rd argument of the timer e.g end, 2000, 0) 0 means it keeps repeating forever, put it to 1
KariiiM Posted August 2, 2015 Posted August 2, 2015 function dx_1() dxDrawRectangle(459, 0, 428, 37, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 470, 4, 508, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Don't forget to check out the site zombie-stampede.enjin.com", 518, 4, 877, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx_2() dxDrawRectangle(459, 0, 398, 53, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 470, 4, 508, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Lets keep the server running help support the server with a", 518, 4, 877, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("small donation. You will be rewarded.", 472, 28, 847, 47, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx_3() dxDrawRectangle(508, 0, 257, 33, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 518, 4, 556, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Remember to read the rules at F1.", 568, 4, 927, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx1() addEventHandler("onClientRender", root, dx_1) setTimer(function() removeEventHandler("onClientRender", root, dx_1) end, 1000, 1) end dx1() function dx2() addEventHandler("onClientRender", root, dx_2) setTimer(function() removeEventHandler("onClientRender", root, dx_2) end, 2000, 1) end dx2() function dx3() addEventHandler("onClientRender", root, dx_3) setTimer(function() removeEventHandler("onClientRender", root, dx_3) end, 3000, 1) end dx3()
Bilal135 Posted August 2, 2015 Author Posted August 2, 2015 dx_1 and dx_2 appears together (this is weird), and the third one appears alone (as it should be). Also if I set it to 1, it only appears once and never appears again. I want, for example, dx_1 to appear first, then it disappears and dx_2 appears, then it disappears and dx_3 appears. This process should continue.
John Smith Posted August 2, 2015 Posted August 2, 2015 of course that they all appear together when you're adding an event handler to them instantly by calling the dx1() etc functions
Bilal135 Posted August 2, 2015 Author Posted August 2, 2015 of course that they all appear together when you're adding an event handler to them instantly by calling the dx1() etc functions So how do I fix it?
John Smith Posted August 2, 2015 Posted August 2, 2015 (edited) function dx1() addEventHandler("onClientRender", root, dx_1) setTimer(function() removeEventHandler("onClientRender", root, dx_1) end, 1000, 1) end dx1() function dx2() addEventHandler("onClientRender", root, dx_2) setTimer(function() removeEventHandler("onClientRender", root, dx_2) end, 1000, 1) end setTimer(dx2,1000,1) function dx3() addEventHandler("onClientRender", root, dx_3) setTimer(function() removeEventHandler("onClientRender", root, dx_3) end, 1000, 1) end setTimer(dx3,2000,1) Edited August 2, 2015 by Guest
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