Jump to content

طلب كود


yazan

Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

أضف ذا أول الملف

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 

وبعدها تطبق عليه ..

مثال

addCommandHandler ( "checkSpeed", 
    function ( thePlayer ) 
        if isPedInVehicle ( thePlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            if theSpeed > 120 then 
                outputChatBox ( "* Your Speed Is Too High ["..theSpeed.." km/h]", thePlayer, 255, 255, 0, true ) 
            else 
                outputChatBox ( "* Your Speed Is ["..theSpeed.." km/h]", thePlayer, 0, 255, 0, true ) 
            end 
        end 
    end 
) 

Link to comment

يسير كذا لكن ما ودي هو يضيف في اف 8 ودي تلقائي بدل

addCommandHandler ( "checkSpeed", 

لحله

  
addCommandHandler ( "checkSpeed", 
    functionfunction ( thePlayer ) 
        if isPedInVehicle ( thePlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            if theSpeed > 120 then 
                outputChatBox ( "* Your Speed Is Too High ["..theSpeed.." km/h]", thePlayer, 255, 255, 0, true ) 
            else 
                outputChatBox ( "* Your Speed Is ["..theSpeed.." km/h]", thePlayer, 0, 255, 0, true ) 
            end 
     function wasted (killer, weapon, bodypart)  
    local sound = playSound("sounds/yazan.mp3") 
         setSoundVolume(sound, 0.5) 
end 
    end 
) 

Link to comment
-- Client !! 
addEvent( "onHighSpeed", true ) 
addEventHandler( "onHighSpeed", root, 
    function ( ) 
        if ( getElementType ( source ) == "player" ) and ( isPedInVehicle ( source ) ) then 
            local Vehicle = getPedOccupiedVehicle ( source ) 
            local Speed = getElementVelocity ( Vehicle ) 
            if ( Speed >= 100 ) then 
                playSound ( "Sound.mp3", true ) 
            else 
                cancelEvent() 
            end 
        end 
    end 
) 
  

:roll: حاس إن فيه أغلاط بس إن شاء الله يشتغل

Link to comment
-- Client !! 
addEvent( "onHighSpeed", true ) 
addEventHandler( "onHighSpeed", root, 
    function ( ) 
        if ( getElementType ( source ) == "player" ) and ( isPedInVehicle ( source ) ) then 
            local Vehicle = getPedOccupiedVehicle ( source ) 
            local Speed = getElementVelocity ( Vehicle ) 
            if ( Speed >= 100 ) then 
                playSound ( "Sound.mp3", true ) 
            else 
                cancelEvent() 
            end 
        end 
    end 
) 
  

:roll: حاس إن فيه أغلاط بس إن شاء الله يشتغل

It has no sense .

Link to comment
-- Client !! 
addEvent( "onHighSpeed", true ) 
addEventHandler( "onHighSpeed", root, 
    function ( ) 
        if ( getElementType ( source ) == "player" ) and ( isPedInVehicle ( source ) ) then 
            local Vehicle = getPedOccupiedVehicle ( source ) 
            local Speed = getElementVelocity ( Vehicle ) 
            if ( Speed >= 100 ) then 
                playSound ( "Sound.mp3", true ) 
            else 
                cancelEvent() 
            end 
        end 
    end 
) 
  

:roll: حاس إن فيه أغلاط بس إن شاء الله يشتغل

It has no sense .

Well, Can you fix it please :mrgreen:

Link to comment
addEvent( "onHighSpeed", true ) 
addEventHandler( "onHighSpeed", root, 
    function ( ) 
      if isPedInVehicle ( thePlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            if theSpeed > 120 then 
                outputChatBox ( "* Your Speed Is Too High ["..theSpeed.." km/h]", thePlayer, 255, 255, 0, true ) 
            else 
                outputChatBox ( "* Your Speed Is ["..theSpeed.." km/h]", thePlayer, 0, 255, 0, true ) 
          if ( Speed >= 100 ) then 
                playSound ( "Sound.mp3", true ) 
            else 
                cancelEvent() 
            end 
        end 
    end 
) 

Link to comment
أضف ذا أول الملف
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 

وبعدها تطبق عليه ..

Link to comment
  
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 
  
addEventHandler ( "onVehicleStartEnter", getRootElement(), 
    function ( thePlayer ) 
        if isPedInVehicle ( thePlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            local speed = 120 --بدله للسرعه الي تبيها 
            if theSpeed > speed then 
                outputChatBox ( "* Your Speed Is Too High ["..theSpeed.." km/h]", thePlayer, 255, 255, 0, true ) 
        playSound ("speed.mp3") 
  
            end 
        end 
    end 
) 
  

:mrgreen:

Link to comment
  
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 
  
addEventHandler ( "onVehicleStartEnter", getRootElement(), 
    function ( thePlayer ) 
        if isPedInVehicle ( thePlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            local speed = 120 --بدله للسرعه الي تبيها 
            if theSpeed > speed then 
                outputChatBox ( "* Your Speed Is Too High ["..theSpeed.." km/h]", thePlayer, 255, 255, 0, true ) 
        playSound ("speed.mp3") 
  
            end 
        end 
    end 
) 
  

:mrgreen:

onVehicleStartEnter -- Server

PlaySound -- Client

:mrgreen:

Link to comment
  
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 
  
addEventHandler ( "onVehicleStartEnter", getRootElement(), 
    function ( thePlayer ) 
        if isPedInVehicle ( thePlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            local speed = 120 --بدله للسرعه الي تبيها 
            if theSpeed > speed then 
                outputChatBox ( "* Your Speed Is Too High ["..theSpeed.." km/h]", thePlayer, 255, 255, 0, true ) 
        playSound ("speed.mp3") 
  
            end 
        end 
    end 
) 
  

:mrgreen:

onVehicleStartEnter -- Server

PlaySound -- Client

:mrgreen:

:lol: سوه انت ترايقر اكره شيء في عمري الترايقر

Link to comment

شباب صحوحون الكود ما عليكم امر

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 
  
addEventHandler ( "onVehicleStartEnter", getRootElement(), 
    functionfunction ( thePlayer ) 
        if isPedInVehicle ( thePlayer ) then 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local theSpeed = getElementSpeed ( theVehicle, "kmh" ) 
            local speed = 120 --بدله للسرعه الي تبيها 
            if theSpeed > speed then 
                outputChatBox ( "* Your Speed Is Too High ["..theSpeed.." km/h]", thePlayer, 255, 255, 0, true ) 
        playSound ("speed.mp3") 
  
            end 
        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...