Finding player accesss to cupboards?
Discussion in 'Rust Development' started by B▲rt, Mar 8, 2016.
-
Do you want to find all player made Tool Cupboards regardless of who is authorized on them?
-
I want to find whether a player has aceess to a tool cupboard and is in its range and also whether there are any nearby tool cupboards that the, would need to be authorised on too.
-
So like, you want it so it can find if they have auth to the area they are in? Or if they own the cupboard they are authed to?
-
If they have auth in the area
-
Oh, when I get home ill post something that can do that( 1-2 hours )
-
@DylanSMR Cheers
-
Do you want like a command? Or when they do something specific?
-
I would like to use it in OnHammerHit hook
-
Ok : Here you go this should work |
Code:using UnityEngine;namespace Oxide.Plugins { [Info("HammerAccess", "test", "0.0.1")] public class HammerAccess : RustPlugin { private readonly int triggerMask = LayerMask.GetMask("Trigger"); private bool IsBuildingAllowed(Vector3 position, BasePlayer player) { var hits = Physics.OverlapSphere(position, 2f, triggerMask); foreach (var collider in hits) { var buildingPrivlidge = collider.GetComponentInParent<BuildingPrivlidge>(); if (buildingPrivlidge == null) continue; if (!buildingPrivlidge.IsAuthed(player)) return false; } return true; } void OnHammerHit(BasePlayer player, HitInfo info) { var pPos = player.transform.position; if (IsBuildingAllowed(pPos, player)) //If player has building access then { //Player has building authPriv code } else //If player does not have buiding priv { //Player does not have building authPriv code } } } } -
Thanks @DylanSMR , I'll try it later today.
