can you pls make it compatible with the new native backpacks
Fix for native backpacksSolved
Fix!!
Need a new uMod hook for backpacks.
lets hope mr blue can help us
I have a solution to this problem. If the plugin author doesn't mind, I'll post the code of two hooks that prevent new backpacks from being looted.
MTriperI have a solution to this problem. If the plugin author doesn't mind, I'll post the code of two hooks that prevent new backpacks from being looted.
Yes it would be nice
Hi, in the code I added only the checks that are needed on my server. You as a developer will do better.
void OnItemDropped(Item item, BaseEntity entity)
{
if (item.info.itemid == -907422733 || item.info.itemid == 2068884361)
{
entity.OwnerID = item.GetOwnerPlayer()?.userID ?? 0;
}
}
object OnItemPickup(Item item, BasePlayer player)
{
BaseEntity entity = item?.GetWorldEntity();
if (player != null && entity != null && entity.OwnerID != 0 && (item.info.itemid == -907422733 || item.info.itemid == 2068884361) && !player.IsNpc && player.userID.IsSteamId())
{
if (entity.OwnerID != player.userID && !IsFriend(entity.OwnerID, player.userID))
{
SendReply(player, lang.GetMessage("OnTryPickup", this, player.UserIDString));
return false;
}
}
return null;
}
void OnLootEntity(BasePlayer player, BaseEntity entity)
{
Item item = entity?.GetItem();
if (player != null && item != null && entity.OwnerID != 0 && (item.info.itemid == -907422733 || item.info.itemid == 2068884361) && !player.IsNpc && player.userID.IsSteamId())
{
if (entity.OwnerID != player.userID && !IsFriend(entity.OwnerID, player.userID))
{
NextFrame(() =>
{
player.inventory.loot.Clear();
player.inventory.loot.SendImmediate();
});
SendReply(player, lang.GetMessage("OnTryLootBackpack", this, player.UserIDString));
}
}
} Could you help me where exactly to copy that piece of code?
viktorvillCould you help me where exactly to copy that piece of code?
This is my suggestion to solve the problem with new backpacks. It lacks most of the checks of this plugin (zone check, cupboard check, etc). In my example, the backpack can only be opened by the owner or his friend. It is necessary for the developer to insert this into his plugin or rewrite it as he sees fit to make it work correctly.
You can add the code I specified at your own risk, I don't guarantee that everything will work well.
Find the line and paste everything after it:
#region Hooks
... copy here ...
Added in the new version 1.15.0
Locked automatically