khalid-mks Posted December 21, 2014 Share Posted December 21, 2014 السلام عليكم شبااب ابيك تساعدوني في لوحة تسجيل الدخول شوفو صورة المود (طبعا هو يشتغل بس لازمه فنكشات) والمشكل انا ابي شي يغيير صورة فرانك لين الي صورة اخرى بعد مرور 5 ثواني عندي مجموعة من الصور ابي اشغلهم كلما مرة 5 ثواني تتغير الصورة ساااعدووني واتمنى ان تفهموووننيييي Link to comment
LaCosTa Posted December 21, 2014 Share Posted December 21, 2014 إستعمل setTimer guiCreateStaticImage Link to comment
EL-JoKeR Posted December 21, 2014 Share Posted December 21, 2014 local x,y = guiGetScreenSize() onStart = function() local image = guiCreateStaticImage( 0, 0, x, y, 'Name.png', false ) setTimer(guiSetVisible,5000,1,image,false) end addEventHandler('onClientResourceStart',resourceRoot,onStart) غير image إلي اسم الصورة بتاعتك وغير png إلي صيغة الصورة بتاعتك هذه راح تمشي بعد 5 ثواني , انت ظبط الاوقات وكدا Link to comment
TAPL Posted December 21, 2014 Share Posted December 21, 2014 guiCreateStaticImage guiStaticImageLoadImage Link to comment
LaCosTa Posted December 21, 2014 Share Posted December 21, 2014 https://wiki.multitheftauto.com/wiki/Gu ... eLoadImage Link to comment
</Mr.Tn6eL> Posted December 21, 2014 Share Posted December 21, 2014 https://wiki.multitheftauto.com/wiki/GuiStaticImageLoadImage زيادة مشاركات وش الفرق بين رد تابل وردك Link to comment
khalid-mks Posted December 21, 2014 Author Share Posted December 21, 2014 شبااب والله ما بعرف ليش ما تشتغل الطريقة هادا الكلنت حقي بليييييزز واحد يطبق عليه العملية wdwLogin_Pannel = {} tabPannel_Main = {} tab_Login = {} tab_Register = {} function open_log_reg_pannel() if not(isElement(wdwLogin_Pannel)) then showChat(false) x,y = guiGetScreenSize() local sWidth,sHeight = guiGetScreenSize() local Width,Height = 350,350 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) Image = guiCreateStaticImage( 0, 0, 1920, 1200, "login_bg.jpeg", false ) guiSetEnabled (Image, false) Login_img = guiCreateStaticImage( X + -100, Y + -112, 540, 569, "login_window.png", false ) guiSetEnabled (Login_img, false) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shLogin = guiCreateStaticImage( X + -90, Y + 265, 250, 45, "login.png", false ) addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin) addEventHandler( "onClientMouseEnter",shLogin,LoginSH) addEventHandler("onClientMouseLeave",shLogin,SErem) edit_Login = guiCreateEdit(X + -23,Y + 136,141,36,"",false) edit_password = guiCreateEdit(X + -22,Y + 198,142,37,"",false) guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) lbl_about_legth = guiCreateLabel(142,42,184,18,"",false) guiLabelSetColor(lbl_about_legth,253,255,68) guiLabelSetVerticalAlign(lbl_about_legth,"center") guiLabelSetHorizontalAlign(lbl_about_legth,"center",false) checkbox_save = guiCreateCheckBox(X + -90,Y + 240,500,20,"(Remember name , password !)",false,false) guiSetFont(checkbox_save,"default-small") login_tab_error_msg = guiCreateLabel(X-200,Y + 175,364,31,"Error_login_tab",false) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shGuest = guiCreateStaticImage( X + 23, Y + 401, 143, 45, "guest.png", false ) -- A gomb addEventHandler("onClientGUIClick",shGuest,onClickGuest) addEventHandler( "onClientMouseEnter",shGuest,GuestSH) addEventHandler("onClientMouseLeave",shGuest,SErem) lbl_reg_top_info = guiCreateLabel(X + 70,Y + 65,500,30,"Do not use:(\"!@#$\"%'^&*()\"):",false) guiLabelSetColor(lbl_reg_top_info,255,234,55) guiLabelSetVerticalAlign(lbl_reg_top_info,"center") guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) guiSetVisible(lbl_reg_top_info,false) edit_account_name = guiCreateEdit(X + 250,Y + 90,160,35,"",false) guiEditSetMaxLength ( edit_account_name,25) guiSetVisible(edit_account_name,false) edit__reg_tab_password = guiCreateEdit(X + 250,Y + 140,160,35,"",false) guiEditSetMaxLength ( edit__reg_tab_password,25) guiEditSetMasked ( edit__reg_tab_password, true ) guiSetVisible(edit__reg_tab_password,false) edit__reg_tab_Repassword = guiCreateEdit(X + 250,Y + 190,160,35,"",false) guiEditSetMaxLength ( edit__reg_tab_Repassword,25) guiEditSetMasked ( edit__reg_tab_Repassword, true ) guiSetVisible(edit__reg_tab_Repassword,false) guiSetEnabled (edit__reg_tab_Repassword, true) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shRegister = guiCreateStaticImage( X + 213, Y + 160, 230, 45, "register.png", false ) addEventHandler("onClientGUIClick",shRegister,OnBtnRegister) addEventHandler( "onClientMouseEnter",shRegister,RegisterSH) addEventHandler("onClientMouseLeave",shRegister,SErem) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shRegister2 = guiCreateStaticImage( X + 258, Y + 230, 143, 45, "register2.png", false ) addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister) addEventHandler( "onClientMouseEnter",shRegister2,Register2SH) addEventHandler("onClientMouseLeave",shRegister2,SErem) guiSetVisible(shRegister2,false) reg_tab_error_msg = guiCreateLabel(X + 230,Y + 265,200,31,"Error_reg_ttab",false) guiLabelSetColor(reg_tab_error_msg,255,20,0) guiLabelSetVerticalAlign(reg_tab_error_msg,"center") guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false) guiSetFont(reg_tab_error_msg,"default-bold-small") showCursor(true) guiSetText(reg_tab_error_msg, "") guiSetText(login_tab_error_msg, "") local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) end end end function LoginSH () guiStaticImageLoadImage(shLogin, "sh.png" ) end function RegisterSH () guiStaticImageLoadImage(shRegister, "shr.png" ) end function Register2SH () guiStaticImageLoadImage(shRegister2, "shr2.png" ) end function GuestSH () guiStaticImageLoadImage(shGuest, "shg.png" ) end function SErem () guiStaticImageLoadImage(shLogin, "login.png" ) guiStaticImageLoadImage(shRegister, "register.png" ) guiStaticImageLoadImage(shGuest, "guest.png" ) guiStaticImageLoadImage(shRegister2, "register2.png" ) end function start_cl_resource() open_log_reg_pannel() end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource) function loadLoginFromXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function onClickBtnLogin(button,state) showChat(true) showCursor(false) guiSetVisible(Image,false) guiSetVisible(shGuest, false) guiSetVisible(Image, false) guiSetVisible(shLogin, false) guiSetVisible(shRegister, false) guiSetVisible(edit_password, false) guiSetVisible(edit_Login, false) guiSetVisible(checkbox_save, false) guiSetVisible(Login_img, false) if(button == "left" and state == "up") then if (source == shLogin) then username = guiGetText(edit_Login) password = guiGetText(edit_password) if guiCheckBoxGetSelected ( checkbox_save ) == true then checksave = true else checksave = false end triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end function OnBtnRegister () Link to comment
</Mr.Tn6eL> Posted December 21, 2014 Share Posted December 21, 2014 شبااب والله ما بعرف ليش ما تشتغل الطريقة هادا الكلنت حقي بليييييزز واحد يطبق عليه العملية wdwLogin_Pannel = {} tabPannel_Main = {} tab_Login = {} tab_Register = {} function open_log_reg_pannel() if not(isElement(wdwLogin_Pannel)) then showChat(false) x,y = guiGetScreenSize() local sWidth,sHeight = guiGetScreenSize() local Width,Height = 350,350 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) Image = guiCreateStaticImage( 0, 0, 1920, 1200, "login_bg.jpeg", false ) guiSetEnabled (Image, false) Login_img = guiCreateStaticImage( X + -100, Y + -112, 540, 569, "login_window.png", false ) guiSetEnabled (Login_img, false) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shLogin = guiCreateStaticImage( X + -90, Y + 265, 250, 45, "login.png", false ) addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin) addEventHandler( "onClientMouseEnter",shLogin,LoginSH) addEventHandler("onClientMouseLeave",shLogin,SErem) edit_Login = guiCreateEdit(X + -23,Y + 136,141,36,"",false) edit_password = guiCreateEdit(X + -22,Y + 198,142,37,"",false) guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) lbl_about_legth = guiCreateLabel(142,42,184,18,"",false) guiLabelSetColor(lbl_about_legth,253,255,68) guiLabelSetVerticalAlign(lbl_about_legth,"center") guiLabelSetHorizontalAlign(lbl_about_legth,"center",false) checkbox_save = guiCreateCheckBox(X + -90,Y + 240,500,20,"(Remember name , password !)",false,false) guiSetFont(checkbox_save,"default-small") login_tab_error_msg = guiCreateLabel(X-200,Y + 175,364,31,"Error_login_tab",false) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shGuest = guiCreateStaticImage( X + 23, Y + 401, 143, 45, "guest.png", false ) -- A gomb addEventHandler("onClientGUIClick",shGuest,onClickGuest) addEventHandler( "onClientMouseEnter",shGuest,GuestSH) addEventHandler("onClientMouseLeave",shGuest,SErem) lbl_reg_top_info = guiCreateLabel(X + 70,Y + 65,500,30,"Do not use:(\"!@#$\"%'^&*()\"):",false) guiLabelSetColor(lbl_reg_top_info,255,234,55) guiLabelSetVerticalAlign(lbl_reg_top_info,"center") guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) guiSetVisible(lbl_reg_top_info,false) edit_account_name = guiCreateEdit(X + 250,Y + 90,160,35,"",false) guiEditSetMaxLength ( edit_account_name,25) guiSetVisible(edit_account_name,false) edit__reg_tab_password = guiCreateEdit(X + 250,Y + 140,160,35,"",false) guiEditSetMaxLength ( edit__reg_tab_password,25) guiEditSetMasked ( edit__reg_tab_password, true ) guiSetVisible(edit__reg_tab_password,false) edit__reg_tab_Repassword = guiCreateEdit(X + 250,Y + 190,160,35,"",false) guiEditSetMaxLength ( edit__reg_tab_Repassword,25) guiEditSetMasked ( edit__reg_tab_Repassword, true ) guiSetVisible(edit__reg_tab_Repassword,false) guiSetEnabled (edit__reg_tab_Repassword, true) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shRegister = guiCreateStaticImage( X + 213, Y + 160, 230, 45, "register.png", false ) addEventHandler("onClientGUIClick",shRegister,OnBtnRegister) addEventHandler( "onClientMouseEnter",shRegister,RegisterSH) addEventHandler("onClientMouseLeave",shRegister,SErem) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shRegister2 = guiCreateStaticImage( X + 258, Y + 230, 143, 45, "register2.png", false ) addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister) addEventHandler( "onClientMouseEnter",shRegister2,Register2SH) addEventHandler("onClientMouseLeave",shRegister2,SErem) guiSetVisible(shRegister2,false) reg_tab_error_msg = guiCreateLabel(X + 230,Y + 265,200,31,"Error_reg_ttab",false) guiLabelSetColor(reg_tab_error_msg,255,20,0) guiLabelSetVerticalAlign(reg_tab_error_msg,"center") guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false) guiSetFont(reg_tab_error_msg,"default-bold-small") showCursor(true) guiSetText(reg_tab_error_msg, "") guiSetText(login_tab_error_msg, "") local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) end end end function LoginSH () guiStaticImageLoadImage(shLogin, "sh.png" ) end function RegisterSH () guiStaticImageLoadImage(shRegister, "shr.png" ) end function Register2SH () guiStaticImageLoadImage(shRegister2, "shr2.png" ) end function GuestSH () guiStaticImageLoadImage(shGuest, "shg.png" ) end function SErem () guiStaticImageLoadImage(shLogin, "login.png" ) guiStaticImageLoadImage(shRegister, "register.png" ) guiStaticImageLoadImage(shGuest, "guest.png" ) guiStaticImageLoadImage(shRegister2, "register2.png" ) end function start_cl_resource() open_log_reg_pannel() end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource) function loadLoginFromXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function onClickBtnLogin(button,state) showChat(true) showCursor(false) guiSetVisible(Image,false) guiSetVisible(shGuest, false) guiSetVisible(Image, false) guiSetVisible(shLogin, false) guiSetVisible(shRegister, false) guiSetVisible(edit_password, false) guiSetVisible(edit_Login, false) guiSetVisible(checkbox_save, false) guiSetVisible(Login_img, false) if(button == "left" and state == "up") then if (source == shLogin) then username = guiGetText(edit_Login) password = guiGetText(edit_password) if guiCheckBoxGetSelected ( checkbox_save ) == true then checksave = true else checksave = false end triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end Link to comment
khalid-mks Posted December 21, 2014 Author Share Posted December 21, 2014 انا سويته كدا وما يبي يشتغل بليييز صحح الخطأ واعطيني الصحيح بليييييزز wdwLogin_Pannel = {} tabPannel_Main = {} tab_Login = {} tab_Register = {} function open_log_reg_pannel() if not(isElement(wdwLogin_Pannel)) then showChat(false) x,y = guiGetScreenSize() local sWidth,sHeight = guiGetScreenSize() local Width,Height = 350,350 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) Image = guiCreateStaticImage( 0, 0, 1920, 1200, "login_bg.jpeg", false ) setTimer ( guiStaticImageLoadImage , 10000 , 1 , myImage، "roro.jpeg" ) Login_img = guiCreateStaticImage( X, Y + 50, 500, 500, 300, "login_window.png", false ) guiSetEnabled (Login_img, false) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shLogin = guiCreateStaticImage( X + 23, Y + 349, 301, 44, "login.png", false ) addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin) addEventHandler( "onClientMouseEnter",shLogin,LoginSH) addEventHandler("onClientMouseLeave",shLogin,SErem) edit_Login = guiCreateEdit(X + 20,Y + 205,250,35,"",false) edit_password = guiCreateEdit(X + 20,Y + 280,250,35,"",false) guiEditSetMaxLength ( edit_Login,25) guiEditSetMaxLength ( edit_password,25) guiEditSetMasked ( edit_password, true ) lbl_about_legth = guiCreateLabel(142,42,184,18,"",false) guiLabelSetColor(lbl_about_legth,253,255,68) guiLabelSetVerticalAlign(lbl_about_legth,"center") guiLabelSetHorizontalAlign(lbl_about_legth,"center",false) checkbox_save = guiCreateCheckBox(X + 175,Y + 260,100,20,"(Remember me!)",false,false) guiSetFont(checkbox_save,"default-small") login_tab_error_msg = guiCreateLabel(X,Y + 310,364,31,"Error_login_tab",false) guiLabelSetColor(login_tab_error_msg,255,0,0) guiLabelSetVerticalAlign(login_tab_error_msg,"center") guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false) guiSetFont(login_tab_error_msg,"default-bold-small") --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shGuest = guiCreateStaticImage( X + 23, Y + 401, 143, 45, "guest.png", false ) -- A gomb addEventHandler("onClientGUIClick",shGuest,onClickGuest) addEventHandler( "onClientMouseEnter",shGuest,GuestSH) addEventHandler("onClientMouseLeave",shGuest,SErem) lbl_reg_top_info = guiCreateLabel(X - 70,Y + 380,500,30,"Fill out all fields. Do no't use: (\"!@#$\"%'^&*()\")",false) guiLabelSetColor(lbl_reg_top_info,255,234,55) guiLabelSetVerticalAlign(lbl_reg_top_info,"center") guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) guiSetVisible(lbl_reg_top_info,false) edit_account_name = guiCreateEdit(X + 20,Y + 210,250,35,"",false) guiEditSetMaxLength ( edit_account_name,25) guiSetVisible(edit_account_name,false) edit__reg_tab_password = guiCreateEdit(X + 20,Y + 275,250,35,"",false) guiEditSetMaxLength ( edit__reg_tab_password,25) guiEditSetMasked ( edit__reg_tab_password, true ) guiSetVisible(edit__reg_tab_password,false) edit__reg_tab_Repassword = guiCreateEdit(X + 20,Y + 345,250,35,"",false) guiEditSetMaxLength ( edit__reg_tab_Repassword,25) guiEditSetMasked ( edit__reg_tab_Repassword, true ) guiSetVisible(edit__reg_tab_Repassword,false) guiSetEnabled (edit__reg_tab_Repassword, true) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shRegister = guiCreateStaticImage( X + 182, Y + 401, 143, 45, "register.png", false ) addEventHandler("onClientGUIClick",shRegister,OnBtnRegister) addEventHandler( "onClientMouseEnter",shRegister,RegisterSH) addEventHandler("onClientMouseLeave",shRegister,SErem) --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! shRegister2 = guiCreateStaticImage( X + 23, Y + 409, 301, 44, "register2.png", false ) addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister) addEventHandler( "onClientMouseEnter",shRegister2,Register2SH) addEventHandler("onClientMouseLeave",shRegister2,SErem) guiSetVisible(shRegister2,false) reg_tab_error_msg = guiCreateLabel(X,Y + 310,364,31,"Error_reg_ttab",false) guiLabelSetColor(reg_tab_error_msg,255,20,0) guiLabelSetVerticalAlign(reg_tab_error_msg,"center") guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false) guiSetFont(reg_tab_error_msg,"default-bold-small") showCursor(true) guiSetText(reg_tab_error_msg, "") guiSetText(login_tab_error_msg, "") local username, password = loadLoginFromXML() if not( username == "" or password == "") then guiCheckBoxSetSelected ( checkbox_save, true ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) else guiCheckBoxSetSelected ( checkbox_save, false ) guiSetText ( edit_Login, tostring(username)) guiSetText ( edit_password, tostring(password)) end end end function LoginSH () guiStaticImageLoadImage(shLogin, "sh.png" ) end function RegisterSH () guiStaticImageLoadImage(shRegister, "shr.png" ) end function Register2SH () guiStaticImageLoadImage(shRegister2, "shr2.png" ) end function GuestSH () guiStaticImageLoadImage(shGuest, "shg.png" ) end function SErem () guiStaticImageLoadImage(shLogin, "login.png" ) guiStaticImageLoadImage(shRegister, "register.png" ) guiStaticImageLoadImage(shGuest, "guest.png" ) guiStaticImageLoadImage(shRegister2, "register2.png" ) end function start_cl_resource() open_log_reg_pannel() end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource) function loadLoginFromXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile ( xml_save_log_File ) end function saveLoginToXML(username, password) local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue (usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild (xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end end if (password ~= "") then local passwordNode = xmlFindChild (xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue (passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile (xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function onClickBtnLogin(button,state) showChat(true) showCursor(false) guiSetVisible(Image,false) guiSetVisible(shGuest, false) guiSetVisible(Image, false) guiSetVisible(shLogin, false) guiSetVisible(shRegister, false) guiSetVisible(edit_password, false) guiSetVisible(edit_Login, false) guiSetVisible(checkbox_save, false) guiSetVisible(Login_img, false) if(button == "left" and state == "up") then if (source == shLogin) then username = guiGetText(edit_Login) password = guiGetText(edit_password) if guiCheckBoxGetSelected ( checkbox_save ) == true then checksave = true else checksave = false end triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave) end end end function OnBtnRegister () guiStaticImageLoadImage(Login_img, "register_window.png" ) 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