public static void LeaveClan(ClientInfo _cInfo) { if (ClanData.OwnersList.Contains(_cInfo.playerId)) { string _phrase126 = "{PlayerName} you can not leave the clan because you are the owner. You can only delete the clan."; if (Phrases._Phrases.TryGetValue(126, out _phrase126)) { _phrase126 = _phrase126.Replace("{PlayerName}", _cInfo.playerName); } _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase126, CustomCommands._chatcolor), "Server")); } else if (!ClanData.PlayersList.Contains(_cInfo.playerId)) { string _phrase127 = "{PlayerName} you do not belong to any clans."; if (Phrases._Phrases.TryGetValue(127, out _phrase127)) { _phrase127 = _phrase127.Replace("{PlayerName}", _cInfo.playerName); } _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase127, CustomCommands._chatcolor), "Server")); } else { string _clanName; if (ClanData.Players.TryGetValue(_cInfo.playerId, out _clanName)) { string _phrase121 = "{PlayerName} you have been removed from the clan {ClanName}."; if (Phrases._Phrases.TryGetValue(121, out _phrase121)) { _phrase121 = _phrase121.Replace("{PlayerName}", _cInfo.playerName); _phrase121 = _phrase121.Replace("{ClanName}", _clanName); } ClanData.RemoveMember(_cInfo.playerId); _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase121, CustomCommands._chatcolor), "Server")); } } }
public static void RemoveMember(ClientInfo _cInfo, string _playerName) { if (!ClanData.OfficersList.Contains(_cInfo.playerId)) { string _phrase107 = "{PlayerName} you do not have permissions to use this command."; if (Phrases._Phrases.TryGetValue(107, out _phrase107)) { _phrase107 = _phrase107.Replace("{PlayerName}", _cInfo.playerName); } _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase107, CustomCommands._chatcolor), "Server")); return; } string _steamId; ClientInfo _PlayertoRemove = ConsoleHelper.ParseParamIdOrName(_playerName); if (_PlayertoRemove != null) { _steamId = _PlayertoRemove.playerId; } else if (ClanData.PlayersList.Contains(_playerName)) { _steamId = _playerName; } else { string _phrase108 = "{PlayerName} the name {TargetPlayerName} was not found."; if (Phrases._Phrases.TryGetValue(108, out _phrase108)) { _phrase108 = _phrase108.Replace("{PlayerName}", _cInfo.playerName); _phrase108 = _phrase108.Replace("{TargetPlayerName}", _playerName); } _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase108, CustomCommands._chatcolor), "Server")); return; } string _clanName; string _clan; if (!ClanData.Players.TryGetValue(_cInfo.playerId, out _clanName) || !ClanData.Players.TryGetValue(_steamId, out _clan)) { string _phrase117 = "{PlayerName} is not a member of your clan."; if (Phrases._Phrases.TryGetValue(117, out _phrase117)) { _phrase117 = _phrase117.Replace("{PlayerName}", _playerName); } _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase117, CustomCommands._chatcolor), "Server")); } else if (_clan != _clanName) { string _phrase117 = "{PlayerName} is not a member of your clan."; if (Phrases._Phrases.TryGetValue(117, out _phrase117)) { _phrase117 = _phrase117.Replace("{PlayerName}", _playerName); } _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase117, CustomCommands._chatcolor), "Server")); } else if (ClanData.OfficersList.Contains(_steamId) && !ClanData.OwnersList.Contains(_cInfo.playerId)) { string _phrase118 = "{PlayerName} only the clan owner can remove officers."; if (Phrases._Phrases.TryGetValue(118, out _phrase118)) { _phrase118 = _phrase118.Replace("{PlayerName}", _cInfo.playerName); } _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase118, CustomCommands._chatcolor), "Server")); } else if (ClanData.OwnersList.Contains(_steamId)) { string _phrase119 = "{PlayerName} clan owners can not be removed."; if (Phrases._Phrases.TryGetValue(119, out _phrase119)) { _phrase119 = _phrase119.Replace("{PlayerName}", _cInfo.playerName); } _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase119, CustomCommands._chatcolor), "Server")); } else { string _phrase120 = "{PlayerName} you have removed {PlayertoRemove} from clan {ClanName}."; if (Phrases._Phrases.TryGetValue(120, out _phrase120)) { _phrase120 = _phrase120.Replace("{PlayerName}", _cInfo.playerName); _phrase120 = _phrase120.Replace("{PlayertoRemove}", _playerName); _phrase120 = _phrase120.Replace("{ClanName}", _clanName); } string _phrase121 = "{PlayerName} you have been removed from the clan {ClanName}."; if (Phrases._Phrases.TryGetValue(121, out _phrase121)) { _phrase121 = _phrase121.Replace("{PlayerName}", _playerName); _phrase121 = _phrase121.Replace("{ClanName}", _clanName); } ClanData.RemoveMember(_steamId); _cInfo.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase120, CustomCommands._chatcolor), "Server")); if (_PlayertoRemove != null) { _PlayertoRemove.SendPackage(new NetPackageGameMessage(string.Format("{1}{0}[-]", _phrase121, CustomCommands._chatcolor), "Server")); } } }