AliAlanzi Posted July 18, 2017 Posted July 18, 2017 الحين انا عندي صوت ابيه مثلا لمن ادعس حرف يشتغل الصوت عندي كود بس يكرر الصوت اول ما يخلص النغمة يرجع يعيدها انا ما ابي يعيدها و ابي الي قريب منك يسمعها معك بعطيك كود الي استخدمه local sounds = { } -- Bind Keys required function bindKeys(res) bindKey("n", "down", toggleSirens) for key, value in ipairs(getElementsByType("vehicle")) do if isElementStreamedIn(value) then if getElementData(value, "lspd:siren") then sounds[value] = playSound3D("policebeep.mp3", 0, 0, 0, true) attachElements( sounds[value], value ) setSoundVolume(sounds[value], 0.4) setSoundMaxDistance(sounds[value], 180) setElementDimension(sounds[value], getElementDimension(value)) setElementInterior(sounds[value], getElementInterior(value)) end end end end addEventHandler("onClientResourceStart", getResourceRootElement(), bindKeys) function toggleSirens() local theVehicle = getPedOccupiedVehicle(getLocalPlayer()) if (theVehicle) then local occupants = getVehicleOccupants(theVehicle) if occupants[0]==getLocalPlayer() then triggerServerEvent("lspd:setSirenState", theVehicle) end end end addCommandHandler("togglesirens", toggleSirens, false) function streamIn() if getElementType( source ) == "vehicle" and getElementData( source, "lspd:siren" ) and not sounds[ source ] then sounds[source] = playSound3D("policebeep.mp3", 0, 0, 0, true) attachElements( sounds[source], source ) setSoundVolume(sounds[source], 0.4) setSoundMaxDistance(sounds[source], 180) setElementDimension(sounds[source], getElementDimension(source)) setElementInterior(sounds[source], getElementInterior(source)) end end addEventHandler("onClientElementStreamIn", getRootElement(), streamIn) function streamOut() if getElementType( source ) == "vehicle" and sounds[source] then destroyElement( sounds[ source ] ) sounds[ source ] = nil end end addEventHandler("onClientElementStreamOut", getRootElement(), streamOut) function updateSirens( name ) if name == "lspd:siren" and isElementStreamedIn( source ) and getElementType( source ) == "vehicle" then local attached = getAttachedElements( source ) if attached then for key, value in ipairs( attached ) do if getElementType( value ) == "sound" and value ~= sounds[ source ] then destroyElement( value ) end end end if not getElementData( source, name ) then if sounds[ source ] then destroyElement( sounds[ source ] ) sounds[ source ] = nil end else if not sounds[ source ] then sounds[source] = playSound3D("policebeep.mp3", 0, 0, 0, true) attachElements( sounds[source], source ) setSoundVolume(sounds[source], 0.4) setSoundMaxDistance(sounds[source], 180) setElementDimension(sounds[source], getElementDimension(source)) setElementInterior(sounds[source], getElementInterior(source)) end end end end addEventHandler("onClientElementDataChange", getRootElement(), updateSirens)
Master_MTA Posted July 19, 2017 Posted July 19, 2017 1 hour ago, Ghost-Gamer said: ردو علي !! تردون على غيري و انا لا اولا الكود طويل جدا +مبين انه مب من صنعك وانك ما بذلت اي مجهود فيه يقلبي لان الاكواد المستخدمه قديمه جدا كمثال getLocalPlayer() فهاذا السبب اللي خلانا ما نساعدك 1
AliAlanzi Posted July 19, 2017 Author Posted July 19, 2017 11 hours ago, Master_MTA said: اولا الكود طويل جدا +مبين انه مب من صنعك وانك ما بذلت اي مجهود فيه يقلبي لان الاكواد المستخدمه قديمه جدا كمثال getLocalPlayer() فهاذا السبب اللي خلانا ما نساعدك ما تبي تساعد محد قلك تدخل هنا ما تبي تساعد خلص لا تقول انت كذا و مدري وش 11 hours ago, iMr.WiFi..! said: سطر 9 وسطر 72 في كلمة false عدله لـ true تقصد سطر 10؟ و 72 و هم اصلن true
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