diff --git a/lua/entities/glorifiedbanking_cardreader/init.lua b/lua/entities/glorifiedbanking_cardreader/init.lua index f50d8a6..ae64995 100644 --- a/lua/entities/glorifiedbanking_cardreader/init.lua +++ b/lua/entities/glorifiedbanking_cardreader/init.lua @@ -19,7 +19,7 @@ end --Merchant setter, use in a hook when buying entities if the merchant isn't setting function ENT:SetMerchant(ply) - return GlorifiedBanking.SetEntOwner(self) + return GlorifiedBanking.SetEntOwner(self, ply) end --OnTransfer can be overriden to get data about transfers when complete diff --git a/lua/glorifiedbanking/sh_glorifiedbanking_compatibility.lua b/lua/glorifiedbanking/sh_glorifiedbanking_compatibility.lua index 4d259be..126a1de 100644 --- a/lua/glorifiedbanking/sh_glorifiedbanking_compatibility.lua +++ b/lua/glorifiedbanking/sh_glorifiedbanking_compatibility.lua @@ -28,7 +28,7 @@ if SERVER then DarkRP.notify( ply, msgType, time, message ) end - function GlorifiedBanking.SetEntOwner( ent ) + function GlorifiedBanking.SetEntOwner( ent, ply ) if ent.Setowning_ent then ent:Setowning_ent(ply) end ent:CPPISetOwner(ply) end @@ -37,3 +37,7 @@ else notification.AddLegacy( message, msgType, time ) end end + +hook.Add("playerBoughtCustomEntity", "GlorifiedBanking.Compatability.playerBoughtCustomEntity", function(ply, entTbl, ent, price) + if ent:GetClass() == "glorifiedbanking_cardreader" then ent:SetMerchant(ply) end +end)