^Dev-PoinT^ Posted November 17, 2011 Share Posted November 17, 2011 Hi it dosnt Play The Sound function beepClient(thePlayer) local playervehicle = getPedOccupiedVehicle(thePlayer) if isVehicleLocked(playervehicle) then local x, y, z = getElementPosition(thePlayer) local beep = playSound("sound/Alarm.mp3", x, y, z, false) setSoundVolume(beep, 2.0) setSoundMaxDistance(beep, 100) end end addEventHandler("onClientVehicleStartEnter", getRootElement(), beepClient) Link to comment
Bssol Posted November 17, 2011 Share Posted November 17, 2011 function beepClient(thePlayer) if isVehicleLocked(source) then local x, y, z = getElementPosition(thePlayer) local beep = playSound("sound/Alarm.mp3", x, y, z, false) setSoundVolume(beep, 2.0) setSoundMaxDistance(beep, 100) end end addEventHandler("onClientVehicleStartEnter", getRootElement(), beepClient) Link to comment
^Dev-PoinT^ Posted November 17, 2011 Author Share Posted November 17, 2011 what about this ? function beepClient(thePlayer) if isVehicleLocked(source) then local x, y, z = getElementPosition(thePlayer) local beep = playSound("sound/Alarm.mp3", x, y, z, false) setSoundVolume(beep, 2.0) setSoundMaxDistance(beep, 100) stopSound( beep ) setTimer ( stopSound, 10000, 1 ) end end addEventHandler("onClientVehicleStartEnter", getRootElement(), beepClient) Link to comment
Twisted Posted November 17, 2011 Share Posted November 17, 2011 what about this ? function beepClient(thePlayer) if isVehicleLocked(source) then local x, y, z = getElementPosition(thePlayer) local beep = playSound("sound/Alarm.mp3", x, y, z, false) setSoundVolume(beep, 2.0) setSoundMaxDistance(beep, 100) stopSound( beep ) setTimer ( stopSound, 10000, 1 ) end end addEventHandler("onClientVehicleStartEnter", getRootElement(), beepClient) I'm not helping but stopSound(beep) then using a timer? LOL check it again no wonder its not working Link to comment
Charlie_Jefferson Posted November 17, 2011 Share Posted November 17, 2011 function beepClient(thePlayer) if isVehicleLocked(source) then local x, y, z = getElementPosition(thePlayer) local beep = playSound("sound/Alarm.mp3", x, y, z, false) setSoundVolume(beep, 2.0) setSoundMaxDistance(beep, 100) stopSound( beep ) end end addEventHandler("onClientVehicleStartEnter", getRootElement(), beepClient) stop = setTimer ( stopSound, 10000, 1 ) kill = killTimer ( stop ) Even though it does make a lot of logic to me, I'm not sure if it will work. Link to comment
^Dev-PoinT^ Posted November 17, 2011 Author Share Posted November 17, 2011 dosnt work to Link to comment
myonlake Posted November 17, 2011 Share Posted November 17, 2011 That script was a large mess. function beepClient(thePlayer) if isVehicleLocked(source) then local x, y, z = getElementPosition(thePlayer) local beep = playSound3D("sound/Alarm.mp3", x, y, z, true) setSoundVolume(beep, 2.0) setSoundMaxDistance(beep, 100) setTimer(function() stopSound(beep) end, 10000, 1) end end addEventHandler("onClientVehicleStartEnter", getRootElement(), beepClient) Timers were incorrect, of course it doesn't play it because you had playSound instead of playSound3D - you were also stopping the sound when starting. Do /debugscript 3 and show us the errors if any. Link to comment
^Dev-PoinT^ Posted November 17, 2011 Author Share Posted November 17, 2011 no errors but after a lock the car and try open it the sound Playe 2 times i want it 1 time for every time i try open the car Link to comment
myonlake Posted November 17, 2011 Share Posted November 17, 2011 Man, you need to try yourself aswell... function beepClient(thePlayer) if isVehicleLocked(source) then if getElementData(source, "beeping") == false then local x, y, z = getElementPosition(source) local beep = playSound3D("sound/Alarm.mp3", x, y, z, true) attachElements(beep, source) setSoundVolume(beep, 2.0) setSoundMaxDistance(beep, 100) setElementData(source, "beeping", true) setTimer(function() detachElements(beep, source) stopSound(beep) setElementData(source, "beeping", false) end, 10000, 1) end end end addEventHandler("onClientVehicleStartEnter", getRootElement(), beepClient) Link to comment
^Dev-PoinT^ Posted November 17, 2011 Author Share Posted November 17, 2011 dosnot work but i fixed it Thx myonlake For Help Me function beepClient(thePlayer) if isVehicleLocked(source) then local x, y, z = getElementPosition(thePlayer) local beep = playSound3D("sound/Alarm.mp3", x, y, z, true) setSoundVolume(beep, 2.0) setSoundMaxDistance(beep, 100) setTimer(function() stopSound(beep) end, 5000, 1) end end addEventHandler("onClientVehicleStartEnter", getRootElement(), beepClient) function xxx () outputChatBox("Car_Warning By Dev-PoinT Loaded",255,255,0) end addEventHandler("onClientResourceStart", getRootElement(), xxx) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now