Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Vendor Argument to CanPlayerUseVendor #440

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading