yoya99 Posted October 14, 2014 Share Posted October 14, 2014 hello i have this countdown resource and i want it to make a text at the players screen like playername... starts the countdown ... 3 ,2,1 GO ! or something thx server: time = {} function Countdown (player, cmd) if isTimer(time[player]) then return end time[player] = setTimer(function() time[player] = nil end,30000,1) local name = getPlayerName(player) local r,g,b = getPlayerNametagColor (player) local accountname = getAccountName (getPlayerAccount(player)) outputChatBox ( "" .. name .. ": #FF9600 Starts the Countdown !", getRootElement(), r, g, b, true ) outputChatBox ( "#FF0000 ===3===", getRootElement(), 255, 255, 255, true ) triggerClientEvent("triggerclientforGridCountdown", getRootElement()) setTimer ( Countdown5, 1000, 1 ) end function Countdown5 ( root ) outputChatBox ( "#FF0000 ===2===", getRootElement(), 255, 255, 255, true ) setTimer ( Countdown4, 1000, 1 ) end function Countdown4 ( root ) outputChatBox ( "#FF0000 ===1===", getRootElement(), 255, 255, 255, true ) setTimer ( Countdown3, 1000, 1 ) end function Countdown3 ( root ) outputChatBox ( "#FF0000 Go Go Go!!!", getRootElement(), 255, 255, 255, true ) setTimer ( Countdown2, 1000, 1 ) end addCommandHandler( "countdown", Countdown ) client: 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 addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), GridCountdown ) Link to comment
Anubhav Posted October 14, 2014 Share Posted October 14, 2014 sWidth, sHeight = nil, nil X, Y, Width, Height = nil, nil, nil, nil count = nil function pro() if count ~= 5 then dxDrawText( tostring(count), x, y, Width, Height ) else dxDrawText( "GO!", x, y, Width, Height ) end end function somethingfor() sWidth, sHeight = guiGetScreenSize() Width,Height = 10, 10 X = (sWidth/2) - (Width/2) Y = (sHeight/2) - (Height/2) addEventHandler("onClientRender", root, pro ) 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) setTimer(removeEventHandler, 1000, 1, "onClientRender", root, pro ) end end function GridCountdown() count = 0 getTickStart = getTickCount () addEventHandler( "onClientRender", getRootElement(), somethingfor) end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), GridCountdown ) Link to comment
yoya99 Posted October 14, 2014 Author Share Posted October 14, 2014 (edited) sry not working:( client lua : 9 bad argument dxdrawtext expected number at argument 2 got nil Edited October 14, 2014 by Guest Link to comment
Anubhav Posted October 14, 2014 Share Posted October 14, 2014 sWidth, sHeight = nil, nil X, Y, Width, Height = nil, nil, nil, nil count = nil function pro() if count ~= 5 then dxDrawText( tostring(count), X, Y, Width, Height ) else dxDrawText( "GO!", X, Y, Width, Height ) end end function somethingfor() sWidth, sHeight = guiGetScreenSize() Width,Height = 10, 10 X = (sWidth/2) - (Width/2) Y = (sHeight/2) - (Height/2) addEventHandler("onClientRender", root, pro ) 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) setTimer(removeEventHandler, 1000, 1, "onClientRender", root, pro ) end end function GridCountdown() count = 0 getTickStart = getTickCount () addEventHandler( "onClientRender", getRootElement(), somethingfor) end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), GridCountdown ) Link to comment
yoya99 Posted October 14, 2014 Author Share Posted October 14, 2014 its counts 1, 2, 3 ,4 (remove the 4 pls) and GO!! doesnt disappear... ( Link to comment
Anubhav Posted October 14, 2014 Share Posted October 14, 2014 sWidth, sHeight = nil, nil X, Y, Width, Height = nil, nil, nil, nil count = nil function pro() if count ~= 4 then dxDrawText( tostring(count), X, Y, Width, Height ) else dxDrawText( "GO!", X, Y, Width, Height ) end end function somethingfor() sWidth, sHeight = guiGetScreenSize() Width,Height = 10, 10 X = (sWidth/2) - (Width/2) Y = (sHeight/2) - (Height/2) addEventHandler("onClientRender", root, pro ) 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) setTimer(removeEventHandler, 1000, 1, "onClientRender", root, pro ) end end function GridCountdown() count = 0 getTickStart = getTickCount () addEventHandler( "onClientRender", getRootElement(), somethingfor) end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), GridCountdown ) Link to comment
yoya99 Posted October 14, 2014 Author Share Posted October 14, 2014 alright now i only have 2 questions.... tha code here is woking but i want it in bankgothic on top of the screen and bigger and the GO! doesnt disappear,,,,,, sWidth, sHeight = nil, nil X, Y, Width, Height = nil, nil, nil, nil count = nil function pro() if count ~= 4 then dxDrawText( tostring(count), X, Y, Width, Height ) else dxDrawText( "GO!", X, Y, Width, Height ) end end function somethingfor() sWidth, sHeight = guiGetScreenSize() Width,Height = 10, 10 X = (sWidth/2) - (Width/2) Y = (sHeight/2) - (Height/2) addEventHandler("onClientRender", root, pro ) if getTickCount() - getTickStart > 0 and count == 0 then sound3 = playSound( "3.mp3", false ) setSoundMaxDistance( sound3, 5000 ) count = 3 elseif getTickCount() - getTickStart > 1000 and count == 3 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 = 1 elseif getTickCount() - getTickStart > 3000 and count == 1 then if sound1 and isElement(sound1) then stopSound( sound1 ) end sound0 = playSound( "0.mp3", false ) setSoundMaxDistance( sound0, 5000 ) count = 4 end end function GridCountdown() count = 0 getTickStart = getTickCount () addEventHandler( "onClientRender", getRootElement(), somethingfor) end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), GridCountdown ) Link to comment
Anubhav Posted October 14, 2014 Share Posted October 14, 2014 sWidth, sHeight = nil, nil X, Y, Width, Height = nil, nil, nil, nil count = nil function pro() if count ~= 4 then dxDrawText( tostring(count), X, Y, Width, Height, tocolor(255, 255, 255, 255), 1, "bankgothic" ) else dxDrawText( "GO!", X, Y, Width, Height, tocolor(255, 255, 255, 255), 1, "bankgothic" ) end end function somethingfor() sWidth, sHeight = guiGetScreenSize() Width,Height = 50, 50 X = (sWidth/2) - (Width/2) Y = (sHeight/2) - (Height/2) addEventHandler("onClientRender", root, pro ) if getTickCount() - getTickStart > 0 and count == 0 then sound3 = playSound( "3.mp3", false ) setSoundMaxDistance( sound3, 5000 ) count = 3 elseif getTickCount() - getTickStart > 1000 and count == 3 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 = 1 elseif getTickCount() - getTickStart > 3000 and count == 1 then if sound1 and isElement(sound1) then stopSound( sound1 ) end sound0 = playSound( "0.mp3", false ) setSoundMaxDistance( sound0, 5000 ) count = 4 removeEventHandler("onClientRender", root, pro ) end end function GridCountdown() count = 0 getTickStart = getTickCount () addEventHandler( "onClientRender", getRootElement(), somethingfor) end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), GridCountdown ) Link to comment
yoya99 Posted October 14, 2014 Author Share Posted October 14, 2014 thx but GO! is not disappearing ( 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