Hello,
Editing the Remover Tool, I have a question and I am assuming this should be a few lines of code to add.
I have it set to use Cupboards so you need to have access on a cupboard (and all cupboards attached) to remove. But what I also want to add, is the ability to Remove if there is NO Cupboards, I.E. if you see a shack in the middle of no where, you can remove it if there is no cupboard at all.
Here is the code regarding cupboard access:
Any help?Code:///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Check Access ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static bool hasTotalAccess(BasePlayer player) { List<BuildingPrivlidge> playerpriv = buildingPrivlidges.GetValue(player) as List<BuildingPrivlidge>; if (playerpriv.Count == 0) { return false; } foreach (BuildingPrivlidge priv in playerpriv.ToArray()) { List<ProtoBuf.PlayerNameID> authorized = priv.authorizedPlayers; bool foundplayer = false; foreach (ProtoBuf.PlayerNameID pni in authorized.ToArray()) { if (pni.userid == player.userID) foundplayer = true; } if (!foundplayer) { return false; } } return true; } static object CanRemoveEntity(BasePlayer player, BaseEntity entity, RemoveType removeType) { if (entity.isDestroyed) return "Entity is already destroyed"; if (removeType == RemoveType.Admin || removeType == RemoveType.All) return true; var externalPlugins = Interface.CallHook("canRemove", player); if (useToolCupboard) if (hasTotalAccess(player)) return true; return "<color=red>You must have Access to all connected Tool Cupboards</color>"; }
Remover Cupboard Question (Should be Easy!)
Discussion in 'Rust Development' started by Solis.Randy, Mar 9, 2016.
-
I strictly would not recommend to do that.
In My opponion this 'remove' would include any deployable on the map, which has no cupboard in Range.
Think of the "Repair Bench" in the Warehouses... ;-) Chaos would come onto your server^^
But, i haven't tested it yet....Did you by now? I'll try to rewrite the R-Remover-Tool to do this... -
The repair bench in warehouses-rad towns-etc are objects via map objects not game entitys im pretty sure. Hence why you can remove it via R-Remover-Tool(With bypass enabled)
-
@Solis.Randy Change if(HasTotalAccess(player)) to if (player.CanBuild())
I believe it just checks to make sure building is not blocked for the player in question
