Jump to content

some Help in Car Alarm System


^Dev-PoinT^

Recommended Posts

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

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
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 xD

Link to comment
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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...