mirror of
https://github.com/StyledStrike/gmod-custom-loadout.git
synced 2025-03-04 03:03:09 -05:00
Run and check hook before applying loadout
This commit is contained in:
parent
633e827d39
commit
e5176a593b
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user