Skip to content

Commit

Permalink
Add vendor entity argument to CanPlayerUseVendor hook (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
bleonheart committed Jul 22, 2024
1 parent c1839ed commit 3f58441
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions docs/hooks/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,12 @@ end
function CanPlayerUseDoor(client, entity)
end

--- @realm server
function CanPlayerUseVendor(activator)
--- Determines whether a player can use a vendor.
-- @realm server
-- @player activator The player attempting to use the vendor
-- @entity vendor The vendor entity being used
-- @treturn bool Returns false if the player can't use the vendor
function CanPlayerUseVendor(activator, vendor)
end

--- @realm client
Expand Down
2 changes: 1 addition & 1 deletion plugins/vendor/entities/entities/ix_vendor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ if (SERVER) then
function ENT:Use(activator)
local character = activator:GetCharacter()

if (!self:CanAccess(activator) or hook.Run("CanPlayerUseVendor", activator) == false) then
if (!self:CanAccess(activator) or hook.Run("CanPlayerUseVendor", activator, self) == false) then
if (self.messages[VENDOR_NOTRADE]) then
activator:ChatPrint(self:GetDisplayName()..": "..self.messages[VENDOR_NOTRADE])
else
Expand Down

0 comments on commit 3f58441

Please sign in to comment.