Simplfied some code parts

This commit is contained in:
hydrant
2018-10-29 21:55:04 +01:00
parent 1b8e877e22
commit 4b37067497

View File

@@ -34,32 +34,17 @@ namespace reallife_gamemode.Server.Events
[RemoteEvent("keyPress:N")] [RemoteEvent("keyPress:N")]
public void KeyPressN(Client player) public void KeyPressN(Client player)
{ {
if (NAPI.Player.IsPlayerInAnyVehicle(player)) if (player.IsInVehicle && player.VehicleSeat == -1)
{ {
bool engineStatus = NAPI.Vehicle.GetVehicleEngineStatus(player.Vehicle); player.Vehicle.EngineStatus = !player.Vehicle.EngineStatus;
if (engineStatus == false)
{
player.Vehicle.EngineStatus = true;
}
else
{
player.Vehicle.EngineStatus = false;
}
} }
} }
[RemoteEvent("keyPress:X")] [RemoteEvent("keyPress:X")]
public void KeyPressX(Client player) public void KeyPressX(Client player)
{ {
if (NAPI.Player.IsPlayerInAnyVehicle(player)) if (player.IsInVehicle)
{ {
if (player.Seatbelt == false) player.Seatbelt = !player.Seatbelt;
{
player.Seatbelt = true;
}
else
{
player.Seatbelt = false;
}
} }
} }
} }