Extend Death System; Add Revive-System
This commit is contained in:
@@ -20,11 +20,13 @@ namespace reallife_gamemode.Server.Commands
|
||||
{
|
||||
class Faction : Script
|
||||
{
|
||||
#region Chat Commands
|
||||
|
||||
[Command("f", "~m~Benutzung: ~s~/f [Nachricht]", GreedyArg = true)]
|
||||
public void CmdFactionF(Client player, string message)
|
||||
{
|
||||
Entities.Faction f = player.GetUser()?.GetFaction();
|
||||
if(f == null || f.StateOwned)
|
||||
if (f == null || f.StateOwned)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
@@ -59,16 +61,18 @@ namespace reallife_gamemode.Server.Commands
|
||||
}
|
||||
|
||||
string broadcastMessage = "!{CC3333}** " + player.GetUser().GetFactionRank().RankName + " " + player.Name + ": " + message + ", over **";
|
||||
using(var context = new DatabaseContext())
|
||||
using (var context = new DatabaseContext())
|
||||
{
|
||||
ChatService.BroadcastFaction(broadcastMessage, context.Factions.ToList().FindAll(c => c.StateOwned));
|
||||
}
|
||||
}
|
||||
#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)
|
||||
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
@@ -81,7 +85,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if(target.GetUser()?.FactionId != null)
|
||||
if (target.GetUser()?.FactionId != null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieser Spieler ist schon in einer Fraktion.");
|
||||
return;
|
||||
@@ -121,7 +125,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
FactionRank fr = dbContext.FactionRanks.FirstOrDefault(r => r.RankName == rank && r.FactionId == player.GetUser(dbContext).FactionId);
|
||||
if(fr == null)
|
||||
if (fr == null)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Dieser Rang existiert nicht.");
|
||||
return;
|
||||
@@ -158,13 +162,13 @@ namespace reallife_gamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if(player.Handle == target.Handle)
|
||||
if (player.Handle == target.Handle)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Du kannst dich nicht selber uninviten.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(target.GetUser()?.FactionLeader ?? false)
|
||||
if (target.GetUser()?.FactionLeader ?? false)
|
||||
{
|
||||
player.SendChatMessage("~r~[FEHLER]~s~ Du kannst keinen Leader uninviten.");
|
||||
return;
|
||||
@@ -183,7 +187,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
|
||||
[Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)]
|
||||
[Command("lc", "~m~Benutzung: ~s~/lc [Nachricht]", GreedyArg = true)]
|
||||
public void CmdFactionLc(Client player, string message)
|
||||
{
|
||||
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
|
||||
@@ -199,5 +203,27 @@ namespace reallife_gamemode.Server.Commands
|
||||
if (p.GetUser()?.FactionLeader ?? false) p.SendChatMessage(broadcastMsg);
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
#region Sanitäter Commands
|
||||
|
||||
[Command("revive", "~m~Benutzung: ~s~/invite")]
|
||||
public void CmdFactionMedicRevive(Client player)
|
||||
{
|
||||
if (player.GetUser()?.FactionId == null || player.GetUser().FactionId != 2)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
var nearPlayers = NAPI.Player.GetPlayersInRadiusOfPlayer(2, player);
|
||||
var deadPlayer = nearPlayers.Where(i => i.GetData("isDead") == true).FirstOrDefault();
|
||||
|
||||
deadPlayer.TriggerEvent("onPlayerRevived");
|
||||
deadPlayer.SendNotification("Du wurdest von ~y~" + player.Name + "~s~ wiederbelebt.");
|
||||
deadPlayer.SetData("isDead", false);
|
||||
NAPI.Player.SpawnPlayer(deadPlayer, deadPlayer.Position);
|
||||
deadPlayer.Health = 50;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user