Hi,
I would like to know if the entity on which the player strikes is in a construction zone or not. That would allow me not to do control if the entity is out of range of a cupboard.
Thank you for your helpCode:private void OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo) { if (entity == null || hitInfo == null) return; ulong targetID = 0; targetID = entity.OwnerID; if (!timeForRaid && (entity is BuildingBlock || entity is SimpleBuildingBlock || entity is Door || entity.ShortPrefabName.Contains(".deployed"))) { if (hitInfo.Initiator is BasePlayer) { BasePlayer player = (BasePlayer)hitInfo.Initiator; if (!player.IsBuildingBlocked()) return; if (IsOwner(player.userID, entity.OwnerID)) return; NullifyDamage(hitInfo); SendReply(player, msg("notraidhour", player.UserIDString)); } else if (hitInfo.Initiator is FireBall) { FireBall fireBall = (FireBall)hitInfo.Initiator; if (IsOwner(fireBall.OwnerID, entity.OwnerID)) return; NullifyDamage(hitInfo); } } else if (raidOn && targetID.IsSteamId() && IsClanOffline(targetID)) { if (hitInfo.Initiator is BasePlayer) { BasePlayer player = (BasePlayer)hitInfo.Initiator; NullifyDamage(hitInfo); SendReply(player, msg("playersnotonline", player.UserIDString)); } } }![]()
Checking if block is in cupboard radius?
Discussion in 'Rust Development' started by Sorrow, Jul 8, 2018.