mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 21:33:46 +03:00
36 lines
951 B
Lua
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 |