# This is our main device script. # It runs when the game starts. using { /Fortnite.com/Devices } using { /Fortnite.com/Vehicles } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We create a new device called lock_driver_device. # This device will hold our logic. lock_driver_device := class(creative_device): # This function runs when the game begins. OnBegin() : void = # We get all players currently in the game session. # GetPlayspace gives us access to the current game space. Playspace := GetPlayspace() # We loop over every player and subscribe to their # ExitedVehicleEvent. This is like giving each player # their own doorbell. for (Player : Playspace.GetPlayers()): # Cast the player to a fort_player so we can # access vehicle-related events. if (FortPlayer := player_is_fort_character[Player]): # Subscribe runs our handler every time # this player exits a vehicle. FortPlayer.ExitedVehicleEvent.Subscribe(OnPlayerExitedVehicle) # This handler is called every time a subscribed player exits a vehicle. # 'Result' carries info about which vehicle was exited. OnPlayerExitedVehicle(Result : exit_vehicle_result) : void = # Grab the vehicle the player just left. Vehicle := Result.Vehicle # Grab the player (fort_character) who jumped out. Character := Result.Character # Here is the magic! # We assign the player back to the vehicle as its driver. # This forces them to get back in. # note: SetDriver is the real API on fort_vehicle in UEFN Verse. Vehicle.SetDriver(Character) # Optional: You could print a message to the console. # Print("A player tried to exit — sending them back!")