JoZeFSvK Posted February 17, 2013 Share Posted February 17, 2013 Hey all i wanna edit "infobox" but i have problem with beep message shows 6000,1 but i hear beep arround when message to hide. i try write under beep.mp3 timer but dont work i show on cheange nick drawtext and position function renderPlayerNick ( ) dxDrawColorText("#ffffff".. messageNick,750,y/15,574.0,50.0,tocolor(200,0,0,255),1,"default-bold","right","top",false,false,false) dxDrawImage (730,y/15,16,16,"icon/nick.png",0,-120) playSound("icon/join.mp3",false) setSoundVolume(sound, 0.9) setTimer ( setInfoLabel, 100, 1) -- timer to stop sound sound have 1 sec and i wanna see only 1x and this sound will hear all players on server end and message addEventHandler ( "onClientPlayerChangeNick", root, function ( oldNick, newNick ) messageNick = "#ffffff" ..oldNick.. " #ffffffis now known as #ffffff" ..newNick addEventHandler ( "onClientRender", root, renderPlayerNick ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerNick ) end ,6000,1 ) end ) Link to comment
Castillo Posted February 17, 2013 Share Posted February 17, 2013 That doesn't make much sense, you are playing the sound every render, also creating a 100 ms timer every render. Link to comment
JoZeFSvK Posted February 18, 2013 Author Share Posted February 18, 2013 i know, i wanna that drawing time remained undamaged and play sound only 1 sec, but this song play until is drawing time no end. i need end sound beep rather than ended drawtime.Just make don't it repetition (sound) Link to comment
JoZeFSvK Posted February 18, 2013 Author Share Posted February 18, 2013 ok i fix problem lock topic Link to comment
JoZeFSvK Posted February 18, 2013 Author Share Posted February 18, 2013 or ... i try create draw info messages but i have problem reklamy = {"Reklama cislo 1", "Reklama cislo 2", "Reklama cislo 3"} function getAds () cislo = math.random(1, #reklamy) dxDrawColorText("ffffff"..reklamy[cislo], 750,y/15,574.0,50.0,tocolor(200,0,0,255),1,"default-bold","right","top",false,false,false) dxDrawImage (730,y/15,16,16,"icon/info.png",0,-120) end setTimer(getAds, 1000, 0) setTimer ( function ( ) removeEventHandler ( "getAds", root, reklamy ) end ,6000,1 ) end ) function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end 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