From 00ff618640b6c41da5e6e0eba4413ea50cdad06d Mon Sep 17 00:00:00 2001 From: David Leal Date: Mon, 1 Feb 2021 13:10:50 -0600 Subject: [PATCH] Fix crash when player leaves in a car --- init.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/init.lua b/init.lua index 7affee8..8f27efc 100644 --- a/init.lua +++ b/init.lua @@ -212,6 +212,19 @@ end local aux_timer = 0 function lib_mount.drive(entity, dtime, is_mob, moving_anim, stand_anim, jump_height, can_fly, can_go_down, can_go_up, enable_crash) + -- Sanity checks + if entity.driver and not entity.driver:get_attach() then entity.driver = nil end + + if entity.passenger and not entity.passenger:get_attach() then + entity.passenger = nil + end + if entity.passenger2 and not entity.passenger2:get_attach() then + entity.passenger2 = nil + end + if entity.passenger3 and not entity.passenger3:get_attach() then + entity.passenger3 = nil + end + aux_timer = aux_timer + dtime if can_fly and can_fly == true then