Ok so i got it work, but to do it again i need to close the window when the song has ended.
Here is my code...
Code:
--[[
============================
Product: Youtube Player
Author : Blaxus
Version: 0.1
============================
]]
// Sart function Play Youtube Url
function playturl(player, text, team, dead)
if player == LocalPlayer() then
// if player said !yturl activate controle
if string.sub(text,0,6) == "!yturl" then
// Variable Containing the link to the youtube url
tur = string.sub(text,8,19)
// Make the panel
HTMLTest = vgui.Create("HTML")
// Open the desired link
HTMLTest:OpenURL("http://www.youtube.com/watch?v=" .. tur .. "")
// Print in console what link we opened
print("Youtube Gmod Player Is now opening: http://www.youtube.com/watch?v=" .. tur .. "")
end
// Check if user wants to stop playing
if string.sub(text,0,3) == "!sp" then
tur = string.sub(text,0,3)
HTMLTest:clear("HTML")
end
// close if localplayer
end
// Close function
end
// Hook the actions
hook.Add("OnPlayerChat" , "playturl" , playturl)
I keep getting
Hook 'playturl' Failed: autorun/client/yturl.lua:34: attempt to call method 'clear' (a nil value)
i used "html" this time, but before it gave the same error and it was just:
HTMLTest:clear()