function legalCarEnter(carHandle)
if doesVehicleExist(carHandle) then
local result, vehicleId = sampGetVehicleIdByCarHandle(carHandle)
if result then
sampSendEnterVehicle(vehicleId, false)
taskEnterCarAsDriver(PLAYER_PED, carHandle, 5000)
end
end
end
function main()
if not isSampLoaded() or not isSampAvailable() then return end
sampRegisterChatCommand('getin', function()
local veh = storeClosestEntities(PLAYER_PED)
if doesVehicleExist(veh) then
legalCarEnter(veh)
else
sampAddChatMessage("Рядом нет машин!", -1)
end
end)
wait(-1)
end