mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

hitElement in onClientVehicleCollision returns nil for projectile

Open sacr1ficez opened this issue 4 years ago • 3 comments

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.

sacr1ficez avatar Aug 26 '21 00:08 sacr1ficez

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".

ffsPLASMA avatar Aug 27 '21 10:08 ffsPLASMA

obraz

Either this or other way i still consider this a bug, or perhaps a missing feature.

sacr1ficez avatar Aug 28 '21 06:08 sacr1ficez

Related to #681

MegadreamsBE avatar Aug 28 '21 16:08 MegadreamsBE