This commit is contained in:
michael.reiswich
2021-05-11 11:13:39 +02:00
parent 47180f6e33
commit 1bc8051d0d
3 changed files with 30 additions and 9 deletions

View File

@@ -378,16 +378,24 @@ namespace ReallifeGamemode.Server.Managers
colShape.OnEntityEnterColShape += (cs, c) =>
{
if (!c.IsInVehicle) return;
if (!(c.IsInVehicle && c.VehicleSeat == 0)) return;
c.TriggerEvent("washcar");
using (var dbcontext = new DatabaseContext())
{
User u = c.GetUser(dbcontext);
u.BankAccount.Balance -= 100;
dbcontext.SaveChanges();
if(u.Handmoney <= 0)
{
c.SendNotification("Du hast nicht genug Geld auf der Hand!");
return;
}
else {
c.TriggerEvent("washcar");
c.SendNotification("Die Autowäsche hat dich ~g~$~w~100 gekostet.");
u.Handmoney -= 100;
dbcontext.SaveChanges();
}
}
c.SendNotification("Die Autowäsche hat dich ~g~$~w~100 gekostet.");
};
}