Jump to content

استبدال سيارات


Recommended Posts

سلام عليكم

كيفكم ان سويت مود تشغيل واطفاء سيارات عشان اللاق للزوار يخف

المهم سويت لوحة وازرار بس اللوحة ماتبي تظهر

  
swtch = true 
cars = { 
{"Camry",411} 
} 
for i,v in ipairs(cars) do 
local row = guiGridListAddRow(grid) 
guiGridListSetItemText(grid,row,1,''..i..'-',false,false) 
  
  
guiGridListSetItemText(grid,row,2,v[1],false,false) 
guiGridListSetItemData(grid,row,2,v[2]) 
guiGridListSetItemColor(grid,row,1,255,0,0) 
guiGridListSetItemColor(grid,row,2,0,255,0) 
end 
--- 
addEventHandler("onClientGUIClick",root, 
function () 
if source == btn_stop then 
if (guiGridListGetSelectedItem(grid)) then 
if swtch = true then 
local id = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
engineRestoreModel(id) 
swtch = false 
elseif swtch = false 
local id1 = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
engineLoadTXD(id1".txd") 
engineImportTXD(id1".txd",id1) 
engineLoadDFF(id1".dff") 
engineReplaceModel(id1".dff",id1) 
swtch = true end 
else 
outputChatBox("* من فضلك اختر سياره لااطفائها",255,0,0) 
end 
end  
end 
) 

اتمنى تصلحون المشكلة + قولو لي مكانها عشان ما اقع في نفس الخطأ مرة ثانية

Link to comment

الدي بق ما يقول شيء وكمان ما اشتغل

وهذا الكود كااامل

  
w = guiCreateWindow(360, 95, 229, 393, "TEXT", false) 
guiWindowSetSizable(w, false) 
grid = guiCreateGridList(9, 21, 210, 275, false, w) 
guiGridListAddColumn(grid, "#", 0.2) 
guiGridListAddColumn(grid, "السيارات", 0.9) 
btn_stop = guiCreateButton(20, 308, 189, 35, "اطفاء / تشغيل السياره", false, w) 
guiSetFont(btn_stop, "default-bold-small") 
guiSetProperty(btn_stop, "NormalTextColour", "FFFF0000") 
  
--------------------- 
  
cars = { 
{"Camry",406}, 
} 
for i,v in ipairs(cars) do 
local row = guiGridListAddRow(grid) 
guiGridListSetItemText(grid,row,1,''..i..'-',false,false) 
  
  
guiGridListSetItemText(grid,row,2,v[1],false,false) 
guiGridListSetItemData(grid,row,2,v[2]) 
guiGridListSetItemColor(grid,row,1,255,0,0) 
guiGridListSetItemColor(grid,row,2,0,255,0) 
end 
-------- 
addEventHandler("onClientGUIClick",root, 
function () 
if source == btn_stop then 
if (guiGridListGetSelectedItem(grid)) then 
if swtch = true then 
local id = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
engineRestoreModel(id) 
swtch = false 
elseif swtch = false 
local id1 = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
engineLoadTXD(id1".txd") 
engineImportTXD(id1".txd",id1) 
engineLoadDFF(id1".dff") 
engineReplaceModel(id1".dff",id1) 
swtch = true end 
else 
outputChatBox("* من فضلك اختر سياره لااطفائها",255,0,0) 
end 
end  
end 
) 

قول لي وش الخطأ لو سمحت + صححه

Link to comment
w = guiCreateWindow(360, 95, 229, 393, "TEXT", false) 
guiWindowSetSizable(w, false) 
grid = guiCreateGridList(9, 21, 210, 275, false, w) 
guiGridListAddColumn(grid, "#", 0.2) 
guiGridListAddColumn(grid, "السيارات", 0.9) 
btn_stop = guiCreateButton(20, 308, 189, 35, "اطفاء / تشغيل السياره", false, w) 
guiSetFont(btn_stop, "default-bold-small") 
guiSetProperty(btn_stop, "NormalTextColour", "FFFF0000") 
  
--------------------- 
  
cars = { 
{"Camry",406}, 
} 
  
