Try this for line 47:
local nick = calling_ply:Nick()
if nick:len() <= 0 then return end
Not sure it will work, but give it a try.
That won't really work, as the calling_ply is already an error, so if you change it to nick, it will read it as calling_ply, so it will give you kind of the same error.
http.Get was removed from gmod... You have to rewrite it to work with http.Fetch.
I've actually tryed this:
sound.PlayURL( "http://gdata.youtube.com/feeds/api/videos/" .. video_id .. "?v=2", "", function( contents )
local video_title = ulx.getVideoTitleFromHTTPData( contents )
ulx.fancyLogAdmin( calling_ply, "#A played YouTube video:\n#s\n#s", url, video_title )
ULib.tsay( nil, "Type !stopvid to stop it.", true )
ULib.csay( nil, "Now playing: " .. video_title, nil, 10 )
end )
Not sure if this will work for every function in his addon, but do you prefer the sound.PlayURL or keep http.Fetch ?
Technically I get no errors when playing some music with the ulx playvid command, only the error I posted first on this thread.
What can/would be the fix for this?
[ERROR] addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:47: attempt to index local 'calling_ply' (a nil value)
1. getVideoLengthFromHTTPData - addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:47
2. unknown - addons/ulx_youtube_music_player/lua/ulx/modules/cl/youtube_music_player_cl.lua:126
[EDIT] I've changed some stuff with the error I first posted on this thread, but still get an error, and I don't understand why it is not working, data is a value not nil, can anyone help me out with this?
function ulx.getVideoTitleFromHTTPData( data )
local video_title
if data:len() <= 0 then
print( "ULX YouTube music player: Error retrieving video title" )
video_title = "<unknown_title>"
else
local _, title_tag1_end = data:find( "<media:title type='plain'>", 1, true )
local title_tag2_pos = data:find( "</media:title>", title_tag1_end + 1, true )
video_title = data:sub( title_tag1_end + 1, title_tag2_pos - 1 )
video_title = ( video_title ~= nil and video_title ~= "" ) and video_title or "<unknown_title>"
end
return video_title
end
This piece of code should retrieve the title of the youtube url you put in the !music menu, when saving a video, but it gives me this error:
[ERROR] addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:29: attempt to index local 'data' (a nil value)
1. getVideoTitleFromHTTPData - addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:29
2. onsuccess - addons/ulx_youtube_music_player/lua/ulx/modules/sh/youtube_music_player_sh.lua:170
3. unknown - lua/includes/modules/http.lua:34[EDIT] If you are trying to help me, make sure you download my edited version of rynos addon, so you can see what I messed up, and fixed partially.