I have a very important part in the plugin using BuildPrivilegeTrigger how do I now replace it?
I was responsible for the fact that a person enters the scope of the cupboard and it checks if a friend is registered in this cupboard, if so, then the friend also registered in the same cupboard.
Piece of my code
And immediately another question, OnSwitchAmmo (BasePlayer player, BaseProjectile projectile) hook is responsible for the pressed recharge button or for the moment of quick recharging without selecting a cartridge?Code:private void OnEntityEnter(TriggerBase trigger, BaseEntity entity) { if (!(trigger is BuildPrivilegeTrigger) || !(entity is BasePlayer)) return; var cupboard = (trigger as BuildPrivilegeTrigger).privlidgeEntity; var player = entity.ToPlayer(); if (cupboard.IsAuthed(player) || !InOneClan(cupboard.OwnerID, player.userID)) return; var clan = Clan.GetClanByPlayer(player.UserIDString); if (cupboard.authorizedPlayers.Count == 0 || cupboard.authorizedPlayers.Exists(x => clan.Members.ContainsKey(x.userid.ToString()))) { cupboard.authorizedPlayers.Add(new ProtoBuf.PlayerNameID { userid = player.userID, username = player.displayName, ShouldPool = true }); player.SendNetworkUpdateImmediate(); cupboard.SendNetworkUpdateImmediate(); } }
Important Methods
Discussion in 'Rust Development' started by DEUSNEXUS, Dec 8, 2017.
-
Wulf Community Admin
-
-
Wulf Community Admin
-
The trigger is gone completely, closest replacement is BasePlayer.GetBuildingPrivilege.
But you need to call it at some fixed rate or so in order to detect nearby cupboards. -