[+] Add Command for Admin /setweaponrack , /rmweaponrack and for Leader /setweaponrank

+ Add blip alpha channel for Players (set to 125)
   + Add blip color for Player with Wanted
   - Removed WeaponHash from DB entry FactionWeapons (Deprecated)
This commit is contained in:
Lukas Moungos
2019-07-21 21:01:14 +02:00
parent 57e22c0b6e
commit bbcb56c492
13 changed files with 1489 additions and 68 deletions

View File

@@ -2,6 +2,7 @@
using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Factions.Medic;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Models;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Wanted;
@@ -131,8 +132,48 @@ namespace ReallifeGamemode.Server.Commands
if (p.GetUser()?.FactionLeader ?? false) ChatService.SendMessage(p, broadcastMsg);
});
}
[Command("setweaponrank", "~m~Benutzung: ~s~/setweaponrank [Waffen Name] [Rank]")]
public void CmdFactionWeaponRank(Client player, string weaponModel, int rank)
{
if (player.GetUser()?.FactionId == null || player.GetUser().FactionLeader == false)
{
ChatService.NotAuthorized(player);
return;
}
if (rank > 12 || rank < 1)
{
ChatService.ErrorMessage(player, "Gebe einen gültigen Rang ein");
return;
}
User user = player.GetUser();
WeaponPoint nearestWeapon = PositionManager.WeaponPoints.Find(w => w.Position.DistanceTo(player.Position) <= 1.5 && w.FactionId == user.FactionId);
if (nearestWeapon == null)
{
ChatService.ErrorMessage(player, "Du bist nicht in der nähe vom Waffenspind");
return;
}
using (var context = new DatabaseContext())
{
Entities.FactionWeapon fw2 = context.FactionWeapons.FirstOrDefault(w => w.FactionId == user.FactionId && w.WeaponModel == weaponModel);
if (fw2 != null)
{
fw2.Rank = rank;
context.SaveChanges();
ChatService.SendMessage(player, "Du hast die " + weaponModel + " als Rang " + rank + " Waffe eingestellt.");
return;
}
ChatService.ErrorMessage(player, "Diese Waffe ist nicht im Waffenlager");
return;
}
}
#endregion
#region Sanitäter Commands
#region Sanitäter Commands
[Command("revive", "~m~Benutzung: ~s~/revive")]
public void CmdFactionMedicRevive(Client player)