for i,v in ipairs(cars) do 
local row = guiGridListAddRow(grid) 
guiGridListSetItemText(grid,row,1,''..i..'-',false,false) 
  
  
guiGridListSetItemText(grid,row,2,v[1],false,false) 
guiGridListSetItemData(grid,row,2,v[2]) 
guiGridListSetItemColor(grid,row,1,255,0,0) 
guiGridListSetItemColor(grid,row,2,0,255,0) 
end 
-------- 
  
addEventHandler("onClientGUIClick",root, 
function () 
local id = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
if source == btn_stop then 
if ( guiGridListGetSelectedItem(grid) == -1 ) then return outputChatBox("* من فضلك اختر سياره لااطفائها",255,0,0) end 
engineRestoreModel(id) 
--- كمل كودك هنا 
end 
end 
) 

Link to comment

الكود اشتغل مشكوووووور بس ممكن تقول لي وش كان الخطأ عشان ما أقع في ثاني

edit #1:

بس في شيء ما اشتغل لما اضغط اطفاء ما يبي يطفي السيارة ولما اضغط تشغيل ما يبي يشغل السيارة

    addEventHandler("onClientGUIClick",root, 
    function () 
    local id = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
    if source == btn_stop then 
    if ( guiGridListGetSelectedItem(grid) == -1 ) then return outputChatBox("* من فضلك اختر سياره لااطفائها",255,0,0) end 
    if swtch == true then 
    engineRestoreModel(id) 
    swtch = false 
    elseif swtch == false then 
    engineLoadTXD(id".txd") 
    engineImportTXD(id".txd",id1) 
    engineLoadDFF(id".dff") 
    engineReplaceModel(id".dff",id1) 
    swtch = true  
    end 
    end 
    end 
    ) 

Link to comment

الاخطاء هي انك ضايف شي ماله فايدة

الكود اشتغل مشكوووووور بس ممكن تقول لي وش كان الخطأ عشان ما أقع في ثاني

edit #1:

بس في شيء ما اشتغل لما اضغط اطفاء ما يبي يطفي السيارة ولما اضغط تشغيل ما يبي يشغل السيارة

    addEventHandler("onClientGUIClick",root, 
    function () 
    local id = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
    if source == btn_stop then 
    if ( guiGridListGetSelectedItem(grid) == -1 ) then return outputChatBox("* من فضلك اختر سياره لااطفائها",255,0,0) end 
    if swtch == true then--<<هنا 
    engineRestoreModel(id) 
    swtch = false--<<هنا 
    elseif swtch == false then--<<هنا 
    engineLoadTXD(id".txd") 
    engineImportTXD(id".txd",id1) 
    engineLoadDFF(id".dff") 
    engineReplaceModel(id".dff",id1) 
    swtch = true --<<< هنا 
    end 
    end 
    end 
    ) 

Link to comment

-- Client Side # 
w = guiCreateWindow(360, 95, 229, 393, 'TEXT', false) 
guiWindowSetSizable(w, false) 
grid = guiCreateGridList(9, 21, 210, 275, false, w) 
guiGridListAddColumn(grid, '#', 0.2) 
guiGridListAddColumn(grid, 'السيارات', 0.9) 
btn_stop = guiCreateButton(20, 308, 189, 35, 'اطفاء / تشغيل السياره', false, w) 
guiSetFont(btn_stop, 'default-bold-small') 
guiSetProperty(btn_stop, 'NormalTextColour', 'FFFF0000') 
showCursor ( true ) 
  
local state = true 
  
cars = { 
    {'Camry',406} 
} 
  
for i,v in ipairs(cars) do 
    local row = guiGridListAddRow(grid) 
    guiGridListSetItemText(grid,row,1,i..'-',false,false) 
    guiGridListSetItemText(grid,row,2,v[1],false,false) 
    guiGridListSetItemData(grid,row,2,v[2]) 
    guiGridListSetItemColor(grid,row,1,255,0,0) 
    guiGridListSetItemColor(grid,row,2,0,255,0) 
end 
  
