Files
wnsrc/lua/arccw/server/sv_year.lua
lifestorm 6a58f406b1 Upload
2024-08-04 23:54:45 +03:00

36 lines
951 B
Lua

--[[
| 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/
--]]
if CLIENT then return end
hook.Add( "PlayerGiveSWEP", "ArcCW_YearLimiter", function( ply, class, swep )
local wep = weapons.Get(class)
if !ArcCW:WithinYearLimit(wep) then
ply:ChatPrint( wep.PrintName .. " is outside the year limit!")
return false
end
end )
function ArcCW:WithinYearLimit(wep)
if !wep then return true end
if !wep.ArcCW then return true end
if !ArcCW.ConVars["limityear_enable"]:GetBool() then return true end
local year = ArcCW.ConVars["limityear"]:GetInt()
if !wep.Trivia_Year then return true end
if !isnumber(wep.Trivia_Year) then return true end
if wep.Trivia_Year > year then return false end
return true
end