Trim out the first semicolon for the arg

This commit is contained in:
Ayane Satomi 2022-05-15 10:18:37 +08:00
parent ee31ad5aa8
commit 5669b9e534

View file

@ -9,8 +9,11 @@ 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)
bass.loadURL("https://translate.google.com/translate_tts?ie=UTF-8&q=" .. http.urlEncode(txt) .. "&tl=" .. lang .. "&client=tw-ob", "3d",
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