Run and check hook before applying loadout

This commit is contained in:
StyledStrike 2024-03-05 10:25:19 -03:00
parent 633e827d39
commit e5176a593b

View File

@ -18,6 +18,10 @@ function CLoadout:IsAvailableForPlayer( ply )
return false, "Your loadout will be applied once you leave build mode."
end
if hook.Run( "CLoadoutCanGiveWeapons", ply ) == false then
return false
end
return true
end
@ -156,12 +160,12 @@ function CLoadout:ReceiveData( len, ply )
local canUse, reason = self:IsAvailableForPlayer( ply )
if not canUse then
if reason then
ply:ChatPrint( "[Custom Loadout] " .. reason )
return
end
if not canUse then return end
self:GiveWeapons( ply )
end