Is there hook to detect enter/exit BuildingPrivilege area
Hook to detect enter/exit BuildingPrivilege?Solved
No, there is no collider or trigger, only radius to closest block
ok was trying to make a ui load up when they enter a blocked or privlages area any suggestions?
You could check for building blocks in a radius from time to time and display UI if there are any, or call GetBuildingPrivilege and such stuff
How about this? mono atached to the player?
private class uiMono : MonoBehaviour
{
public BasePlayer player;
public bool Active;
private void Awake()
{
player = GetComponent<BasePlayer>();
CancelInvoke("inCupRange");
InvokeRepeating("inCupRange", 5, 6);
}
private void inCupRange()
{
if (player == null || player.IsSleeping() || player.IsDead()) return;
var theBuilding = player?.GetBuildingPrivilege();
if (theBuilding != null && !Active)
{
if (!_instance.BaseProData.pData.ContainsKey(theBuilding.net.ID.ToString()) || _instance.BaseProData.pData[theBuilding.net.ID.ToString()].timeExpire < DateTime.Now) return;
Active = true;
CuiHelper.DestroyUi(player, "BaseProtector_HelpUI");
_instance.DrawHelpInterface(player, _instance.BaseProData.pData[theBuilding.net.ID.ToString()].protection);
}
else if (theBuilding == null && Active)
{
Active = false;
CuiHelper.DestroyUi(player, "BaseProtector_HelpUI");
}
}
} Could you not just check BasePlayer.IsBuildingBlocked() or BasePlayer.IsBuildingAuthed() ?
ya but i nedd the
player?.GetBuildingPrivilege();Anyways for the call so chose to check that.
Locked automatically