Something like this if you just want to get started and might want to learn about vectors more later:
-- "ball" is the ball element
-- "vehicle" is the vehicle element that collided with the ball
local x, y, z = getElementPosition(ball)
local x2, y2, z2 = getElementPosition(vehicle)
local velX, velY, velZ = getElementVelocity(vehicle)
local vel = math.sqrt(velX*velX + velY*velY + velZ*velZ) -- equal to getDistanceBetweenPoints3D(0, 0, 0, velX, velY, velZ)
local dirX, dirY, dirZ = x - x2, y - y2, z - z2
local dist = math.sqrt(dirX*dirX + dirY*dirY + dirZ*dirZ) -- equal to getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
dirX, dirY, dirZ = dirX / dist, dirY / dist, dirZ / dist
-- To change velocity of the ball now, i guess you might want to do:
-- setElementVelocity(ball, dirX * vel, dirY * vel, dirZ * vel)
Keep in mind that this will set the velocity of the ball to the velocity of the vehicle in the direction that the ball is compared to the center of the vehicle, and that's why you might want to instead get the point of collision in onClientVehicleCollision and use that point together with vehicle position and you could then add stuff like spin to the ball as well then, but that is a bit more advanced.