mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
36
lua/arccw/server/sv_year.lua
Normal file
36
lua/arccw/server/sv_year.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| 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
|
||||
Reference in New Issue
Block a user