DzMGZXL Posted December 14, 2014 Posted December 14, 2014 (edited) Deleted Edited December 16, 2014 by Guest
</Mr.Tn6eL> Posted December 14, 2014 Posted December 14, 2014 triggerClientEvent(source, "onLock", source) skype : 011101000110111000110110011001010110110000110000001110010011000000111001
DzMGZXL Posted December 14, 2014 Author Posted December 14, 2014 (edited) triggerClientEvent(source, "onLock", source) Now it works but sound can hear only that who lock car Edited December 16, 2014 by Guest
ViRuZGamiing Posted December 14, 2014 Posted December 14, 2014 That's because the is played Client Side. triggerClientEvent(source, "onLock", root) -- arg1. Source of the event is source, arg2. "onLock" the event, arg3. sent to? All a.k.a root. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
DzMGZXL Posted December 14, 2014 Author Posted December 14, 2014 That's because the is played Client Side. triggerClientEvent(source, "onLock", root) -- arg1. Source of the event is source, arg2. "onLock" the event, arg3. sent to? All a.k.a root. can you please help me make it when everyone can hear sound?I use root doesn't work.
ViRuZGamiing Posted December 14, 2014 Posted December 14, 2014 client: addEvent ( "playSoundForAllPlayers" , true) addEventHandler("playSoundForAllPlayers", root, function() playSound3D(...) end) And in server, use this whenever you want to play the sound. triggerClientEvent("playSoundForAllPlayers", root) Read this on another post "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
DzMGZXL Posted December 14, 2014 Author Posted December 14, 2014 client: addEvent ( "playSoundForAllPlayers" , true) addEventHandler("playSoundForAllPlayers", root, function() playSound3D(...) end) And in server, use this whenever you want to play the sound. triggerClientEvent("playSoundForAllPlayers", root) Read this on another post Doesn't work
ViRuZGamiing Posted December 14, 2014 Posted December 14, 2014 Show code now "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
DzMGZXL Posted December 14, 2014 Author Posted December 14, 2014 (edited) [ Edited December 16, 2014 by Guest
ViRuZGamiing Posted December 14, 2014 Posted December 14, 2014 addEvent("lockUnlockOutsideVehicle", true) addEventHandler("lockUnlockOutsideVehicle", getRootElement(), lockUnlockOutside) what is the point of this? are you triggering it from client side? because if so you are triggering from Client the server and back to client. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
DzMGZXL Posted December 14, 2014 Author Posted December 14, 2014 addEvent("lockUnlockOutsideVehicle", true) addEventHandler("lockUnlockOutsideVehicle", getRootElement(), lockUnlockOutside) what is the point of this? are you triggering it from client side? because if so you are triggering from Client the server and back to client. I use it because i have locks with key "K" and i trigger it in server side.
Moderators IIYAMA Posted December 15, 2014 Moderators Posted December 15, 2014 (edited) triggerClientEvent( root,-- target "onLock",-- event vehicle -- vehicle = source ) -- this was correct -- addEvent("onLock",true) addEventHandler("onLock",root, function() if isElement(source) then local x,y,z = getElementPosition(source) -- source = vehicle playSound3D("CarAlarmChirp.mp3",x,y,z) end end) Edited December 15, 2014 by Guest Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
tosfera Posted December 15, 2014 Posted December 15, 2014 If you really want to do it like this; client locks -> server request to lock and play the sound -> client request for the sound. You should create a createColSphere with the desired size and get all the elements in there with getElementsWithinColShape. Loop over these and make them all do a triggerClientEvent() to the sound function. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
DzMGZXL Posted December 15, 2014 Author Posted December 15, 2014 triggerClientEvent( root,-- target "onLock"-- event vehicle -- vehicle = source ) -- this was correct -- addEvent("onLock",true) addEventHandler("onLock",root, function() if isElement(source) then local x,y,z = getElementPosition(source) -- source = vehicle playSound3D("CarAlarmChirp.mp3",x,y,z) end end) Still doesn't work.
Moderators IIYAMA Posted December 15, 2014 Moderators Posted December 15, 2014 Then you made a mistake somewhere else. Debug your code using debug lines else I can't help you. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
DzMGZXL Posted December 15, 2014 Author Posted December 15, 2014 Then you made a mistake somewhere else.Debug your code using debug lines else I can't help you. client addEvent("onLock",true) addEventHandler("onLock",root, function() if isElement(source) then local x,y,z = getElementPosition(source) -- source = vehicle playSound3D("CarAlarmChirp.mp3",x,y,z) end end) And in SERVER triggerClientEvent("onLock", root)
Moderators IIYAMA Posted December 15, 2014 Moderators Posted December 15, 2014 If you don't take over my code correctly, it will not work! triggerClientEvent( root,-- target "onLock",-- event vehicle -- vehicle = source ) IS -_-" AAARRRRGRRRRR!! triggerClientEvent(root,"onLock",vehicle) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
DzMGZXL Posted December 15, 2014 Author Posted December 15, 2014 If you don't take over my code correctly, it will not work! triggerClientEvent( root,-- target "onLock",-- event vehicle -- vehicle = source ) IS -_-" AAARRRRGRRRRR!! triggerClientEvent(root,"onLock",vehicle) Thanks now everything works perfect!
Moderators IIYAMA Posted December 15, 2014 Moderators Posted December 15, 2014 np. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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