[+] 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:
@@ -2600,9 +2600,142 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
|
||||
[Command("setweaponrack", "~m~Benutzung: ~s~/setweaponrack [Fraktion ID] [Waffen Model] [SlotID (1-4)]")]
|
||||
public void CmdAdminSetWeaponrack(Client player, int factionID,string weaponModel,int slotId)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == factionID);
|
||||
if (f == null)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||
return;
|
||||
}
|
||||
if (weaponModel != "Schutzweste")
|
||||
{
|
||||
if (!uint.TryParse(weaponModel, out uint weapon))
|
||||
{
|
||||
if (weaponModel.Contains("mk2") && !weaponModel.Contains("_mk2")) weaponModel = weaponModel.Replace("mk2", "_mk2");
|
||||
weapon = NAPI.Util.GetHashKey($"weapon_{weaponModel}");
|
||||
}
|
||||
|
||||
if (!WeaponManager.IsValidHash(weapon))
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Waffe existiert nicht");
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.FactionWeapon fw = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
if (fw == null)
|
||||
{
|
||||
var newWeapon = new Entities.FactionWeapon
|
||||
{
|
||||
WeaponModel = weaponModel,
|
||||
SlotID = slotId,
|
||||
Rank = 12,
|
||||
FactionId = factionID
|
||||
};
|
||||
dbContext.FactionWeapons.Add(newWeapon);
|
||||
dbContext.SaveChanges();
|
||||
ChatService.SendMessage(player, "Neuer Waffeneintrag für die Fraktion " + f.Name + ": " + weaponModel + ", SlotId: " + slotId);
|
||||
return;
|
||||
}
|
||||
|
||||
fw.SlotID = slotId;
|
||||
dbContext.SaveChanges();
|
||||
ChatService.SendMessage(player, "Waffeneintrag bearbeitet für die Fraktion " + f.Name + ": " + weaponModel + ", SlotId: " + slotId);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Entities.FactionWeapon fw2 = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
if (fw2 == null)
|
||||
{
|
||||
var schutzweste = new Entities.FactionWeapon
|
||||
{
|
||||
WeaponModel = weaponModel,
|
||||
SlotID = slotId,
|
||||
Rank = 12,
|
||||
FactionId = factionID
|
||||
};
|
||||
dbContext.FactionWeapons.Add(schutzweste);
|
||||
dbContext.SaveChanges();
|
||||
ChatService.SendMessage(player, "Neuer Waffeneintrag für die Fraktion " + f.Name + ": " + weaponModel + ", SlotId: " + slotId);
|
||||
return;
|
||||
}
|
||||
|
||||
fw2.SlotID = slotId;
|
||||
dbContext.SaveChanges();
|
||||
ChatService.SendMessage(player, "Waffeneintrag bearbeitet für die Fraktion " + f.Name + ": " + weaponModel + ", SlotId: " + slotId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Command("rmweaponrack", "~m~Benutzung: ~s~/rmweaponrack [Fraktion ID] [Waffen Model]")]
|
||||
public void CmdAdminRmWeaponrack(Client player, int factionID, string weaponModel)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
Entities.Faction f = dbContext.Factions.FirstOrDefault(x => x.Id == factionID);
|
||||
if (f == null)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Fraktion existiert nicht (Liste: ~m~/factionlist~s~)");
|
||||
return;
|
||||
}
|
||||
if (weaponModel != "Schutzweste")
|
||||
{
|
||||
if (!uint.TryParse(weaponModel, out uint weapon))
|
||||
{
|
||||
if (weaponModel.Contains("mk2") && !weaponModel.Contains("_mk2")) weaponModel = weaponModel.Replace("mk2", "_mk2");
|
||||
weapon = NAPI.Util.GetHashKey($"weapon_{weaponModel}");
|
||||
}
|
||||
|
||||
if (!WeaponManager.IsValidHash(weapon))
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Waffe existiert nicht");
|
||||
return;
|
||||
}
|
||||
|
||||
Entities.FactionWeapon fw = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
if (fw != null)
|
||||
{
|
||||
dbContext.FactionWeapons.Remove(fw);
|
||||
ChatService.SendMessage(player, "Waffe entsorgt für die Fraktion " + f.Name + ": " + weaponModel);
|
||||
dbContext.SaveChanges();
|
||||
return;
|
||||
}
|
||||
ChatService.ErrorMessage(player, "Diese Waffe befindet sich nicht im Waffenlager");
|
||||
return;
|
||||
}
|
||||
Entities.FactionWeapon fw2 = dbContext.FactionWeapons.FirstOrDefault(w => w.FactionId == factionID && w.WeaponModel == weaponModel);
|
||||
if (fw2 != null)
|
||||
{
|
||||
dbContext.FactionWeapons.Remove(fw2);
|
||||
ChatService.SendMessage(player, "Schutzweste entsorgt für die Fraktion " + f.Name + ": " + weaponModel);
|
||||
dbContext.SaveChanges();
|
||||
return;
|
||||
}
|
||||
ChatService.ErrorMessage(player, "Es befindet sich keine Schutzweste im Waffenlager");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region ALevel1338
|
||||
#region ALevel1338
|
||||
[Command("whitelist", "~m~Benutzung: ~s~/whitelist [Add / Remove] [Socialclub Name]")]
|
||||
public void CmdAdminWhitelist(Client player, string option, string scName)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user