try some fixes Taxidriver
This commit is contained in:
@@ -81,14 +81,28 @@ namespace ReallifeGamemode.Server.Job
|
||||
player.SetData<float>("FareKm", km);
|
||||
int targetId = player.GetData<int>("Passager");
|
||||
if (targetId == 0) return;
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
if (player.HasData("hasPassager"))
|
||||
{
|
||||
User target = dbContext.Users.Where(u => u.Id == targetId).FirstOrDefault();
|
||||
target.Handmoney -= amount;
|
||||
player.GetUser(dbContext).Wage += amount;
|
||||
dbContext.SaveChanges();
|
||||
if(target.Handmoney <= 0)
|
||||
{
|
||||
player.SetData<bool>("hasPassager", false);
|
||||
player.SendNotification("~r~[Info] ~w~ Dein Kunde hat kein Geld mehr auf der Hand.");
|
||||
if(player.HasData("Passager"))
|
||||
{
|
||||
player.SendNotification("~r~[Info] ~w~ Du hast kein Geld mehr auf der Hand.");
|
||||
player.TriggerEvent("CLIENT:stopFare");
|
||||
player.WarpOutOfVehicle();
|
||||
}
|
||||
}
|
||||
else {
|
||||
target.Handmoney -= amount;
|
||||
player.GetUser(dbContext).Wage += amount;
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
//target.Player.TriggerEvent("SERVER:SET_HANDMONEY", target.Handmoney);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user