yoya99 Posted October 14, 2014 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 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 ) 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 ) And the snail starts to sing
Anubhav Posted October 14, 2014 Posted October 14, 2014 Why are you posting so many topics? See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 becasue nobody helps me And the snail starts to sing
ReSe Posted October 14, 2014 Posted October 14, 2014 Server timers = {} function Countdown (player) if isTimer(timers[player]) then return end timers[player] = setTimer(function() timers[player] = nil end,30000,1) local name = getPlayerName(player) local r,g,b = getPlayerNametagColor (player) outputChatBox ( " ".. name .. ": #FF9600 Starts the Countdown !", getRootElement(), r, g, b, true ) local i = 4 setTimer( function() i=i-1 triggerClientEvent("triggerclientforGridCountdown", getRootElement(), i) if (i==0) then outputChatBox ( "#FF0000 Go Go Go!!!", getRootElement(), 255, 255, 255, true ) return end outputChatBox ( "#FF0000 ==="..i.."===", getRootElement(), 255, 255, 255, true ) end, 1000, 4 ) setTimer (function() timers[player] = nil end, 30000, 1) end addCommandHandler( "countdown", Countdown ) Client function triggerSound(soundID) sound = playSound( soundID..".mp3", false ) end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), triggerSound )
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 but i want only a screen text in bankgothic for this .(starts the countdown....3...2....1... GO GO GO And the snail starts to sing
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 in chat and on each screen yes And the snail starts to sing
ReSe Posted October 14, 2014 Posted October 14, 2014 Server timers = {} function Countdown (player) if isTimer(timers[player]) then return end timers[player] = setTimer(function() timers[player] = nil end,30000,1) local name = getPlayerName(player) local r,g,b = getPlayerNametagColor (player) outputChatBox ( " ".. name .. ": #FF9600 Starts the Countdown !", getRootElement(), r, g, b, true ) local i = 4 setTimer( function() i=i-1 triggerClientEvent("triggerclientforGridCountdown", getRootElement(), i) if (i==0) then outputChatBox ( "#FF0000 Go Go Go!!!", getRootElement(), 255, 255, 255, true ) return elseif i > 0 then outputChatBox ( "#FF0000 ==="..i.."===", getRootElement(), 255, 255, 255, true ) end end, 1000, 5 ) setTimer (function() timers[player] = nil end, 30000, 1) end addCommandHandler( "countdown", Countdown ) Client i = nil local x, y = guiGetScreenSize() function triggerDraw(ID) i = ID if i == 3 then drawBegin() elseif i < 0 then drawStop() end end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), triggerDraw ) function drawOnScreen() if not i then return end if i > 0 then dxDrawText("#FF0000==="..i.."===",0,0,x,y, tocolor(0,0,0,255), 2, "bankgothic", "center", "center", false, false, true, true) else dxDrawText("#FF0000Go Go Go!!!",0,0,x,y, tocolor(0,0,0,255), 2, "bankgothic", "center", "center", false, false, true, true) end end function drawBegin() addEventHandler( "onClientRender", getRootElement(), drawOnScreen) end function drawStop() removeEventHandler( "onClientRender", getRootElement(), drawOnScreen) end
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 thx but anyway to but the 4 soundfiles in there : 1.mp3, 2.mp3, 3.mp3 0.mp3 ?? And the snail starts to sing
ReSe Posted October 14, 2014 Posted October 14, 2014 If you want sound change triggerDraw function in client with that one function triggerDraw(ID) i = ID if i == 3 then drawBegin() elseif i < 0 then drawStop() return end sound = playSound( i..".mp3", false ) end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), triggerDraw )
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 client lua :9 attempt to concentate gloabal "soundid" a nil value And the snail starts to sing
ReSe Posted October 14, 2014 Posted October 14, 2014 I've fixed it already. Just change "soundID" with "i"
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 thx but its drawing me the text on the left top of the page...i only can see some === And the snail starts to sing
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 ye i am sure i just copied everything again but without the sound it was working fine O:O And the snail starts to sing
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 f### i am sorry i forgot the guigetscreensize.... thank you very much ... And the snail starts to sing
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 viewtopic.php?f=91&t=81481 pls help ( And the snail starts to sing
ReSe Posted October 14, 2014 Posted October 14, 2014 Mhm try to copy it one more time. Client i = nil local x, y = guiGetScreenSize() function triggerDraw(ID) i = ID if i == 3 then drawBegin() elseif i < 0 then drawStop() return end playSound( i..".mp3", false ) end addEvent ( "triggerclientforGridCountdown", true ) addEventHandler ( "triggerclientforGridCountdown", getRootElement(), triggerDraw ) function drawOnScreen() if not i then return end if i > 0 then dxDrawText("#FF0000==="..i.."===",0,0,x,y, tocolor(0,0,0,255), 2, "bankgothic", "center", "center", false, false, true, true) else dxDrawText("#FF0000Go Go Go!!!",0,0,x,y, tocolor(0,0,0,255), 2, "bankgothic", "center", "center", false, false, true, true) end end function drawBegin() addEventHandler( "onClientRender", getRootElement(), drawOnScreen) end function drawStop() removeEventHandler( "onClientRender", getRootElement(), drawOnScreen) end //Owh nvm
yoya99 Posted October 14, 2014 Author Posted October 14, 2014 Thank you much :DD solveddd And the snail starts to sing
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