bool IsFriend(BasePlayer victim, BasePlayer attacker) { // Friends plugin support - http://oxidemod.org/plugins/friends-api.686/ if (config.FriendProtection && Friends != null) { // Check if victim is friend of attacker if (!((bool)Friends.Call("AreFriends", attacker.userID, victim.userID))) { return(false); } Player.Reply(attacker, Lang("IsFriend", attacker.UserIDString)); return(true); } // Rust:IO plugin support - http://oxidemod.org/extensions/rust-io.768/ if (config.FriendProtection && RustIO != null) { // Check if victim is friend of attacker if (!((bool)RustIO.Call("HasFriend", attacker.UserIDString, victim.UserIDString))) { return(false); } Player.Reply(attacker, Lang("IsFriend", attacker.UserIDString)); return(true); } return(false); }
private bool IsFriend(ulong playerID, ulong friendID) { if (!Friends || !configData.IgnoreFriends) { return(false); } return((bool)Friends?.Call("AreFriends", playerID, friendID)); }
private List <ulong> GetFriends(ulong ownerId) { var friends = Friends?.Call("IsFriendOf", ownerId); if (friends is ulong[]) { return((friends as ulong[]).ToList()); } return(new List <ulong>()); }
private bool HasFriends(ulong playerUID) { if (Friends == null) { return(false); } var friendsList = Friends.Call <ulong[]>("GetFriends", playerUID); return(friendsList != null && friendsList.Length != 0); }
//////////////////////////////////////// /// Friends API //////////////////////////////////////// bool IsFriend(BasePlayer player, string friendID) { if (Friends == null) { return(true); } bool isFriend = (bool)(Friends.Call("HasFriendS", friendID, player.UserIDString) ?? false); DevMsg($"IsFriend({player}, {friendID})"); DevMsg($"IsFriend: returning {isFriend}"); return(isFriend); }
private List <BasePlayer> GetFriends(ulong playerUID) { var friendsList = new List <BasePlayer>(); var friends = Friends.Call <ulong[]>("GetFriends", playerUID); foreach (var friendUID in friends) { var friend = RustCore.FindPlayerById(friendUID); friendsList.Add(friend); } return(friendsList); }
private bool IsCodeLockSharedWithPlayer(BasePlayer player, CodeLock codeLock) { var ownerID = codeLock.OwnerID; if (ownerID == 0 || ownerID == player.userID) { return(false); } // In case the owner was locked out for some reason if (!IsPlayerAuthorizedToCodeLock(ownerID, codeLock)) { return(false); } var sharingSettings = PluginConfig.SharingSettings; if (sharingSettings.Team && player.currentTeam != 0) { var team = RelationshipManager.Instance.FindTeam(player.currentTeam); if (team != null && team.members.Contains(ownerID)) { return(true); } } if (sharingSettings.Friends && Friends != null) { var friendsResult = Friends.Call("HasFriend", codeLock.OwnerID, player.userID); if (friendsResult is bool && (bool)friendsResult) { return(true); } } if ((sharingSettings.Clan || sharingSettings.ClanOrAlly) && Clans != null) { var clanMethodName = sharingSettings.ClanOrAlly ? "IsMemberOrAlly" : "IsClanMember"; var clanResult = Clans.Call(clanMethodName, ownerID.ToString(), player.UserIDString); if (clanResult is bool && (bool)clanResult) { return(true); } } return(false); }
private bool IsTeamed(BasePlayer ownerPlayer, BasePlayer skullOwner) { if (ownerPlayer == null || skullOwner == null) { return(false); } if (teamsSupport) { RelationshipManager.PlayerTeam team = RelationshipManager.Instance.FindTeam(ownerPlayer.currentTeam); if (team == null) { return(false); } foreach (ulong entry in team.members) { if (entry == skullOwner.userID) { return(true); } } } if (friendsSupport) { if ((bool)Friends?.Call("AreFriends", ownerPlayer.userID, skullOwner.userID) == true) { return(true); } } if (clansSupport) { if (Clans != null) { if ((string)Clans.Call("GetClanOf", ownerPlayer.userID) == (string)Clans.Call("GetClanOf", skullOwner.userID)) { return(true); } } } return(false); }
private void OnEntityDeath(BaseCombatEntity entity, HitInfo info) { if (entity == null) { return; } if (!Economics && !ServerRewards) { return; } if (!info?.Initiator?.ToPlayer()) { return; } var player = info.Initiator.ToPlayer(); var animal = UppercaseFirst(entity.LookupPrefab().ToString().Replace("[0]", "")); amount = 0; if (entity.ToPlayer() != null && !(entity is NPCPlayer)) { var victim = entity.ToPlayer(); if (player == victim) { return; } amount = config.Settings.Rewards[PluginRewards.Player]; animal = "player"; if (Friends && config.Settings.Rewards[PluginRewards.PlayerFriend] != 0) { bool isFriend = Friends.Call <bool>("HasFriend", victim.userID, player.userID); bool isFriendReverse = Friends.Call <bool>("HasFriend", player.userID, victim.userID); if (isFriend && isFriendReverse) { amount = config.Settings.Rewards[PluginRewards.PlayerFriend]; animal = "friend"; } } if (Clans && config.Settings.Rewards[PluginRewards.ClanMember] != 0) { string victimclan = Clans.Call <string>("GetClanOf", victim.userID); string playerclan = Clans.Call <string>("GetClanOf", player.userID); if (victimclan == playerclan) { amount = config.Settings.Rewards[PluginRewards.ClanMember]; animal = "clan member"; } } } else { if (entity is NPCMurderer) { animal = "Murderer"; config.Settings.Rewards.TryGetValue(animal, out amount); } else if (entity is NPCPlayerApex) { animal = "Scientist"; config.Settings.Rewards.TryGetValue(animal, out amount); } else if (entity.GetComponent("BaseNpc")) { animal = UppercaseFirst(entity.LookupPrefab().ToString().Replace("[0]", "")); config.Settings.Rewards.TryGetValue(animal, out amount); } } if (amount != 0) { GiveCredit(player, "kill", amount, animal); } }
public bool IsFriend(string playerId, string playerDoorOwner) { return(Friends.IsLoaded && Friends.Call <bool>("IsFriend", playerId, playerDoorOwner)); }