Added /invite, removed some unneccessary debug lines

This commit is contained in:
hydrant
2018-10-15 23:25:53 +02:00
parent 0101503f17
commit 49085d8a09
4 changed files with 107 additions and 34 deletions

View File

@@ -64,5 +64,36 @@ namespace reallife_gamemode.Server.Commands
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned));
}
}
[Command("invite", "~m~Benutzung: ~s~/invite [Name]")]
public void CmdFactionInvite(Client player, string name)
{
if(player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
{
ChatService.NotAuthorized(player);
return;
}
Client target = ClientService.GetClientByName(name);
if (target == null || !target.IsLoggedIn())
{
ChatService.PlayerNotFound(player);
return;
}
if(target.GetUser()?.FactionId != null)
{
player.SendChatMessage("~r~[FEHLER]~s~ Dieser Spieler ist schon in einer Fraktion.");
return;
}
target.SetData("accept_invite", player.Handle);
player.SendChatMessage("!{02FCFF}Du hast dem Spieler " + target.Name + " eine Einladung in deine Fraktion gesendet.");
target.SendChatMessage("!{02FCFF}Du hast von " + player.Name + " eine Einladung in die Fraktion \"" + player.GetUser().GetFaction().Name + "\" erhalten.");
target.SendChatMessage("!{02FCFF}Benutze '/accept invite', um die Einladung anzunehmen");
return;
}
}
}