Jump to content

[Ayuda] fadeCamera error


Recommended Posts

Hola amigos otra vez tengo un problema con unos de mis resource.

Tengo el resource "loginform" (Link en la community AQUI)

Modificado por mi mismo, hice algunas modificaciones mínimas , traducción y una imágen estática, el problema es que viene con opcion de poner true/false para la opción fadeCamera para que cuando un jugador entre al juego se le vea toda la pantalla negra y sólo se vea el GUI.

El problema es que cuando la gente entra se ve el GUI, pero no la pantalla negra, quiero solucionar eso, sólo se ve la pantalla negra cuando inicio el Script.

Client:

wdwLogin_Pannel = {} 
tabPannel_Main = {}
tab_Login = {}
tab_Register = {}
 
--Settings
blackLoginScreen = true --True/false Black screen, while player login...
blackScreenTime = 3  --Time to complete disappearance of the black screen in seconds.
 
GuestEnable = false --Can a Player play as Guest, or no. [true/false]
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(wdwLogin_Pannel)) then
   
    if blackLoginScreen == true then
        fadeCamera(false,0,0,0,0)
    end
   
    local sWidth,sHeight = guiGetScreenSize() -- The variables
    local Width,Height = 350,390 --Main Window sizes
    local X = (sWidth/2) - (Width/2) --Main Window horizontal position
    local Y = (sHeight/2) - (Height/2) --Main Window vertical position
    toggleAllControls(EnableMTAControlsOnLogin)
 
 
    wdwLogin_Pannel = guiCreateWindow(X,Y,Width,Height,"MTA-LPM",false)
   
    guiWindowSetSizable(wdwLogin_Pannel,false)
   
    tabPannel_Main = guiCreateTabPanel(9,130,350,251,false,wdwLogin_Pannel)
   
    tab_Login = guiCreateTab("Iniciar sesion",tabPannel_Main)
   
    lbl_Login = guiCreateLabel(13,39,100,21,"Cuenta:",false,tab_Login)
    guiLabelSetVerticalAlign(lbl_Login,"center")
    guiLabelSetHorizontalAlign(lbl_Login,"right",false)
    guiSetFont(lbl_Login,"default-bold-small")
   
    edit_Login = guiCreateEdit(142,40,130,23,"",false,tab_Login) --Поле ввода логина
    edit_password = guiCreateEdit(142,71,130,23,"",false,tab_Login) --Поле ввода пароля
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
 
   
    lbl_Password = guiCreateLabel(13,71,100,21,"Clave:",false,tab_Login)
    guiLabelSetVerticalAlign(lbl_Password,"center")
    guiLabelSetHorizontalAlign(lbl_Password,"right",false)
    guiSetFont(lbl_Password,"default-bold-small")
   
