Jump to content

طلب اكواد مود تسجيل الدخول


Recommended Posts

  • Replies 108
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

كود حسن شغآل 100%

Client Side !

GUIEditor_Button = {} 
GUIEditor_Checkbox = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Image = {} 
  
wnd = guiCreateWindow(1,1,799,600,"",false) 
guiSetAlpha(wnd,1) 
GUIEditor_Image[2] = guiCreateStaticImage(10,24,781,449,"1.png",false,wnd) 
GUIEditor_Edit[1] = guiCreateEdit(299,484,166,27,"",false,wnd) 
GUIEditor_Edit[2] = guiCreateEdit(299,520,166,27,"",false,wnd) 
guiEditSetMasked(GUIEditor_Edit[2],true) 
GUIEditor_Label[1] = guiCreateLabel(238,487,106,18,"username",false,wnd) 
GUIEditor_Label[2] = guiCreateLabel(238,521,106,18,"password",false,wnd) 
GUIEditor_Button[1] = guiCreateButton(279,559,78,24,"login",false,wnd) 
GUIEditor_Button[2] = guiCreateButton(432,559,78,24,"register",false,wnd) 
GUIEditor_Checkbox[1] = guiCreateCheckBox(474,522,123,22,"تذكرني",false,false,wnd) 
  
addEventHandler("onClientGUIClick",getRootElement(), 
    function () 
        local user = guiGetText(GUIEditor_Edit[1]) 
        local pass = guiGetText(GUIEditor_Edit[2]) 
        if ( source == GUIEditor_Button[1] ) then 
        guiSetVisible (wnd,false) 
        showCursor(false) 
            if ( guiCheckBoxGetSelected ( GUIEditor_Checkbox[1] ) ) then 
            local file = xmlLoadFile("account.xml") or xmlCreateFile("account.xml","account") 
            xmlNodeSetValue(xmlCreateChild(file,"name"),""..user.."") 
            xmlNodeSetValue(xmlCreateChild(file,"pass"),""..pass.."") 
            xmlSaveFile(file) 
            triggerServerEvent('onlogin',localPlayer,user,pass) 
            end 
        elseif ( source == GUIEditor_Button[2] ) then 
        guiSetVisible (wnd,false) 
        showCursor(false) 
        triggerServerEvent('onre',localPlayer,user,pass)   
        end 
     end 
) 
function show() 
    guiSetVisible(wnd, not guiGetVisible(wnd)) 
    showCursor(guiGetVisible(wnd)) 
end 
bindKey ("F2", "down", show) 

Server Side !

addEvent('onlogin',true) 
addEventHandler('onlogin',getRootElement(), 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
            logIn(source,account,pass) 
        else 
            outputChatBox("* Worng Username Or Password",source,255,0,0) 
        end 
    end 
) 
  
addEvent('onre',true) 
addEventHandler('onre',root, 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
            outputChatBox("* This Account is Already Used",source,255,0,0) 
        else 
            addAccount(user,pass) 
            outputChatBox("UserName: " .. user .. " PassWord : " .. pass,source,0,150,255) 
        end 
    end 
) 
  
 addEventHandler('register', root, 
 function (player, user, pass ) 
 account = addAccount ( user, pass ) 
        if (logIn ( player, account, pass ) == true) then 
        outputChatBox ( "Register  : [ Username ] : " .. user .. " [ Password ] : " .. pass .. "", player, 255, 255, 0 , true ) 
        else 
            outputChatBox ( "Erorr Register", player, 255, 255, 0 ) 
  
        end 
    end) 

ملف account.xml

تلقاة هنآ

C:\Program Files\MTA San Andreas 1.3\mods\deathmatch\resources 

Link to comment
كود حسن شغآل 100%

Client Side !

GUIEditor_Button = {} 
GUIEditor_Checkbox = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Image = {} 
  
wnd = guiCreateWindow(1,1,799,600,"",false) 
guiSetAlpha(wnd,1) 
GUIEditor_Image[2] = guiCreateStaticImage(10,24,781,449,"1.png",false,wnd) 
GUIEditor_Edit[1] = guiCreateEdit(299,484,166,27,"",false,wnd) 
GUIEditor_Edit[2] = guiCreateEdit(299,520,166,27,"",false,wnd) 
guiEditSetMasked(GUIEditor_Edit[2],true) 
GUIEditor_Label[1] = guiCreateLabel(238,487,106,18,"username",false,wnd) 
GUIEditor_Label[2] = guiCreateLabel(238,521,106,18,"password",false,wnd) 
GUIEditor_Button[1] = guiCreateButton(279,559,78,24,"login",false,wnd) 
GUIEditor_Button[2] = guiCreateButton(432,559,78,24,"register",false,wnd) 
GUIEditor_Checkbox[1] = guiCreateCheckBox(474,522,123,22,"تذكرني",false,false,wnd) 
  
