AL-SAYED Posted June 1, 2013 Author Share Posted June 1, 2013 addEventHandler("onClientRender",root, function( ) local vehicle = getPedOccupiedVehicle( localPlayer ) if ( vehicle ) then if getElementSpeed ( vehicle , "kmh" ) > 0 then StartSound ( ) else DestroySound ( ) end end end ) function StartSound ( ) if isElement ( sound ) then return false end sound = playSound ( ha7Sound,true ) end function DestroySound ( ) if isElement ( sound ) then destroyElement ( sound ) end end addEventHandler("onClientGUIClick",GUIEditor.button[6], function () triggerEvent ( "onClientRender", root) end ) طيب الحين ابغيه بزر سويت لكن ماضبط Link to comment
iPrestege Posted June 1, 2013 Share Posted June 1, 2013 يعني تبية يوم بـ زر و يضغط يفعل؟ و هو بـ سيارة ولا بدون السيارهـ بس صوت ؟ Link to comment
jafar Posted June 2, 2013 Share Posted June 2, 2013 يعني تبية يوم بـ زر و يضغط يفعل؟و هو بـ سيارة ولا بدون السيارهـ بس صوت ؟ يقصد bindKey Link to comment
3NAD Posted June 2, 2013 Share Posted June 2, 2013 لم يتم التجربة .. onGetVehicleSpeed = function ( vehicle ) if isElement ( vehicle ) then if getElementType ( vehicle ) == "vehicle" then local x, y, z = getElementVelocity ( vehicle ) return ( x^2 + y^2 + z^2 ) ^ ( 0.5 ) * 180 else return false end else return false end end onCheckSound = function ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) if vehicle then local vehicleSpeed = onGetVehicleSpeed ( vehicle ) if vehicleSpeed then if vehicleSpeed >= 5 then onStartSound ( ) else onDestroySound ( ) end else onDestroySound ( ) end end onStartSound = function ( ) if sound then if isElement ( sound ) then return end end sound = playSound ( ha7Sound, true ) end onDestroySound = function ( ) if sound then if isElement ( sound ) then destroyElement ( sound ) onDestroyTimer ( ) end end end onDestroyTimer = function ( ) if isTimer ( soundTimer ) then killTimer ( soundTimer ) end end addEventHandler ( "onClientGUIClick", root, function ( ) if source == GUIEditor.button[6] then onDestroySound ( ) soundTimer = setTimer ( onCheckSound, 1000, 0 ) end end ) 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