Is there a way to make the backpack only able to be opened if the player has building priv?
Is there a way to make the backpack only able to be opened if the player has building priv?
Isnt the whole point of a backpack is that you have the ability to carry more resources from loot piles etc ?
If you can only use it in your base why carry one ?
It's a long shot solution for a bloke who shouldn't be wanting what he does. He wants to use the backpack as a "RaidProof" storage. But he doesn't want players to access it outside TC.
TheFriendlyChap
It's a long shot solution for a bloke who shouldn't be wanting what he does. He wants to use the backpack as a "RaidProof" storage. But he doesn't want players to access it outside TC.
Thanks for the info, Bit of a "catch 22" that one,
As discussed over Discord DMs, I suggest creating an addon plugin that uses the CanOpenBackpack hook. It would look something like this.
string CanOpenBackpack(BasePlayer player, ulong backpackOwnerID)
{
if (player.IsBuildingAuthed())
return null;
return "You cannot open your backpack outside of TC range";
}One abuse vector to potentially watch out for is players opening their backpack and then keeping it open while traveling. It's pretty unlikely to be useful to players, but if you are concerned about it, or if you end up needing to react to players who are abusing it, I suggest adding something like the following.
[PluginReference]
Plugin Backpacks;
Dictionary<ulong, Timer> _backpackTimers = new Dictionary<ulong, Timer>();
void OnBackpackOpened(BasePlayer player, ulong backpackOwnerID, ItemContainer backpackContainer)
{
// Clean up existing timer if present, just in case.
OnBackpackClosed(player, backpackOwnerID, backpackContainer);
Timer timerInstance = timer.Every(1, () =>
{
if (!player.IsBuildingAuthed())
{
player.EndLooting();
player.ChatMessage("Your backpack has been closed because you are outside TC range");
}
});
_backpackTimers[player.userID] = timerInstance;
}
void OnBackpackClosed(BasePlayer player, ulong backpackOwnerID, ItemContainer backpackContainer)
{
Timer timerInstance;
if (_backpackTimers.TryGetValue(player.userID, out timerInstance))
{
timerInstance.Destroy();
_backpackTimes.Remove(player.userID);
}
} Sweet, thanks :)
WhiteThunder
As discussed over Discord DMs, I suggest creating an addon plugin that uses the
CanOpenBackpackhook. It would look something like this.string CanOpenBackpack(BasePlayer player, ulong backpackOwnerID) { if (player.IsBuildingAuthed()) return null; return "You cannot open your backpack outside of TC range"; }One abuse vector to potentially watch out for is players opening their backpack and then keeping it open while traveling. It's pretty unlikely to be useful to players, but if you are concerned about it, or if you end up needing to react to players who are abusing it, I suggest adding something like the following.
[PluginReference] Plugin Backpacks; Dictionary<ulong, Timer> _backpackTimers = new Dictionary<ulong, Timer>(); void OnBackpackOpened(BasePlayer player, ulong backpackOwnerID, ItemContainer backpackContainer) { // Clean up existing timer if present, just in case. OnBackpackClosed(player, backpackOwnerID, backpackContainer); Timer timerInstance = timer.Every(1, () => { if (!player.IsBuildingAuthed()) { player.EndLooting(); player.ChatMessage("Your backpack has been closed because you are outside TC range"); } }); _backpackTimers[player.userID] = timerInstance; } void OnBackpackClosed(BasePlayer player, ulong backpackOwnerID, ItemContainer backpackContainer) { Timer timerInstance; if (_backpackTimers.TryGetValue(player.userID, out timerInstance)) { timerInstance.Destroy(); _backpackTimes.Remove(player.userID); } }
I am puzzled as to how players "keep it open when travelling" ?, it disables the mouse for movement and of course the chat box so you cant tp , its really got me intrigued as to how they do it,
The inventory being open doesn't prevent movement.
WhiteThunder
The inventory being open doesn't prevent movement.
I have to disagree, with the backpack open , (which also opens the inventory) your movement is restricted to the arrow keys , left/right/forward/back , you cannot open any doors or containers, you can select a weapon but you cannot fire it. you cannot of course tp . The only way you could possibly move is if you are on something that is moving and someone else is in control of it.
If as you say it is possible i would like to see a video demonstration of a player with backpack open (and inventory or course) being able to move out of a base which has doors/locks .
As I said, it would probably not be very useful as far as exploits go. However, a cheat interface could probably allow opening doors anyway, since I see no looting related checks in the server side validation.