addEventHandler("onClientGUIClick",getRootElement(), 
    function () 
        local user = guiGetText(GUIEditor_Edit[1]) 
        local pass = guiGetText(GUIEditor_Edit[2]) 
        if ( source == GUIEditor_Button[1] ) then 
        guiSetVisible (wnd,false) 
        showCursor(false) 
            if ( guiCheckBoxGetSelected ( GUIEditor_Checkbox[1] ) ) then 
            local file = xmlLoadFile("account.xml") or xmlCreateFile("account.xml","account") 
            xmlNodeSetValue(xmlCreateChild(file,"name"),""..user.."") 
            xmlNodeSetValue(xmlCreateChild(file,"pass"),""..pass.."") 
            xmlSaveFile(file) 
            triggerServerEvent('onlogin',localPlayer,user,pass) 
            end 
        elseif ( source == GUIEditor_Button[2] ) then 
        guiSetVisible (wnd,false) 
        showCursor(false) 
        triggerServerEvent('onre',localPlayer,user,pass)   
        end 
     end 
) 
function show() 
    guiSetVisible(wnd, not guiGetVisible(wnd)) 
    showCursor(guiGetVisible(wnd)) 
end 
bindKey ("F2", "down", show) 

Server Side !

addEvent('onlogin',true) 
addEventHandler('onlogin',getRootElement(), 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
            logIn(source,account,pass) 
        else 
            outputChatBox("* Worng Username Or Password",source,255,0,0) 
        end 
    end 
) 
  
addEvent('onre',true) 
addEventHandler('onre',root, 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
            outputChatBox("* This Account is Already Used",source,255,0,0) 
        else 
            addAccount(user,pass) 
            outputChatBox("UserName: " .. user .. " PassWord : " .. pass,source,0,150,255) 
        end 
    end 
) 
  
 addEventHandler('register', root, 
 function (player, user, pass ) 
 account = addAccount ( user, pass ) 
        if (logIn ( player, account, pass ) == true) then 
        outputChatBox ( "Register  : [ Username ] : " .. user .. " [ Password ] : " .. pass .. "", player, 255, 255, 0 , true ) 
        else 
            outputChatBox ( "Erorr Register", player, 255, 255, 0 ) 
  
        end 
    end) 

ملف account.xml

تلقاة هنآ

C:\Program Files\MTA San Andreas 1.3\mods\deathmatch\resources 

طيب مدام كذا اي واحد يزرف اوم الحسابات ؟

Link to comment
لا مو شغال متاكد :mrgreen:

وش الي مو شغال فيه ؟

كود حسن

اضغط على تذكرني

واطلع وادخل وشوف البيانات انحفظت ولا

آهآ , مآ آنتبهت لـ هذي,

بخصوص الحسآبآت آنت خلها, واليوم الثاني سيرفرك مدعوس :lol:

Link to comment
كود حسن شغآل 100%

Client Side !

GUIEditor_Button = {} 
GUIEditor_Checkbox = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Image = {} 
  
wnd = guiCreateWindow(1,1,799,600,"",false) 
guiSetAlpha(wnd,1) 
GUIEditor_Image[2] = guiCreateStaticImage(10,24,781,449,"1.png",false,wnd) 
GUIEditor_Edit[1] = guiCreateEdit(299,484,166,27,"",false,wnd) 
GUIEditor_Edit[2] = guiCreateEdit(299,520,166,27,"",false,wnd) 
guiEditSetMasked(GUIEditor_Edit[2],true) 
GUIEditor_Label[1] = guiCreateLabel(238,487,106,18,"username",false,wnd) 
GUIEditor_Label[2] = guiCreateLabel(238,521,106,18,"password",false,wnd) 
GUIEditor_Button[1] = guiCreateButton(279,559,78,24,"login",false,wnd) 
GUIEditor_Button[2] = guiCreateButton(432,559,78,24,"register",false,wnd) 
GUIEditor_Checkbox[1] = guiCreateCheckBox(474,522,123,22,"تذكرني",false,false,wnd) 
  
