I got my other scripts to work, so I think it should be okay if I asked for some help here.
I want to get vehicle's speed before he hits another vehicle, the problem is, it always returns the same speed (180 or 179kph), no matter how fast or slow I'm going. What I'm doing wrong here?
https://wiki.multitheftauto.com/wiki/OnC ... eCollision
function collision(collider,force, bodyPart, x, y, z, vx, vy, vz)
if (getElementType (collider) == "vehicle") and (source == getPedOccupiedVehicle (getLocalPlayer())) then
actualspeed = (vx^2 + vy^2 + vz^2)^(0.5)
kmh = actualspeed * 180
outputChatBox(kmh)
end
end
addEventHandler("onClientVehicleCollision", root, collision)