This commit is contained in:
lifestorm
2024-08-04 23:12:27 +03:00
parent 8064ba84d8
commit 9c918c46e5
7081 changed files with 2173485 additions and 14 deletions

View File

@@ -0,0 +1,95 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
PLUGIN.stopDraw = 0
local COLOR_BLACK_WHITE = {
["$pp_colour_addr"] = 0,
["$pp_colour_addg"] = 0,
["$pp_colour_addb"] = 0,
["$pp_colour_brightness"] = -0.1,
["$pp_colour_contrast"] = 0.9,
["$pp_colour_colour"] = 0,
["$pp_colour_mulr"] = 0,
["$pp_colour_mulg"] = 0,
["$pp_colour_mulb"] = 0
}
function PLUGIN:HUDPaint()
if (IsValid(LocalPlayer()) and LocalPlayer():IsAFK() and LocalPlayer():GetAimVector() and self.stopDraw < CurTime()) then
draw.SimpleText(
"JESTEŚ AFK",
"HUDFontExtraLargeNoClamp",
ScrW() * 0.5,
ScrH() - SScaleMin(230 / 3),
Color(255, 255, 255, 255),
TEXT_ALIGN_CENTER
)
draw.SimpleText(
"Liczniki głodu, pragnienia i racji są wstrzymane.",
"WNBleedingTextNoClamp",
ScrW() * 0.5,
ScrH() - SScaleMin(165 / 3),
Color(255, 255, 255, 255),
TEXT_ALIGN_CENTER
)
draw.SimpleText(
"Możesz zostać wyrzucony",
"WNBleedingTextNoClamp",
ScrW() * 0.5,
ScrH() - SScaleMin(135 / 3),
Color(255, 78, 69, 255),
TEXT_ALIGN_CENTER
)
end
end
local afkColor = Color(255, 78, 69, 255)
function PLUGIN:PopulateCharacterInfo(client, character, tooltip)
if (client:IsAFK()) then
local afk = tooltip:AddRowAfter("name", "afk")
afk:SetBackgroundColor(afkColor)
afk:SetText(L("playerIsAFK"))
afk:SizeToContents()
end
end
function PLUGIN:GetPlayerESPText(client, toDraw, distance, alphaFar, alphaMid, alphaClose)
if (client:IsAFK()) then
toDraw[#toDraw + 1] = {alpha = alphaFar, priority = 2, text = "AFK - "..math.floor(client:GetNetVar("afkTime", 0) / 60).."m"}
end
end
function PLUGIN:Think()
if (LocalPlayer():IsAFK()) then
if ((!self.aimVector or !self.posVector) and self.stopDraw < CurTime()) then
self.aimVector = LocalPlayer():GetAimVector()
self.posVector = LocalPlayer():GetPos()
elseif (self.aimVector != LocalPlayer():GetAimVector() or
self.posVector != LocalPlayer():GetPos()) then
self.stopDraw = CurTime() + 5
self.aimVector = nil
self.posVector = nil
end
end
end
function PLUGIN:RenderScreenspaceEffects()
if (LocalPlayer():IsAFK() and self.stopDraw < CurTime()) then
DrawColorModify(COLOR_BLACK_WHITE)
end
end
net.Receive("ixPrintAfkPlayers", function()
local text = net.ReadString()
chat.AddText(Color(255,255,255), text)
end)

View File

@@ -0,0 +1,16 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
LANGUAGE = {
antiafk = "Anti-AFK",
kickedAFK = "Zostałeś wyrzuony za bycie AFK",
kickedAdminAFK = "%s autowyrzucił '%s' (AFK).",
charAFK = "Away from keyboard"
}

View File

@@ -0,0 +1,16 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
LANGUAGE = {
antiafk = "Anti-AFK",
kickedAFK = "Zostałeś wyrzuony za bycie AFK",
kickedAdminAFK = "%s autowyrzucił '%s' (AFK).",
charAFK = "Away from keyboard"
}

View File

@@ -0,0 +1,16 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
LANGUAGE = {
kickedAdminAFK = "%s ha auto-expulsado '%s' (AFK).",
antiafk = "Anti-AFK",
kickedAFK = "%s ha sido expulsado por el servidor (AFK)",
charAFK = "Ausente"
}

View File

@@ -0,0 +1,84 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
PLUGIN.name = "Anti-AFK"
PLUGIN.author = "Gr4Ss, M!NT"
PLUGIN.description = "Stops AFK players from earning wages and kicks when server is full."
PLUGIN.license = [[
(c) 2020 by Willard Networks - WN:IX A unique HL2RP schema built by the WN team
Copyright Atko 2020 All Rights Reserved
]]
ix.afk = ix.afk or {}
ix.config.Add("afkTime", 300, "The amount of seconds it takes for someone to be flagged as AFK.", nil, {
data = {min = 120, max = 3600},
category = "antiafk"
})
ix.lang.AddTable("english", {
playerIsAFK = "Ten gracz jest AFK",
noAfk = "Nikt nie jest obecnie AFK.",
currentAFK = "Obecni gracze AFK:\n",
afkFormat = "%s na %.1fm\n",
})
ix.lang.AddTable("spanish", {
playerIsAFK = "Este jugador está AFK",
currentAFK = "Jugadores AFK actuales:\n",
afkFormat = "%s para %.1fm\n",
noAfk = "Nadie está AFK ahora mismo."
})
ix.lang.AddTable("polish", {
playerIsAFK = "Ten gracz jest AFK",
noAfk = "Nikt nie jest obecnie AFK.",
currentAFK = "Obecni gracze AFK:\n",
afkFormat = "%s na %.1fm\n",
})
ix.command.Add("PrintAFKPlayers", {
description = "Prints the currently AFK players into your chat.",
adminOnly = true,
OnRun = function(self, client)
local text = L("noAfk", client)
local afkPlayers = {}
for _, target in ipairs(player.GetAll()) do
if (target:IsAFK()) then
afkPlayers[#afkPlayers + 1] = target
end
end
if (#afkPlayers > 0) then
text = L("currentAFK", client)
for _, target in pairs(afkPlayers) do
text = text..string.format("%s for %.1fm\n", target:GetName(), math.floor(target:GetNetVar("afkTime", 0) / 60))
end
end
net.Start("ixPrintAfkPlayers")
net.WriteString(text)
net.Send(client)
end
})
do
local PLAYER = FindMetaTable("Player")
function PLAYER:IsAFK()
return self:GetNetVar("afkTime", 0) >= ix.config.Get("afkTime")
end
end
ix.util.Include("cl_hooks.lua")
ix.util.Include("sv_plugin.lua")
ix.util.Include("sv_hooks.lua")

View File

@@ -0,0 +1,37 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
function PLUGIN:PlayerLoadedCharacter(client, character)
local uniqueID = "ixAntiAFK"..client:SteamID64()
timer.Create(uniqueID, 30, 0, function()
if (IsValid(client)) then
local result = client:CheckAFKTick(client.ixAfkInterval)
if (result) then
client.ixAfkInterval = result
timer.Adjust(uniqueID, result)
end
else
timer.Remove(uniqueID)
end
end)
client:ResetAFKTimer()
end
function PLUGIN:PlayerInteractItem(client)
client:ResetAFKTimer()
end
function PLUGIN:PlayerSay(client)
client:ResetAFKTimer()
end

View File

@@ -0,0 +1,84 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
local INTERVAL = 30
util.AddNetworkString("ixPrintAfkPlayers")
ix.log.AddType("afkStart", function(client)
return Format("%s has gone afk.", client:Name())
end)
ix.log.AddType("afkEnd", function(client, ...)
local arg = {...}
return Format("%s is no longer afk. Total time spent AFK: %s", client:Name(), arg[1])
end)
do
local PLAYER = FindMetaTable("Player")
function PLAYER:CheckAFKTick(interval)
local aimVector = self:GetAimVector()
local posVector = self:GetPos()
if (self.ixLastAimVector == aimVector
and self.ixLastPosition == posVector
and !self.autowalk)
then
return self:AddAFKTime(interval or INTERVAL)
else
self.ixLastAimVector = aimVector
self.ixLastPosition = posVector
if (self:GetNetVar("afkTime", 0) > 0) then
return self:ResetAFKTimer()
end
end
end
function PLAYER:AddAFKTime(time)
local oldValue, oldTime = self:IsAFK(), self:GetNetVar("afkTime", 0)
self:SetNetVar("afkTime", oldTime + time)
if (self:IsAFK() and !oldValue) then
ix.log.Add(self, "afkStart")
return 5
elseif (oldTime + time >= ix.config.Get("afkTime") - 60 and oldTime < ix.config.Get("afkTime") - 60) then
self:Notify("Jeśli się nie ruszysz w ciągu 60 sekund, zostaniesz oznaczony jako AFK.")
return 1
end
end
function PLAYER:ResetAFKTimer()
if (self:IsAFK()) then
ix.log.Add(self, "afkEnd", self:GetNetVar("afkTime", 0))
elseif (self:GetNetVar("afkTime", 0) > (ix.config.Get("afkTime") - 60)) then
self:Notify("Zresetowano licznik czasu AFK.")
end
self:SetNetVar("afkTime", 0)
return INTERVAL
end
end
function PLUGIN:KickAFK(target, byAdmin)
if (target and target:IsAFK()) then
target:Kick("Zostałeś wyrzucony za bycie AFK")
if (byAdmin) then
ix.util.NotifyLocalized("kickedAdminAFK", nil, byAdmin:Name(), target:Name())
else
ix.util.NotifyLocalized("kickedAFK", nil, target:Name())
end
elseif (byAdmin) then
byAdmin:NotifyLocalized("targetNotAFK", target:Name())
end
end