Hello,
(I have found nothing, excuse me if available)
There is a hook to know the contents of the inventory of a player?
I modified "m-Teleportation" to prohibit the teleportation with C4
and prohibit teleportation when overflow inventory.
Solved Getting the contents of a player's inventory?
Discussion in 'Rust Development' started by Loup-des-Neiges, Nov 5, 2015.
-
Calytic Community Admin Community Mod
Code:object canTeleport(BasePlayer player) { if (player.inventory.AllItems().Length == 24) { return "You cannot teleport with that much"; } if (player.inventory.GetAmount(498591726) > 0) { return "You cannot teleport with Timed Explosives"; } return null; }
-
Thank you very much, I will work with it.
Code:if player.inventory.AllItems().Length == 24 then self:SendMessage(player, self.Config.Messages.HomeTPInventory) return end if player.inventory.GetAmount(498591726) > 0 then self:SendMessage(player, self.Config.Messages.HomeTPInventoryC4) return end
-
Wulf Community Admin
-
There is a method to control the number of objects in the main inventory only?
Like :
Code:if (player.inventory.GetContainer(Main).Length = 24) { return MessageErrorFullInventory; }
Last edited by a moderator: Jan 30, 2016 -
Code:
if(player.inventory.GetContainer(PlayerInventory.Type.Main).itemList.Count == 24)
Code:if(player.inventory.containerMain.itemList.Count == 24)
-
I tried this method but I had forgotten to replace "Length" to "Count" ><