Hello
I'm Working On a Parking Sensor For MTA:SA
Also I'm New To MTA And Scripting
My problem is that when I start the resource and move the car in reverse gear, there is no sound
Parkings.lua
-- parking sensor for mta:sa
function isVehicleReversing(theVehicle)
local theVehicle = getPedOccupiedVehicle ( thePlayer )
local getMatrix = getElementMatrix (theVehicle)
local getVelocity = Vector3 (getElementVelocity(theVehicle))
local getVectorDirection = (getVelocity.x * getMatrix[2][1]) + (getVelocity.y * getMatrix[2][2]) + (getVelocity.z * getMatrix[2][3])
if (getVectorDirection < 0) then
return true
function getDistanceBetweenElements(arg1, arg2)
local car = Vector3(getPedOccupiedVehicle( arg1 ))
local nearObject = Vector3(getNearestElement( arg2 ))
local distance = getDistanceBetweenPoints3D( car,nearObject )
if vehicle then
local sound = playSound("beep.mp3")
setSoundVolume(sound, 0.5)
setSoundProperties(sound, 48000.0, 128.00, distance, false)
return distance
addEventHandler("onClientResourceStart", resourceRoot, isVehicleReversing, getDistanceBetweenElements) --
meta.xml
<meta>
<script src="parkings.lua" type="client" />
<file src="beep.mp3" type="client" />
</meta>
What is wrong with my script?