Added /invite, removed some unneccessary debug lines
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user