mtasa-blue
mtasa-blue copied to clipboard
hitElement in onClientVehicleCollision returns nil for projectile
Describe the bug When projectile collides with vehicle it returns nil instead of element.
To reproduce
localPlayer.position = Vector3(0, -10, 3)
local veh = Vehicle(411, 0, 0, 3)
local proj = Projectile(localPlayer, 16, 0, 0, 10, 10, nil, 0, 0, 0, 0, 0, -0.5)
proj:setCounter(9999999)
addEventHandler('onClientVehicleCollision', veh,
function(hitElement)
outputChatBox(tostring(hitElement))
end
)
addEventHandler('onClientResourceStop', resourceRoot,
function()
proj.position = Vector3(0, 0, 9999999)
end
)
Expected behaviour It should return projectile element.
Version Client/server: v1.5.8-release-20927
Additional context No idea if it happens with other projectile types.
A projectile is actually not an element.
See the wiki, createProjectile returns a projectile rather than an element and therefore we also have special functions for this "issue".

Either this or other way i still consider this a bug, or perhaps a missing feature.
Related to #681