giveweapon, clothes, props headadmin
This commit is contained in:
@@ -1405,74 +1405,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.SendMessage(player, "~b~Du hast die HP von " + target.Name + " auf " + hp + " gesetzt.");
|
||||
}
|
||||
|
||||
[Command("clothes", "~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)")]
|
||||
public void CmdAdminClothes(Player player, string name, int component, int drawable, int texture = 0)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
Player target = PlayerService.GetPlayerByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User user = target.GetUser(dbContext);
|
||||
bool duty = user.GetData<bool>("duty");
|
||||
CharacterCloth cloth = dbContext.CharacterClothes.Where(c => c.UserId == user.Id && c.SlotId == component && c.SlotType == 0 && c.Duty == duty).FirstOrDefault();
|
||||
if (cloth == null)
|
||||
{
|
||||
cloth = new CharacterCloth()
|
||||
{
|
||||
Duty = duty,
|
||||
ClothId = drawable,
|
||||
SlotId = component,
|
||||
SlotType = 0,
|
||||
Texture = texture,
|
||||
UserId = user.Id,
|
||||
};
|
||||
dbContext.CharacterClothes.Add(cloth);
|
||||
}
|
||||
else
|
||||
{
|
||||
cloth.ClothId = drawable;
|
||||
cloth.Texture = texture;
|
||||
}
|
||||
dbContext.SaveChanges();
|
||||
NAPI.Player.SetPlayerClothes(target, component, drawable, texture);
|
||||
}
|
||||
}
|
||||
|
||||
[Command("props", "~m~Benutzung: ~s~/props [Spieler] [Component ID] [Drawable] (Textur)")]
|
||||
public void CmdAdminProps(Player player, string name, int slot, int component, int texture = 0)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
Player target = PlayerService.GetPlayerByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (component == -1)
|
||||
{
|
||||
target.ClearAccessory(slot);
|
||||
return;
|
||||
}
|
||||
target.SetAccessories(slot, component, texture);
|
||||
}
|
||||
|
||||
[Command("aunjail", "~m~Benutzung: ~s~/aunjail [Spieler]", GreedyArg = true)]
|
||||
public void CmdAdminAunjai(Player player, string targetname)
|
||||
{
|
||||
@@ -1722,47 +1654,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.SendMessage(player, "Farb-ID1 " + color1 + ", Farb-ID2 " + color2 + "");
|
||||
}
|
||||
|
||||
[Command("giveweapon", "~m~Benutzung: ~s~/giveweapon [Spieler] [Waffe] [Munition]")]
|
||||
public void CmdAdminGiveweapon(Player player, string name, string hash, int ammo)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ammo <= 0)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Es muss mindestens 1 Munition vergeben werden");
|
||||
return;
|
||||
}
|
||||
|
||||
hash = hash.ToLower();
|
||||
|
||||
Player target = PlayerService.GetPlayerByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!uint.TryParse(hash, out uint uHash))
|
||||
{
|
||||
if (hash.Contains("mk2") && !hash.Contains("_mk2")) hash = hash.Replace("mk2", "_mk2");
|
||||
uHash = NAPI.Util.GetHashKey($"weapon_{hash}");
|
||||
}
|
||||
|
||||
if (!WeaponManager.IsValidHash(uHash))
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Waffe existiert nicht");
|
||||
return;
|
||||
}
|
||||
|
||||
target.GiveWeapon((WeaponHash)uHash, ammo);
|
||||
ChatService.SendMessage(target, "~b~Du hast von " + player.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " erhalten.");
|
||||
ChatService.SendMessage(player, "~b~Du hast " + target.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " gegeben.");
|
||||
}
|
||||
|
||||
[Command("aneon", "~m~Benutzung: ~s~/aneon [R][G][B]")]
|
||||
public void CmdAdminNeon(Player player, int r, int g, int b)
|
||||
{
|
||||
@@ -3919,6 +3810,115 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.SendMessage(player, $"~b~[ADMIN]~s~ Der Kaufpreis des Fahrzeugs ~y~{serverVehicle.Id}~s~ wurde auf ~g~{price.ToMoneyString()} gesetzt. Alter Preis: {oldPriceStr}");
|
||||
}
|
||||
|
||||
[Command("clothes", "~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)")]
|
||||
public void CmdAdminClothes(Player player, string name, int component, int drawable, int texture = 0)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
Player target = PlayerService.GetPlayerByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User user = target.GetUser(dbContext);
|
||||
bool duty = user.GetData<bool>("duty");
|
||||
CharacterCloth cloth = dbContext.CharacterClothes.Where(c => c.UserId == user.Id && c.SlotId == component && c.SlotType == 0 && c.Duty == duty).FirstOrDefault();
|
||||
if (cloth == null)
|
||||
{
|
||||
cloth = new CharacterCloth()
|
||||
{
|
||||
Duty = duty,
|
||||
ClothId = drawable,
|
||||
SlotId = component,
|
||||
SlotType = 0,
|
||||
Texture = texture,
|
||||
UserId = user.Id,
|
||||
};
|
||||
dbContext.CharacterClothes.Add(cloth);
|
||||
}
|
||||
else
|
||||
{
|
||||
cloth.ClothId = drawable;
|
||||
cloth.Texture = texture;
|
||||
}
|
||||
dbContext.SaveChanges();
|
||||
NAPI.Player.SetPlayerClothes(target, component, drawable, texture);
|
||||
}
|
||||
}
|
||||
|
||||
[Command("props", "~m~Benutzung: ~s~/props [Spieler] [Component ID] [Drawable] (Textur)")]
|
||||
public void CmdAdminProps(Player player, string name, int slot, int component, int texture = 0)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
Player target = PlayerService.GetPlayerByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (component == -1)
|
||||
{
|
||||
target.ClearAccessory(slot);
|
||||
return;
|
||||
}
|
||||
target.SetAccessories(slot, component, texture);
|
||||
}
|
||||
|
||||
[Command("giveweapon", "~m~Benutzung: ~s~/giveweapon [Spieler] [Waffe] [Munition]")]
|
||||
public void CmdAdminGiveweapon(Player player, string name, string hash, int ammo)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ammo <= 0)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Es muss mindestens 1 Munition vergeben werden");
|
||||
return;
|
||||
}
|
||||
|
||||
hash = hash.ToLower();
|
||||
|
||||
Player target = PlayerService.GetPlayerByNameOrId(name);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!uint.TryParse(hash, out uint uHash))
|
||||
{
|
||||
if (hash.Contains("mk2") && !hash.Contains("_mk2")) hash = hash.Replace("mk2", "_mk2");
|
||||
uHash = NAPI.Util.GetHashKey($"weapon_{hash}");
|
||||
}
|
||||
|
||||
if (!WeaponManager.IsValidHash(uHash))
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Diese Waffe existiert nicht");
|
||||
return;
|
||||
}
|
||||
|
||||
target.GiveWeapon((WeaponHash)uHash, ammo);
|
||||
ChatService.SendMessage(target, "~b~Du hast von " + player.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " erhalten.");
|
||||
ChatService.SendMessage(player, "~b~Du hast " + target.Name + " eine/n " + hash + " mit einer Munition von " + ammo + " gegeben.");
|
||||
}
|
||||
|
||||
#endregion ALevel1337
|
||||
|
||||
#region ALevel1338
|
||||
|
||||
Reference in New Issue
Block a user