yazan Posted February 12, 2013 Share Posted February 12, 2013 سلام عليكم ودي كود لو تسرع اكثر من 50يطلع صوت متل تحذير يلي يكون متل تنتن يلي ما فهم طلبي بوضح له اكثر Link to comment
3NAD Posted February 12, 2013 Share 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 ) Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 وين الصوت بل موضع ؟؟؟ Link to comment
3NAD Posted February 12, 2013 Share Posted February 12, 2013 انا ما بسوي لك الكود اللي تبيه اعتمد على نفسكـ .. playSound Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 لا انا ما قلت ودي تجهز الكود كامل انا بعمله و بطرح لو فيه اخطاء لكن شفت كودك ما فيه اكود اصوت و مفكر انك مجهز كود Link to comment
yazan Posted February 12, 2013 Author Share 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 ) Link to comment
PaiN^ Posted February 12, 2013 Share Posted February 12, 2013 الكود فيه أغلاط حاول مرة ثانيية وانا بحاول اسويه لك Link to comment
PaiN^ Posted February 12, 2013 Share 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 ) حاس إن فيه أغلاط بس إن شاء الله يشتغل Link to comment
iPrestege Posted February 12, 2013 Share 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 . Link to comment
PaiN^ Posted February 12, 2013 Share 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 Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 مثل ما قلك اخوي برستيج ما له معنا يعني هذى ما يطلع سرعه لزمه +ما له وقت محدد مشان يسير حدث Link to comment
yazan Posted February 12, 2013 Author Share 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 ) Link to comment
iPrestege Posted February 12, 2013 Share Posted February 12, 2013 الايفنت تخريفي -_-" ماراح يشتغل Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 هذى الكود مزجت اكثر من واحد يعني حق تحقق من سرع و صوت و كود عناد يلي يطلع كم بل شات Link to comment
PaiN^ Posted February 12, 2013 Share Posted February 12, 2013 مافي فنكشن اسمه getElementSpeed -_-" Link to comment
iPrestege Posted February 12, 2013 Share 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 وبعدها تطبق عليه .. Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 وين المسعدات شباب حولنا فيه Link to comment
iMr.Dawix~# Posted February 12, 2013 Share 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 ) Link to comment
iPrestege Posted February 12, 2013 Share 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 Link to comment
iMr.Dawix~# Posted February 12, 2013 Share 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 سوه انت ترايقر اكره شيء في عمري الترايقر Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 فعلن اخوي وضيفه صوت كلنت لكن ما اعرف ادمج كلنت و سيرفر !!! Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 هذى كلنت صحيح local sound = playSound("sounds/wasted.mp3") setSoundVolume(sound, 0.7) end addEventHandler ( "onVehicleStartEnter", getRootElement(), Link to comment
PaiN^ Posted February 12, 2013 Share Posted February 12, 2013 "onVehicleStartEnter" server side only -_-" Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 يب مشكور للتنبيه المشكله منه Link to comment
yazan Posted February 12, 2013 Author Share 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 ) مشكلته في تشغل صوت امر تشغيل كلنت و انا ما اعرف ادمج كلنت و سيرفر Link to comment
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