If the player tries to leave the car by pressing "enter" they are unable too. Effectively stuck inside their vehicle. Same if you use a script to set the player to not be driving.
Code: Select all
/sc
local character = game.player.character
local surface = character.surface
local carPosition = {10,10}
local car1 = surface.create_entity({ name = "car", position = carPosition, force = character.force, create_build_effect_smoke = false, raise_built = true })
car1.set_driver(character)
--[[ Without car2 this places the player normally --]]
local car2 = surface.create_entity({ name = "car", position = carPosition, force = character.force, create_build_effect_smoke = false, raise_built = true })
game.player.driving = false
If you kick the player out via script from the car by setting the driver to nil the player is placed inside the collision box of the car.
Code: Select all
/sc
local character = game.player.character
local surface = character.surface
local carPosition = {10,10}
local car1 = surface.create_entity({ name = "car", position = carPosition, force = character.force, create_build_effect_smoke = false, raise_built = true })
car1.set_driver(character)
--[[ Without car2 this places the player normally --]]
local car2 = surface.create_entity({ name = "car", position = carPosition, force = character.force, create_build_effect_smoke = false, raise_built = true })
car1.set_driver(nil)