addEventHandler("onClientGUIClick",getRootElement(), 
    function () 
        local user = guiGetText(GUIEditor_Edit[1]) 
        local pass = guiGetText(GUIEditor_Edit[2]) 
        if ( source == GUIEditor_Button[1] ) then 
        guiSetVisible (wnd,false) 
        showCursor(false) 
            if ( guiCheckBoxGetSelected ( GUIEditor_Checkbox[1] ) ) then 
            local file = xmlLoadFile("account.xml") or xmlCreateFile("account.xml","account") 
            xmlNodeSetValue(xmlCreateChild(file,"name"),""..user.."") 
            xmlNodeSetValue(xmlCreateChild(file,"pass"),""..pass.."") 
            xmlSaveFile(file) 
            triggerServerEvent('onlogin',localPlayer,user,pass) 
            end 
        elseif ( source == GUIEditor_Button[2] ) then 
        guiSetVisible (wnd,false) 
        showCursor(false) 
        triggerServerEvent('onre',localPlayer,user,pass)   
        end 
     end 
) 
function show() 
    guiSetVisible(wnd, not guiGetVisible(wnd)) 
    showCursor(guiGetVisible(wnd)) 
end 
bindKey ("F2", "down", show) 

Server Side !

addEvent('onlogin',true) 
addEventHandler('onlogin',getRootElement(), 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
            logIn(source,account,pass) 
        else 
            outputChatBox("* Worng Username Or Password",source,255,0,0) 
        end 
    end 
) 
  
addEvent('onre',true) 
addEventHandler('onre',root, 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
            outputChatBox("* This Account is Already Used",source,255,0,0) 
        else 
            addAccount(user,pass) 
            outputChatBox("UserName: " .. user .. " PassWord : " .. pass,source,0,150,255) 
        end 
    end 
) 
  
 addEventHandler('register', root, 
 function (player, user, pass ) 
 account = addAccount ( user, pass ) 
        if (logIn ( player, account, pass ) == true) then 
        outputChatBox ( "Register  : [ Username ] : " .. user .. " [ Password ] : " .. pass .. "", player, 255, 255, 0 , true ) 
        else 
            outputChatBox ( "Erorr Register", player, 255, 255, 0 ) 
  
        end 
    end) 

ملف account.xml

تلقاة هنآ

C:\Program Files\MTA San Andreas 1.3\mods\deathmatch\resources 

طيب مدام كذا اي واحد يزرف اوم الحسابات ؟

لول؟ حسابك انت بينزل بس ذذ بـ ملفاتك لانك انت اللي كتبت واللي ينكتب بالايديت ينرسل للملف اللي بـ جهازك -_-

Link to comment
هات المود حقك وهو شغال واسويه لك او خذ مثال :
b = guiCreateButton(9,157,102,29,"save",false) 
e1 = guiCreateEdit(78,39,181,29,"name",false) 
e2 = guiCreateEdit(78,77,181,29,"pass",false) 
  
addEventHandler("onClientGUIClick",getRootElement(),function() 
    if source ==  b  then 
        user = guiGetText(e1) 
        pass = guiGetText(e2) 
        local file = xmlLoadFile("account.xml") or xmlCreateFile("account.xml","account") 
        xmlNodeSetValue(xmlCreateChild(file,"name"),""..user.."") 
        xmlNodeSetValue(xmlCreateChild(file,"pass"),""..pass.."") 
        xmlSaveFile(file) 
    end 
end) 

اذا ماعرفت هات المود حقك او ملف كلينت واسويه لك ..~#

انا ما ابيه يحفظ المعلومات في ملف

ابيه يحفظها في نفس اللوحة يعني على طول يخش يحصل كل شي جاهز يضغط دخول ويدخل على طول

Link to comment

خخخخخ توني افهم عليك خذ كودي الي طرحته من قبل + ظيف عليه ذا الكود

كلينت

addEvent("load",true) 
addEventHandler("load",root,function() 
    local xml = xmlLoadFile ( "account.xml" ) 
    local n1 = xmlFindChild ( xml, "name", 0 ) 
    local n2 = xmlFindChild ( xml, "pass", 0 ) 
    guiSetText(GUIEditor_Edit[1],xmlNodeGetValue ( n1 )) 
    guiSetText(GUIEditor_Edit[2],xmlNodeGetValue ( n2 )) 
end) 

سيرفر

addEventHandler("onPlayerJoin",root,function() 
    triggerClientEvent(source,"load",source) 
end) 

Link to comment
اذا كود حسن شغال بعتزل البرمجه هع ~

