#Hulk Posted January 20, 2018 Share Posted January 20, 2018 مشكله في تحميل ف الجريد بيجي false وما يحمل المف xml الخطأ سطر 15 , 16 local screenW, screenH = guiGetScreenSize() wnd2 = guiCreateWindow((screenW - 276) / 2, (screenH - 338) / 2, 276, 338, "Furniture System List", false) guiWindowSetSizable(wnd2, false) guiSetVisible(wnd2,false) gr1 = guiCreateGridList(9, 24, 257, 231, false, wnd2) guiGridListAddColumn(gr1, "ID", 0.5) guiGridListAddColumn(gr1, "Name", 0.5) getit = guiCreateButton(75, 265, 127, 28, "Get it", false, wnd2) cl2 = guiCreateButton(75, 300, 127, 28, "Close", false, wnd2) guiGridListSetSelectionMode(gr1,2) node = xmlLoadFile("objects.xml") for i = 0,2 do subnode = xmlFindSubNode(node,"model", i) id = xmlNodeGetAttribute(subnode,"id") name = xmlNodeGetAttribute(subnode, "name") row = guiGridListAddRow ( gr1 ) guiGridListSetItemText ( gr1, row, 1, tostring(id), false, false ) guiGridListSetItemText ( gr1, row, 2, tostring(name), false, false ) end Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 @Default#^ @Master_MTA Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 5 hours ago, #Hulk said: مشكله في تحميل ف الجريد بيجي false وما يحمل المف xml الخطأ سطر 15 , 16 local screenW, screenH = guiGetScreenSize() wnd2 = guiCreateWindow((screenW - 276) / 2, (screenH - 338) / 2, 276, 338, "Furniture System List", false) guiWindowSetSizable(wnd2, false) guiSetVisible(wnd2,false) gr1 = guiCreateGridList(9, 24, 257, 231, false, wnd2) guiGridListAddColumn(gr1, "ID", 0.5) guiGridListAddColumn(gr1, "Name", 0.5) getit = guiCreateButton(75, 265, 127, 28, "Get it", false, wnd2) cl2 = guiCreateButton(75, 300, 127, 28, "Close", false, wnd2) guiGridListSetSelectionMode(gr1,2) node = xmlLoadFile("objects.xml") for i = 0,2 do subnode = xmlFindSubNode(node,"model", i) id = xmlNodeGetAttribute(subnode,"id") name = xmlNodeGetAttribute(subnode, "name") row = guiGridListAddRow ( gr1 ) guiGridListSetItemText ( gr1, row, 1, tostring(id), false, false ) guiGridListSetItemText ( gr1, row, 2, tostring(name), false, false ) end اعرض الملف Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 9 minutes ago, Master_MTA said: اعرض الملف <objects> <obj name="Door" model="1491" /> <obj name="Door 2" model="1492" /> <obj name="Door 3" model="1494" /> <obj name="Door 4" model="1499" /> <obj name="Door 5" model="1502" /> </objects> Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 local file=fileOpen("objects.xml") xml = xmlLoadFile("objects.xml") local Children=xmlNodeGetChildren(xml) local ta={} for k,v in ipairs(Children) do local attrs = xmlNodeGetAttributes ( v ) local row=guiGridListAddRow() for n,s in pairs(attrs)do if tostring(n)=='name' then guiGridListSetItemText ( gr1, row, 2, tostring(s), false, false ) elseif tostring(n)=='model' then guiGridListSetItemText ( gr1, row, 1, tostring(s), false, false ) end end end غير مجرب جربه وردلي خبر 14 minutes ago, #Hulk said: <objects> <obj name="Door" model="1491" /> <obj name="Door 2" model="1492" /> <obj name="Door 3" model="1494" /> <obj name="Door 4" model="1499" /> <obj name="Door 5" model="1502" /> </objects> Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 13 minutes ago, Master_MTA said: local file=fileOpen("objects.xml") xml = xmlLoadFile("objects.xml") local Children=xmlNodeGetChildren(xml) local ta={} for k,v in ipairs(Children) do local attrs = xmlNodeGetAttributes ( v ) local row=guiGridListAddRow() for n,s in pairs(attrs)do if tostring(n)=='name' then guiGridListSetItemText ( gr1, row, 2, tostring(s), false, false ) elseif tostring(n)=='model' then guiGridListSetItemText ( gr1, row, 1, tostring(s), false, false ) end end end غير مجرب جربه وردلي خبر debug : ERROR: 6 bad argument #1 to 'ipairs' ( table, expected,got boolean ) ما اشتغل Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 52 minutes ago, #Hulk said: debug : ERROR: 6 bad argument #1 to 'ipairs' ( table, expected,got boolean ) ما اشتغل تحقق من ملف xml الخاص بك https://wiki.multitheftauto.com/wiki/XmlNodeGetChildren شوف الرابط بيفيدك الكود سليم مافيه مشكله 1 hour ago, #Hulk said: <objects> <obj name="Door" model="1491" /> <obj name="Door 2" model="1492" /> <obj name="Door 3" model="1494" /> <obj name="Door 4" model="1499" /> <obj name="Door 5" model="1502" /> </objects> ثواني انت عرضت جزء من الملف وليس الملف كلو Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 3 minutes ago, Master_MTA said: تحقق من ملف xml الخاص بك https://wiki.multitheftauto.com/wiki/XmlNodeGetChildren شوف الرابط بيفيدك الكود سليم مافيه مشكله الملف مظبوط , كل الي ابيه انه يجيب الاوبجكتات في الجريد ليست عن طريق الملف اوبجكت ! 5 minutes ago, Master_MTA said: تحقق من ملف xml الخاص بك https://wiki.multitheftauto.com/wiki/XmlNodeGetChildren شوف الرابط بيفيدك الكود سليم مافيه مشكله ثواني انت عرضت جزء من الملف وليس الملف كلو ده كل المف ! Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 1 minute ago, #Hulk said: الملف مظبوط , كل الي ابيه انه يجيب الاوبجكتات في الجريد ليست عن طريق الملف اوبجكت ! اعرض الملف كامل Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 Just now, Master_MTA said: اعرض الملف كامل <objects> <obj name="Door" model="1491" /> <obj name="Door 2" model="1492" /> <obj name="Door 3" model="1494" /> <obj name="Door 4" model="1499" /> <obj name="Door 5" model="1502" /> </objects> كل الملف ده Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 Just now, #Hulk said: <objects> <obj name="Door" model="1491" /> <obj name="Door 2" model="1492" /> <obj name="Door 3" model="1494" /> <obj name="Door 4" model="1499" /> <obj name="Door 5" model="1502" /> </objects> كل الملف ده local file=fileOpen("objects.xml") xml = xmlLoadFile("objects.xml") local Children=xmlNodeGetChildren(xml) local ta={} for k,v in ipairs(Children) do local attrs = xmlNodeGetAttributes ( v ) local row=guiGridListAddRow() print(#attrs) for n,s in pairs(attrs)do if tostring(n)=='name' then guiGridListSetItemText ( gr1, row, 2, tostring(s), false, false ) elseif tostring(n)=='model' then guiGridListSetItemText ( gr1, row, 1, tostring(s), false, false ) end end end قولي ايه اللي بيطلعلك في الدي بق عشان اكون فاهم في رقم هيطلعلك لو 1 قولي ولو 2 قلي ولو 0 قول اي شي لو nil Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 9 minutes ago, Master_MTA said: local file=fileOpen("objects.xml") xml = xmlLoadFile("objects.xml") local Children=xmlNodeGetChildren(xml) local ta={} for k,v in ipairs(Children) do local attrs = xmlNodeGetAttributes ( v ) local row=guiGridListAddRow() print(#attrs) for n,s in pairs(attrs)do if tostring(n)=='name' then guiGridListSetItemText ( gr1, row, 2, tostring(s), false, false ) elseif tostring(n)=='model' then guiGridListSetItemText ( gr1, row, 1, tostring(s), false, false ) end end end قولي ايه اللي بيطلعلك في الدي بق عشان اكون فاهم في رقم هيطلعلك لو 1 قولي ولو 2 قلي ولو 0 قول اي شي لو nil مو جايب برينت اصلا الديبق : ERROR 7 : bad argument #1 to 'ipairs' (table expected,got boolean) Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 Just now, #Hulk said: مو جايب برينت اصلا الديبق : ERROR 7 : bad argument #1 to 'ipairs' (table expected,got boolean) حلو الحين ابيك قبل for الكود ذا وتجرب عشان اعرف وين المشكله print(#Children) Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 4 minutes ago, Master_MTA said: حلو الحين ابيك قبل for الكود ذا وتجرب عشان اعرف وين المشكله print(#Children) ERROR 6 : attempt to get length of local 'Children' (a boolean value) Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 xml = xmlLoadFile("objects.xml") for i = 1,3 do if i<3 then subnode = xmlFindChild(node,"model", i-1) id = xmlNodeGetAttribute(subnode,"id") name = xmlNodeGetAttribute(subnode, "name") row = guiGridListAddRow ( gr1 ) guiGridListSetItemText ( gr1, row, 1, tostring(id), false, false ) guiGridListSetItemText ( gr1, row, 2, tostring(name), false, false ) end end جرب كده Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 2 minutes ago, Master_MTA said: xml = xmlLoadFile("objects.xml") for i = 1,3 do if i<3 then subnode = xmlFindChild(node,"model", i-1) id = xmlNodeGetAttribute(subnode,"id") name = xmlNodeGetAttribute(subnode, "name") row = guiGridListAddRow ( gr1 ) guiGridListSetItemText ( gr1, row, 1, tostring(id), false, false ) guiGridListSetItemText ( gr1, row, 2, tostring(name), false, false ) end end جرب كده الديبق مو جايب شي بس الجريد ليست false Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 7 minutes ago, #Hulk said: الديبق مو جايب شي بس الجريد ليست false مش فاهم Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 2 minutes ago, Master_MTA said: مش فاهم شوف الصوره Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 1 minute ago, #Hulk said: شوف الصوره انته حيرتني هات المود في الخاص الله يهديك Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 معاك فيس طيب ؟ 9 minutes ago, Master_MTA said: انته حيرتني هات المود في الخاص الله يهديك Link to comment
Master_MTA Posted January 20, 2018 Share Posted January 20, 2018 Just now, #Hulk said: معاك فيس طيب ؟ متجيبه هنا في الخاص Link to comment
#Hulk Posted January 20, 2018 Author Share Posted January 20, 2018 1 minute ago, Master_MTA said: متجيبه هنا في الخاص بعته بس اسهل فيس ... Link to comment
' A F . Posted January 20, 2018 Share Posted January 20, 2018 function getXMLNodes(xmlfile,nodename) local xml = xmlLoadFile(xmlfile) if xml then local ntable={} local a = 0 while xmlFindChild(xml,nodename,a) do table.insert(ntable,a+1) ntable[a+1]={} local attrs = xmlNodeGetAttributes ( xmlFindChild(xml,nodename,a) ) for name,value in pairs ( attrs ) do table.insert(ntable[a+1],name) ntable[a+1][name]=value end ntable[a+1]["nodevalue"]=xmlNodeGetValue(xmlFindChild(xml,nodename,a)) a=a+1 end return ntable else return {} end end for k,v in ipairs ( getXMLNodes ( "objects.xml" , "obj" ) ) do local row = guiGridListAddRow ( gr1 ) ; guiGridListSetItemText ( gr1 , row , 1 , v.name , false , false ) guiGridListSetItemText ( gr1 , row , 2 , v.model , false , false ) end Link to comment
#Hulk Posted January 21, 2018 Author Share Posted January 21, 2018 (edited) 16 hours ago, Default#^ said: function getXMLNodes(xmlfile,nodename) local xml = xmlLoadFile(xmlfile) if xml then local ntable={} local a = 0 while xmlFindChild(xml,nodename,a) do table.insert(ntable,a+1) ntable[a+1]={} local attrs = xmlNodeGetAttributes ( xmlFindChild(xml,nodename,a) ) for name,value in pairs ( attrs ) do table.insert(ntable[a+1],name) ntable[a+1][name]=value end ntable[a+1]["nodevalue"]=xmlNodeGetValue(xmlFindChild(xml,nodename,a)) a=a+1 end return ntable else return {} end end for k,v in ipairs ( getXMLNodes ( "objects.xml" , "obj" ) ) do local row = guiGridListAddRow ( gr1 ) ; guiGridListSetItemText ( gr1 , row , 1 , v.name , false , false ) guiGridListSetItemText ( gr1 , row , 2 , v.model , false , false ) end شكرا اشتغل <3 سؤال تاني , عايز لمه يحدد جريد ويضغط جيت يجيب الاوبجكت Edited January 21, 2018 by #Hulk Link to comment
' A F . Posted January 21, 2018 Share Posted January 21, 2018 'onClientDoubleClick' guiGridListGetSelectedItem guiGridListGetItemText getElementPosition triggerServerEvent createObject 1 Link to comment
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