• sound.PlayFile problem
    3 replies, posted
It seems file paths that include "." cause an error. Is there anything I can do to fix this or is it a Garry problem? [lua] function PlaySong( song, blnAllowAutoPlay ) print(song) sound.PlayFile( song, "noblock", function( CurrentSong, ErrorID, ErrorName ) --If the game is paused this won't call print(ErrorID) print(ErrorName) PlayingSong = CurrentSong --Make it global CurrentSong:SetVolume( Volume:GetFloat() / 100, 0 ) --line 589 end ) end [/lua] Console output [code] sound/gmmp/Avicii - The Nights.mp3 nil nil ] sound/gmmp/Classified No Pressure ft. Snoop Dogg.mp3 2 BASS_ERROR_FILEOPEN [ERROR] lua/gmmp/cl_gmmp.lua:589: attempt to index local 'CurrentSong' (a nil value) 1. unknown - lua/gmmp/cl_gmmp.lua:589 [/code]
You should check if audio channel (ie CurentSong) is valid before tampering with it. Also, what's the path you want to try? I've heard using this escape thingy \ could help, go ahead give it a shot. Can you also give an example to a path that works with this script?
sound/gmmp/Avicii - The Nights.mp3 is an example of a working filepath. sound/gmmp/Classified No Pressure ft. Snoop Dogg.mp3 is one with a "." that doesn't work
I looked into it more and the problem is more specific. There is only a problem when a space is before or after the period. ie. ". " or " ."
Sorry, you need to Log In to post a reply to this thread.