Jump to content

[HELP]Please help with sounds.


DzMGZXL

Recommended Posts

So i want start to make seatbelt warning sound when player doesn't wear seatbelt then it beep but when player wear seatbelt it stop beep.Anyone can help me with functions or examples?

I use this seatbelt script.

function seatbelt(thePlayer) 
    if getPedOccupiedVehicle(thePlayer) then 
        local theVehicle = getPedOccupiedVehicle(thePlayer) 
        if (getVehicleType(theVehicle) == "BMX" or getVehicleType(theVehicle) == "Bike") then 
            outputChatBox("Odd... There's no seatbelt on this vehicle!", thePlayer, 255, 0, 0) 
        else 
        if  (getElementData(thePlayer, "seatbelt") == true) then 
            exports['anticheat-system']:changeProtectedElementDataEx(thePlayer, "seatbelt", false, true) 
            outputChatBox("You unbuckled your seatbelt.", thePlayer, 255, 0, 0) 
            exports.global:sendLocalMeAction(thePlayer, "unbuckles their seatbelt.") 
        else 
            exports['anticheat-system']:changeProtectedElementDataEx(thePlayer, "seatbelt", true, true) 
            outputChatBox("You buckled your seatbelt.", thePlayer, 0, 255, 0) 
            exports.global:sendLocalMeAction(thePlayer, "buckles in their seatbelt.") 
        end 
        end 
    end 
end 
addCommandHandler("seatbelt", seatbelt) 
addCommandHandler("belt", seatbelt) 

Link to comment
If the code is server side, then you'll need the following:
triggerClientEvent 
addEvent -- client side 
addEventHandler -- client side 

and for the client side:

playSound 
destroyElement -- potentially 

Yes but how to make when player seatbelt state is 0 then it beeps?

Link to comment
But do you want that the beep sounds when you get into the car?

If that's what you want, you can add an event so when the player gets into the car if the elementData returns false it'll sound.

I want when player don't wear seatbelt in vehicle then it beep but when then wear seatbelt it stop beep.

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