Add Keine Punkte Vergabe ohne FS und keine Minus Punkte

This commit is contained in:
Mac_Slash
2020-04-09 22:00:45 +02:00
parent ac64661c26
commit ee302d76b1

View File

@@ -396,33 +396,47 @@ namespace ReallifeGamemode.Server.Managers
Player target = PlayerService.GetPlayerByNameOrId(nameOrId);
string playername = NAPI.Player.GetPlayerName(player);
string targetname = NAPI.Player.GetPlayerName(target);
using (var dbContext = new DatabaseContext())
if (target.GetUser().DriverLicenseVehicle == false && target.GetUser().DriverLicenseBike == false)
{
User target2 = target.GetUser(dbContext);
target2.Points += amount;
dbContext.SaveChanges();
}
player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~.");
target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true);
if(target.GetUser().Points >= 8)
{
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~8/8 ~x~Strafpunkten.", true);
target.SendNotification($"~w~Dir wird ~r~Auo- ~w~und ~r~Motorradführerschein ~w~entzogen.", true);
using (var dbContext = new DatabaseContext())
{
User target2 = target.GetUser(dbContext);
target2.Points = 0;
target2.DriverLicenseVehicle = false;
target2.DriverLicenseBike = false;
dbContext.SaveChanges();
}
}
else
{
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{target.GetUser().Points}/8 ~x~Strafpunkten.", true);
if (amount > 0 && amount < 9)
{
using (var dbContext = new DatabaseContext())
{
User target2 = target.GetUser(dbContext);
target2.Points += amount;
dbContext.SaveChanges();
}
player.SendNotification($"~w~Du hast ~y~{targetname} ~b~{amount} ~w~Strafpunkte gegeben. Grund: ~g~{reason}~w~.");
target.SendNotification($"~b~{player.GetUser().FactionRank.RankName} | {playername} ~w~hat dir ~y~{amount} ~w~Strafpunkte gegeben.", true);
if (target.GetUser().Points >= 8)
{
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~r~8/8 ~x~Strafpunkten.", true);
target.SendNotification($"~w~Dir wird ~r~Auo- ~w~und ~r~Motorradführerschein ~w~entzogen.", true);
using (var dbContext = new DatabaseContext())
{
User target2 = target.GetUser(dbContext);
target2.Points = 0;
target2.DriverLicenseVehicle = false;
target2.DriverLicenseBike = false;
dbContext.SaveChanges();
}
}
else
{
target.SendNotification($"~w~Grund: ~g~{reason}~w~. ~x~Du hast nun ~y~{target.GetUser().Points}/8 ~x~Strafpunkten.", true);
}
}
else
{
player.SendNotification("~r~Du kannst nur zwischen 1 und 8 Punkte verteilen!");
}
}
else
{
player.SendNotification("~r~Spieler hat weder Auto- noch Motorradführerschein!");
}
}
#endregion
#region Spielerinteraktionen PFEILTASTE-LINKS
[RemoteEvent("openTradeInventory")]