Jump to content

فكشنات حركة السيارة


Recommended Posts

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

لم يتم التجربة ..

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

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