mirror of
https://github.com/sr229/metastruct-experiments.git
synced 2024-09-20 14:40:35 +00:00
25 lines
No EOL
730 B
Lua
25 lines
No EOL
730 B
Lua
--@name GimpyTTS
|
|
--@author Mavain and Minori
|
|
--@client
|
|
|
|
local lang = "en"
|
|
local soundref
|
|
|
|
hook.add("playerchat", "henkey", function(ply, txt)
|
|
if ply ~= owner() then return end
|
|
|
|
if string.sub(txt, 1, 1) ~= ";" then return end
|
|
local arg = string.sub(txt, 2)
|
|
|
|
if arg ~= nil then return end
|
|
|
|
bass.loadURL("https://translate.google.com/translate_tts?ie=UTF-8&q=" .. http.urlEncode(arg) .. "&tl=" .. lang .. "&client=tw-ob", "3d",
|
|
function(a, err, name)
|
|
-- we dispose the current reference, then we create a new one
|
|
if soundref then soundref:stop() end
|
|
soundref = a
|
|
|
|
hook.add("think", "soundFollow", function() a:setPos(owner():getPos()) end)
|
|
soundref:play()
|
|
end)
|
|
end) |