metastruct-experiments/starfallex/starfall_tts_gimpy.lua
Ayane Satomi 8018795e9c Make sure input gets URLEncoded
Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>
2022-05-14 09:31:50 +08:00

20 lines
No EOL
600 B
Lua

--@name GimpyTTS
--@author Mavain and Minori
--@client
local lang = "en"
local soundref
hook.add("playerchat", "fucke2", function(ply, txt)
if ply ~= owner() then return end
bass.loadURL("https://translate.google.com/translate_tts?ie=UTF-8&q=" .. http.urlEncode(txt) .. "&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)
a:play()
end)
end)