function getPointFromDistanceRotation(x, y, dist, angle)
local a = math.rad(90 - angle);
local dx = math.cos(a) * dist;
local dy = math.sin(a) * dist;
return x+dx, y+dy;
end
function findRotation( x1, y1, x2, y2 )
local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) )
return t < 0 and t + 360 or t
end
addEventHandler("onClientVehicleCollision", root,
function(collider,force, bodyPart, x, y, z, nx, ny, nz)
if ( source == getPedOccupiedVehicle(localPlayer) ) then
if getElementData(veh,"vehicle:id") then
if collider==nil then
if force>1100 then
local px,py,pz=getElementPosition(getPedOccupiedVehicle(localPlayer))
local dx,dy=getPointFromDistanceRotation(x,y,2,-findRotation(px,py,x,y))
triggerServerEvent("wywal",localPlayer,localPlayer,dx-px,dy-py)
end
end
end
end)