lbl_top_info = guiCreateStaticImage(36, 28, 261, 88, "logo.png", false, wdwLogin_Pannel)
local sound = playSound("sonido.mp3")
 
   
       
   
    --[[lbl_top_info = guiCreateLabel(74,6,244,35,"Enter with your username and password.",false,tab_Login)
    guiLabelSetColor(lbl_top_info,137,26,26)
    guiLabelSetVerticalAlign(lbl_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_top_info,"center",false)
    guiSetFont(lbl_top_info,"default-bold-small")]]
   
    --[[lbl_about_legth = guiCreateLabel(142,42,184,18,"Max Length: 25 symbols",false,tab_Login)
    guiLabelSetColor(lbl_about_legth,253,255,68)
    guiLabelSetVerticalAlign(lbl_about_legth,"center")
    guiLabelSetHorizontalAlign(lbl_about_legth,"center",false)]]
   
   
    checkbox_save = guiCreateCheckBox(215,97,140,20,"Recordar",false,false,tab_Login)
    guiSetFont(checkbox_save,"default-small")
   
    btn_Login = guiCreateButton(110,150,130,40,"Iniciar sesion",false,tab_Login)
    guiSetFont(btn_Login,"default-bold-small")
   
    login_tab_error_msg = guiCreateLabel(0,112,350,25,"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")
   
    --Guest func
    if GuestEnable == true then
        btnGuest = guiCreateButton(29,168,94,32,"Play as Guest",false,tab_Login)
        guiSetFont(btnGuest,"default-small")
        guiSetVisible(btnGuest,true)
    else
        if isElement(btnGuest) then guiSetVisible(btnGuest,false) end
        btnGuest = nil
    end
   
   
    tab_Register = guiCreateTab("Registro",tabPannel_Main)
   
    lbl_account_name = guiCreateLabel(13,39,119,21,"Cuenta:",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(80,5,364,31,"No usar caracteres raros.",false,tab_Register)
    guiLabelSetColor(lbl_reg_top_info,255,234,55)
    guiLabelSetVerticalAlign(lbl_reg_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_reg_top_info,"left",false)
   
    edit_account_name = guiCreateEdit(142,40,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit_account_name,25)
   
    lbl__reg_tab_password = guiCreateLabel(13,71,119,21,"Clave:",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(142,71,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
   
    edit__reg_tab_Repassword = guiCreateEdit(142,102,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
   
    lvl_reg_tab_Repassword = guiCreateLabel(13,102,119,21,"Repetir clave:",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(110,150,130,40,"Crear cuenta",false,tab_Register)
    guiSetFont(btn_reg_tab_register,"default-bold-small")
   
    reg_tab_error_msg = guiCreateLabel(0,170,350,31,"Error_reg_ttab",false,tab_Register)
    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")
   
    guiEditSetMasked(edit__reg_tab_password, true)
    guiEditSetMasked(edit__reg_tab_Repassword, true)
   
    guiSetVisible(wdwLogin_Pannel,true)
    --guiSetInputEnabled(true)
    showCursor(true)
   
    --Изменение надписей:
    guiSetText(reg_tab_error_msg, "") --Поле ошибки в Reg табе
    guiSetText(login_tab_error_msg, "") --Поле ошибки в Login табе
   
   
   
    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
 
    --Эвенты
    addEventHandler("onClientGUIClick",btn_Login,onClickBtnLogin)
    addEventHandler("onClientGUIClick",btn_reg_tab_register,onClickBtnRegister)
    if GuestEnable == true then addEventHandler("onClientGUIClick",btnGuest,onClickGuest) end
   
   
--else
    --destroyElement(wdwLogin_Pannel)
    --guiSetInputEnabled(false)
    --wdwLogin_Pannel = nil
    --showCursor(false)
end
end
 
 
 
 
function start_cl_resource() --При старте
    open_log_reg_pannel()
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource)
addEventHandler("onPlayerJoin",getResourceRootElement(getThisResource()),start_cl_resource)
 
 
function loadLoginFromXML() --Загрузка логина и пароля из XML
    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) --Сохрание логина и пароля в XML
    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() --Сохрание логина и пароля в XML
        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)
 
 
 
 
Link to comment
Hola amigos otra vez tengo un problema con unos de mis resource.

Tengo el resource "loginform" (Link en la community AQUI)

Modificado por mi mismo, hice algunas modificaciones mínimas , traducción y una imágen estática, el problema es que viene con opcion de poner true/false para la opción fadeCamera para que cuando un jugador entre al juego se le vea toda la pantalla negra y sólo se vea el GUI.

El problema es que cuando la gente entra se ve el GUI, pero no la pantalla negra, quiero solucionar eso, sólo se ve la pantalla negra cuando inicio el Script.

Client:

wdwLogin_Pannel = {} 
tabPannel_Main = {}
tab_Login = {}
tab_Register = {}
 
--Settings
blackLoginScreen = true --True/false Black screen, while player login...
blackScreenTime = 3  --Time to complete disappearance of the black screen in seconds.
 
GuestEnable = false --Can a Player play as Guest, or no. [true/false]
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(wdwLogin_Pannel)) then
   
    if blackLoginScreen == true then
        fadeCamera(false,0,0,0,0)
    end
   
    local sWidth,sHeight = guiGetScreenSize() -- The variables
    local Width,Height = 350,390 --Main Window sizes
    local X = (sWidth/2) - (Width/2) --Main Window horizontal position
    local Y = (sHeight/2) - (Height/2) --Main Window vertical position
    toggleAllControls(EnableMTAControlsOnLogin)
 
 
    wdwLogin_Pannel = guiCreateWindow(X,Y,Width,Height,"MTA-LPM",false)
   
    guiWindowSetSizable(wdwLogin_Pannel,false)
   
    tabPannel_Main = guiCreateTabPanel(9,130,350,251,false,wdwLogin_Pannel)
   
    tab_Login = guiCreateTab("Iniciar sesion",tabPannel_Main)
   
    lbl_Login = guiCreateLabel(13,39,100,21,"Cuenta:",false,tab_Login)
    guiLabelSetVerticalAlign(lbl_Login,"center")
    guiLabelSetHorizontalAlign(lbl_Login,"right",false)
    guiSetFont(lbl_Login,"default-bold-small")
   
    edit_Login = guiCreateEdit(142,40,130,23,"",false,tab_Login) --Поле ввода логина
    edit_password = guiCreateEdit(142,71,130,23,"",false,tab_Login) --Поле ввода пароля
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
 
   
    lbl_Password = guiCreateLabel(13,71,100,21,"Clave:",false,tab_Login)
    guiLabelSetVerticalAlign(lbl_Password,"center")
    guiLabelSetHorizontalAlign(lbl_Password,"right",false)
    guiSetFont(lbl_Password,"default-bold-small")
   
lbl_top_info = guiCreateStaticImage(36, 28, 261, 88, "logo.png", false, wdwLogin_Pannel)
local sound = playSound("sonido.mp3")
 
   
       
   
    --[[lbl_top_info = guiCreateLabel(74,6,244,35,"Enter with your username and password.",false,tab_Login)
    guiLabelSetColor(lbl_top_info,137,26,26)
    guiLabelSetVerticalAlign(lbl_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_top_info,"center",false)
    guiSetFont(lbl_top_info,"default-bold-small")]]
   
    --[[lbl_about_legth = guiCreateLabel(142,42,184,18,"Max Length: 25 symbols",false,tab_Login)
    guiLabelSetColor(lbl_about_legth,253,255,68)
    guiLabelSetVerticalAlign(lbl_about_legth,"center")
    guiLabelSetHorizontalAlign(lbl_about_legth,"center",false)]]
   
   
    checkbox_save = guiCreateCheckBox(215,97,140,20,"Recordar",false,false,tab_Login)
    guiSetFont(checkbox_save,"default-small")
   
    btn_Login = guiCreateButton(110,150,130,40,"Iniciar sesion",false,tab_Login)
    guiSetFont(btn_Login,"default-bold-small")
   
    login_tab_error_msg = guiCreateLabel(0,112,350,25,"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")
   
    --Guest func
    if GuestEnable == true then
        btnGuest = guiCreateButton(29,168,94,32,"Play as Guest",false,tab_Login)
        guiSetFont(btnGuest,"default-small")
        guiSetVisible(btnGuest,true)
    else
        if isElement(btnGuest) then guiSetVisible(btnGuest,false) end
        btnGuest = nil
    end
   
   
    tab_Register = guiCreateTab("Registro",tabPannel_Main)
   
    lbl_account_name = guiCreateLabel(13,39,119,21,"Cuenta:",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(80,5,364,31,"No usar caracteres raros.",false,tab_Register)
    guiLabelSetColor(lbl_reg_top_info,255,234,55)
    guiLabelSetVerticalAlign(lbl_reg_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_reg_top_info,"left",false)
   
    edit_account_name = guiCreateEdit(142,40,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit_account_name,25)
   
    lbl__reg_tab_password = guiCreateLabel(13,71,119,21,"Clave:",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(142,71,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
   
    edit__reg_tab_Repassword = guiCreateEdit(142,102,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
   
    lvl_reg_tab_Repassword = guiCreateLabel(13,102,119,21,"Repetir clave:",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(110,150,130,40,"Crear cuenta",false,tab_Register)
    guiSetFont(btn_reg_tab_register,"default-bold-small")
   
    reg_tab_error_msg = guiCreateLabel(0,170,350,31,"Error_reg_ttab",false,tab_Register)
    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")
   
    guiEditSetMasked(edit__reg_tab_password, true)
    guiEditSetMasked(edit__reg_tab_Repassword, true)
   
    guiSetVisible(wdwLogin_Pannel,true)
    --guiSetInputEnabled(true)
    showCursor(true)
   
    --Изменение надписей:
    guiSetText(reg_tab_error_msg, "") --Поле ошибки в Reg табе
    guiSetText(login_tab_error_msg, "") --Поле ошибки в Login табе
   
   
   
    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
 
    --Эвенты
    addEventHandler("onClientGUIClick",btn_Login,onClickBtnLogin)
    addEventHandler("onClientGUIClick",btn_reg_tab_register,onClickBtnRegister)
    if GuestEnable == true then addEventHandler("onClientGUIClick",btnGuest,onClickGuest) end
   
   
--else
    --destroyElement(wdwLogin_Pannel)
    --guiSetInputEnabled(false)
    --wdwLogin_Pannel = nil
    --showCursor(false)
end
end
 
 
 
 
function start_cl_resource() --При старте
    open_log_reg_pannel()
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource)
addEventHandler("onPlayerJoin",getResourceRootElement(getThisResource()),start_cl_resource)
 
 
function loadLoginFromXML() --Загрузка логина и пароля из XML
    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) --Сохрание логина и пароля в XML
    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() --Сохрание логина и пароля в XML
        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)
 
 
Link to comment
Hola amigos otra vez tengo un problema con unos de mis resource.

Tengo el resource "loginform" (Link en la community AQUI)

Modificado por mi mismo, hice algunas modificaciones mínimas , traducción y una imágen estática, el problema es que viene con opcion de poner true/false para la opción fadeCamera para que cuando un jugador entre al juego se le vea toda la pantalla negra y sólo se vea el GUI.

El problema es que cuando la gente entra se ve el GUI, pero no la pantalla negra, quiero solucionar eso, sólo se ve la pantalla negra cuando inicio el Script.

Client:

wdwLogin_Pannel = {} 
tabPannel_Main = {}
tab_Login = {}
tab_Register = {}
 
--Settings
blackLoginScreen = true --True/false Black screen, while player login...
blackScreenTime = 3  --Time to complete disappearance of the black screen in seconds.
 
GuestEnable = false --Can a Player play as Guest, or no. [true/false]
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(wdwLogin_Pannel)) then
   
    if blackLoginScreen == true then
        fadeCamera(false,0,0,0,0)
    end
   
    local sWidth,sHeight = guiGetScreenSize() -- The variables
    local Width,Height = 350,390 --Main Window sizes
    local X = (sWidth/2) - (Width/2) --Main Window horizontal position
    local Y = (sHeight/2) - (Height/2) --Main Window vertical position
    toggleAllControls(EnableMTAControlsOnLogin)
 
 
    wdwLogin_Pannel = guiCreateWindow(X,Y,Width,Height,"MTA-LPM",false)
   
    guiWindowSetSizable(wdwLogin_Pannel,false)
   
    tabPannel_Main = guiCreateTabPanel(9,130,350,251,false,wdwLogin_Pannel)
   
    tab_Login = guiCreateTab("Iniciar sesion",tabPannel_Main)
   
    lbl_Login = guiCreateLabel(13,39,100,21,"Cuenta:",false,tab_Login)
    guiLabelSetVerticalAlign(lbl_Login,"center")
    guiLabelSetHorizontalAlign(lbl_Login,"right",false)
    guiSetFont(lbl_Login,"default-bold-small")
   
    edit_Login = guiCreateEdit(142,40,130,23,"",false,tab_Login) --Поле ввода логина
    edit_password = guiCreateEdit(142,71,130,23,"",false,tab_Login) --Поле ввода пароля
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
 
   
    lbl_Password = guiCreateLabel(13,71,100,21,"Clave:",false,tab_Login)
    guiLabelSetVerticalAlign(lbl_Password,"center")
    guiLabelSetHorizontalAlign(lbl_Password,"right",false)
    guiSetFont(lbl_Password,"default-bold-small")
   
lbl_top_info = guiCreateStaticImage(36, 28, 261, 88, "logo.png", false, wdwLogin_Pannel)
local sound = playSound("sonido.mp3")
 
   
       
   
    --[[lbl_top_info = guiCreateLabel(74,6,244,35,"Enter with your username and password.",false,tab_Login)
    guiLabelSetColor(lbl_top_info,137,26,26)
    guiLabelSetVerticalAlign(lbl_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_top_info,"center",false)
    guiSetFont(lbl_top_info,"default-bold-small")]]
   
    --[[lbl_about_legth = guiCreateLabel(142,42,184,18,"Max Length: 25 symbols",false,tab_Login)
    guiLabelSetColor(lbl_about_legth,253,255,68)
    guiLabelSetVerticalAlign(lbl_about_legth,"center")
    guiLabelSetHorizontalAlign(lbl_about_legth,"center",false)]]
   
   
    checkbox_save = guiCreateCheckBox(215,97,140,20,"Recordar",false,false,tab_Login)
    guiSetFont(checkbox_save,"default-small")
   
    btn_Login = guiCreateButton(110,150,130,40,"Iniciar sesion",false,tab_Login)
    guiSetFont(btn_Login,"default-bold-small")
   
    login_tab_error_msg = guiCreateLabel(0,112,350,25,"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")
   
    --Guest func
    if GuestEnable == true then
        btnGuest = guiCreateButton(29,168,94,32,"Play as Guest",false,tab_Login)
        guiSetFont(btnGuest,"default-small")
        guiSetVisible(btnGuest,true)
    else
        if isElement(btnGuest) then guiSetVisible(btnGuest,false) end
        btnGuest = nil
    end
   
   
    tab_Register = guiCreateTab("Registro",tabPannel_Main)
   
    lbl_account_name = guiCreateLabel(13,39,119,21,"Cuenta:",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(80,5,364,31,"No usar caracteres raros.",false,tab_Register)
    guiLabelSetColor(lbl_reg_top_info,255,234,55)
    guiLabelSetVerticalAlign(lbl_reg_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_reg_top_info,"left",false)
   
    edit_account_name = guiCreateEdit(142,40,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit_account_name,25)
   
    lbl__reg_tab_password = guiCreateLabel(13,71,119,21,"Clave:",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(142,71,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
   
    edit__reg_tab_Repassword = guiCreateEdit(142,102,130,23,"",false,tab_Register)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
   
    lvl_reg_tab_Repassword = guiCreateLabel(13,102,119,21,"Repetir clave:",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(110,150,130,40,"Crear cuenta",false,tab_Register)
    guiSetFont(btn_reg_tab_register,"default-bold-small")
   
    reg_tab_error_msg = guiCreateLabel(0,170,350,31,"Error_reg_ttab",false,tab_Register)
    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")
   
    guiEditSetMasked(edit__reg_tab_password, true)
    guiEditSetMasked(edit__reg_tab_Repassword, true)
   
    guiSetVisible(wdwLogin_Pannel,true)
    --guiSetInputEnabled(true)
    showCursor(true)
   
    --Изменение надписей:
    guiSetText(reg_tab_error_msg, "") --Поле ошибки в Reg табе
    guiSetText(login_tab_error_msg, "") --Поле ошибки в Login табе
   
   
   
    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
 
    --Эвенты
    addEventHandler("onClientGUIClick",btn_Login,onClickBtnLogin)
    addEventHandler("onClientGUIClick",btn_reg_tab_register,onClickBtnRegister)
    if GuestEnable == true then addEventHandler("onClientGUIClick",btnGuest,onClickGuest) end
   
   
--else
    --destroyElement(wdwLogin_Pannel)
    --guiSetInputEnabled(false)
    --wdwLogin_Pannel = nil
    --showCursor(false)
end
end
 
 
 
 
function start_cl_resource() --При старте
    open_log_reg_pannel()
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource)
addEventHandler("onPlayerJoin",getResourceRootElement(getThisResource()),start_cl_resource)
 
 
function loadLoginFromXML() --Загрузка логина и пароля из XML
    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) --Сохрание логина и пароля в XML
    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() --Сохрание логина и пароля в XML
        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
Link to comment

Ya lo arreglé por mi mismo :D

Puse esto a la hora de renderizar la ventana wdw_LoginPanel (GUI principal)

function updateCamera ()

if not(isElement(wdwLogin_Pannel)) then

if blackLoginScreen == true then

fadeCamera (false,blackScreenTime)

end

end

end

addEventHandler ( "onClientRender", wdwLogin_Pannel, updateCamera )

Link to comment

Aunque no se mucho de esto, puedo notar que pusiste:

fadeCamera(false,0,0,0,0) 

y la guia de argumento es:

fadeCamera ( bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] ) 

Es Decir, pusiste todo en 0, para eso era mejor solo poner

fadeCamera(false) 

ya que pusiste el tiempo en 0, es decir, que apenas entre vea todo negro.

Intenta cambiar a ver y dime como te va. Yo tambien use ese script hace tiempo y, use el argumento de la forma que te di y me funciono.

fadeCamera(false) 

Ya se que esta solucionado el tema pero me pareció pertinente hacer una acotación, cuando dices que poner todo en 0 es igual a poner solo el argumento bool "false" estas equivocado pues el segundo argumento no viene por default en 0 sino que en 1.0 , eso quiere decir que para que quedase igual como el quería solo tenias que omitir los argumentos de color quedando asi:

fadeCamera(false, 0) 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...