Guest Posted July 25, 2018 Posted July 25, 2018 (edited) Guys what is wrong ? function somethingfor() if getTickCount() - getTickStart > 0 and count == 0 then sound3 = playSound( "3.mp3", false ) setSoundMaxDistance( sound3, 5000 ) count = 1 elseif getTickCount() - getTickStart > 1000 and count == 1 then if sound3 and isElement(sound3) then stopSound( sound3 ) end sound2 = playSound( "2.mp3", false ) setSoundMaxDistance( sound2, 5000 ) count = 2 elseif getTickCount() - getTickStart > 2000 and count == 2 then if sound2 and isElement(sound2) then stopSound( sound2 ) end sound1 = playSound( "1.mp3", false ) setSoundMaxDistance( sound1, 5000 ) count = 3 elseif getTickCount() - getTickStart > 3000 and count == 3 then if sound1 and isElement(sound1) then stopSound( sound1 ) end sound0 = playSound( "0.mp3", false ) setSoundMaxDistance( sound0, 5000 ) count = 4 elseif getTickCount() - getTickStart > 4000 and count == 4 then count = 5 if sound0 and isElement(sound0) then stopSound( sound0 ) end removeEventHandler( "onClientRender", getRootElement(), somethingfor) end end function GridCountdown() count = 0 getTickStart = getTickCount () addEventHandler( "onClientRender", getRootElement(), somethingfor) end time = {} function Countdown (player, cmd) if isTimer(time[player]) then return end time[player] = setTimer(function() time[player] = nil end,30000,1) local screenW, screenH = guiGetScreenSize() local name = getPlayerName(player) local r,g,b = getPlayerNametagColor (player) local accountname = getAccountName (getPlayerAccount(player)) addEventHandler("onClientRender", getRootElement(), Countdown) dxDrawText(""..name.." has started the countdown", 218 + 1, 149 + 1, 1148 + 1, 190 + 1, tocolor(0, 0, 0, 255), 1.20, "bankgothic", "center", "top", false, false, false, false, false) dxDrawText(""..name.." has started the countdown", 218, 149, 1148, 190, tocolor(255, 255, 255, 255), 1.20, "bankgothic", "center", "top", false, false, false, false, false) setTimer ( Countdown5, 4000, 1 ) removeEventHandler("onClientRender", getRootElement(), Countdown) end function Countdown5 ( root ) local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", getRootElement(), Countdown) dxDrawText("1", (screenW * 0.1596) + 1, (screenH * 0.2839) + 1, (screenW * 0.8404) + 1, (screenH * 0.4297) + 1, tocolor(0, 0, 0, 255), 4.00, "bankgothic", "center", "top", false, false, false, false, false) dxDrawText("1", screenW * 0.1596, screenH * 0.2839, screenW * 0.8404, screenH * 0.4297, tocolor(255, 255, 255, 255), 4.00, "bankgothic", "center", "top", false, false, false, false, false) setTimer ( Countdown4, 1000, 1 ) removeEventHandler("onClientRender", getRootElement(), Countdown) end function Countdown4 ( root ) local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", getRootElement(), Countdown) dxDrawText("2", (screenW * 0.1596) + 1, (screenH * 0.2839) + 1, (screenW * 0.8404) + 1, (screenH * 0.4297) + 1, tocolor(0, 0, 0, 255), 4.00, "bankgothic", "center", "top", false, false, false, false, false) dxDrawText("2", screenW * 0.1596, screenH * 0.2839, screenW * 0.8404, screenH * 0.4297, tocolor(255, 255, 255, 255), 4.00, "bankgothic", "center", "top", false, false, false, false, false) setTimer ( Countdown3, 1000, 1 ) removeEventHandler("onClientRender", getRootElement(), Countdown) end function Countdown3 ( root ) local screenW, screenH = guiGetScreenSize() addEventHandler("onClientRender", getRootElement(), Countdown) dxDrawText("Go Go !!", (screenW * 0.1596) + 1, (screenH * 0.2839) + 1, (screenW * 0.8404) + 1, (screenH * 0.4297) + 1, tocolor(0, 0, 0, 255), 4.00, "bankgothic", "center", "top", false, false, false, false, false) dxDrawText("Go Go !!", screenW * 0.1596, screenH * 0.2839, screenW * 0.8404, screenH * 0.4297, tocolor(255, 255, 255, 255), 4.00, "bankgothic", "center", "top", false, false, false, false, false) setTimer ( Countdown2, 1000, 1 ) removeEventHandler("onClientRender", getRootElement(), Countdown) end addCommandHandler( "countdown", Countdown ) Edited July 25, 2018 by Guest
Moderators Pirulax Posted July 25, 2018 Moderators Posted July 25, 2018 Explain ur issue a little bit more please.
Guest Posted July 25, 2018 Posted July 25, 2018 i wan't when i type /countdown i get these dxDrawTexts "..playerName" starts the countdown 1 2 3 Go but with dxDrawText
Moderators IIYAMA Posted July 25, 2018 Moderators Posted July 25, 2018 How about you use this tool to make it a lot easier: Syntax: addRenderEvent(function functionVar [, string eventName, arguments ...]) bool removeRenderEvent(function functionVar [, string eventName]) Use: function renderCountDown (text) dxDrawText(text, (screenW * 0.1596) + 1, (screenH * 0.2839) + 1, (screenW * 0.8404) + 1, (screenH * 0.4297) + 1, tocolor(0, 0, 0, 255), 4.00, "bankgothic", "center", "top", false, false, false, false, false) dxDrawText(text, screenW * 0.1596, screenH * 0.2839, screenW * 0.8404, screenH * 0.4297, tocolor(255, 255, 255, 255), 4.00, "bankgothic", "center", "top", false, false, false, false, false) end addRenderEvent(renderCountDown, "onClientRender", 1) -- timer removeRenderEvent(renderCountDown, "onClientRender") addRenderEvent(renderCountDown, "onClientRender", 2) -- timer removeRenderEvent(renderCountDown, "onClientRender") addRenderEvent(renderCountDown, "onClientRender", 3) -- timer removeRenderEvent(renderCountDown, "onClientRender") addRenderEvent(renderCountDown, "onClientRender", "Go!") -- timer removeRenderEvent(renderCountDown, "onClientRender") + <Add source code https://forum.multitheftauto.com/topic/103866-src-client-render-events-enchanting/ /> Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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