mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 03:07:34 +00:00
add log bot and add give
This commit is contained in:
parent
0c492a56ca
commit
bfdda46882
|
@ -51,6 +51,18 @@ local possibleConfig = {
|
||||||
end,
|
end,
|
||||||
["category"] = "Main"
|
["category"] = "Main"
|
||||||
},
|
},
|
||||||
|
["logBotActions"] = {
|
||||||
|
["label"] = "Log Bot Actions",
|
||||||
|
["description"] = "Activate or deactivate logs for bot actions.",
|
||||||
|
["type"] = "checkbox",
|
||||||
|
["value"] = function(setting, value)
|
||||||
|
return value
|
||||||
|
end,
|
||||||
|
["onEdit"] = function(setting, value)
|
||||||
|
saveConfig(setting, value == "Enabled" && true || false)
|
||||||
|
end,
|
||||||
|
["category"] = "Main"
|
||||||
|
},
|
||||||
["filterOnBan"] = {
|
["filterOnBan"] = {
|
||||||
["label"] = "Block Discord Ban Player",
|
["label"] = "Block Discord Ban Player",
|
||||||
["description"] = "Block players banned on the discord server.",
|
["description"] = "Block players banned on the discord server.",
|
||||||
|
|
|
@ -55,12 +55,21 @@ local function logDisable()
|
||||||
return !gmInte.config.sendLog
|
return !gmInte.config.sendLog
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function validLogAndPlayers(players)
|
||||||
|
if (logDisable()) then return false end
|
||||||
|
for _, ply in pairs(players) do
|
||||||
|
if (!IsValid(ply)) then return false end
|
||||||
|
if (!ply:IsBot() && !gmInte.config.logBotActions) then return false end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
// Posts
|
// Posts
|
||||||
//
|
//
|
||||||
|
|
||||||
function gmInte.postLogPlayerSay(ply, text, teamChat)
|
function gmInte.postLogPlayerSay(ply, text, teamChat)
|
||||||
if (logDisable() || ply:IsBot()) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/server/log/playerSay",
|
gmInte.post("/server/log/playerSay",
|
||||||
{
|
{
|
||||||
|
@ -72,7 +81,7 @@ function gmInte.postLogPlayerSay(ply, text, teamChat)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.postLogPlayerDeath(ply, inflictor, attacker)
|
function gmInte.postLogPlayerDeath(ply, inflictor, attacker)
|
||||||
if (logDisable() || ply:IsBot() || attacker:IsBot()) then return end
|
if (!validLogAndPlayers({ply, attacker})) then return end
|
||||||
|
|
||||||
gmInte.post("/server/log/playerDeath",
|
gmInte.post("/server/log/playerDeath",
|
||||||
{
|
{
|
||||||
|
@ -84,7 +93,7 @@ function gmInte.postLogPlayerDeath(ply, inflictor, attacker)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.postLogPlayerInitialSpawn(ply)
|
function gmInte.postLogPlayerInitialSpawn(ply)
|
||||||
if (logDisable() || ply:IsBot()) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/server/log/playerInitialSpawn",
|
gmInte.post("/server/log/playerInitialSpawn",
|
||||||
{
|
{
|
||||||
|
@ -94,7 +103,7 @@ function gmInte.postLogPlayerInitialSpawn(ply)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.postLogPlayerHurt(ply, attacker, healthRemaining, damageTaken)
|
function gmInte.postLogPlayerHurt(ply, attacker, healthRemaining, damageTaken)
|
||||||
if (logDisable() || ply:IsBot() || attacker:IsBot()) then return end
|
if (!validLogAndPlayers({ply, attacker})) then return end
|
||||||
|
|
||||||
// Wait a second to see if the player is going to be hurt again
|
// Wait a second to see if the player is going to be hurt again
|
||||||
ply.gmodInteLastHurt = ply.gmodInteLastHurt || {}
|
ply.gmodInteLastHurt = ply.gmodInteLastHurt || {}
|
||||||
|
@ -120,7 +129,7 @@ function gmInte.postLogPlayerHurt(ply, attacker, healthRemaining, damageTaken)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.postLogPlayerSpawnedSomething(object, ply, ent, model)
|
function gmInte.postLogPlayerSpawnedSomething(object, ply, ent, model)
|
||||||
if (logDisable() || ply:IsBot()) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/server/log/playerSpawnedSomething",
|
gmInte.post("/server/log/playerSpawnedSomething",
|
||||||
{
|
{
|
||||||
|
@ -133,7 +142,7 @@ function gmInte.postLogPlayerSpawnedSomething(object, ply, ent, model)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.postLogPlayerSpawn(ply)
|
function gmInte.postLogPlayerSpawn(ply)
|
||||||
if (logDisable() || ply:IsBot()) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/server/log/playerSpawn",
|
gmInte.post("/server/log/playerSpawn",
|
||||||
{
|
{
|
||||||
|
@ -143,7 +152,7 @@ function gmInte.postLogPlayerSpawn(ply)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gmInte.postLogPlayerDisconnect(ply)
|
function gmInte.postLogPlayerDisconnect(ply)
|
||||||
if (logDisable() || ply:IsBot()) then return end
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
gmInte.post("/server/log/playerDisconnect",
|
gmInte.post("/server/log/playerDisconnect",
|
||||||
{
|
{
|
||||||
|
@ -165,6 +174,18 @@ function gmInte.postLogPlayerConnect(data)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function gmInte.postLogPlayerGivet(ply, class, swep)
|
||||||
|
if (!validLogAndPlayers({ply})) then return end
|
||||||
|
|
||||||
|
gmInte.post("/server/log/playerGive",
|
||||||
|
{
|
||||||
|
["ply"] = logFormatPlayer(ply),
|
||||||
|
["class"] = class,
|
||||||
|
["swep"] = swep
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hooks
|
// Hooks
|
||||||
//
|
//
|
||||||
|
@ -184,6 +205,9 @@ end)
|
||||||
hook.Add("PlayerDisconnected", "gmInte:Log:PlayerDisconnected", function(ply)
|
hook.Add("PlayerDisconnected", "gmInte:Log:PlayerDisconnected", function(ply)
|
||||||
gmInte.postLogPlayerDisconnect(ply)
|
gmInte.postLogPlayerDisconnect(ply)
|
||||||
end)
|
end)
|
||||||
|
hook.Add("PlayerGiveSWEP", "gmInte:Log:PlayerSWEPs", function( ply, class, swep )
|
||||||
|
gmInte.postLogPlayerGivet(ply, class, swep)
|
||||||
|
end)
|
||||||
|
|
||||||
// Sandbox - Server Events
|
// Sandbox - Server Events
|
||||||
hook.Add("player_connect", "gmInte:Log:PlayerConnect", function(data)
|
hook.Add("player_connect", "gmInte:Log:PlayerConnect", function(data)
|
||||||
|
|
|
@ -65,6 +65,7 @@ gmInte.config.chatTrigger = {
|
||||||
gmInte.config.forcePlayerLink = false // If true, the addon will force the players to link their discord account to their steam account before playing
|
gmInte.config.forcePlayerLink = false // If true, the addon will force the players to link their discord account to their steam account before playing
|
||||||
gmInte.config.supportLink = "" // The link of your support (shown when a player do not have the requiments to join the server)
|
gmInte.config.supportLink = "" // The link of your support (shown when a player do not have the requiments to join the server)
|
||||||
gmInte.config.debug = false // If true, the addon will show debug informations in the console
|
gmInte.config.debug = false // If true, the addon will show debug informations in the console
|
||||||
|
gmInte.config.logBotActions = false // If true, the addon will log the messages of the bot in the console
|
||||||
|
|
||||||
//
|
//
|
||||||
// Syncronization
|
// Syncronization
|
||||||
|
|
Loading…
Reference in New Issue
Block a user