SA:MP Функция посадки в кар lua

regbuff

Новичок
Автор темы
2
0
Версия SA-MP
  1. Любая
Нужна функция которая садится в кар с анимкой на луашке на водительское
 

e11evated

Участник
68
24
Lua:
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
 
  • Нравится
Реакции: Funny Rofl