mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 04:17:34 +00:00
remove trigger on sync chat and add prefix
This commit is contained in:
parent
edee3dd47e
commit
ef790c705a
|
@ -52,7 +52,11 @@ end
|
||||||
|
|
||||||
local function triggerChat(text)
|
local function triggerChat(text)
|
||||||
for k, v in pairs(gmInte.config.chatTrigger) do
|
for k, v in pairs(gmInte.config.chatTrigger) do
|
||||||
if (string.StartWith(text, k)) then return true end
|
if (string.StartWith(text, k)) then
|
||||||
|
if (tostring(v) == "false") then return false end
|
||||||
|
if (tostring(v) == "true") then v = "" end
|
||||||
|
return v .. string.sub(text, string.len(k) + 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
@ -60,12 +64,13 @@ end
|
||||||
|
|
||||||
function gmInte.playerSay(ply, text, team)
|
function gmInte.playerSay(ply, text, team)
|
||||||
if (!gmInte.config.syncChat) then return end
|
if (!gmInte.config.syncChat) then return end
|
||||||
if (!triggerChat(text) && !gmInte.config.chatTriggerAll) then return end
|
local triggerText = triggerChat(text)
|
||||||
|
if (!triggerText && !gmInte.config.chatTriggerAll) then return end
|
||||||
|
|
||||||
gmInte.post("/server/user/say",
|
gmInte.post("/server/user/say",
|
||||||
{
|
{
|
||||||
["steamID64"] = ply:SteamID64(),
|
["steamID64"] = ply:SteamID64(),
|
||||||
["message"] = text,
|
["message"] = triggerText,
|
||||||
["name"] = ply:Nick(),
|
["name"] = ply:Nick(),
|
||||||
["team"] = team,
|
["team"] = team,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user