add cityhall menu, add self interaction menu (Arrow Down), fix freecam, add group creation, move (faction) invite from commands to menu
This commit is contained in:
@@ -71,36 +71,10 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
#endregion
|
||||
#region Leader Commands
|
||||
|
||||
[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.GetClientByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.GetUser()?.FactionId != null)
|
||||
{
|
||||
ChatService.Error(player, "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().Faction.Name + "\" erhalten.");
|
||||
target.SendChatMessage("!{02FCFF}Benutze '/accept invite', um die Einladung anzunehmen");
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
[Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)]
|
||||
|
||||
31
ReallifeGamemode.Server/Commands/GroupCommands.cs
Normal file
31
ReallifeGamemode.Server/Commands/GroupCommands.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using GTANetworkAPI;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
class GroupCommands : Script
|
||||
{
|
||||
#region Chat Commands
|
||||
[Command("g", "~m~Benutzung: ~s~/g [Nachricht]", GreedyArg = true)]
|
||||
public void CmdGroupG(Client player, string message)
|
||||
{
|
||||
Entities.Group group = player.GetUser().Group;
|
||||
if (group == null)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
message = Regex.Replace(message, "(~[a-zA-Z]~{1})|(!{(.*)})", "");
|
||||
message = $"{player.Name}: {message}";
|
||||
|
||||
ChatService.BroadcastGroup(message, group);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -21,40 +21,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
case "invite":
|
||||
{
|
||||
if (!player.HasData("accept_invite"))
|
||||
{
|
||||
ChatService.Error(player, "Du hast keine Einladung in eine Fraktion erhalten");
|
||||
return;
|
||||
}
|
||||
|
||||
player.ResetData("accept_data");
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Client leader = NAPI.Player.GetPlayerFromHandle((NetHandle)player.GetData("accept_invite"));
|
||||
|
||||
if (leader == null)
|
||||
{
|
||||
ChatService.Error(player, "Die Einladung ist abgelaufen");
|
||||
return;
|
||||
}
|
||||
|
||||
User u = leader.GetUser(dbContext);
|
||||
User own = player.GetUser(dbContext);
|
||||
|
||||
own.FactionId = u.FactionId;
|
||||
own.FactionLeader = false;
|
||||
own.FactionRankId = dbContext
|
||||
.FactionRanks
|
||||
.OrderBy(x => x.Order)
|
||||
.Where(r => r.FactionId == own.FactionId)
|
||||
.FirstOrDefault()?.Id ?? null;
|
||||
|
||||
leader.SendChatMessage("!{02FCFF}" + player.Name + " hat die Einladung angenommen.");
|
||||
player.SendChatMessage("!{02FCFF}Du hast die Einladung angenommen.");
|
||||
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -73,16 +40,10 @@ namespace ReallifeGamemode.Server.Commands
|
||||
if (player.GetUser().IsAdmin(AdminLevel.SUPPORTER))
|
||||
{
|
||||
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | " + veh.ToString() + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
||||
}
|
||||
player.SendChatMessage("~m~" + ((VehicleHash)pVeh.Model) + " | Farbe 1: " + pVeh.PrimaryColor + " | Farbe 2: " + pVeh.SecondaryColor + " | ID: " + pVeh.Handle.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user