Jump to content

طلب كود


yazan

Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

جرب

-- Client

addEventHandler("onClientRender",getRootElement(),function() 
    triggerServerEvent("getSpeed",localPlayer) 
end) 
  
addEvent("StartSound",true) 
addEventHandler("StartSound",getRootElement(),function() 
    local sound = playSound("name.mp3") 
    setSoundVolume(sound,0.9) 
end) 
  
addEvent("StopSound",true) 
addEventHandler("StopSound",getRootElement(),function() 
    destroyElement(sound) 
end) 

-- Server

function getElementSpeed(element,unit) 
    if unit == nil then unit = 0 end 
    if isElement ( element ) then 
        local x,y,z = getElementVelocity(element) 
        if ( unit == "mph" or unit == 1 or unit == "1" ) then 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 100 
        else 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 1.61 * 100 
        end 
    else 
        return false 
    end 
end 
  
addEvent("getSpeed",true) 
addEventHandler("getSpeed",getRootElement(),function() 
    local Veh = getPedOccupiedVehicle(source) 
    local Speed = getElementSpeed (Veh,"kmh") 
    if Speed > 120 then 
        triggerClientEvent(source,"StartSound",source) 
    else 
        triggerClientEvent(source,"StopSound",source) 
    end 
end) 

Edited by Guest
Link to comment

@ hassan.k.s.a

كودك بيجيب لآق بالسيرفر ..

جرب كلنت

-- Client Side 
function getElementSpeed ( element, unit ) 
    if unit == nil then unit = 0 end 
    if isElement ( element ) then 
        local x,y,z = getElementVelocity ( element ) 
        if ( unit == "mph" or unit == 1 or unit == "1" ) then 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 100 
        else 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 1.61 * 100 
        end 
    else 
        return false 
    end 
end 
  
sound = playSound ( "name.mp3", true ) 
setSoundVolume ( sound, 0.5 ) 
setSoundPaused ( sound, true ) 
  
setTimer ( 
    function ( ) 
        if isPedInVehicle ( localPlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
            local theSpeed = getElementSpeed ( localPlayer, "kmh" ) 
            if theSpeed > 10 then 
                setSoundPaused ( sound, false )  
            else 
                setSoundPaused ( sound, true )   
            end 
        end 
    end 
, 2500, 0 ) 

Link to comment

جرب ذا احسن

-- Client

function getElementSpeed(element,unit) 
    if unit == nil then unit = 0 end 
    if isElement ( element ) then 
        local x,y,z = getElementVelocity ( element ) 
        if ( unit == "mph" or unit == 1 or unit == "1" ) then 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 100 
        else 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 1.61 * 100 
        end 
    else 
        return false 
    end 
end 
  
setTimer(function() 
    local Veh = getPedOccupiedVehicle(localPlayer) 
    local Speed = getElementSpeed(Veh,"kmh") 
    if Speed > 120 then 
        if isElement(sound) then 
            destroyElement(sound) 
        end 
        local sound = playSound("name.mp3")  
        setSoundVolume(sound,0.9) 
    else 
        setSoundVolume(sound,0) 
    end 
end,700,0) 

Edited by Guest
Link to comment

لوول نسيت احط تعريف السيارة بدال اللاعب

بـ الكود ذا

getElementSpeed ( localPlayer, "kmh" ) 

على العموم التصحيح

-- Client Side 
function getElementSpeed ( element, unit ) 
    if unit == nil then unit = 0 end 
    if isElement ( element ) then 
        local x,y,z = getElementVelocity ( element ) 
        if ( unit == "mph" or unit == 1 or unit == "1" ) then 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 100 
        else 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 1.61 * 100 
        end 
    else 
        return false 
    end 
end 
  
sound = playSound ( "name.mp3", true ) 
setSoundVolume ( sound, 0.5 ) 
setSoundPaused ( sound, true ) 
  
setTimer ( 
    function ( ) 
        if isPedInVehicle ( localPlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            if theSpeed > 10 then 
                if isSoundPaused ( sound ) then 
                    setSoundPaused ( sound, false )  
                end 
            else 
                if not isSoundPaused ( sound ) then 
                    setSoundPaused ( sound, true )   
                end 
            end 
        end 
    end 
, 1000, 0 ) 

Link to comment
-- Client Side 
function getElementSpeed ( element, unit ) 
    if unit == nil then unit = 0 end 
    if isElement ( element ) then 
        local x,y,z = getElementVelocity ( element ) 
        if ( unit == "mph" or unit == 1 or unit == "1" ) then 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 100 
        else 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 1.61 * 100 
        end 
    else 
        return false 
    end 
end 
  
sound = playSound ( "name.mp3", true ) 
setSoundVolume ( sound, 0.5 ) 
setSoundPaused ( sound, true ) 
  
setTimer ( 
    function ( ) 
        if isPedInVehicle ( localPlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            if theSpeed > 10 then 
                if isSoundPaused ( sound ) then 
                    setSoundPaused ( sound, false )  
                end 
            else 
                if not isSoundPaused ( sound ) then 
                    setSoundPaused ( sound, true )   
                end 
            end 
        end 
    end 
, 1000, 0 ) 

جربت هذا ؟؟

Link to comment
-- Client Side 
function getElementSpeed ( element, unit ) 
    if unit == nil then unit = 0 end 
    if isElement ( element ) then 
        local x,y,z = getElementVelocity ( element ) 
        if ( unit == "mph" or unit == 1 or unit == "1" ) then 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 100 
        else 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 1.61 * 100 
        end 
    else 
        return false 
    end 
end 
  
sound = playSound ( "name.mp3", true ) 
setSoundVolume ( sound, 0.5 ) 
setSoundPaused ( sound, true ) 
  
setTimer ( 
    function ( ) 
        if isPedInVehicle ( localPlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            if theSpeed > 10 then 
                if isSoundPaused ( sound ) then 
                    setSoundPaused ( sound, false )  
                end 
            else 
                if not isSoundPaused ( sound ) then 
                    setSoundPaused ( sound, true )   
                end 
            end 
        end 
    end 
, 1000, 0 ) 

جربت هذا ؟؟

اي شغال تمام

Link to comment
-- Client Side 
function getElementSpeed ( element, unit ) 
    if unit == nil then unit = 0 end 
    if isElement ( element ) then 
        local x,y,z = getElementVelocity ( element ) 
        if ( unit == "mph" or unit == 1 or unit == "1" ) then 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 100 
        else 
            return ( x^2 + y^2 + z^2 ) ^ 0.5 * 1.61 * 100 
        end 
    else 
        return false 
    end 
end 
  
sound = playSound ( "name.mp3", true ) 
setSoundVolume ( sound, 0.5 ) 
setSoundPaused ( sound, true ) 
  
setTimer ( 
    function ( ) 
        if isPedInVehicle ( localPlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            if theSpeed > 10 then 
                if isSoundPaused ( sound ) then 
                    setSoundPaused ( sound, false )  
                end 
            else 
                if not isSoundPaused ( sound ) then 
                    setSoundPaused ( sound, true )   
                end 
            end 
        end 
    end 
, 1000, 0 ) 

جربت هذا ؟؟

الصوت يمشي مع السياره؟

ويطلع للي ييسوق بس؟

:roll: <<ملقوف

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