روح اعتزل خخ وش الخطأ بكودي يعني ؟

+

انت انتبه على اكوادك ترا كل شوي طايح في خطأ

شوف كودك :

addEvent('xml', true) 
addEventHandler('xml', root, 
function ( ) 
        local lr = xmlLoadFile("acc.xml") or xmlCreateFile("acc.xml"," acc") 
        xmlNodeSetValue (xmlCreateChild ( lr, "UserName:"), ""..user.."" ) -- [size=8]user من وين [/size] 
        xmlNodeSetValue (xmlCreateChild ( lr, "password:"), ""..pass.."" )-- [size=8]pass من وين [/size] 
        xmlSaveFile(lr) 
        xmlUnloadFile(lr) 
    end 
    ) 

   addEvent('save', true) 
addEventHandler('save',root, 
function ( player, user,pass )   
    local account = getAccount ( user,pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
        triggerClientEvent(player, 'xml', player) 
        else 
             outputChatBox ( "Error Login...", player, 255, 0, 0 ) 
         end 
     end 
 end) 

Link to comment

ههه كودي زبطته وارسلته له خآص

كنت بقول لكم لان اكوادكم + اكوادي بالبداية ماكان فيه احضار اليوزر والباس من الايدت

بس صلحته له وارسلته خاص انا احسبه يبي حفظها بملف قال لي يبي يخش تلقائي

على اي حآل

مآقصرت ياحسن .

Link to comment

المود شغال وكل شي بسس ما يحفظ تسجيل دخول تلقائي

function guiCreateWindow( x2, y2, width2, height2, titleBarText2, relative2 ) 
    mainBackground = guiCreateStaticImage ( x2, y2, width2, height2, "1.png", relative2 ) 
    local mainBackgroundLabel = guiCreateLabel ( 0, 0, 250, 100, titleBarText2, false, mainBackground ) 
    guiSetEnabled ( mainBackgroundLabel, false ) 
    return mainBackground 
end 
GUIEditor_Button = {} 
GUIEditor_Checkbox = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Image = {} 
  
fadeCamera( false ) 
showChat( false ) 
showCursor(true) 
  
wnd = guiCreateWindow(1,1,799,600,"",false) 
guiSetAlpha(wnd,1) 
GUIEditor_Image[2] = guiCreateStaticImage(10,24,781,449,"2.png",false,wnd) 
GUIEditor_Edit[1] = guiCreateEdit(299,484,166,27,"",false,wnd) 
GUIEditor_Edit[2] = guiCreateEdit(299,520,166,27,"",false,wnd) 
guiEditSetMasked(GUIEditor_Edit[2],true) 
GUIEditor_Label[1] = guiCreateLabel(238,487,106,18,"username",false,wnd) 
GUIEditor_Label[2] = guiCreateLabel(238,521,106,18,"password",false,wnd) 
GUIEditor_Button[1] = guiCreateButton(279,559,78,24,"login",false,wnd) 
GUIEditor_Button[2] = guiCreateButton(432,559,78,24,"register",false,wnd) 
GUIEditor_Checkbox[1] = guiCreateCheckBox(474,522,123,22,"تذكرني",false,false,wnd) 
  
addEventHandler("onClientGUIClick",getRootElement(), 
    function () 
        local user = guiGetText(GUIEditor_Edit[1]) 
        local pass = guiGetText(GUIEditor_Edit[2]) 
        if ( source == GUIEditor_Button[1] ) then 
           guiSetVisible( wnd, false ) 
           showChat( true ) 
           fadeCamera( true ) 
           showCursor( false ) 
            if ( guiCheckBoxGetSelected ( GUIEditor_Checkbox[1] ) ) then 
            local file = xmlLoadFile("account.xml") or xmlCreateFile("account.xml","login") 
            xmlNodeSetValue(xmlCreateChild(file,"name"),""..user.."") 
            xmlNodeSetValue(xmlCreateChild(file,"pass"),""..pass.."") 
       xmlNodeSetAttribute(file,"username",tostring(guiGetText(GUIEditor_Edit[1]))) 
       xmlNodeSetAttribute(file,"password",tostring(guiGetText(GUIEditor_Edit[2]))) 
       xmlSaveFile(file) 
       xmlUnloadFile(file) 
            triggerServerEvent('onlogin',localPlayer,user,pass) 
            end 
            addEvent("load",true) 
            addEventHandler("load",root,function() 
            local xml = xmlLoadFile ( "account.xml" ) 
            local n1 = xmlFindChild ( xml, "name", 0 ) 
            local n2 = xmlFindChild ( xml, "pass", 0 ) 
            guiSetText(GUIEditor_Edit[1],xmlNodeGetValue ( n1 )) 
            guiSetText(GUIEditor_Edit[2],xmlNodeGetValue ( n2 )) 
            end) 
  
        elseif ( source == GUIEditor_Button[2] ) then 
        triggerServerEvent('onRegister',localPlayer,user,pass)   
        end 
     end 
) 

addEvent('onlogin',true) 
addEventHandler('onlogin',getRootElement(), 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
            logIn(source,account,pass) 
        else 
            outputChatBox("* Worng Username Or Password",source,255,0,0) 
        end 
    end 
) 
addEventHandler("onPlayerJoin",root,function() 
    triggerClientEvent(source,"load",source) 
end) 
  
addEvent('onRegister',true) 
addEventHandler('onRegister',root, 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
        logIn(source,account,pass) 
            outputChatBox("* This Account is Already Used",source,255,0,0) 
        else 
            addAccount(user,pass) 
            outputChatBox("UserName: " .. user .. " PassWord : " .. pass,source,0,150,255) 
        end 
    end 
) 

Link to comment
المود شغال وكل شي بسس ما يحفظ تسجيل دخول تلقائي
function guiCreateWindow( x2, y2, width2, height2, titleBarText2, relative2 ) 
    mainBackground = guiCreateStaticImage ( x2, y2, width2, height2, "1.png", relative2 ) 
    local mainBackgroundLabel = guiCreateLabel ( 0, 0, 250, 100, titleBarText2, false, mainBackground ) 
    guiSetEnabled ( mainBackgroundLabel, false ) 
    return mainBackground 
end 
GUIEditor_Button = {} 
GUIEditor_Checkbox = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Image = {} 
  
fadeCamera( false ) 
showChat( false ) 
showCursor(true) 
  
wnd = guiCreateWindow(1,1,799,600,"",false) 
guiSetAlpha(wnd,1) 
GUIEditor_Image[2] = guiCreateStaticImage(10,24,781,449,"2.png",false,wnd) 
GUIEditor_Edit[1] = guiCreateEdit(299,484,166,27,"",false,wnd) 
GUIEditor_Edit[2] = guiCreateEdit(299,520,166,27,"",false,wnd) 
guiEditSetMasked(GUIEditor_Edit[2],true) 
GUIEditor_Label[1] = guiCreateLabel(238,487,106,18,"username",false,wnd) 
GUIEditor_Label[2] = guiCreateLabel(238,521,106,18,"password",false,wnd) 
GUIEditor_Button[1] = guiCreateButton(279,559,78,24,"login",false,wnd) 
GUIEditor_Button[2] = guiCreateButton(432,559,78,24,"register",false,wnd) 
GUIEditor_Checkbox[1] = guiCreateCheckBox(474,522,123,22,"تذكرني",false,false,wnd) 
  
addEventHandler("onClientGUIClick",getRootElement(), 
    function () 
        local user = guiGetText(GUIEditor_Edit[1]) 
        local pass = guiGetText(GUIEditor_Edit[2]) 
        if ( source == GUIEditor_Button[1] ) then 
           guiSetVisible( wnd, false ) 
           showChat( true ) 
           fadeCamera( true ) 
           showCursor( false ) 
            if ( guiCheckBoxGetSelected ( GUIEditor_Checkbox[1] ) ) then 
            local file = xmlLoadFile("account.xml") or xmlCreateFile("account.xml","login") 
            xmlNodeSetValue(xmlCreateChild(file,"name"),""..user.."") 
            xmlNodeSetValue(xmlCreateChild(file,"pass"),""..pass.."") 
       xmlNodeSetAttribute(file,"username",tostring(guiGetText(GUIEditor_Edit[1]))) 
       xmlNodeSetAttribute(file,"password",tostring(guiGetText(GUIEditor_Edit[2]))) 
       xmlSaveFile(file) 
       xmlUnloadFile(file) 
            triggerServerEvent('onlogin',localPlayer,user,pass) 
            end 
            addEvent("load",true) 
            addEventHandler("load",root,function() 
            local xml = xmlLoadFile ( "account.xml" ) 
            local n1 = xmlFindChild ( xml, "name", 0 ) 
            local n2 = xmlFindChild ( xml, "pass", 0 ) 
            guiSetText(GUIEditor_Edit[1],xmlNodeGetValue ( n1 )) 
            guiSetText(GUIEditor_Edit[2],xmlNodeGetValue ( n2 )) 
            end) 
  
        elseif ( source == GUIEditor_Button[2] ) then 
        triggerServerEvent('onRegister',localPlayer,user,pass)   
        end 
     end 
) 

addEvent('onlogin',true) 
addEventHandler('onlogin',getRootElement(), 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
            logIn(source,account,pass) 
        else 
            outputChatBox("* Worng Username Or Password",source,255,0,0) 
        end 
    end 
) 
addEventHandler("onPlayerJoin",root,function() 
    triggerClientEvent(source,"load",source) 
end) 
  
addEvent('onRegister',true) 
addEventHandler('onRegister',root, 
    function (user,pass) 
        local account = getAccount(user,pass) 
        if ( account ) then 
        logIn(source,account,pass) 
            outputChatBox("* This Account is Already Used",source,255,0,0) 
        else 
            addAccount(user,pass) 
            outputChatBox("UserName: " .. user .. " PassWord : " .. pass,source,0,150,255) 
        end 
    end 
) 

function guiCreateWindow( x2, y2, width2, height2, titleBarText2, relative2 ) 
    mainBackground = guiCreateStaticImage ( x2, y2, width2, height2, "1.png", relative2 ) 
    local mainBackgroundLabel = guiCreateLabel ( 0, 0, 250, 100, titleBarText2, false, mainBackground ) 
    guiSetEnabled ( mainBackgroundLabel, false ) 
    return mainBackground 
end 
GUIEditor_Button = {} 
GUIEditor_Checkbox = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Image = {} 
  
fadeCamera( false ) 
showChat( false ) 
showCursor(true) 
  
wnd = guiCreateWindow(1,1,799,600,"",false) 
guiSetAlpha(wnd,1) 
GUIEditor_Image[2] = guiCreateStaticImage(10,24,781,449,"2.png",false,wnd) 
GUIEditor_Edit[1] = guiCreateEdit(299,484,166,27,"",false,wnd) 
GUIEditor_Edit[2] = guiCreateEdit(299,520,166,27,"",false,wnd) 
guiEditSetMasked(GUIEditor_Edit[2],true) 
GUIEditor_Label[1] = guiCreateLabel(238,487,106,18,"username",false,wnd) 
GUIEditor_Label[2] = guiCreateLabel(238,521,106,18,"password",false,wnd) 
GUIEditor_Button[1] = guiCreateButton(279,559,78,24,"login",false,wnd) 
GUIEditor_Button[2] = guiCreateButton(432,559,78,24,"register",false,wnd) 
GUIEditor_Checkbox[1] = guiCreateCheckBox(474,522,123,22,"تذكرني",false,false,wnd) 
  
addEventHandler("onClientGUIClick",getRootElement(), 
    function () 
        local user = guiGetText(GUIEditor_Edit[1]) 
        local pass = guiGetText(GUIEditor_Edit[2]) 
        if ( source == GUIEditor_Button[1] ) then 
           guiSetVisible( wnd, false ) 
           showChat( true ) 
           fadeCamera( true ) 
           showCursor( false ) 
            if ( guiCheckBoxGetSelected ( GUIEditor_Checkbox[1] ) ) then 
            local file = xmlLoadFile("account.xml") or xmlCreateFile("account.xml","login") 
            xmlNodeSetValue(xmlCreateChild(file,"name"),""..user.."") 
            xmlNodeSetValue(xmlCreateChild(file,"pass"),""..pass.."") 
       xmlNodeSetAttribute(file,"username",tostring(guiGetText(GUIEditor_Edit[1]))) 
       xmlNodeSetAttribute(file,"password",tostring(guiGetText(GUIEditor_Edit[2]))) 
       xmlSaveFile(file) 
       xmlUnloadFile(file) 
            triggerServerEvent('onlogin',localPlayer,user,pass) 
            end 
  
        elseif ( source == GUIEditor_Button[2] ) then 
        triggerServerEvent('onRegister',localPlayer,user,pass)   
        end 
     end 
) 
  
addEvent("load",true) 
addEventHandler("load",root,function() 
            local xml = xmlLoadFile ( "account.xml" ) 
            local n1 = xmlFindChild ( xml, "name", 0 ) 
            local n2 = xmlFindChild ( xml, "pass", 0 ) 
            guiSetText(GUIEditor_Edit[1],xmlNodeGetValue ( n1 )) 
            guiSetText(GUIEditor_Edit[2],xmlNodeGetValue ( n2 )) 
end) 

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