addEventHandler('onClientGUIClick',btn_stop,function () 
    if guiGridListGetSelectedItem(grid) ~= -1 then 
        if state == true  then 
            id = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
                engineRestoreModel(id) 
                        state = false 
            else 
                    engineImportTXD(engineLoadTXD(id..'.txd'), id) 
                        engineReplaceModel(engineLoadDFF(id..'.dff'),id) 
                            state = true 
            end 
        end 
    end,false 
) 
Link to comment
-- Client Side # 
w = guiCreateWindow(360, 95, 229, 393, 'TEXT', false) 
guiWindowSetSizable(w, false) 
grid = guiCreateGridList(9, 21, 210, 275, false, w) 
guiGridListAddColumn(grid, '#', 0.2) 
guiGridListAddColumn(grid, 'السيارات', 0.9) 
btn_stop = guiCreateButton(20, 308, 189, 35, 'اطفاء / تشغيل السياره', false, w) 
guiSetFont(btn_stop, 'default-bold-small') 
guiSetProperty(btn_stop, 'NormalTextColour', 'FFFF0000') 
showCursor ( true ) 
  
local state = true 
  
cars = { 
    {'Camry',406} 
} 
  
for i,v in ipairs(cars) do 
    local row = guiGridListAddRow(grid) 
    guiGridListSetItemText(grid,row,1,i..'-',false,false) 
    guiGridListSetItemText(grid,row,2,v[1],false,false) 
    guiGridListSetItemData(grid,row,2,v[2]) 
    guiGridListSetItemColor(grid,row,1,255,0,0) 
    guiGridListSetItemColor(grid,row,2,0,255,0) 
end 
  
addEventHandler('onClientGUIClick',btn_stop,function () 
    if guiGridListGetSelectedItem(grid) ~= -1 then 
        if state == true  then 
            id = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
                engineRestoreModel(id) 
                        state = false 
            else 
                    engineImportTXD(engineLoadTXD(id..'.txd'), id) 
                        engineReplaceModel(engineLoadDFF(id..'.dff'),id) 
                            state = true 
            end 
        end 
    end,false 
) 

الكود ما اشتغل لما اضغط تشغيل السيارة ما يشغلها

يعني ابيه لما اضغط تشغيل يستبدل السيارة بملف dffو txd

موجود في المود نفسه

بس مارضي يشتغل

Link to comment

انت تبي اول ما يضغط الزر , الضغطه الاولى يشغل او يطفي ؟

انا مسويه الضغطه الاولى يطفي , اذا تبي العكس :

-- Client Side # 
w = guiCreateWindow(360, 95, 229, 393, 'TEXT', false) 
guiWindowSetSizable(w, false) 
grid = guiCreateGridList(9, 21, 210, 275, false, w) 
guiGridListAddColumn(grid, '#', 0.2) 
guiGridListAddColumn(grid, 'السيارات', 0.9) 
btn_stop = guiCreateButton(20, 308, 189, 35, 'اطفاء / تشغيل السياره', false, w) 
guiSetFont(btn_stop, 'default-bold-small') 
guiSetProperty(btn_stop, 'NormalTextColour', 'FFFF0000') 
showCursor ( true ) 
  
local state = true 
  
cars = { 
    {'Camry',406} 
} 
  
for i,v in ipairs(cars) do 
    local row = guiGridListAddRow(grid) 
    guiGridListSetItemText(grid,row,1,i..'-',false,false) 
    guiGridListSetItemText(grid,row,2,v[1],false,false) 
    guiGridListSetItemData(grid,row,2,v[2]) 
    guiGridListSetItemColor(grid,row,1,255,0,0) 
    guiGridListSetItemColor(grid,row,2,0,255,0) 
end 
  
addEventHandler('onClientGUIClick',btn_stop,function () 
    if guiGridListGetSelectedItem(grid) ~= -1 then 
        if state == true  then 
            id = guiGridListGetItemData (grid, guiGridListGetSelectedItem (grid), 2) 
                engineImportTXD(engineLoadTXD(id..'.txd'), id) 
                    engineReplaceModel(engineLoadDFF(id..'.dff'),id) 
                        state = false 
            else 
                    engineRestoreModel(id) 
                            state = true 
            end 
        end 
    end,false 
) 
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...