HighFlyer Posted February 23, 2010 Share Posted February 23, 2010 Hey guys, I have a problem, I have scripted a race on MTA Race, but wanted to make custom music. I added this into meta.xml <meta> <info author="Puzi" description="FastSpeed Raceway" version="1.2" type="map" /> <map src="raceway.map" /> <script src="music-somethinggood.lua" type="client"/> <file src="somethinggood.mp3" /> </meta> My song is in a MP3 file. This is the music-somethinggood.lua file: function startMusic() setRadioChannel(0) song = playSound("somethinggood.mp3",true) outputChatBox("Toggle music on/off using M") end function makeRadioStayOff() setRadioChannel(0) cancelEvent() end function toggleSong() if not songOff then setSoundVolume(song,0) songOff = true removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) else setSoundVolume(song,1) songOff = false setRadioChannel(0) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) end end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff) addCommandHandler("musicsomethinggood",toggleSong) bindKey("m","down","musicsomethinggood") The problem although is that the script doesnt want to open, it failes to load on the console. Any ideas? Thanks, Puzi Link to comment
Gamesnert Posted February 23, 2010 Share Posted February 23, 2010 You mean something like: "Failed to load resource "? Type: "info " And see why it fails to load. Then fix it, and type "refresh" or "refreshall". Link to comment
HighFlyer Posted February 23, 2010 Author Share Posted February 23, 2010 Erm, in the console it says ''Couldn't find music-somethinggood.lua...'' or something. It's in the same folder tho, zipped called race-raceway. Link to comment
HighFlyer Posted February 23, 2010 Author Share Posted February 23, 2010 info: Resource was not found. I wonder why. I have meta.xml, .map, .lua and mp3 file. The file is called race-raceway. Please help =( I still get ERROR: Could not find music-blabla.lua file for resource race-raceway. Link to comment
Callum Posted February 23, 2010 Share Posted February 23, 2010 It appears the problem is not with the music file, but with the script. Things like too little/many "(" and ")" or "," in the wrong place can cause a script to fail. But it should ouput that error on debugscript. I can't actually find any errors in your script. And line 8 is useless, if you're cancelling the event they won't switch the station in the first place. Maybe you should add that to an onVehicleEnter function, because when entering a vehicle for the first time by default a radio station comes on. By the way, if it's commercial music it's illegal to give all the clients a copy of it. Link to comment
lil Toady Posted February 23, 2010 Share Posted February 23, 2010 Does your system show file extensions? It could be that you saved your file as music-somethinggood.lua.txt for example. You could try to open the file with notepad, then in "save as.." make sure you have "any file type" selected instead of "text file" 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