yazan Posted February 12, 2013 Posted February 12, 2013 سلام عليكم ودي كود لو تسرع اكثر من 50يطلع صوت متل تحذير يلي يكون متل تنتن يلي ما فهم طلبي بوضح له اكثر
3NAD Posted February 12, 2013 Posted February 12, 2013 أضف ذا أول الملف 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 )
3NAD Posted February 12, 2013 Posted February 12, 2013 انا ما بسوي لك الكود اللي تبيه اعتمد على نفسكـ .. playSound
yazan Posted February 12, 2013 Author Posted February 12, 2013 لا انا ما قلت ودي تجهز الكود كامل انا بعمله و بطرح لو فيه اخطاء لكن شفت كودك ما فيه اكود اصوت و مفكر انك مجهز كود
yazan Posted February 12, 2013 Author Posted February 12, 2013 يسير كذا لكن ما ودي هو يضيف في اف 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 )
PaiN^ Posted February 12, 2013 Posted February 12, 2013 الكود فيه أغلاط حاول مرة ثانيية وانا بحاول اسويه لك
PaiN^ Posted February 12, 2013 Posted February 12, 2013 -- 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 ) حاس إن فيه أغلاط بس إن شاء الله يشتغل
iPrestege Posted February 12, 2013 Posted February 12, 2013 -- 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 ) حاس إن فيه أغلاط بس إن شاء الله يشتغل It has no sense .
PaiN^ Posted February 12, 2013 Posted February 12, 2013 -- 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 ) حاس إن فيه أغلاط بس إن شاء الله يشتغل It has no sense . Well, Can you fix it please
yazan Posted February 12, 2013 Author Posted February 12, 2013 مثل ما قلك اخوي برستيج ما له معنا يعني هذى ما يطلع سرعه لزمه +ما له وقت محدد مشان يسير حدث
yazan Posted February 12, 2013 Author Posted February 12, 2013 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 )
yazan Posted February 12, 2013 Author Posted February 12, 2013 هذى الكود مزجت اكثر من واحد يعني حق تحقق من سرع و صوت و كود عناد يلي يطلع كم بل شات
iPrestege Posted February 12, 2013 Posted February 12, 2013 أضف ذا أول الملف 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 وبعدها تطبق عليه ..
iMr.Dawix~# Posted February 12, 2013 Posted February 12, 2013 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 )
iPrestege Posted February 12, 2013 Posted February 12, 2013 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 ) onVehicleStartEnter -- Server PlaySound -- Client
iMr.Dawix~# Posted February 12, 2013 Posted February 12, 2013 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 ) onVehicleStartEnter -- Server PlaySound -- Client سوه انت ترايقر اكره شيء في عمري الترايقر
yazan Posted February 12, 2013 Author Posted February 12, 2013 فعلن اخوي وضيفه صوت كلنت لكن ما اعرف ادمج كلنت و سيرفر !!!
yazan Posted February 12, 2013 Author Posted February 12, 2013 هذى كلنت صحيح local sound = playSound("sounds/wasted.mp3") setSoundVolume(sound, 0.7) end addEventHandler ( "onVehicleStartEnter", getRootElement(),
yazan Posted February 12, 2013 Author Posted February 12, 2013 شباب صحوحون الكود ما عليكم امر 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 ) مشكلته في تشغل صوت امر تشغيل كلنت و انا ما اعرف ادمج كلنت و سيرفر
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