I'd make redmarker and bluemarker have their own functions - it's simpler.
bluemarker = createMarker ( 4000, -460, 25, "corona", 3, 0, 0, 255, 255 ) -- blue
redmarker = createMarker ( 4040, -460, 25, "corona", 3, 255, 0, 0, 255 ) -- red
function setElementGravity(theElement, gravity)
if (getElementType(theElement)=='ped') then
setPedGravity ( theElement, gravity )
end
end
function BlueMarkerHit(theElement)
setElementGravity ( theElement, 0.008 )
end
function RedMarkerHit(theElement)
setElementGravity ( theElement, 0.004 )
end
addEventHandler( "onMarkerHit", bluemarker, BlueMarkerHit )
addEventHandler( "onMarkerHit", redmarker, RedMarkerHit )