local ride_local = get_char_vehicle_name(LOCAL_PLAYER)
local ride_remote = get_char_vehicle_name(REMOTE_PLAYER)
local driver_local = vehicle_get_driver(ride_local)
local driver_remote = vehicle_get_driver(ride_remote)
if COOP_COMMANDS and coop_is_active() then
if character_is_in_vehicle(LOCAL_PLAYER) and not character_is_in_vehicle(REMOTE_PLAYER) and driver_local == "LOCAL_PLAYER" then
vehicle_exit_teleport(REMOTE_PLAYER)
vehicle_enter_teleport(REMOTE_PLAYER, ride_local, 1)
sandboxplus_message("Remote player teleported to local player's car.")
elseif character_is_in_vehicle(REMOTE_PLAYER) and not character_is_in_vehicle(LOCAL_PLAYER) and driver_remote == "REMOTE_PLAYER" then
vehicle_exit_teleport(LOCAL_PLAYER)
vehicle_enter_teleport(LOCAL_PLAYER, ride_remote, 1)
sandboxplus_message("Local player teleported to remote player's car.")
elseif character_is_in_vehicle(REMOTE_PLAYER) and character_is_in_vehicle(LOCAL_PLAYER) and driver_remote == "REMOTE_PLAYER" then
vehicle_exit_teleport(LOCAL_PLAYER)
vehicle_exit_teleport(REMOTE_PLAYER)
vehicle_enter_teleport(LOCAL_PLAYER, ride_local, 0)
vehicle_enter_teleport(REMOTE_PLAYER, ride_local, 1)
sandboxplus_message("Players swapped their seats - local player is driving now.")
elseif character_is_in_vehicle(REMOTE_PLAYER) and character_is_in_vehicle(LOCAL_PLAYER) and driver_local == "LOCAL_PLAYER" then
vehicle_exit_teleport(LOCAL_PLAYER)
vehicle_exit_teleport(REMOTE_PLAYER)
vehicle_enter_teleport(LOCAL_PLAYER, ride_local, 1)
vehicle_enter_teleport(REMOTE_PLAYER, ride_local, 0)
sandboxplus_message("Players swapped their seats - remote player is driving now.")
else
sandboxplus_message("Failed.")
end
else
sandboxplus_message("You have to play in coop to use this function.")
end