1. There is a player.
2. There are necessary coordinates (this is not a position player).
Question: How can I find out if the player can build in the given coordinates?
CanBuild for position
Discussion in 'Rust Development' started by Romzes, Sep 22, 2016.
-
Wulf Community Admin
I don't know of any way to check that. Basically a player flag gets set when a player is in an area they can build in, which is what CanBuild checks.
-
Romzes, are you referring to the hook or the CanBuild inside BasePlayer?
-
If my house is in a strange area of construction, I want to ban the teleport to the location.
To do this, it would be nice to come up with how to determine whether a Can Build player in certain coordinates. -
The same goes for your other post Solved - IsWalk() player method? | Oxide.
To get you started:
The BuildingPrivilidge flag is set like this:
Code:// BasePlayer private void UpdatePrivilegeFlags() { BuildingPrivlidge buildingPrivlidge = this.GetBuildingPrivilege(); this.SetPlayerFlag(BasePlayer.PlayerFlags.InBuildingPrivilege, buildingPrivlidge); this.SetPlayerFlag(BasePlayer.PlayerFlags.HasBuildingPrivilege, buildingPrivlidge && buildingPrivlidge.IsAuthed(this)); }
Code:// BasePlayer public BuildingPrivlidge GetBuildingPrivilege() { uint num = 4294967295u; BuildingPrivlidge result = null; for (int i = 0; i < this.buildingPrivilege.Count; i++) { BuildingPrivlidge buildingPrivlidge = this.buildingPrivilege[i]; uint num2 = (buildingPrivlidge.net != null) ? buildingPrivlidge.net.ID : 0u; if (num2 < num) { if (buildingPrivlidge.CheckEntity(this)) { result = buildingPrivlidge; num = num2; } } } return result; }