Jump to content

حل مشكلة جدول


Recommended Posts

الحين انا مسوي لوب فاضي

خلصت

سويت اضافة سيارة داخل اللوب

خلصت

بس ابي اتحقق اذا داخل لوب فوق 1 سيارة

يحذف السيارة الاولى ويضيف سيارة جديدة

محاولتي

  
vehicles = {} 
  
vehicles.vehicle[source] = createVehicle(411,x+10,y,z) 
if #vehicles =< 1 then 
destroyElement(vehicles[1]) 
  

Link to comment

بما انك تبي تحقق وجود السيارة او لا , ليه تسوي تحقق بالكمية؟

if vehicles.vehicle[source] then 
    if isElement ( vehicles.vehicle[source] ) then 
        -- destroy  
    end 
end 

Link to comment
الحين انا مسوي لوب فاضي

خلصت

سويت اضافة سيارة داخل اللوب

خلصت

بس ابي اتحقق اذا داخل لوب فوق 1 سيارة

يحذف السيارة الاولى ويضيف سيارة جديدة

محاولتي

  
vehicles = {} 
  
vehicles.vehicle[source] = createVehicle(411,x+10,y,z) 
if #vehicles =< 1 then 
destroyElement(vehicles[1]) 
  

ممكن توضح لنا اكتر :roll:

Link to comment

يقولي من هنا تبدأ المشاكل , :

  
vehicles = {} 
  
addEvent('CarVIP',true) 
addEventHandler('CarVIP',root,function() 
local x,y,z = getElementPosition(source) 
vehicles.vehicle[source] = createVehicle(411,x+10,y,z) 
if vehicles.vehicle[source] then 
    if isElement ( vehicles.vehicle[source] ) then 
        destroyElement(vehicles.vehicle[source]) 
    end 
end 
end) 
  
vehicles2 = {} 
  
addEvent('CreateVehicle',true) 
addEventHandler('CreateVehicle',root,function( ID ) 
local x,y,z = getElementPosition(source) 
vehicles2.vehicle[source] = createVehicle(ID,x+10,y,z) 
if vehicles2.vehicle[source] then 
    if isElement ( vehicles2.vehicle[source] ) then 
        destroyElement(vehicles2.vehicle[source]) 
    end 
end 
end) 
  

اتمنى التصحيح

Link to comment

جرب كدا يا لوفي

vehicles = {} -- Vehicle table 
  
addEvent('CarVIP',true) 
addEventHandler('CarVIP',root,function() 
local x,y,z = getElementPosition(source) 
vehicles.vehicle[source] = createVehicle(411,x+10,y,z) 
if vehicles.vehicle[source] then 
    if isElement ( vehicles.vehicle[source] ) then 
        destroyElement(vehicles.vehicle[source]) 
        vehicles[source] = nil 
    end 
end 
end) 
  
vehicles2 = {} 
  
addEvent('CreateVehicle',true) 
addEventHandler('CreateVehicle',root,function( ID ) 
local x,y,z = getElementPosition(source) 
vehicles2.vehicle[source] = createVehicle(ID,x+10,y,z) 
if vehicles2.vehicle[source] then 
    if isElement ( vehicles2.vehicle[source] ) then 
        destroyElement(vehicles2.vehicle[source]) 
        vehicles[source] = nil 
    end 
end 
end) 

Link to comment

vehicles = {} 
addEvent('CarVIP',true) 
addEventHandler('CarVIP',root,function() 
local x,y,z = getElementPosition(source) 
if isElement (vehicles[source]) then 
destroyElement (vehicles[source]) 
end 
vehicles[source] = createVehicle(411,x+10,y,z) 
end)  
vehicles2 = {} 
addEvent('CreateVehicle',true) 
addEventHandler('CreateVehicle',root,function( ID ) 
local x,y,z = getElementPosition(source) 
if isElement (vehicles2[source]) then 
destroyElement (vehicles2[source]) 
end 
vehicles2[source] = createVehicle(ID,x+10,y,z) 
end) 
  
Link to comment
جرب كدا يا لوفي
vehicles = {} -- Vehicle table 
  
addEvent('CarVIP',true) 
addEventHandler('CarVIP',root,function() 
local x,y,z = getElementPosition(source) 
vehicles.vehicle[source] = createVehicle(411,x+10,y,z) 
if vehicles.vehicle[source] then 
    if isElement ( vehicles.vehicle[source] ) then 
        destroyElement(vehicles.vehicle[source]) 
        vehicles[source] = nil 
    end 
end 
end) 
  
vehicles2 = {} 
  
addEvent('CreateVehicle',true) 
addEventHandler('CreateVehicle',root,function( ID ) 
local x,y,z = getElementPosition(source) 
vehicles2.vehicle[source] = createVehicle(ID,x+10,y,z) 
if vehicles2.vehicle[source] then 
    if isElement ( vehicles2.vehicle[source] ) then 
        destroyElement(vehicles2.vehicle[source]) 
        vehicles[source] = nil 
    end 
end 
end) 

كودك هريسس ,

تمام اشتغل كودك ي

@DTC12

Link to comment

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

  
addEvent('Destroy',true) 
addEventHandler('Destroy',root,function() 
if #vehicles2 ~= 0 and #vehicles2 == 2 then  
Num = #vehicles2 - 1 
destroyElement( vehicles2 [ Num ] ) 
table.remove( vehicles2, Num) 
end 
end) 
  

Link to comment
طيب انا حاولت اسوي خاصية الحذف ولاقدرت محاولتي
  
addEvent('Destroy',true) 
addEventHandler('Destroy',root,function() 
if #vehicles2 ~= 0 and #vehicles2 == 2 then  
Num = #vehicles2 - 1 
destroyElement( vehicles2 [ Num ] ) 
table.remove( vehicles2, Num) 
end 
end) 
  

if vehicles.vehicle[source] then 
    if isElement ( vehicles.vehicle[source] ) then 
        -- destroy  
    end 
end 

ماله داعي تعقد المسألة

Link to comment
جرب كدا يا لوفي
vehicles = {} -- Vehicle table 
  
addEvent('CarVIP',true) 
addEventHandler('CarVIP',root,function() 
local x,y,z = getElementPosition(source) 
vehicles.vehicle[source] = createVehicle(411,x+10,y,z) 
if vehicles.vehicle[source] then 
    if isElement ( vehicles.vehicle[source] ) then 
        destroyElement(vehicles.vehicle[source]) 
        vehicles[source] = nil 
    end 
end 
end) 
  
vehicles2 = {} 
  
addEvent('CreateVehicle',true) 
addEventHandler('CreateVehicle',root,function( ID ) 
local x,y,z = getElementPosition(source) 
vehicles2.vehicle[source] = createVehicle(ID,x+10,y,z) 
if vehicles2.vehicle[source] then 
    if isElement ( vehicles2.vehicle[source] ) then 
        destroyElement(vehicles2.vehicle[source]) 
        vehicles[source] = nil 
    end 
end 
end) 

كودك هريسس ,

تمام اشتغل كودك ي

@DTC12

شكرا :mrgreen:

Link to comment

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