mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 01:57:34 +00:00
getTriggerInfo
This commit is contained in:
parent
b1cdb28db8
commit
fad6411850
|
@ -50,12 +50,19 @@ function gmInte.playerConnect(data)
|
||||||
gmInte.post("/server/user/connect", data)
|
gmInte.post("/server/user/connect", data)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function triggerChat(text)
|
local function getTriggerInfo(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
|
if (string.StartWith(text, k)) then
|
||||||
if (tostring(v) == "false") then return false end
|
local defaultConfig = {
|
||||||
if (tostring(v) == "true") then v = "" end
|
["prefix"] = "",
|
||||||
return v .. string.sub(text, string.len(k) + 1)
|
["show_rank"] = false,
|
||||||
|
["anonymous"] = false,
|
||||||
|
["channel"] = "admin_sync_chat"
|
||||||
|
}
|
||||||
|
for k2, v2 in pairs(v) do
|
||||||
|
defaultConfig[k2] = v2
|
||||||
|
end
|
||||||
|
return defaultConfig.prefix .. string.sub(text, string.len(k) + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -64,13 +71,14 @@ 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
|
||||||
local triggerText = triggerChat(text)
|
local triggerInfo = getTriggerInfo(text)
|
||||||
if (!triggerText && !gmInte.config.chatTriggerAll) then return end
|
if (!triggerInfo && !gmInte.config.chatTriggerAll) then return end
|
||||||
|
|
||||||
gmInte.post("/server/user/say",
|
gmInte.post("/server/user/say",
|
||||||
{
|
{
|
||||||
["steamID64"] = ply:SteamID64(),
|
["steamID64"] = ply:SteamID64(),
|
||||||
["message"] = triggerText,
|
["usergroup"] = ply:GetUserGroup();
|
||||||
|
["msgInfo"] = triggerInfo,
|
||||||
["name"] = ply:Nick(),
|
["name"] = ply:Nick(),
|
||||||
["team"] = team,
|
["team"] = team,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user