Jump to content

Recommended Posts

Posted

السلام عليكم ورحمة الله وبركاته

انا عملت مود اطلاق صواريخ بمساعدتكم ان شاء الله

بس لما يطلق صواريخ السيارة تنفجر

ولما ازيل البروجكتر التاني والتالت والتايمر السيارة ماتنفجر ي ريت حل

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)

 

Posted

استعمل الداتا وسوي داتا للسيارة اذا كان معه فلوس بعد ماياخذ الفلوس وبعد مايطلق الصاروخ سوي تايمر يحط الداتا فولس

onClientVehicleDamage واستعمل الحدث

وتحقق من الداتا وسوي cancelEvent

وتحقق من السلاح كذلك

Posted
19 minutes ago, FaHaD said:

استعمل الداتا وسوي داتا للسيارة اذا كان معه فلوس بعد ماياخذ الفلوس وبعد مايطلق الصاروخ سوي تايمر يحط الداتا فولس

onClientVehicleDamage واستعمل الحدث

وتحقق من الداتا وسوي cancelEvent

وتحقق من السلاح كذلك

والله مافهمت شي

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

 

Posted

جرب هذا الكود :

 

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
)

 

  • Like 1
Posted
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
)

 

اشتغل بس المشكلة ان الصاروخ يضرب ب السيارة ليش ؟

Posted

@mahmod3 وش قصدك يضرب بالسيارة؟ انا جربتة عندي الان شغال تمام يضرب صاروخ من تحت السيارة وعادي ماتنفجر ولا تتأثر 

جرب عدل على الاحداثيات ضيف على x 

Posted
Just now, FaHaD said:

@mahmod3 وش قصدك يضرب بالسيارة؟ انا جربتة عندي الان شغال تمام يضرب صاروخ من تحت السيارة وعادي ماتنفجر ولا تتأثر 

جرب عدل على الاحداثيات ضيف على x 

السيارة ماتنفجر بس بيضرب ب السيارة

Posted
1 minute ago, FaHaD said:

شغال معي تمام جرب ضيف على احداثيات 

الـ x+math.random ( 1,5 )

مشكور المشكلة انححلت طيب اقدر لو اللاعب ضرب صواريخ ابي اخليه مايقدر في نفس الوقت يزيد يضرب يعني يستنى شوي ةقت 5 تواني او 10 تواني ويقدر يضرب

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

انا عملت كدا عشان الصواريخ تطلع ورى بعض

Posted
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 ثواني

Posted
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 ثواني

ههه مشكور والله

Posted
1 minute ago, FaHaD said:

حياك الله

انت مبدع صح؟

انا مافهمت الداتا من زاحف ياريت تشرحلي امتله عشان افهمها كويس

 

Posted (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 by FaHaD
  • Like 2
Posted
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
  )

 

 

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

يعني ان الداتا متل الاكاونت داتا بزبط

Posted
1 hour ago, Abdul KariM said:

@FaHaD

getPlayerMoney > client 

مافيه ارقمنت لاعب

 

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

@mahmod3 تقريباً نفس الشيء تستعمل لتخزين قيم لكن هذي تخزن لكن مش بالاكاونت بالاعب نفسة 

  • Like 1
Posted

اضافة لذلك اتوقع ان اذا طلقت صواريخ مايشوفه الا الاعب نفسه

مايشوفه الباقيه فـ اذا كان كذا سوي ترايقر للسيرفر وخلي التحققات كله سيرفر وبعدين سوي ترايقر للكلينت 

افضلك بكثير من الي انت مسويه ذا 

ولك الخيار وبالتوفيق ان شاء الله 

Posted
1 hour ago, NssoR said:

كود إنشاء الصاروخ , غريب نوعأما مع انه كلنت ولكن الكل يقدر يشوف الصاروخ

 

صحيح انا مستغرب لذا الشي الى الآن لكن مايهم :)

  • Like 1
Posted
49 minutes ago, Abdul KariM said:

طيب لو انا ضربت عليك مثلا صاروخ يأثر فيك ولا ؟

 

كل شي تمام الصاروخ يضهر لكل اللاعبين ولما الصاروخ يضرب في انا ماتتفجر سيارتي وادا ضربت احد او ضربني احد تتفجر السيارة يعني كل شي تمام

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