save car at position

This commit is contained in:
michael.reiswich
2021-05-13 00:33:10 +02:00
parent efc4a7e991
commit 0aa1e4d49b
3 changed files with 25 additions and 4 deletions

View File

@@ -4024,7 +4024,7 @@ namespace ReallifeGamemode.Server.Commands
ChatService.BroadcastAdmin("~b~[ADMIN]~s~ " + player.Name + " hat " + target.Name + " den Blackscreen entfernt. ", AdminLevel.ADMIN);
}
}
[Command("washcar", "~m~Benutzung: ~s~/washcar")]
/*[Command("washcar", "~m~Benutzung: ~s~/washcar")]
public void washcar(Player player)
{
player.TriggerEvent("washcar");
@@ -4035,7 +4035,7 @@ namespace ReallifeGamemode.Server.Commands
{
player.TriggerEvent("getdirtlevel");
}
*/
[Command("makeadmin", "~m~Benutzung: ~s~/makeadmin [Name] [Adminlevel]")]
public void CmdAdminMakeadmin(Player player, string name, int rank)
{

View File

@@ -9,6 +9,7 @@ using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Services;
using ReallifeGamemode.Server.Util;
using ReallifeGamemode.Server.WeaponDeal;
using ReallifeGamemode.Database.Models;
namespace ReallifeGamemode.Server.Events
{
@@ -65,7 +66,27 @@ namespace ReallifeGamemode.Server.Events
//LastVehicle = vehicle;
//timerNoobRollerRespawn.Elapsed += async (sender, e) => {await
}
}
using (var dbContext = new DatabaseContext())
{
ServerVehicle sV = vehicle.GetServerVehicle(dbContext);
if (sV is UserVehicle)
{
Vector3 pos = vehicle.Position;
sV.PositionX = pos.X;
sV.PositionY = pos.Y;
sV.PositionZ = pos.Z;
sV.Heading = vehicle.Heading;
dbContext.SaveChanges();
}
}
}
private static void Timer600000_Elapsed(object sender, ElapsedEventArgs e)
{
//ExitVehicle c = new ExitVehicle();

View File

@@ -384,7 +384,7 @@ namespace ReallifeGamemode.Server.Managers
using (var dbcontext = new DatabaseContext())
{
User u = c.GetUser(dbcontext);
if(u.Handmoney <= 0)
if(u.Handmoney < 0)
{
c.SendNotification("Du hast nicht genug Geld auf der Hand!");
return;