Jump to content

طلب كود


yazan

Recommended Posts

Posted

سلام عليكم

ودي كود لو تسرع اكثر من 50يطلع صوت متل تحذير يلي يكون متل تنتن

يلي ما فهم طلبي بوضح له اكثر

سبحان الله

----------------------------------

LUA 56%

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

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

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 
) 

Posted

لا انا ما قلت ودي تجهز الكود كامل انا بعمله و بطرح لو فيه اخطاء لكن شفت كودك ما فيه اكود اصوت و مفكر انك مجهز كود

سبحان الله

----------------------------------

LUA 56%

Posted

يسير كذا لكن ما ودي هو يضيف في اف 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 
) 

سبحان الله

----------------------------------

LUA 56%

Posted

:wink: الكود فيه أغلاط حاول مرة ثانيية وانا بحاول اسويه لك

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted
-- 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: حاس إن فيه أغلاط بس إن شاء الله يشتغل

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

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

  

Posted
-- 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:

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

مثل ما قلك اخوي برستيج ما له معنا يعني هذى ما يطلع سرعه لزمه +ما له وقت محدد مشان يسير حدث

سبحان الله

----------------------------------

LUA 56%

Posted
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 
) 

سبحان الله

----------------------------------

LUA 56%

Posted

هذى الكود مزجت اكثر من واحد يعني حق تحقق من سرع و صوت و كود عناد يلي يطلع كم بل شات

سبحان الله

----------------------------------

LUA 56%

Posted

مافي فنكشن اسمه

getElementSpeed 

-_-"

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

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

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

  

Posted
  
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:

My E-mails:

" Manners Maketh Man "

" الأخلاق تصنع الرجل "

░░░░░███████ ]▄▄▄▄▄▄▄▄ BooM !

▂▄▅█████████▅▄▃▂

███████████████████].

◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

Posted
  
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:

  

Posted
  
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: سوه انت ترايقر اكره شيء في عمري الترايقر

My E-mails:

" Manners Maketh Man "

" الأخلاق تصنع الرجل "

░░░░░███████ ]▄▄▄▄▄▄▄▄ BooM !

▂▄▅█████████▅▄▃▂

███████████████████].

◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤

Posted

فعلن اخوي وضيفه صوت كلنت لكن ما اعرف ادمج كلنت و سيرفر !!!

سبحان الله

----------------------------------

LUA 56%

Posted

هذى كلنت صحيح

local sound = playSound("sounds/wasted.mp3")  
    setSoundVolume(sound, 0.7) 
end 
  
addEventHandler ( "onVehicleStartEnter", getRootElement(), 

سبحان الله

----------------------------------

LUA 56%

Posted

"onVehicleStartEnter" 

server side only -_-"

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

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

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 
) 

مشكلته في تشغل صوت امر تشغيل كلنت و انا ما اعرف ادمج كلنت و سيرفر

سبحان الله

----------------------------------

LUA 56%

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