Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if html and html:IsValid() then html:Remove() end
- local html = vgui.Create("DHTML") _G.html = html
- html:AddFunction("gmod", "print", print)
- local player = setmetatable(
- {
- },
- {
- __index = function(self, func_name)
- return function(...)
- local tbl = {...}
- for key, val in pairs(tbl) do
- tbl[key] = tostring(val)
- if tbl[key] == "nil" or tbl[key] == "NULL" then
- tbl[key] = "null"
- end
- end
- local str = ("%s(%q);"):format(func_name, table.concat(tbl, ", "))
- html:QueueJavascript(str)
- --print(str)
- end
- end
- }
- )
- html:SetPos(ScrW(), ScrH())
- html:OpenURL("http://dl.dropbox.com/u/244444/gmod_audio.html")
- html:QueueJavascript[[
- var obj = null;
- function player()
- {
- if (!obj)
- obj = new Audio();
- return obj;
- }
- function play(str)
- {
- try
- {
- player().src = str;
- player().play();
- gmod.print("playing " + player().src);
- }
- catch(err)
- {
- gmod.print(err);
- }
- }
- ]]
- player.play("http://dl.dropbox.com/u/244444/2-02%20New%20Map.mp3")
Advertisement
Add Comment
Please, Sign In to add comment