xRGamingx Posted May 20, 2018 Posted May 20, 2018 (edited) Hello friends I need a little help I created a small square dxDraw But the problem is that when he called the square dxdraw disappears very fast And what I need is for it to stay at least 30 seconds ---Client function helpe(emergenci) local screenW, screenH = guiGetScreenSize() dxDrawLine((screenW * 0.4281) - 1, (screenH * 0.1380) - 1, (screenW * 0.4281) - 1, screenH * 0.4232, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5594, (screenH * 0.1380) - 1, (screenW * 0.4281) - 1, (screenH * 0.1380) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.4281) - 1, screenH * 0.4232, screenW * 0.5594, screenH * 0.4232, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5594, screenH * 0.4232, screenW * 0.5594, (screenH * 0.1380) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.4281, screenH * 0.1380, screenW * 0.1313, screenH * 0.2852, tocolor(0, 0, 0, 98), false) end addEvent("helpe", true) addEventHandler("helpe", root, helpe) function delhelpe () addEventHandler("onClientRender",getRootElement(),helpe) setTimer(function() removeEventHandler("onClientRender",getRootElement(),helpe) end,10000,1) end addEvent ("onSpecialEvent", true) addEventHandler ("onSpecialEvent", root, delhelpe) ---Server triggerClientEvent (player,"helpe", player,emergenci) Edited May 20, 2018 by xRGamingx
itHyperoX Posted May 20, 2018 Posted May 20, 2018 (edited) local sec = 30 -- < you can always change this. just put the second here local sec_ = sec*1000 setTimer(function() removeEventHandler("onClientRender",getRootElement(),helpe) end, sec_ , 1) Edited May 20, 2018 by TheMOG
xRGamingx Posted May 20, 2018 Author Posted May 20, 2018 (edited) 25 minutes ago, TheMOG said: local sec = 30 -- < you can always change this. just put the second here local sec_ = sec*1000 setTimer(function() removeEventHandler("onClientRender",getRootElement(),helpe) end, sec_ , 1) friend can you fix it in the same code please because I tried one way and it did not work Edited May 20, 2018 by xRGamingx
Dzsozi (h03) Posted May 20, 2018 Posted May 20, 2018 (edited) Try this. ? local screenW, screenH = guiGetScreenSize() -- you don't have to get the screen size inside the render function local disappearTime = 10 -- seconds function renderPanel() dxDrawLine((screenW * 0.4281) - 1, (screenH * 0.1380) - 1, (screenW * 0.4281) - 1, screenH * 0.4232, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5594, (screenH * 0.1380) - 1, (screenW * 0.4281) - 1, (screenH * 0.1380) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.4281) - 1, screenH * 0.4232, screenW * 0.5594, screenH * 0.4232, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5594, screenH * 0.4232, screenW * 0.5594, (screenH * 0.1380) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.4281, screenH * 0.1380, screenW * 0.1313, screenH * 0.2852, tocolor(0, 0, 0, 98), false) end function handlePanelRender(state) removeEventHandler("onClientRender",getRootElement(),renderPanel) if state then addEventHandler("onClientRender",getRootElement(),renderPanel) end -- if you want the timer solution then just delete the --[[ and the ]] at the end and delete the code above --[[ removeEventHandler("onClientRender",getRootElement(),renderPanel) -- add this so there won't be errors in debugscript about event is being already handled addEventHandler("onClientRender",getRootElement(),renderPanel) setTimer(function() removeEventHandler("onClientRender",getRootElement(),renderPanel) end, disappearTime*1000, 1) ]] end addEvent ("onSpecialEvent", true) addEventHandler ("onSpecialEvent", root, handlePanelRender) ---Server triggerClientEvent(player,"onSpecialEvent",player, true) -- change true to false if you want to make the panel disappear Edited May 20, 2018 by Dzsozi (h03) 1
xRGamingx Posted May 20, 2018 Author Posted May 20, 2018 2 hours ago, Dzsozi (h03) said: Try this. ? local screenW, screenH = guiGetScreenSize() -- you don't have to get the screen size inside the render function local disappearTime = 10 -- seconds function renderPanel() dxDrawLine((screenW * 0.4281) - 1, (screenH * 0.1380) - 1, (screenW * 0.4281) - 1, screenH * 0.4232, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5594, (screenH * 0.1380) - 1, (screenW * 0.4281) - 1, (screenH * 0.1380) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine((screenW * 0.4281) - 1, screenH * 0.4232, screenW * 0.5594, screenH * 0.4232, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(screenW * 0.5594, screenH * 0.4232, screenW * 0.5594, (screenH * 0.1380) - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(screenW * 0.4281, screenH * 0.1380, screenW * 0.1313, screenH * 0.2852, tocolor(0, 0, 0, 98), false) end function handlePanelRender(state) removeEventHandler("onClientRender",getRootElement(),renderPanel) if state then addEventHandler("onClientRender",getRootElement(),renderPanel) end -- if you want the timer solution then just delete the --[[ and the ]] at the end and delete the code above --[[ removeEventHandler("onClientRender",getRootElement(),renderPanel) -- add this so there won't be errors in debugscript about event is being already handled addEventHandler("onClientRender",getRootElement(),renderPanel) setTimer(function() removeEventHandler("onClientRender",getRootElement(),renderPanel) end, disappearTime*1000, 1) ]] end addEvent ("onSpecialEvent", true) addEventHandler ("onSpecialEvent", root, handlePanelRender) ---Server triggerClientEvent(player,"onSpecialEvent",player, true) -- change true to false if you want to make the panel disappear Thanks broth 1
Dzsozi (h03) Posted May 21, 2018 Posted May 21, 2018 7 hours ago, xRGamingx said: Thanks broth Anytime!
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