DzMGZXL Posted September 4, 2014 Share Posted September 4, 2014 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
xXMADEXx Posted September 4, 2014 Share Posted September 4, 2014 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 Link to comment
DzMGZXL Posted September 4, 2014 Author Share Posted September 4, 2014 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
Mr.Aleks Posted September 4, 2014 Share Posted September 4, 2014 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. Link to comment
DzMGZXL Posted September 4, 2014 Author Share Posted September 4, 2014 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
Mr.Aleks Posted September 4, 2014 Share Posted September 4, 2014 So you can use onVehicleEnter, setElementData and getElementData. Then you can trigger the sound and delete it when you want. 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