Jump to content

حل كود


Recommended Posts

Posted

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

انا يا شباب لي وقت ما قد طرحت مواضيع

لكن الحين انا ابي اعرف الحل سويت المود لكن ما اشتغل

.::الكود::.

pcar = {} 
  
addCommandHandler("car", 
    function (source) 
        local x,y,z = getElementPosition(source) 
        local pcar[source] = createVehicle(411,x,y,z) 
        warpPedIntoVehicle(source,pcar[source]) 
        outputChatBox("* This is Your Car",source,0,255,0) 
    end 
) 
  
addEventHandler("onVehicleExplode",pcar[source], 
    function () 
        destroyElement(pcar[source]) 
    end 
) 
  

your Answer plz

Posted
pcar = {} 
  
addCommandHandler("car", 
    function (source) 
        local x,y,z = getElementPosition(source) 
        pcar[source] = createVehicle(411,x,y,z) 
        warpPedIntoVehicle(source,pcar[source]) 
        outputChatBox("* This is Your Car",source,0,255,0) 
        addEventHandler("onVehicleExplode",pcar[source], function() destroyElement(source) end) 
    end 
) 

الخطأ كان في

local pcar[source] = createVehicle(411,x,y,z) 

الصحيح هو

pcar[source] = createVehicle(411,x,y,z) 

لان pcar

يعتبر تيبل خارج الدالة

لكذا ما يصلح تحط local

ايضا

addEventHandler("onVehicleExplode",pcar[source], 
    function () 
        destroyElement(pcar[source]) 
    end 
) 

يعتبر خطأ

جرب الكود الي حطيته لك اعلى شي

Posted

كلامك كله صح بس انت عندك غلطه في كودك

ذا الصح

pcar = {} 
  
addCommandHandler("car", 
    function (source) 
        local x,y,z = getElementPosition(source) 
        pcar[source] = createVehicle(411,x,y,z) 
        warpPedIntoVehicle(source,pcar[source]) 
        outputChatBox("* This is Your Car",source,0,255,0) 
        addEventHandler("onVehicleExplode",pcar[source], function() destroyElement(pcar[source]) end) 
    end 
) 

بس مشكور صراحة استفدت منك كثير شكراا

انت كنت مخلي الديستروي على source

Posted

لا اخوي كودي صحيح :mrgreen:

لان source في

addEventHandler("onVehicleExplode",pcar[source], function() destroyElement(source) end) 

ليست اللاعب، بل هي السيارة نفسها

لان الـ source للايفنت

onVehicleExplode 

هي السيارة

راجع الايفينت وتعرف وش اقصد

وهذا الكود نفسه سويت فيه تعديل بسيط عشان توصل لك الفكرة بس

pcar = {} 
  
addCommandHandler("car", 
    function (player) 
        local x,y,z = getElementPosition(player) 
        pcar[player] = createVehicle(411,x,y,z) 
        warpPedIntoVehicle(player,pcar[player]) 
        outputChatBox("* This is Your Car",player,0,255,0) 
        addEventHandler("onVehicleExplode",pcar[player], function() destroyElement(source) end) 
    end 
) 

ونصيحة، اذا جيت تستخدم

addCommandHandler 

حاول ما تخلي المتغير للاعب يكون source

خله اي شي ثاني، مثلاا player

عشان ما تتلخبط بعدين

Posted
كلامك كله صح بس انت عندك غلطه في كودك

ذا الصح

pcar = {} 
  
addCommandHandler("car", 
    function (source) 
        local x,y,z = getElementPosition(source) 
        pcar[source] = createVehicle(411,x,y,z) 
        warpPedIntoVehicle(source,pcar[source]) 
        outputChatBox("* This is Your Car",source,0,255,0) 
        addEventHandler("onVehicleExplode",pcar[source], function() destroyElement(pcar[source]) end) 
    end 
) 

بس مشكور صراحة استفدت منك كثير شكراا

انت كنت مخلي الديستروي على source

The source of this event is the vehicle that exploded.

كلام بسول صح

Posted

طيب انا جربت الكود حقه

و كتبت /car

طلعت سيارة و طلعت سلاح و فجرتها و ما اختفت

قلت انزل سيارة ثانية تروح الي تفجرت و ما راحت

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

اذا ما تصدق جرب بنفسك

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