Jump to content

Chat Bug white login script help


orcun99

Recommended Posts

wdwLoginBackGround = {} 
wdwLogin_Pannel = {}
tabPannel_Main = {}
tab_Login = {}
tab_Register = {}
tab_News = {}
 
--Settings
 
 
EnableMTAControlsOnLogin = false --Set false to not open the chat when you press "t" on fields, for example. [true/false]
 
 
function open_log_reg_pannel()
if not(isElement(wdwLoginBackGround)) then
   
   
    local sWidth,sHeight = guiGetScreenSize()
    local Width,Height = 320,360
    local X = (sWidth/2) - (Width/2)
    local Y = (sHeight/2) - (Height/2)
    toggleAllControls(EnableMTAControlsOnLogin)
 
    wdwLoginBackGround = guiCreateStaticImage( 0, 0, sWidth,sHeight, "bg.png", false )
   
   
    wdwLogin_Pannel = guiCreateWindow(X,Y,Width,Height,"BD:RPG Giriş Panel",false, wdwLoginBackGround)
   
    guiWindowSetSizable(wdwLogin_Pannel,false)
    guiWindowSetMovable ( wdwLogin_Pannel, false )
   
    tabPannel_Main = guiCreateTabPanel(15, 89, 289, 257,false,wdwLogin_Pannel)
   
    tab_Login = guiCreateTab("Login",tabPannel_Main)
   
    lbl_Login = guiCreateLabel(35, 82, 42, 15, "Giriş :",false,tab_Login)
    guiLabelSetVerticalAlign(lbl_Login,"center")
    guiLabelSetHorizontalAlign(lbl_Login,"right",false)
    guiSetFont(lbl_Login,"default-bold-small")
   
    edit_Login = guiCreateEdit(87, 82, 174, 25,"",false,tab_Login)
    edit_password = guiCreateEdit(87, 117, 174, 23,"",false,tab_Login)
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
 
   
    lbl_Password = guiCreateLabel(17, 117, 60, 15,"Şifre :",false,tab_Login)
    guiLabelSetVerticalAlign(lbl_Password,"center")
    guiLabelSetHorizontalAlign(lbl_Password,"right",false)
    guiSetFont(lbl_Password,"default-bold-small")
   
    lbl_top_info = guiCreateLabel(30, 10, 231, 15, "Kimseye Kendi Bilgilerini Verme!", false,tab_Login)
    guiLabelSetVerticalAlign(lbl_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_top_info,"center",false)
    guiSetFont(lbl_top_info,"default-bold-small")
   
    lbl_about_legth = guiCreateLabel(67, 25, 153, 15, "Hesap ismi ve Şifre", false,tab_Login)
    guiLabelSetVerticalAlign(lbl_about_legth,"center")
    guiLabelSetHorizontalAlign(lbl_about_legth,"center",false)
    guiSetFont(lbl_about_legth,"default-bold-small")
   
   
    checkbox_save = guiCreateCheckBox(180, 150, 81, 20,"Beni Hatırla",false,false,tab_Login)
    guiSetFont(checkbox_save,"default-small")
   
    btn_Login = guiCreateButton(178, 180, 83, 30,"Giriş",false,tab_Login)
    guiSetFont(btn_Login,"default-bold-small")
   
    login_tab_error_msg = guiCreateLabel(10, 50, 269, 22,"Error_login_tab",false,tab_Login)
    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")
   
   
   
    tab_Register = guiCreateTab("Register",tabPannel_Main)
   
    lbl_account_name = guiCreateLabel(30, 66, 68, 14,"Hesap İsmi :",false,tab_Register)
    guiLabelSetVerticalAlign(lbl_account_name,"center")
    guiLabelSetHorizontalAlign(lbl_account_name,"right",false)
    guiSetFont(lbl_account_name,"default-bold-small")
   
    lbl_reg_top_info = guiCreateLabel(10, 10, 269, 15, "Güçlü bir Şifre Kullan!", false, tab_Register)
    guiLabelSetVerticalAlign(lbl_reg_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false)
        guiSetFont(lbl_reg_top_info,"default-bold-small")
   
    edit_account_name = guiCreateEdit(108, 66, 153, 24,"",false,tab_Register)
    guiEditSetMaxLength ( edit_account_name,25)
   
    lbl__reg_tab_password = guiCreateLabel(37, 100, 61, 15,"Şifre :",false,tab_Register)
    guiLabelSetVerticalAlign(lbl__reg_tab_password,"center")
    guiLabelSetHorizontalAlign(lbl__reg_tab_password,"right",false)
    guiSetFont(lbl__reg_tab_password,"default-bold-small")
   
    edit__reg_tab_password = guiCreateEdit(108, 100, 153, 24,"",false,tab_Register)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
   
    edit__reg_tab_Repassword = guiCreateEdit(108, 133, 153, 24,"",false,tab_Register)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
   
    lvl_reg_tab_Repassword = guiCreateLabel(20, 133, 78, 15,"Şifreyi Tekrar Et :",false,tab_Register)
    guiLabelSetVerticalAlign(lvl_reg_tab_Repassword,"center")
    guiLabelSetHorizontalAlign(lvl_reg_tab_Repassword,"right",false)
    guiSetFont(lvl_reg_tab_Repassword,"default-bold-small")
   
    btn_reg_tab_register = guiCreateButton(178, 180, 83, 30,"Kaydol",false,tab_Register)
    guiSetFont(btn_reg_tab_register,"default-bold-small")
   
    reg_tab_error_msg = guiCreateLabel(10, 25, 269, 31,"Error_reg_ttab",false,tab_Register)
    guiLabelSetColor(reg_tab_error_msg,225,0,0)
    guiLabelSetVerticalAlign(reg_tab_error_msg,"center")
    guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false)
    guiSetFont(reg_tab_error_msg,"default-bold-small")
   
    logininfo1 = guiCreateLabel(11, 32, 299, 16, "BD:RPG'ye hoşgeldiniz :)", false, wdwLogin_Pannel)
        guiSetFont(logininfo1, "default-bold-small")
        guiLabelSetColor(logininfo1, 30,144,255)
        guiLabelSetHorizontalAlign(logininfo1, "center", false)
        guiLabelSetVerticalAlign(logininfo1, "center")
        logininfo2 = guiCreateLabel(11, 63, 299, 16, "Adminlere sorularını yöneltebilirsiniz", false, wdwLogin_Pannel)
        guiSetFont(logininfo2, "default-bold-small")
        guiLabelSetColor(logininfo2, 30,144,255)
        guiLabelSetHorizontalAlign(logininfo2, "center", false)
        guiLabelSetVerticalAlign(logininfo2, "center")
        logininfo3 = guiCreateLabel(11, 48, 299, 15, "F1'e basarak bilgileri öğrenebilirsiniz.", false, wdwLogin_Pannel)
        guiSetFont(logininfo3, "default-bold-small")
        guiLabelSetColor(logininfo3, 30,144,255)
        guiLabelSetHorizontalAlign(logininfo3, "center", false)
        guiLabelSetVerticalAlign(logininfo3, "center")
   
    guiEditSetMasked(edit__reg_tab_password, true)
    guiEditSetMasked(edit__reg_tab_Repassword, true)
   
    guiSetVisible(wdwLogin_Pannel,true)
    showCursor(true)
   
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
-- Labels changing when player doing mistake
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
 
    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
 
   
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
-- Events
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
 
    addEventHandler("onClientGUIClick",btn_Login,onClickBtnLogin)
    addEventHandler("onClientGUIClick",btn_reg_tab_register,onClickBtnRegister)
   
 
end
end
 
 
 
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
-- Opening login panel when the resource starting
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
 
function start_cl_resource()
    open_log_reg_pannel()
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource)
 
 
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
-- Loading usernames and password from xml file
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
 
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
 
 
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
-- Saving login and password to the xml file. Type: 1
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
 
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)
 
 
 
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
-- Saving login and password to the xml. Type: 2
---------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------
 
function resetSaveXML()
        local xml_save_log_File = xmlLoadFile ("files/xml/userdata.xml")
Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...