Clear() and EndLooting() do not cancel the loot interface for me.
Code:function PLUGIN:OnPlayerLoot( sourceplayerloot, target ) if(target:GetComponent("BasePlayer")) then local sourcePlayer = sourceplayerloot:GetComponent("BasePlayer") sourceplayerloot:Clear() rust.SendChatMessage( sourcePlayer, "<color=#FFD700>Looting sleepers on this server is disabled</color>" ) end end
Solved No looting sleepers
Discussion in 'Plugin Requests' started by Killzone, Mar 29, 2015.
-
I'm also looking for something similar, I would like to disable looting of sleeping admins as sometimes we have extra items in our inventory that we used commands to obtain that if we were looted would give an unfair advantage to the player looting us.
-
This should do what you want:
Code:function PLUGIN:OnPlayerLoot(source, target) if target:GetComponent("BasePlayer") then timer.NextFrame(function() source:Clear() end) player = source:GetComponent("BasePlayer") rust.SendChatMessage( player, "<color=#FFD700>Looting sleepers on this server is disabled</color>" ) end end
-
Thank you, that works.
-
Is the a way to track is looting menu is still opened? Or hook for loot menu close?
-
Code:player.inventory.loot.IsLooting()
-
Like inventory.IsLootingBy() : BasePlayer?