mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 21:17:34 +00:00
finish chat sync
This commit is contained in:
parent
83c2fd2d14
commit
14b00e1462
|
@ -40,6 +40,7 @@ local function getTriggerInfo(text)
|
|||
for k, v in pairs(gmInte.config.chatTrigger) do
|
||||
if (string.StartWith(text, k)) then
|
||||
local defaultConfig = {
|
||||
["trigger"] = k,
|
||||
["prefix"] = "",
|
||||
["show_rank"] = false,
|
||||
["anonymous"] = false,
|
||||
|
@ -48,18 +49,13 @@ local function getTriggerInfo(text)
|
|||
for k2, v2 in pairs(v) do
|
||||
defaultConfig[k2] = v2
|
||||
end
|
||||
return defaultConfig.prefix .. string.sub(text, string.len(k) + 1)
|
||||
return defaultConfig
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function gmInte.wsPlayerSay(data)
|
||||
if !gmInte.config.syncChat then return end
|
||||
gmInte.SendNet(1, data, nil)
|
||||
end
|
||||
|
||||
function gmInte.playerSay(ply, text, team)
|
||||
if (!gmInte.config.syncChat) then return end
|
||||
local triggerInfo = getTriggerInfo(text)
|
||||
|
@ -68,14 +64,19 @@ function gmInte.playerSay(ply, text, team)
|
|||
gmInte.post("/server/user/say",
|
||||
{
|
||||
["steamID64"] = ply:SteamID64(),
|
||||
["usergroup"] = ply:GetUserGroup();
|
||||
["msgInfo"] = triggerInfo,
|
||||
["message"] = string.sub(text, string.len(triggerInfo.trigger) + 1),
|
||||
["name"] = ply:Nick(),
|
||||
["team"] = team,
|
||||
["usergroup"] = ply:GetUserGroup(),
|
||||
["message_info"] = triggerInfo
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
function gmInte.wsPlayerSay(data)
|
||||
if !gmInte.config.syncChat then return end
|
||||
gmInte.SendNet(1, data, nil)
|
||||
end
|
||||
|
||||
function gmInte.playerBan(data)
|
||||
data.steam = util.SteamIDTo64(data.networkid)
|
||||
gmInte.post("/server/user/ban", data)
|
||||
|
|
Loading…
Reference in New Issue
Block a user