Vehicle system

This commit is contained in:
hydrant
2018-12-16 12:08:29 +01:00
parent 08ed548732
commit df58d50941
2 changed files with 11 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ namespace reallife_gamemode.Server.Entities
if (currentVeh != null) VehicleManager.DeleteVehicle(currentVeh); if (currentVeh != null) VehicleManager.DeleteVehicle(currentVeh);
Vehicle veh = NAPI.Vehicle.CreateVehicle(this.Model, this.Position, this.Heading, this.PrimaryColor, this.SecondaryColor, this.NumberPlate, locked: this.Locked, engine: false); Vehicle veh = NAPI.Vehicle.CreateVehicle(this.Model, this.Position, this.Heading, this.PrimaryColor, this.SecondaryColor, this.NumberPlate, locked: this.Locked, engine: false);
VehicleStreaming.SetEngineState(veh, false); VehicleStreaming.SetEngineState(veh, false);
VehicleStreaming.SetLockStatus(veh, false); VehicleStreaming.SetLockStatus(veh, this.Locked);
VehicleManager.AddVehicle(this, veh); VehicleManager.AddVehicle(this, veh);
string numberplate = $"{this.Id}"; string numberplate = $"{this.Id}";
@@ -52,6 +52,13 @@ namespace reallife_gamemode.Server.Entities
numberplate = $"U{uV.UserId} " + numberplate; numberplate = $"U{uV.UserId} " + numberplate;
} }
if(this is ShopVehicle sV)
{
numberplate = "Shop";
VehicleStreaming.SetLockStatus(veh, false);
Array.ForEach((WindowID[])Enum.GetValues(typeof(WindowID)), x => VehicleStreaming.SetVehicleWindowState(veh, x, WindowState.WindowDown));
}
veh.NumberPlate = numberplate; veh.NumberPlate = numberplate;
return veh; return veh;

View File

@@ -199,7 +199,9 @@ namespace reallife_gamemode.Server.Events
if (player.IsInVehicle && player.VehicleSeat == -1) if (player.IsInVehicle && player.VehicleSeat == -1)
{ {
Vehicle v = player.Vehicle; Vehicle v = player.Vehicle;
VehicleStreaming.SetEngineState(v, !VehicleStreaming.GetEngineState(v)); bool state = VehicleStreaming.GetEngineState(v);
NAPI.Util.ConsoleOutput("changing engine state: " + state.ToString());
VehicleStreaming.SetEngineState(v, !state);
} }
} }
[RemoteEvent("keyPress:X")] [RemoteEvent("keyPress:X")]