Jump to content

ملف XML


Recommended Posts

Posted

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

ابي اعرف كيف استخدم ملف الاكس ام ال

مثلا لو ابي احفظ الكلام اللي في guiEdit

مع مثال لو تكرمتم

والسلام خير ختام

لا اله الا الله محمد رسول الله

Posted

الاكس ام ل , انا اشوف انه ماهو بذيك الصعوبه

لاكن بعض الناس يحط بعقله ذا الشي , لاكن مهي مشكله

راح اعطيك مثال صغير عن حفظ الكلام في ايديت او جلبه

edit = guiCreateEdit (....) 
save = guiCreateButton (....) 
  
addEventHandler ("onClientResourceStart", resourceRoot, function () -- اول ما يشتغل 
    local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
    if not xml then return end -- اذا ما كان موجود يوقف الوظيفه 
    local child = xmlFindChild (xml, "TheText", 0 ) -- نجيب مكان الكتابه 
    if (child) then -- اذا مكان الكتابه موجود 
    local text = xmlNodeGetValue (child) -- نجيب الكلام 
    guiSetText (edit, text) -- نكتبه 
    end 
end 
) 
  
addEventHandler ("onClientGUIClick", resourceRoot, function () 
    if (source == save) then -- اذا كان الزر زر الحفظ 
        local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
        local child = xmlFindChild (xml, "TheText", 0 ) or xmlCreateChild (xml, "TheText") -- نجيب مكان الكتابه 
        xmlNodeSetValue (child, guiGetText (edit))  -- نكتب الكلام في مكان الكتابه 
        xmlSaveFile (xml) -- نحفظ الملف 
        xmlUnloadFile (xml) -- نقفل الملف 
    end 
end 
)  
Posted
الاكس ام ل , انا اشوف انه ماهو بذيك الصعوبه

لاكن بعض الناس يحط بعقله ذا الشي , لاكن مهي مشكله

راح اعطيك مثال صغير عن حفظ الكلام في ايديت او جلبه

edit = guiCreateEdit (....) 
save = guiCreateButton (....) 
  
addEventHandler ("onClientResourceStart", resourceRoot, function () -- اول ما يشتغل 
    local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
    if not xml then return end -- اذا ما كان موجود يوقف الوظيفه 
    local child = xmlFindChild (xml, "TheText", 0 ) -- نجيب مكان الكتابه 
    if (child) then -- اذا مكان الكتابه موجود 
    local text = xmlNodeGetValue (child) -- نجيب الكلام 
    guiSetText (edit, text) -- نكتبه 
    end 
end 
) 
  
addEventHandler ("onClientGUIClick", resourceRoot, function () 
    if (source == save) then -- اذا كان الزر زر الحفظ 
        local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
        local child = xmlFindChild (xml, "TheText", 0 ) or xmlCreateChild (xml, "TheText") -- نجيب مكان الكتابه 
        xmlNodeSetValue (child, guiGetText (edit))  -- نكتب الكلام في مكان الكتابه 
        xmlSaveFile (xml) -- نحفظ الملف 
        xmlUnloadFile (xml) -- نقفل الملف 
    end 
end 
)  

ممكن توضح اكثر لو سمحت

ايش Text و TheText

ومشكور

Posted

text

;rootNodeName: the name of the root node in the XML document.

TheText

tagName: This is the name of the child node you wish to find (case-sensitive).

Posted
الاكس ام ل , انا اشوف انه ماهو بذيك الصعوبه

لاكن بعض الناس يحط بعقله ذا الشي , لاكن مهي مشكله

راح اعطيك مثال صغير عن حفظ الكلام في ايديت او جلبه

edit = guiCreateEdit (....) 
save = guiCreateButton (....) 
  
addEventHandler ("onClientResourceStart", resourceRoot, function () -- اول ما يشتغل 
    local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
    if not xml then return end -- اذا ما كان موجود يوقف الوظيفه 
    local child = xmlFindChild (xml, "TheText", 0 ) -- نجيب مكان الكتابه 
    if (child) then -- اذا مكان الكتابه موجود 
    local text = xmlNodeGetValue (child) -- نجيب الكلام 
    guiSetText (edit, text) -- نكتبه 
    end 
end 
) 
  
addEventHandler ("onClientGUIClick", resourceRoot, function () 
    if (source == save) then -- اذا كان الزر زر الحفظ 
        local xml = xmlLoadFile ("Save.xml") or xmlCreateFile ("Save.xml", "Text") -- نفتح الملف 
        local child = xmlFindChild (xml, "TheText", 0 ) or xmlCreateChild (xml, "TheText") -- نجيب مكان الكتابه 
        xmlNodeSetValue (child, guiGetText (edit))  -- نكتب الكلام في مكان الكتابه 
        xmlSaveFile (xml) -- نحفظ الملف 
        xmlUnloadFile (xml) -- نقفل الملف 
    end 
end 
)  

وضح اكتر لاهنت

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