mahmod3 Posted October 22, 2016 Posted October 22, 2016 السلام عليكم ورحمة الله وبركاته انا عملت مود اطلاق صواريخ بمساعدتكم ان شاء الله بس لما يطلق صواريخ السيارة تنفجر ولما ازيل البروجكتر التاني والتالت والتايمر السيارة ماتنفجر ي ريت حل function shootProjectile() vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then local x, y, z = getElementPosition(vehicle) if getElementModel (vehicle) == 438 then if ( getPlayerMoney(localPlayer) >= 1000)then takePlayerMoney(1000) setTimer(createProjectile,250,1,vehicle,19,x+2,y,z+2) setTimer(createProjectile,250,2,vehicle,19,x+2,y,z+2) setTimer(createProjectile,250,3,vehicle,19,x+2,y,z+2) else outputChatBox("ليس لديك المال الكافي",0,255,0) end else outputChatBox("لي ضرب بي صواريخ يجب ان تكون لديك سيارة الجراد",0,255,0) end end end bindKey("lalt", "down", shootProjectile)
iPrestege Posted October 22, 2016 Posted October 22, 2016 استعمل الداتا وسوي داتا للسيارة اذا كان معه فلوس بعد ماياخذ الفلوس وبعد مايطلق الصاروخ سوي تايمر يحط الداتا فولس onClientVehicleDamage واستعمل الحدث وتحقق من الداتا وسوي cancelEvent وتحقق من السلاح كذلك
mahmod3 Posted October 22, 2016 Author Posted October 22, 2016 19 minutes ago, FaHaD said: استعمل الداتا وسوي داتا للسيارة اذا كان معه فلوس بعد ماياخذ الفلوس وبعد مايطلق الصاروخ سوي تايمر يحط الداتا فولس onClientVehicleDamage واستعمل الحدث وتحقق من الداتا وسوي cancelEvent وتحقق من السلاح كذلك والله مافهمت شي
Ahmed Ly Posted October 22, 2016 Posted October 22, 2016 function shootProjectile() vehicle = getPedOccupiedVehicle(localPlayer) if(vehicle)then if getElementModel (vehicle) == 438 then if ( getPlayerMoney(localPlayer) >= 1000)then takePlayerMoney(1000) setTimer(createProjectile,250,1,vehicle,19) setTimer(createProjectile,250,2,vehicle,19) setTimer(createProjectile,250,3,vehicle,19) else outputChatBox("ليس لديك المال الكافي",0,255,0) end else outputChatBox("لي ضرب بي صواريخ يجب ان تكون لديك سيارة الجراد",0,255,0) end end end bindKey("lalt", "down", shootProjectile)
iPrestege Posted October 22, 2016 Posted October 22, 2016 جرب هذا الكود : function shootProjectile ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) if ( vehicle ) then if getElementModel ( vehicle ) == 438 then if ( getPlayerMoney ( localPlayer ) >= 1000 ) then takePlayerMoney ( 1000 ) setElementData ( vehicle,'aDamage',true ) local x, y, z = getElementPosition(vehicle) createProjectile ( vehicle,19,x,y,z ) createProjectile ( vehicle,19,x,y,z ) createProjectile ( vehicle,19,x,y,z ) setTimer ( setElementData,1500,1,vehicle,'aDamage',false ) else outputChatBox ( 'ليس لديك المال الكافي',0,255,0 ) end else outputChatBox ('لي ضرب بي صواريخ يجب ان تكون لديك سيارة الجراد',0,255,0 ) end end end bindKey ( 'lalt','down',shootProjectile ) addEventHandler ( 'onClientVehicleDamage',root, function ( _,aWeapon ) if ( aWeapon and getElementData ( source,'aDamage') == true ) then cancelEvent ( ) end end ) 1
mahmod3 Posted October 22, 2016 Author Posted October 22, 2016 5 minutes ago, FaHaD said: جرب هذا الكود : function shootProjectile ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) if ( vehicle ) then if getElementModel ( vehicle ) == 438 then if ( getPlayerMoney ( localPlayer ) >= 1000 ) then takePlayerMoney ( 1000 ) setElementData ( vehicle,'aDamage',true ) local x, y, z = getElementPosition(vehicle) createProjectile ( vehicle,19,x,y,z ) createProjectile ( vehicle,19,x,y,z ) createProjectile ( vehicle,19,x,y,z ) setTimer ( setElementData,1500,1,vehicle,'aDamage',false ) else outputChatBox ( 'ليس لديك المال الكافي',0,255,0 ) end else outputChatBox ('لي ضرب بي صواريخ يجب ان تكون لديك سيارة الجراد',0,255,0 ) end end end bindKey ( 'lalt','down',shootProjectile ) addEventHandler ( 'onClientVehicleDamage',root, function ( _,aWeapon ) if ( aWeapon and getElementData ( source,'aDamage') == true ) then cancelEvent ( ) end end ) اشتغل بس المشكلة ان الصاروخ يضرب ب السيارة ليش ؟
iPrestege Posted October 22, 2016 Posted October 22, 2016 @mahmod3 وش قصدك يضرب بالسيارة؟ انا جربتة عندي الان شغال تمام يضرب صاروخ من تحت السيارة وعادي ماتنفجر ولا تتأثر جرب عدل على الاحداثيات ضيف على x
mahmod3 Posted October 22, 2016 Author Posted October 22, 2016 Just now, FaHaD said: @mahmod3 وش قصدك يضرب بالسيارة؟ انا جربتة عندي الان شغال تمام يضرب صاروخ من تحت السيارة وعادي ماتنفجر ولا تتأثر جرب عدل على الاحداثيات ضيف على x السيارة ماتنفجر بس بيضرب ب السيارة
iPrestege Posted October 22, 2016 Posted October 22, 2016 شغال معي تمام جرب ضيف على احداثيات الـ x+math.random ( 1,5 )
mahmod3 Posted October 22, 2016 Author Posted October 22, 2016 1 minute ago, FaHaD said: شغال معي تمام جرب ضيف على احداثيات الـ x+math.random ( 1,5 ) مشكور المشكلة انححلت طيب اقدر لو اللاعب ضرب صواريخ ابي اخليه مايقدر في نفس الوقت يزيد يضرب يعني يستنى شوي ةقت 5 تواني او 10 تواني ويقدر يضرب
mahmod3 Posted October 22, 2016 Author Posted October 22, 2016 1 minute ago, FaHaD said: @mahmod3 استخدم متغير وتايمر function shootProjectile ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) if ( vehicle ) then if getElementModel ( vehicle ) == 438 then if ( getPlayerMoney ( localPlayer ) >= 1000 ) then takePlayerMoney ( 1000 ) setElementData ( vehicle,'aDamage',true ) local x, y, z = getElementPosition(vehicle) setTimer ( createProjectile,250,1, vehicle,19,x+math.random ( 1,5 ),y,z+3 ) setTimer ( createProjectile,250,2, vehicle,19,x+math.random ( 1,5 ),y,z+3 ) setTimer ( createProjectile,250,3,vehicle,19,x+math.random ( 1,5 ),y,z+3 ) setTimer ( setElementData,1500,1,vehicle,'aDamage',false ) else outputChatBox ( 'ليس لديك المال الكافي',0,255,0 ) end else outputChatBox ('لي ضرب بي صواريخ يجب ان تكون لديك سيارة الجراد',0,255,0 ) end end end bindKey ( 'lalt','down',shootProjectile ) addEventHandler ( 'onClientVehicleDamage',root, function ( _,aWeapon ) if ( aWeapon and getElementData ( source,'aDamage') == true ) then cancelEvent ( ) end end ) انا عملت كدا عشان الصواريخ تطلع ورى بعض
iPrestege Posted October 22, 2016 Posted October 22, 2016 local aShoot = true function shootProjectile ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) if ( vehicle ) then if getElementModel ( vehicle ) == 438 and aShoot == true then if ( getPlayerMoney ( localPlayer ) >= 1000 ) then takePlayerMoney ( 1000 ) setElementData ( vehicle,'aDamage',true ) local x, y, z = getElementPosition(vehicle) createProjectile ( vehicle,19,x+math.random(1,5),y,z+3 ) createProjectile ( vehicle,19,x+math.random(1,5),y,z+3 ) createProjectile ( vehicle,19,x+math.random(1,5),y,z+3 ) setTimer ( setElementData,1500,1,vehicle,'aDamage',false ) aShoot = false setTimer ( function ( ) aShoot = true end,5000,1 ) else outputChatBox ( 'ليس لديك المال الكافي',0,255,0 ) end else outputChatBox ('لي ضرب بي صواريخ يجب ان تكون لديك سيارة الجراد',0,255,0 ) end end end bindKey ( 'lalt','down',shootProjectile ) addEventHandler ( 'onClientVehicleDamage',root, function ( _,aWeapon ) if ( aWeapon and getElementData ( source,'aDamage') == true ) then cancelEvent ( ) end end ) جرب هذا بعد 5 ثواني
mahmod3 Posted October 22, 2016 Author Posted October 22, 2016 2 minutes ago, FaHaD said: local aShoot = true function shootProjectile ( ) local vehicle = getPedOccupiedVehicle ( localPlayer ) if ( vehicle ) then if getElementModel ( vehicle ) == 438 and aShoot == true then if ( getPlayerMoney ( localPlayer ) >= 1000 ) then takePlayerMoney ( 1000 ) setElementData ( vehicle,'aDamage',true ) local x, y, z = getElementPosition(vehicle) createProjectile ( vehicle,19,x+math.random(1,5),y,z+3 ) createProjectile ( vehicle,19,x+math.random(1,5),y,z+3 ) createProjectile ( vehicle,19,x+math.random(1,5),y,z+3 ) setTimer ( setElementData,1500,1,vehicle,'aDamage',false ) aShoot = false setTimer ( function ( ) aShoot = true end,5000,1 ) else outputChatBox ( 'ليس لديك المال الكافي',0,255,0 ) end else outputChatBox ('لي ضرب بي صواريخ يجب ان تكون لديك سيارة الجراد',0,255,0 ) end end end bindKey ( 'lalt','down',shootProjectile ) addEventHandler ( 'onClientVehicleDamage',root, function ( _,aWeapon ) if ( aWeapon and getElementData ( source,'aDamage') == true ) then cancelEvent ( ) end end ) جرب هذا بعد 5 ثواني ههه مشكور والله
mahmod3 Posted October 22, 2016 Author Posted October 22, 2016 1 minute ago, FaHaD said: حياك الله انت مبدع صح؟ انا مافهمت الداتا من زاحف ياريت تشرحلي امتله عشان افهمها كويس
iPrestege Posted October 22, 2016 Posted October 22, 2016 (edited) -- Server addCommandHandler ( 'aSet', function ( aPlayer ) if not getElementData ( aPlayer,'aData' ) then -- اذا ماكانت الداتا موجودة للاعب setElementData ( aPlayer,'aData','mahmoad' ) -- يحط الداتا بقيمة سترنق اللي هي محمود else -- او removeElementData ( aPlayer,'aData' ) -- يشيل الداتا اذا كانت موجودة end end ) addCommandHandler ( 'aGet', function ( ) outputChatBox ( getElementData ( localPlayer,'aData' ) or 'no data' ) -- هنا بالكلاينت نجيب الداتا للاعب اللوكال لو عنده داتا او يطلع لك نو داتا end ) اعتذر منك اذا مافهمت الشرح لكن شرح زاحف كافي ووافي لكن العب بالداتا يعني تمرس عليها استعملها وجرب تسوي فيها وشوف الاخطاء وصحح وان شاء الله تتعلمها تمام Edited October 22, 2016 by FaHaD 2
mahmod3 Posted October 22, 2016 Author Posted October 22, 2016 1 hour ago, FaHaD said: -- Server addCommandHandler ( 'aSet', function ( aPlayer ) if not getElementData ( aPlayer,'aData' ) then -- اذا ماكانت الداتا موجودة للاعب setElementData ( aPlayer,'aData','mahmoad' ) -- يحط الداتا بقيمة سترنق اللي هي محمود else -- او removeElementData ( aPlayer,'aData' ) -- يشيل الداتا اذا كانت موجودة end end ) addCommandHandler ( 'aGet', function ( ) outputChatBox ( getElementData ( localPlayer,'aData' ) or 'no data' ) -- هنا بالكلاينت نجيب الداتا للاعب اللوكال لو عنده داتا او يطلع لك نو داتا end ) اعتذر منك اذا مافهمت الشرح لكن شرح زاحف كافي ووافي لكن العب بالداتا يعني تمرس عليها استعملها وجرب تسوي فيها وشوف الاخطاء وصحح وان شاء الله تتعلمها تمام يعني ان الداتا متل الاكاونت داتا بزبط
Abdul KariM Posted October 22, 2016 Posted October 22, 2016 @FaHaD getPlayerMoney > client مافيه ارقمنت لاعب
iPrestege Posted October 22, 2016 Posted October 22, 2016 1 hour ago, Abdul KariM said: @FaHaD getPlayerMoney > client مافيه ارقمنت لاعب صحيح مانتبهت لها وماتفرق وجودها او عدمها ماراح يسبب خطأ في السكربت @mahmod3 تقريباً نفس الشيء تستعمل لتخزين قيم لكن هذي تخزن لكن مش بالاكاونت بالاعب نفسة 1
Abdul KariM Posted October 22, 2016 Posted October 22, 2016 اضافة لذلك اتوقع ان اذا طلقت صواريخ مايشوفه الا الاعب نفسه مايشوفه الباقيه فـ اذا كان كذا سوي ترايقر للسيرفر وخلي التحققات كله سيرفر وبعدين سوي ترايقر للكلينت افضلك بكثير من الي انت مسويه ذا ولك الخيار وبالتوفيق ان شاء الله
!#NssoR_) Posted October 22, 2016 Posted October 22, 2016 كود إنشاء الصاروخ , غريب نوعأما مع انه كلنت ولكن الكل يقدر يشوف الصاروخ 2
</Mr.Tn6eL> Posted October 22, 2016 Posted October 22, 2016 1 hour ago, NssoR said: كود إنشاء الصاروخ , غريب نوعأما مع انه كلنت ولكن الكل يقدر يشوف الصاروخ صحيح انا مستغرب لذا الشي الى الآن لكن مايهم 1
Abdul KariM Posted October 23, 2016 Posted October 23, 2016 طيب لو انا ضربت عليك مثلا صاروخ يأثر فيك ولا ؟
mahmod3 Posted October 23, 2016 Author Posted October 23, 2016 49 minutes ago, Abdul KariM said: طيب لو انا ضربت عليك مثلا صاروخ يأثر فيك ولا ؟ كل شي تمام الصاروخ يضهر لكل اللاعبين ولما الصاروخ يضرب في انا ماتتفجر سيارتي وادا ضربت احد او ضربني احد تتفجر السيارة يعني كل شي تمام
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