local oldISVehicleMenu = ISVehicleMenu.FillMenuOutsideVehicle

local paintBus = function(playerObj, vehicle)
    ISTimedActionQueue.add(ISPathFindAction:pathToVehicleArea(playerObj, vehicle, "SeatFrontRight"))
    ISTimedActionQueue.add(ISPaintBus:new(playerObj, vehicle, "SeatFrontRight", 1))
end

function ISVehicleMenu.FillMenuOutsideVehicle(player, context, vehicle, test)
    oldISVehicleMenu(player, context, vehicle, test)
    local playerObj = getSpecificPlayer(player)
    local playerInv = playerObj:getInventory()
    local paintBrush = playerInv:getFirstTypeRecurse("Paintbrush")
    if vehicle and paintBrush and vehicle:getSkinIndex() ~= 1 then
        local scriptName = vehicle:getScriptName()
        local paintCan = nil
        if (scriptName == "Base.ATAArmyBus") then
            paintCan = playerInv:getFirstTypeRecurse("PaintWhite")
        elseif (scriptName == "Base.ATAPrisonBus") then
            paintCan = playerInv:getFirstTypeRecurse("PaintRed")
        elseif (scriptName == "Base.ATASchoolBus") then
            paintCan = playerInv:getFirstTypeRecurse("PaintGreen")
        end
        if paintCan then
            context:addOption(getText("ContextMenu_Vehicle_EGNH"), playerObj, paintBus, vehicle)
        end
    end
end

