justn Posted April 21, 2014 Author Share Posted April 21, 2014 It says 'number' '0' 'None' Link to comment
Scripting Moderators Sarrum Posted April 21, 2014 Scripting Moderators Share Posted April 21, 2014 Try this: n = 1 local radios = { {"None","None",6}, {"http://mp3uplink.duplexfx.com:8054/listen.pls","West Coast Rap",5}, {"http://somafm.com/dubstep.pls","Dubstep",4}, {"http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls","Power 181",3}, {"http://193.34.51.25/listen.pls","rauteMusik.",2}, {"http://212.45.104.34:8042/listen.pls","defjay",1} } title = "Radio Off" addEventHandler("onClientSoundChangedMeta", root, function(streamTitle) title = streamTitle end) addEventHandler("onClientSoundStream",root,function(suc,length,streamN) title = streamN end) function onPlayerEnterVehicle(player,seat) if seat == 0 then setRadioChannel(0) addEventHandler("onClientRender", getRootElement(), RenderClient) bindKey("mouse_wheel_up", "down", PlaySound, "up") bindKey("mouse_wheel_down", "down", PlaySound, "down") end end addEventHandler("onClientPlayerVehicleEnter", getRootElement(), onPlayerEnterVehicle) function stopMySound(player,seat) if seat == 0 then if sound then stopSound( sound ) sound = nil end removeEventHandler("onClientRender", getRootElement(), RenderClient) unbindKey("mouse_wheel_up", "down", PlaySound) unbindKey("mouse_wheel_down", "down", PlaySound) n = 1 end end addEventHandler("onClientPlayerVehicleExit",getRootElement(),stopMySound) function RenderClient() if isPedInVehicle(localPlayer) then local x,y = guiGetScreenSize() dxDrawText("Song Name: "..title, x*0.299, y*0.778, x*0.599, y*0.800, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) dxDrawText("Radio: "..tostring(radiotitle), x*0.299, y*0.757, x*0.599, y*0.778, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, true, false, false) end end function PlaySound(state) local x,y,z = getElementPosition(getLocalPlayer()) n = tonumber(n) if sound then stopSound(sound) sound = nil end if state == "mouse_wheel_up" then if n < #radios then n = n + 1 end elseif state == "mouse_wheel_down" then if n > 1 then n = n - 1 end end sound = playSound3D(radios[n][1], x,y,z) --outputChatBox(n) outputChatBox("Stream: "..radios[n][1]) outputChatBox("Title: "..radios[n][2]) radiotitle = radios[n][2] end function UpdateSound() if sound then local x,y,z = getElementPosition(getLocalPlayer()) setElementPosition(sound, x,y,z) end end addEventHandler("onClientRender", getRootElement(), UpdateSound) Link to comment
Scripting Moderators Sarrum Posted April 21, 2014 Scripting Moderators Share Posted April 21, 2014 My pleasure. 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