PaiN^ Posted February 12, 2013 Share Posted February 12, 2013 إستخدم triggerServerEvent Link to comment
3NAD 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 تكفى عناد قسم دخت وانا احاول اطرح الكود كامل تكفى Link to comment
hassan.k.s.a Posted February 12, 2013 Share Posted February 12, 2013 (edited) جرب -- 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 February 12, 2013 by Guest Link to comment
PaiN^ 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
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 شلون أضيف ملف الصوت للميتا ؟؟ غير سسس Link to comment
3NAD Posted February 12, 2013 Share Posted February 12, 2013 @ 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
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 قائمه شكر ض1 hassan.k.s.a 3nad alm برستيج دويكس اجرب و ارد خبر Link to comment
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 عناد كودك خربان و كود حسان شغال تمام Link to comment
hassan.k.s.a Posted February 12, 2013 Share Posted February 12, 2013 (edited) جرب ذا احسن -- 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 February 12, 2013 by Guest Link to comment
3NAD Posted February 12, 2013 Share Posted February 12, 2013 لوول نسيت احط تعريف السيارة بدال اللاعب بـ الكود ذا 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
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 مشكورين بس حسان ترا كودك يجيب لاق شنييييييييع Link to comment
hassan.k.s.a 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
3NAD Posted February 12, 2013 Share Posted February 12, 2013 -- 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
iPrestege Posted February 12, 2013 Share Posted February 12, 2013 -- 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
iMr.Dawix~# Posted February 12, 2013 Share Posted February 12, 2013 -- 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
yazan Posted February 12, 2013 Author Share Posted February 12, 2013 شتغل فلللله ههه عناد ارفعلي صوت الهردز ترا كان ودي تي تي مثل سياره الحقيقي Link to comment
3NAD Posted February 12, 2013 Share Posted February 12, 2013 setSoundVolume الكود عندكـ Link to comment
3NAD Posted February 12, 2013 Share Posted February 12, 2013 جربت هذا ؟؟ الصوت يمشي مع السياره؟ ويطلع للي ييسوق بس؟ <<ملقوف يمشي مع السيارة ويسمعه كل الركاب 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