Jump to content

طلب تصحيح كود


Recommended Posts

السلام عليكم انا عملت لووحة لي شخص تشغيل دخول بس كل ما اندير تسجيل مايسجل حساب جديد او بندير دخول زائر يستاكة مود يرجا تصحيح كود للخبراء فقط

 

Client

local winFont = dxCreateFont ( "CODE_Bold.ttf",52,false )

local x, y = guiGetScreenSize()
local fontTam = dxGetFontHeight(1,winFont)

local teamName = "# #646464Welcome To Libyan monstres Server"
local tagName = "[L.M] Login Panel"

local user = "Username"
local pass = "Password"

local fontAlto = dxGetFontHeight(0.6,winFont)
local fontLargo = dxGetTextWidth ("iGamers Gaming",0.6,winFont)
local fontLargo2 = dxGetTextWidth (tagName,0.4,winFont)
local zene = playSound("music.mp3", true)
setSoundVolume(zene, 0.4)

local fAltUser = dxGetFontHeight (2,"default")

local start={}
local varX={}
local varY={}
local varZ={}
local alpha = {}
local loginError=0

alpha["دخول"]=0
alpha["cancel"]=0
alpha["reg"]=0
alpha["here"]="#0fc0fc"
comprobar=0

local espX = 30
local espY = 60

local recX = 350
local recY = 30

local logX = x/2
local logY = y/2.7

local cancelX=100
local okX=60

local sep=20
local men=15

--bindKey("F2", "down",
addEvent("onFinishIntro",true)
addEventHandler("onFinishIntro",getRootElement(),
function()
    setTimer(function()
       showChat(false)
    end,300,1)
    showCursor(true)

    start[0] = getTickCount()
    guiPart()
    addEventHandler ( "onClientRender", getRootElement(), interfaz )
end
)


function guiPart()
    shLogin = guiCreateButton(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, "دخول", false)
    addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
    addEventHandler( "onClientMouseEnter",shLogin,function() alpha["دخول"]=20 end)
    addEventHandler("onClientMouseLeave",shLogin,function() alpha["دخول"]=0 end)
    guiSetAlpha ( shLogin, 0 )
    
    shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
    
    shRegister = guiCreateButton(x/2+75, logY+fAltUser*2+sep*3+70+3, 30, 10, "", false)
    addEventHandler("onClientGUIClick",shRegister,OnBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister,function() alpha["here"]="#999999" end)
    addEventHandler("onClientMouseLeave",shRegister,function() alpha["here"]="#0fc0fc" end)
    guiSetAlpha ( shRegister, 0 )
    
        
    edit_Login = guiCreateEdit(logX-recX/2+7, logY+fAltUser, recX, recY, "Username", false)
    addEventHandler("onClientGUIClick",edit_Login,function() guiSetText ( edit_Login, "" ) end)
    guiSetAlpha ( edit_Login, 0 )
    
    edit_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep, recX, recY, "Password", false)
    addEventHandler("onClientGUIClick",edit_password,function() guiSetText ( edit_password, "" ) end)
    guiSetAlpha ( edit_password, 0 )    
    
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
    
    --Register
    shRegister2 = guiCreateButton(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY, "", false)
    addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister2,function() alpha["reg"]=40 end)
    addEventHandler("onClientMouseLeave",shRegister2,function() alpha["reg"]=0 end)
    guiSetAlpha ( shRegister2, 0 )
    guiSetVisible(shRegister2,false)
        
    edit_account_name = guiCreateEdit(logX-recX/2+7, logY+fAltUser-men, recX, recY,"Username",false)
    addEventHandler("onClientGUIClick",edit_account_name,function() guiSetText ( edit_account_name, "" ) end)
    guiEditSetMaxLength ( edit_account_name,25)
    guiSetVisible(edit_account_name,false)
    guiSetAlpha ( edit_account_name, 0 )
    
    edit__reg_tab_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep-men,recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_password,function() guiSetText ( edit__reg_tab_password, "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
    guiEditSetMasked ( edit__reg_tab_password, true )
    guiSetVisible(edit__reg_tab_password,false)
    guiSetAlpha ( edit__reg_tab_password, 0 )
    
    edit__reg_tab_Repassword = guiCreateEdit(logX-recX/2+7, logY+fAltUser*3+sep*2-men, recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_Repassword ,function() guiSetText ( edit__reg_tab_Repassword , "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
    guiEditSetMasked ( edit__reg_tab_Repassword, true )
    guiSetVisible(edit__reg_tab_Repassword,false)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetAlpha ( edit__reg_tab_Repassword , 0 )
    
    
    setTimer(function()
        checkbox_save = guiCreateCheckBox(logX-recX/2+10,logY+fAltUser*2+10+sep*3+5,20,20,"",false,false)
    
        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,1100,1)
end

function interfaz()
    ahora = getTickCount()
    count=ahora-start[0]
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    --dxDrawRectangle ( 0, 0, x, y, tocolor ( 0, 0, 0, 100 ) )    
    --dxDrawText ( count, 0, 0, x, y, tocolor ( 255, 255, 255, 255 ), 0.4, winFont )
    if (count>500) then
        varX[1],varY[1],varZ[1] = anim(start[0]+500,2500,0,0,0,255,200,80,"Linear")
        dxDrawText ( teamName, espX, espY, 10, 10, tocolor ( 15,192,252, varX[1] ), 0.6, winFont, nil, nil, true, false, false, true )
        dxDrawText ( tagName, fontLargo-fontLargo2+espX, fontAlto+espY, x, y, tocolor ( 255, 255, 255, varX[1]*0.8 ), 0.4, winFont )
        --dxDrawText ( tagName, 0, y*0.9, x, y, tocolor ( 255, 255, 255, varX[1] ), 0.4, winFont,"center" )
    end
    if (count>1000) then
        txtUser = guiGetText ( edit_Login )
        txtPass = guiGetText ( edit_password )
        txtPass = string.rep( '*', #txtPass )
        
        varX[2],varY[2],varZ[2] = anim(start[0]+1000,1000,0,0,0,255,recX,150,"Linear")
        
        dxDrawText ( txtUser, logX-recX/2+15, logY+fAltUser+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawText ( txtPass, logX-recX/2+15, logY+fAltUser*2+sep+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        
        dxDrawRectangle ( logX-recX/2, logY+fAltUser, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)        
    
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)
    
        dxDrawText ( "Cancel", logX-recX/2+(recX-cancelX)+18, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY,tocolor( 255, 0, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, tocolor ( 255, 255, 255, alpha["cancel"] ) )    
    
        dxDrawText ( "دخول", logX-recX/2+(recX-cancelX-okX-10)+15, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY,tocolor( 0, 255, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, tocolor ( 255, 255, 255, alpha["دخول"] ) )
        
        dxDrawText ( "Remember me", logX-recX/2+30,logY+fAltUser*2+12+sep*3+5, x, y, tocolor ( 255, 255, 255, varX[2] ), 1, "default-bold" )
    end
    
    if (count>2000) then
        varX[3],varY[3],varZ[3] = anim(start[0]+2000,1000,0,0,0,255,0,150,"Linear")
        --dxDrawImage(x-320*0.5, y-240*0.5-10, 320*0.5, 240*0.5, 'logo.png')
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep+4, 20, 20, 'pass.png',varY[3])        
        dxDrawText ( "Don't have an account? Register "..alpha["here"].."Here#ffffff.", 0, logY+fAltUser*2+sep*3+70, x, y, tocolor ( 255, 255, 255, varX[3] ), 1, "default-bold", "center", nil,true,false,false,true  )    
    end
end

function register_panel()
    regAlto = 250
    regAncho = 370
    ahora2 = getTickCount()
    count2=ahora2-start[1]
    varX[4],varY[4],varZ[4] = anim(start[1],1000,0,0,0,regAncho,regAlto,150,"Linear")
    dxDrawRectangle ( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4], tocolor ( 15,192,252, 250 ) )
    dxDrawEmptyRec( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4],tocolor( 255, 255, 255, 255),2)
    if (count2>1000) then
        txtRegUser = guiGetText ( edit_account_name )
        txtRegPass = guiGetText ( edit__reg_tab_password  )
        txtRegPass = string.rep( '*', #txtRegPass )
        txtRegRePass = guiGetText ( edit__reg_tab_Repassword  )
        txtRegRePass = string.rep( '*', #txtRegRePass)
        
        dxDrawText ( "Register", 0, logY+fAltUser-men-dxGetFontHeight(2,"default-bold"), x, y, tocolor ( 255, 255, 255, 255 ), 2, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawText ( txtRegUser, logX-recX/2+15, logY+fAltUser-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser-men, recX, recY,tocolor( 255, 255, 255, 255),1)        
    
        dxDrawText ( txtRegPass, logX-recX/2+15, logY+fAltUser*2+sep-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawText ( txtRegRePass, logX-recX/2+15, logY+fAltUser*3+sep*2-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawEmptyRec(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, 255),1)
        dxDrawRectangle(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, alpha["reg"]))
        dxDrawText ( "Done", 0, logY+fAltUser*4+sep*3.5-men+3, x, y, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser-men+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep-men+4, 20, 20, 'pass.png',varY[3])    
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*3+sep*2-men+4, 20, 20, 'pass.png',varY[3])
        --dxDrawEmptyRec ( (x-varX[4])/2+regAncho-15, (y-varY[4])/2+5,11 , 11, tocolor ( 255, 255, 255, 255 ), 1 )
        --dxDrawText ( "x", (x-varX[4])/2+regAncho-12, (y-varY[4])/2+2, x, y, tocolor ( 255, 255, 255, 255 ), 1, "default" )
    end
end

 

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(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, 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)
            removeEventHandler("onClientRender", getRootElement(), interfaz)

        end
    end
end

function OnBtnRegister ()

    guiSetVisible(shRegister2, true)
    guiSetVisible(lbl_reg_top_info,true)
    guiSetVisible(edit__reg_tab_Repassword,true)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetVisible(edit__reg_tab_password,true)
    guiSetVisible(edit_account_name,true)
       guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
    start[1] = getTickCount()
    addEventHandler("onClientRender", getRootElement(), register_panel)    
end

function onClickBtnRegister(button,state)

    if (guiGetText (edit_account_name)=="Username") or (guiGetText (edit_account_name)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a user name",2)
    elseif ((guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="")) and (guiGetText (edit__reg_tab_password)==guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_Repassword)=="Password") or (guiGetText (edit__reg_tab_Repassword)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please repeat pasword",2)
    elseif (guiGetText (edit__reg_tab_password)~=guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Passwords don't match",2)
    else

    guiStaticImageLoadImage(Login_img, "Login_window.png" )

        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)
        guiSetVisible(shRegister2, false)
        guiSetVisible(edit__reg_tab_password, false)
        guiSetVisible(edit__reg_tab_Repassword, false)
        guiSetVisible(edit_account_name, false)
        guiSetVisible(lbl_reg_top_info, false)
    --
            username = guiGetText(edit_account_name)
            password = guiGetText(edit__reg_tab_password)
            passwordConfirm = guiGetText(edit__reg_tab_Repassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
            
            triggerEvent("addNotification", getLocalPlayer(),"Successful register!",1)
            triggerEvent("addNotification", getLocalPlayer(),"Now log in!",1)            

    removeEventHandler("onClientRender", getRootElement(), register_panel)
    end
end

 

function Error_msg(Tab, Text)
    showCursor(true)
    showChat(false)
    if Tab == "Login" then
        setTimer(function()
            addEventHandler ( "onClientRender", getRootElement(), interfaz )
        end,1100,1)
        guiSetVisible(btnGuest, true)
        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(btn_reg_tab_register, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)

        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    elseif Tab == "Register" then
        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    end
end
addEvent("set_warning_text",true)
addEventHandler("set_warning_text",getRootElement(),Error_msg)


function onClickGuest()

    showChat(true)

        guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
        guiSetVisible(Login_img, false)
    removeEventHandler("onClientRender", getRootElement(), login_panel)
    triggerServerEvent("Don't", getLocalPlayer ( ),"You have to login to play!")
end


function hideLoginWindow()

    destroyElement(zene)
    stopSound(zene)
    showChat(true)
    removeEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)

function CursorError ()
outputChatBox("Kurzor elrejtve")
showCursor(false)
end
addCommandHandler("showc", CursorError)

function dxDrawEmptyRec(absX,absY,sizeX,sizeY,color,ancho)
    dxDrawRectangle ( absX,absY,sizeX,ancho,color )
    dxDrawRectangle ( absX,absY+ancho,ancho,sizeY-ancho,color )
    dxDrawRectangle ( absX+ancho,absY+sizeY-ancho,sizeX-ancho,ancho,color )
    dxDrawRectangle ( absX+sizeX-ancho,absY+ancho,ancho,sizeY-ancho*2,color )    
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 

 

info_c

x, y = guiGetScreenSize()
font="default-bold"
fontTam=5

spcGam=dxGetTextWidth ("Gamers",fontTam,font)
function main()
    showChat(false)
    start = getTickCount()
    addEventHandler("onClientRender",getRootElement(),intro)
    setTimer ( function()
        removeEventHandler("onClientRender",getRootElement(),intro)
    triggerEvent("onFinishIntro",getRootElement())
    end, 5000, 1 )
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),main)

function intro()
    ahora = getTickCount()
    count=ahora-start
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    sizeX=64*1.21
    sizeY=64*1.21
    varX,varY,varZ = anim(start,1000,spcGam,0,0,0,spcGam,150,"Linear")
    dxDrawText("منور وحوش Monstres",0+x/2-varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,true)
    dxDrawText("#0088FF?",x/2+varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,false,false,false,true)
    if (count>1500) then
    varX2,varY2,varZ2 = anim(start+1500,1000,0,0,0,200,250,360,"Linear")
    dxDrawText("#00FF00~ #FFFFFFWelcome#ff0000To #ffffffLib#0088ffyan #FFFFFFMonstres #00FF00~",0+x/2-varY/2,y/2-100+dxGetFontHeight(fontTam,font),varY+x/2-varY/2,y,tocolor(255,255,255,varX2),1,font,"center",nil,false,false,false,true)    
    end
    if (count>2000) then
        varX2,varY3,varZ3 = anim(start+2000,1000*10,0,0,0,200,250,360*20,"Linear")
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando1.png',varZ3)
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando2.png',180+varZ3)
    dxDrawText("تحميل",12,y/2+60+sizeY+1,x,y,tocolor(0,0,0,85),1.5,font,"center",nil,false,false,false,true)
    dxDrawText("تحميل",10,y/2+60+sizeY,x,y,tocolor(255,255,255,255),1.5,font,"center",nil,false,false,false,true)
    end
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 

server

 

function PlayerLogin(username,password,checksave)
    if not (username == "") then
        if not (password == "") then
            local account = getAccount ( username, password )
            if ( account ~= false ) then
                logIn(source, account, password)
                triggerClientEvent ('stopsong',source)
                triggerClientEvent (source,"hideLoginWindow",getRootElement())
                
                    if checksave == true then
                        triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password)
                    else
                        triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password)
                    end
                
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Wrong username and/or password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your username!")
    end
end
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

 

function registerPlayer(username,password,passwordConfirm)
    if not (username == "") then
        if not (password == "") then
            if not (passwordConfirm == "") then
                if password == passwordConfirm then
                    local account = getAccount (username,password)
                    if (account == false) then
                        local accountAdded = addAccount(tostring(username),tostring(password))
                        if (accountAdded) then
                            outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [Username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true )
                        else
                            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An unknown error has occured! Please choose a different username/password and try again.")
                        end
                    else
                        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An account with this username already exists!")
                    end
                else
                    triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Passwords do not match!")
                end
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a username you would like to register with!")
    end
end
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)

 

ارجو رد

 

  • Like 1
Link to comment
4 minutes ago, Mohamed_king said:

ممكن تعملي مود مرة اخري فهد ؟

 

شوف اطرح اكوادك بضيغة lua 

هكي مفيش حد يقدر يساعدك الا الي فاضي بينسخ الاكواد وبيلصقهم في المحرر متع وموضع بتفتحه

Link to comment
---Clinet
x, y = guiGetScreenSize()

local winFont = dxCreateFont ( "CODE_Bold.ttf",52,false )

local fontTam = dxGetFontHeight(1,winFont)

local teamName = "# #646464Welcome To Libyan monstres Server"
local tagName = "[L.M] Login Panel"

local user = "Username"
local pass = "Password"

local fontAlto = dxGetFontHeight(0.6,winFont)
local fontLargo = dxGetTextWidth ("iGamers Gaming",0.6,winFont)
local fontLargo2 = dxGetTextWidth (tagName,0.4,winFont)
local zene = playSound("music.mp3", true)
setSoundVolume(zene, 0.4)

local fAltUser = dxGetFontHeight (2,"default")

local start={}
local varX={}
local varY={}
local varZ={}
local alpha = {}
local loginError=0

alpha["دخول"]=0
alpha["cancel"]=0
alpha["reg"]=0
alpha["here"]="#0fc0fc"
comprobar=0

local espX = 30
local espY = 60

local recX = 350
local recY = 30

local logX = x/2
local logY = y/2.7

local cancelX=100
local okX=60

local sep=20
local men=15

--bindKey("F2", "down",
addEvent("onFinishIntro",true)
addEventHandler("onFinishIntro",getRootElement(),
function()
    setTimer(function()
       showChat(false)
    end,300,1)
    showCursor(true)

    start[0] = getTickCount()
    guiPart()
    addEventHandler ( "onClientRender", getRootElement(), interfaz )
end
)


function guiPart()
    shLogin = guiCreateButton(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, "دخول", false)
    addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
    addEventHandler( "onClientMouseEnter",shLogin,function() alpha["دخول"]=20 end)
    addEventHandler("onClientMouseLeave",shLogin,function() alpha["دخول"]=0 end)
    guiSetAlpha ( shLogin, 0 )
    
    shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
    
    shRegister = guiCreateButton(x/2+75, logY+fAltUser*2+sep*3+70+3, 30, 10, "", false)
    addEventHandler("onClientGUIClick",shRegister,OnBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister,function() alpha["here"]="#999999" end)
    addEventHandler("onClientMouseLeave",shRegister,function() alpha["here"]="#0fc0fc" end)
    guiSetAlpha ( shRegister, 0 )
    
        
    edit_Login = guiCreateEdit(logX-recX/2+7, logY+fAltUser, recX, recY, "Username", false)
    addEventHandler("onClientGUIClick",edit_Login,function() guiSetText ( edit_Login, "" ) end)
    guiSetAlpha ( edit_Login, 0 )
    
    edit_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep, recX, recY, "Password", false)
    addEventHandler("onClientGUIClick",edit_password,function() guiSetText ( edit_password, "" ) end)
    guiSetAlpha ( edit_password, 0 )    
    
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
    
    --Register
    shRegister2 = guiCreateButton(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY, "", false)
    addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister2,function() alpha["reg"]=40 end)
    addEventHandler("onClientMouseLeave",shRegister2,function() alpha["reg"]=0 end)
    guiSetAlpha ( shRegister2, 0 )
    guiSetVisible(shRegister2,false)
        
    edit_account_name = guiCreateEdit(logX-recX/2+7, logY+fAltUser-men, recX, recY,"Username",false)
    addEventHandler("onClientGUIClick",edit_account_name,function() guiSetText ( edit_account_name, "" ) end)
    guiEditSetMaxLength ( edit_account_name,25)
    guiSetVisible(edit_account_name,false)
    guiSetAlpha ( edit_account_name, 0 )
    
    edit__reg_tab_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep-men,recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_password,function() guiSetText ( edit__reg_tab_password, "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
    guiEditSetMasked ( edit__reg_tab_password, true )
    guiSetVisible(edit__reg_tab_password,false)
    guiSetAlpha ( edit__reg_tab_password, 0 )
    
    edit__reg_tab_Repassword = guiCreateEdit(logX-recX/2+7, logY+fAltUser*3+sep*2-men, recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_Repassword ,function() guiSetText ( edit__reg_tab_Repassword , "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
    guiEditSetMasked ( edit__reg_tab_Repassword, true )
    guiSetVisible(edit__reg_tab_Repassword,false)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetAlpha ( edit__reg_tab_Repassword , 0 )
    
    
    setTimer(function()
        checkbox_save = guiCreateCheckBox(logX-recX/2+10,logY+fAltUser*2+10+sep*3+5,20,20,"",false,false)
    
        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,1100,1)
end

function interfaz()
    ahora = getTickCount()
    count=ahora-start[0]
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    --dxDrawRectangle ( 0, 0, x, y, tocolor ( 0, 0, 0, 100 ) )    
    --dxDrawText ( count, 0, 0, x, y, tocolor ( 255, 255, 255, 255 ), 0.4, winFont )
    if (count>500) then
        varX[1],varY[1],varZ[1] = anim(start[0]+500,2500,0,0,0,255,200,80,"Linear")
        dxDrawText ( teamName, espX, espY, 10, 10, tocolor ( 15,192,252, varX[1] ), 0.6, winFont, nil, nil, true, false, false, true )
        dxDrawText ( tagName, fontLargo-fontLargo2+espX, fontAlto+espY, x, y, tocolor ( 255, 255, 255, varX[1]*0.8 ), 0.4, winFont )
        --dxDrawText ( tagName, 0, y*0.9, x, y, tocolor ( 255, 255, 255, varX[1] ), 0.4, winFont,"center" )
    end
    if (count>1000) then
        txtUser = guiGetText ( edit_Login )
        txtPass = guiGetText ( edit_password )
        txtPass = string.rep( '*', #txtPass )
        
        varX[2],varY[2],varZ[2] = anim(start[0]+1000,1000,0,0,0,255,recX,150,"Linear")
        
        dxDrawText ( txtUser, logX-recX/2+15, logY+fAltUser+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawText ( txtPass, logX-recX/2+15, logY+fAltUser*2+sep+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        
        dxDrawRectangle ( logX-recX/2, logY+fAltUser, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)        
    
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)
    
        dxDrawText ( "Cancel", logX-recX/2+(recX-cancelX)+18, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY,tocolor( 255, 0, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, tocolor ( 255, 255, 255, alpha["cancel"] ) )    
    
        dxDrawText ( "دخول", logX-recX/2+(recX-cancelX-okX-10)+15, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY,tocolor( 0, 255, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, tocolor ( 255, 255, 255, alpha["دخول"] ) )
        
        dxDrawText ( "Remember me", logX-recX/2+30,logY+fAltUser*2+12+sep*3+5, x, y, tocolor ( 255, 255, 255, varX[2] ), 1, "default-bold" )
    end
    
    if (count>2000) then
        varX[3],varY[3],varZ[3] = anim(start[0]+2000,1000,0,0,0,255,0,150,"Linear")
        --dxDrawImage(x-320*0.5, y-240*0.5-10, 320*0.5, 240*0.5, 'logo.png')
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep+4, 20, 20, 'pass.png',varY[3])        
        dxDrawText ( "Don't have an account? Register "..alpha["here"].."Here#ffffff.", 0, logY+fAltUser*2+sep*3+70, x, y, tocolor ( 255, 255, 255, varX[3] ), 1, "default-bold", "center", nil,true,false,false,true  )    
    end
end

function register_panel()
    regAlto = 250
    regAncho = 370
    ahora2 = getTickCount()
    count2=ahora2-start[1]
    varX[4],varY[4],varZ[4] = anim(start[1],1000,0,0,0,regAncho,regAlto,150,"Linear")
    dxDrawRectangle ( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4], tocolor ( 15,192,252, 250 ) )
    dxDrawEmptyRec( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4],tocolor( 255, 255, 255, 255),2)
    if (count2>1000) then
        txtRegUser = guiGetText ( edit_account_name )
        txtRegPass = guiGetText ( edit__reg_tab_password  )
        txtRegPass = string.rep( '*', #txtRegPass )
        txtRegRePass = guiGetText ( edit__reg_tab_Repassword  )
        txtRegRePass = string.rep( '*', #txtRegRePass)
        
        dxDrawText ( "Register", 0, logY+fAltUser-men-dxGetFontHeight(2,"default-bold"), x, y, tocolor ( 255, 255, 255, 255 ), 2, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawText ( txtRegUser, logX-recX/2+15, logY+fAltUser-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser-men, recX, recY,tocolor( 255, 255, 255, 255),1)        
    
        dxDrawText ( txtRegPass, logX-recX/2+15, logY+fAltUser*2+sep-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawText ( txtRegRePass, logX-recX/2+15, logY+fAltUser*3+sep*2-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawEmptyRec(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, 255),1)
        dxDrawRectangle(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, alpha["reg"]))
        dxDrawText ( "Done", 0, logY+fAltUser*4+sep*3.5-men+3, x, y, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser-men+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep-men+4, 20, 20, 'pass.png',varY[3])    
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*3+sep*2-men+4, 20, 20, 'pass.png',varY[3])
        --dxDrawEmptyRec ( (x-varX[4])/2+regAncho-15, (y-varY[4])/2+5,11 , 11, tocolor ( 255, 255, 255, 255 ), 1 )
        --dxDrawText ( "x", (x-varX[4])/2+regAncho-12, (y-varY[4])/2+2, x, y, tocolor ( 255, 255, 255, 255 ), 1, "default" )
    end
end

 

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(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, 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)
            removeEventHandler("onClientRender", getRootElement(), interfaz)

        end
    end
end

function OnBtnRegister ()

    guiSetVisible(shRegister2, true)
    guiSetVisible(lbl_reg_top_info,true)
    guiSetVisible(edit__reg_tab_Repassword,true)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetVisible(edit__reg_tab_password,true)
    guiSetVisible(edit_account_name,true)
       guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
    start[1] = getTickCount()
    addEventHandler("onClientRender", getRootElement(), register_panel)    
end

function onClickBtnRegister(button,state)

    if (guiGetText (edit_account_name)=="Username") or (guiGetText (edit_account_name)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a user name",2)
    elseif ((guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="")) and (guiGetText (edit__reg_tab_password)==guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_Repassword)=="Password") or (guiGetText (edit__reg_tab_Repassword)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please repeat pasword",2)
    elseif (guiGetText (edit__reg_tab_password)~=guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Passwords don't match",2)
    else

    guiStaticImageLoadImage(Login_img, "Login_window.png" )

        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)
        guiSetVisible(shRegister2, false)
        guiSetVisible(edit__reg_tab_password, false)
        guiSetVisible(edit__reg_tab_Repassword, false)
        guiSetVisible(edit_account_name, false)
        guiSetVisible(lbl_reg_top_info, false)
    --
            username = guiGetText(edit_account_name)
            password = guiGetText(edit__reg_tab_password)
            passwordConfirm = guiGetText(edit__reg_tab_Repassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
            
            triggerEvent("addNotification", getLocalPlayer(),"Successful register!",1)
            triggerEvent("addNotification", getLocalPlayer(),"Now log in!",1)            

    removeEventHandler("onClientRender", getRootElement(), register_panel)
    end
end

 

function Error_msg(Tab, Text)
    showCursor(true)
    showChat(false)
    if Tab == "Login" then
        setTimer(function()
            addEventHandler ( "onClientRender", getRootElement(), interfaz )
        end,1100,1)
        guiSetVisible(btnGuest, true)
        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(btn_reg_tab_register, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)

        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    elseif Tab == "Register" then
        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    end
end
addEvent("set_warning_text",true)
addEventHandler("set_warning_text",getRootElement(),Error_msg)


function onClickGuest()

    showChat(true)

        guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
        guiSetVisible(Login_img, false)
    removeEventHandler("onClientRender", getRootElement(), login_panel)
    triggerServerEvent("Don't", getLocalPlayer ( ),"You have to login to play!")
end


function hideLoginWindow()

    destroyElement(zene)
    stopSound(zene)
    showChat(true)
    removeEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)

function CursorError ()
outputChatBox("Kurzor elrejtve")
showCursor(false)
end
addCommandHandler("showc", CursorError)

function dxDrawEmptyRec(absX,absY,sizeX,sizeY,color,ancho)
    dxDrawRectangle ( absX,absY,sizeX,ancho,color )
    dxDrawRectangle ( absX,absY+ancho,ancho,sizeY-ancho,color )
    dxDrawRectangle ( absX+ancho,absY+sizeY-ancho,sizeX-ancho,ancho,color )
    dxDrawRectangle ( absX+sizeX-ancho,absY+ancho,ancho,sizeY-ancho*2,color )    
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 

 
-- Clinet


font="default-bold"
fontTam=5

spcGam=dxGetTextWidth ("Gamers",fontTam,font)
function main()
    showChat(false)
    start = getTickCount()
    addEventHandler("onClientRender",getRootElement(),intro)
    setTimer ( function()
        removeEventHandler("onClientRender",getRootElement(),intro)
    triggerEvent("onFinishIntro",getRootElement())
    end, 5000, 1 )
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),main)

function intro()
    ahora = getTickCount()
    count=ahora-start
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    sizeX=64*1.21
    sizeY=64*1.21
    varX,varY,varZ = anim(start,1000,spcGam,0,0,0,spcGam,150,"Linear")
    dxDrawText("منور وحوش Monstres",0+x/2-varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,true)
    dxDrawText("#0088FF?",x/2+varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,false,false,false,true)
    if (count>1500) then
    varX2,varY2,varZ2 = anim(start+1500,1000,0,0,0,200,250,360,"Linear")
    dxDrawText("#00FF00~ #FFFFFFWelcome#ff0000To #ffffffLib#0088ffyan #FFFFFFMonstres #00FF00~",0+x/2-varY/2,y/2-100+dxGetFontHeight(fontTam,font),varY+x/2-varY/2,y,tocolor(255,255,255,varX2),1,font,"center",nil,false,false,false,true)    
    end
    if (count>2000) then
        varX2,varY3,varZ3 = anim(start+2000,1000*10,0,0,0,200,250,360*20,"Linear")
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando1.png',varZ3)
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando2.png',180+varZ3)
    dxDrawText("تحميل",12,y/2+60+sizeY+1,x,y,tocolor(0,0,0,85),1.5,font,"center",nil,false,false,false,true)
    dxDrawText("تحميل",10,y/2+60+sizeY,x,y,tocolor(255,255,255,255),1.5,font,"center",nil,false,false,false,true)
    end
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 


 --- Server

function PlayerLogin(username,password,checksave)
    if not (username == "") then
        if not (password == "") then
            local account = getAccount ( username, password )
            if ( account ~= false ) then
                logIn(source, account, password)
                triggerClientEvent ('stopsong',source)
                triggerClientEvent (source,"hideLoginWindow",getRootElement())
                
                    if checksave == true then
                        triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password)
                    else
                        triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password)
                    end
                
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Wrong username and/or password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your username!")
    end
end
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

 

function registerPlayer(username,password,passwordConfirm)
    if not (username == "") then
        if not (password == "") then
            if not (passwordConfirm == "") then
                if password == passwordConfirm then
                    local account = getAccount (username,password)
                    if (account == false) then
                        local accountAdded = addAccount(tostring(username),tostring(password))
                        if (accountAdded) then
                            outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [Username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true )
                        else
                            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An unknown error has occured! Please choose a different username/password and try again.")
                        end
                    else
                        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An account with this username already exists!")
                    end
                else
                    triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Passwords do not match!")
                end
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a username you would like to register with!")
    end
end
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)

 

جرب

في بعض الاخطاء صلحته بس مدري يمكن مايشتغل انت جرب

و اذا ما اشتغل اكتب في اف8

debugscript 3  

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

و هات الي يطلعلك في الدي بوق او صور الشاشه و ارفع و هات الصوره

Edited by iMr ~ MnHmAr
Link to comment
7 minutes ago, iMr ~ MnHmAr said:

---Clinet
x, y = guiGetScreenSize()

local winFont = dxCreateFont ( "CODE_Bold.ttf",52,false )

local fontTam = dxGetFontHeight(1,winFont)

local teamName = "# #646464Welcome To Libyan monstres Server"
local tagName = "[L.M] Login Panel"

local user = "Username"
local pass = "Password"

local fontAlto = dxGetFontHeight(0.6,winFont)
local fontLargo = dxGetTextWidth ("iGamers Gaming",0.6,winFont)
local fontLargo2 = dxGetTextWidth (tagName,0.4,winFont)
local zene = playSound("music.mp3", true)
setSoundVolume(zene, 0.4)

local fAltUser = dxGetFontHeight (2,"default")

local start={}
local varX={}
local varY={}
local varZ={}
local alpha = {}
local loginError=0

alpha["دخول"]=0
alpha["cancel"]=0
alpha["reg"]=0
alpha["here"]="#0fc0fc"
comprobar=0

local espX = 30
local espY = 60

local recX = 350
local recY = 30

local logX = x/2
local logY = y/2.7

local cancelX=100
local okX=60

local sep=20
local men=15

--bindKey("F2", "down",
addEvent("onFinishIntro",true)
addEventHandler("onFinishIntro",getRootElement(),
function()
    setTimer(function()
       showChat(false)
    end,300,1)
    showCursor(true)

    start[0] = getTickCount()
    guiPart()
    addEventHandler ( "onClientRender", getRootElement(), interfaz )
end
)


function guiPart()
    shLogin = guiCreateButton(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, "دخول", false)
    addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
    addEventHandler( "onClientMouseEnter",shLogin,function() alpha["دخول"]=20 end)
    addEventHandler("onClientMouseLeave",shLogin,function() alpha["دخول"]=0 end)
    guiSetAlpha ( shLogin, 0 )
    
    shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
    
    shRegister = guiCreateButton(x/2+75, logY+fAltUser*2+sep*3+70+3, 30, 10, "", false)
    addEventHandler("onClientGUIClick",shRegister,OnBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister,function() alpha["here"]="#999999" end)
    addEventHandler("onClientMouseLeave",shRegister,function() alpha["here"]="#0fc0fc" end)
    guiSetAlpha ( shRegister, 0 )
    
        
    edit_Login = guiCreateEdit(logX-recX/2+7, logY+fAltUser, recX, recY, "Username", false)
    addEventHandler("onClientGUIClick",edit_Login,function() guiSetText ( edit_Login, "" ) end)
    guiSetAlpha ( edit_Login, 0 )
    
    edit_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep, recX, recY, "Password", false)
    addEventHandler("onClientGUIClick",edit_password,function() guiSetText ( edit_password, "" ) end)
    guiSetAlpha ( edit_password, 0 )    
    
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
    
    --Register
    shRegister2 = guiCreateButton(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY, "", false)
    addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister2,function() alpha["reg"]=40 end)
    addEventHandler("onClientMouseLeave",shRegister2,function() alpha["reg"]=0 end)
    guiSetAlpha ( shRegister2, 0 )
    guiSetVisible(shRegister2,false)
        
    edit_account_name = guiCreateEdit(logX-recX/2+7, logY+fAltUser-men, recX, recY,"Username",false)
    addEventHandler("onClientGUIClick",edit_account_name,function() guiSetText ( edit_account_name, "" ) end)
    guiEditSetMaxLength ( edit_account_name,25)
    guiSetVisible(edit_account_name,false)
    guiSetAlpha ( edit_account_name, 0 )
    
    edit__reg_tab_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep-men,recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_password,function() guiSetText ( edit__reg_tab_password, "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
    guiEditSetMasked ( edit__reg_tab_password, true )
    guiSetVisible(edit__reg_tab_password,false)
    guiSetAlpha ( edit__reg_tab_password, 0 )
    
    edit__reg_tab_Repassword = guiCreateEdit(logX-recX/2+7, logY+fAltUser*3+sep*2-men, recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_Repassword ,function() guiSetText ( edit__reg_tab_Repassword , "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
    guiEditSetMasked ( edit__reg_tab_Repassword, true )
    guiSetVisible(edit__reg_tab_Repassword,false)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetAlpha ( edit__reg_tab_Repassword , 0 )
    
    
    setTimer(function()
        checkbox_save = guiCreateCheckBox(logX-recX/2+10,logY+fAltUser*2+10+sep*3+5,20,20,"",false,false)
    
        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,1100,1)
end

function interfaz()
    ahora = getTickCount()
    count=ahora-start[0]
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    --dxDrawRectangle ( 0, 0, x, y, tocolor ( 0, 0, 0, 100 ) )    
    --dxDrawText ( count, 0, 0, x, y, tocolor ( 255, 255, 255, 255 ), 0.4, winFont )
    if (count>500) then
        varX[1],varY[1],varZ[1] = anim(start[0]+500,2500,0,0,0,255,200,80,"Linear")
        dxDrawText ( teamName, espX, espY, 10, 10, tocolor ( 15,192,252, varX[1] ), 0.6, winFont, nil, nil, true, false, false, true )
        dxDrawText ( tagName, fontLargo-fontLargo2+espX, fontAlto+espY, x, y, tocolor ( 255, 255, 255, varX[1]*0.8 ), 0.4, winFont )
        --dxDrawText ( tagName, 0, y*0.9, x, y, tocolor ( 255, 255, 255, varX[1] ), 0.4, winFont,"center" )
    end
    if (count>1000) then
        txtUser = guiGetText ( edit_Login )
        txtPass = guiGetText ( edit_password )
        txtPass = string.rep( '*', #txtPass )
        
        varX[2],varY[2],varZ[2] = anim(start[0]+1000,1000,0,0,0,255,recX,150,"Linear")
        
        dxDrawText ( txtUser, logX-recX/2+15, logY+fAltUser+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawText ( txtPass, logX-recX/2+15, logY+fAltUser*2+sep+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        
        dxDrawRectangle ( logX-recX/2, logY+fAltUser, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)        
    
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)
    
        dxDrawText ( "Cancel", logX-recX/2+(recX-cancelX)+18, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY,tocolor( 255, 0, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, tocolor ( 255, 255, 255, alpha["cancel"] ) )    
    
        dxDrawText ( "دخول", logX-recX/2+(recX-cancelX-okX-10)+15, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY,tocolor( 0, 255, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, tocolor ( 255, 255, 255, alpha["دخول"] ) )
        
        dxDrawText ( "Remember me", logX-recX/2+30,logY+fAltUser*2+12+sep*3+5, x, y, tocolor ( 255, 255, 255, varX[2] ), 1, "default-bold" )
    end
    
    if (count>2000) then
        varX[3],varY[3],varZ[3] = anim(start[0]+2000,1000,0,0,0,255,0,150,"Linear")
        --dxDrawImage(x-320*0.5, y-240*0.5-10, 320*0.5, 240*0.5, 'logo.png')
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep+4, 20, 20, 'pass.png',varY[3])        
        dxDrawText ( "Don't have an account? Register "..alpha["here"].."Here#ffffff.", 0, logY+fAltUser*2+sep*3+70, x, y, tocolor ( 255, 255, 255, varX[3] ), 1, "default-bold", "center", nil,true,false,false,true  )    
    end
end

function register_panel()
    regAlto = 250
    regAncho = 370
    ahora2 = getTickCount()
    count2=ahora2-start[1]
    varX[4],varY[4],varZ[4] = anim(start[1],1000,0,0,0,regAncho,regAlto,150,"Linear")
    dxDrawRectangle ( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4], tocolor ( 15,192,252, 250 ) )
    dxDrawEmptyRec( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4],tocolor( 255, 255, 255, 255),2)
    if (count2>1000) then
        txtRegUser = guiGetText ( edit_account_name )
        txtRegPass = guiGetText ( edit__reg_tab_password  )
        txtRegPass = string.rep( '*', #txtRegPass )
        txtRegRePass = guiGetText ( edit__reg_tab_Repassword  )
        txtRegRePass = string.rep( '*', #txtRegRePass)
        
        dxDrawText ( "Register", 0, logY+fAltUser-men-dxGetFontHeight(2,"default-bold"), x, y, tocolor ( 255, 255, 255, 255 ), 2, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawText ( txtRegUser, logX-recX/2+15, logY+fAltUser-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser-men, recX, recY,tocolor( 255, 255, 255, 255),1)        
    
        dxDrawText ( txtRegPass, logX-recX/2+15, logY+fAltUser*2+sep-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawText ( txtRegRePass, logX-recX/2+15, logY+fAltUser*3+sep*2-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawEmptyRec(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, 255),1)
        dxDrawRectangle(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, alpha["reg"]))
        dxDrawText ( "Done", 0, logY+fAltUser*4+sep*3.5-men+3, x, y, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser-men+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep-men+4, 20, 20, 'pass.png',varY[3])    
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*3+sep*2-men+4, 20, 20, 'pass.png',varY[3])
        --dxDrawEmptyRec ( (x-varX[4])/2+regAncho-15, (y-varY[4])/2+5,11 , 11, tocolor ( 255, 255, 255, 255 ), 1 )
        --dxDrawText ( "x", (x-varX[4])/2+regAncho-12, (y-varY[4])/2+2, x, y, tocolor ( 255, 255, 255, 255 ), 1, "default" )
    end
end

 

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(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, 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)
            removeEventHandler("onClientRender", getRootElement(), interfaz)

        end
    end
end

function OnBtnRegister ()

    guiSetVisible(shRegister2, true)
    guiSetVisible(lbl_reg_top_info,true)
    guiSetVisible(edit__reg_tab_Repassword,true)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetVisible(edit__reg_tab_password,true)
    guiSetVisible(edit_account_name,true)
       guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
    start[1] = getTickCount()
    addEventHandler("onClientRender", getRootElement(), register_panel)    
end

function onClickBtnRegister(button,state)

    if (guiGetText (edit_account_name)=="Username") or (guiGetText (edit_account_name)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a user name",2)
    elseif ((guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="")) and (guiGetText (edit__reg_tab_password)==guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_Repassword)=="Password") or (guiGetText (edit__reg_tab_Repassword)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please repeat pasword",2)
    elseif (guiGetText (edit__reg_tab_password)~=guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Passwords don't match",2)
    else

    guiStaticImageLoadImage(Login_img, "Login_window.png" )

        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)
        guiSetVisible(shRegister2, false)
        guiSetVisible(edit__reg_tab_password, false)
        guiSetVisible(edit__reg_tab_Repassword, false)
        guiSetVisible(edit_account_name, false)
        guiSetVisible(lbl_reg_top_info, false)
    --
            username = guiGetText(edit_account_name)
            password = guiGetText(edit__reg_tab_password)
            passwordConfirm = guiGetText(edit__reg_tab_Repassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
            
            triggerEvent("addNotification", getLocalPlayer(),"Successful register!",1)
            triggerEvent("addNotification", getLocalPlayer(),"Now log in!",1)            

    removeEventHandler("onClientRender", getRootElement(), register_panel)
    end
end

 

function Error_msg(Tab, Text)
    showCursor(true)
    showChat(false)
    if Tab == "Login" then
        setTimer(function()
            addEventHandler ( "onClientRender", getRootElement(), interfaz )
        end,1100,1)
        guiSetVisible(btnGuest, true)
        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(btn_reg_tab_register, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)

        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    elseif Tab == "Register" then
        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    end
end
addEvent("set_warning_text",true)
addEventHandler("set_warning_text",getRootElement(),Error_msg)


function onClickGuest()

    showChat(true)

        guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
        guiSetVisible(Login_img, false)
    removeEventHandler("onClientRender", getRootElement(), login_panel)
    triggerServerEvent("Don't", getLocalPlayer ( ),"You have to login to play!")
end


function hideLoginWindow()

    destroyElement(zene)
    stopSound(zene)
    showChat(true)
    removeEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)

function CursorError ()
outputChatBox("Kurzor elrejtve")
showCursor(false)
end
addCommandHandler("showc", CursorError)

function dxDrawEmptyRec(absX,absY,sizeX,sizeY,color,ancho)
    dxDrawRectangle ( absX,absY,sizeX,ancho,color )
    dxDrawRectangle ( absX,absY+ancho,ancho,sizeY-ancho,color )
    dxDrawRectangle ( absX+ancho,absY+sizeY-ancho,sizeX-ancho,ancho,color )
    dxDrawRectangle ( absX+sizeX-ancho,absY+ancho,ancho,sizeY-ancho*2,color )    
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 

 
-- Clinet


font="default-bold"
fontTam=5

spcGam=dxGetTextWidth ("Gamers",fontTam,font)
function main()
    showChat(false)
    start = getTickCount()
    addEventHandler("onClientRender",getRootElement(),intro)
    setTimer ( function()
        removeEventHandler("onClientRender",getRootElement(),intro)
    triggerEvent("onFinishIntro",getRootElement())
    end, 5000, 1 )
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),main)

function intro()
    ahora = getTickCount()
    count=ahora-start
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    sizeX=64*1.21
    sizeY=64*1.21
    varX,varY,varZ = anim(start,1000,spcGam,0,0,0,spcGam,150,"Linear")
    dxDrawText("منور وحوش Monstres",0+x/2-varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,true)
    dxDrawText("#0088FF?",x/2+varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,false,false,false,true)
    if (count>1500) then
    varX2,varY2,varZ2 = anim(start+1500,1000,0,0,0,200,250,360,"Linear")
    dxDrawText("#00FF00~ #FFFFFFWelcome#ff0000To #ffffffLib#0088ffyan #FFFFFFMonstres #00FF00~",0+x/2-varY/2,y/2-100+dxGetFontHeight(fontTam,font),varY+x/2-varY/2,y,tocolor(255,255,255,varX2),1,font,"center",nil,false,false,false,true)    
    end
    if (count>2000) then
        varX2,varY3,varZ3 = anim(start+2000,1000*10,0,0,0,200,250,360*20,"Linear")
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando1.png',varZ3)
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando2.png',180+varZ3)
    dxDrawText("تحميل",12,y/2+60+sizeY+1,x,y,tocolor(0,0,0,85),1.5,font,"center",nil,false,false,false,true)
    dxDrawText("تحميل",10,y/2+60+sizeY,x,y,tocolor(255,255,255,255),1.5,font,"center",nil,false,false,false,true)
    end
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 


 --- Server

function PlayerLogin(username,password,checksave)
    if not (username == "") then
        if not (password == "") then
            local account = getAccount ( username, password )
            if ( account ~= false ) then
                logIn(source, account, password)
                triggerClientEvent ('stopsong',source)
                triggerClientEvent (source,"hideLoginWindow",getRootElement())
                
                    if checksave == true then
                        triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password)
                    else
                        triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password)
                    end
                
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Wrong username and/or password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your username!")
    end
end
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

 

function registerPlayer(username,password,passwordConfirm)
    if not (username == "") then
        if not (password == "") then
            if not (passwordConfirm == "") then
                if password == passwordConfirm then
                    local account = getAccount (username,password)
                    if (account == false) then
                        local accountAdded = addAccount(tostring(username),tostring(password))
                        if (accountAdded) then
                            outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [Username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true )
                        else
                            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An unknown error has occured! Please choose a different username/password and try again.")
                        end
                    else
                        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An account with this username already exists!")
                    end
                else
                    triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Passwords do not match!")
                end
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a username you would like to register with!")
    end
end
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)

 

جرب

في بعض الاخطاء صلحته بس مدري يمكن مايشتغل انت جرب

و اذا ما اشتغل اكتب في اف8

debugscript 3  

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

و هات الي يطلعلك في الدي بوق او صور الشاشه و ارفع و هات الصوره

مشكو ر دقايق وبجربه

client

local winFont = dxCreateFont ( "CODE_Bold.ttf",52,false )

local x, y = guiGetScreenSize()
local fontTam = dxGetFontHeight(1,winFont)

local teamName = "# #646464Welcome To Libyan monstres Server"
local tagName = "[L.M] Login Panel"

local user = "Username"
local pass = "Password"

local fontAlto = dxGetFontHeight(0.6,winFont)
local fontLargo = dxGetTextWidth ("iGamers Gaming",0.6,winFont)
local fontLargo2 = dxGetTextWidth (tagName,0.4,winFont)
local zene = playSound("music.mp3", true)
setSoundVolume(zene, 0.4)

local fAltUser = dxGetFontHeight (2,"default")

local start={}
local varX={}
local varY={}
local varZ={}
local alpha = {}
local loginError=0

alpha["دخول"]=0
alpha["cancel"]=0
alpha["reg"]=0
alpha["here"]="#0fc0fc"
comprobar=0

local espX = 30
local espY = 60

local recX = 350
local recY = 30

local logX = x/2
local logY = y/2.7

local cancelX=100
local okX=60

local sep=20
local men=15

--bindKey("F2", "down",
addEvent("onFinishIntro",true)
addEventHandler("onFinishIntro",getRootElement(),
function()
    setTimer(function() 
       showChat(false)
	end,300,1)
    showCursor(true)

	start[0] = getTickCount()
	guiPart()
	addEventHandler ( "onClientRender", getRootElement(), interfaz )
end
)


function guiPart()
    shLogin = guiCreateButton(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, "دخول", false)
	addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
	addEventHandler( "onClientMouseEnter",shLogin,function() alpha["دخول"]=20 end)
	addEventHandler("onClientMouseLeave",shLogin,function() alpha["دخول"]=0 end)
	guiSetAlpha ( shLogin, 0 )
	
	shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
	addEventHandler("onClientGUIClick",shGuest,onClickGuest)
	addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
	addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
	guiSetAlpha ( shGuest, 0 )
	
	shRegister = guiCreateButton(x/2+75, logY+fAltUser*2+sep*3+70+3, 30, 10, "", false)
    addEventHandler("onClientGUIClick",shRegister,OnBtnRegister)
	addEventHandler( "onClientMouseEnter",shRegister,function() alpha["here"]="#999999" end)
	addEventHandler("onClientMouseLeave",shRegister,function() alpha["here"]="#0fc0fc" end)
	guiSetAlpha ( shRegister, 0 )
	
		
    edit_Login = guiCreateEdit(logX-recX/2+7, logY+fAltUser, recX, recY, "Username", false)
	addEventHandler("onClientGUIClick",edit_Login,function() guiSetText ( edit_Login, "" ) end)
	guiSetAlpha ( edit_Login, 0 )
	
	edit_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep, recX, recY, "Password", false)
	addEventHandler("onClientGUIClick",edit_password,function() guiSetText ( edit_password, "" ) end)
	guiSetAlpha ( edit_password, 0 )	
	
	guiEditSetMaxLength ( edit_Login,25)
	guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
	
	--Register
	shRegister2 = guiCreateButton(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY, "", false)
	addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister)
	addEventHandler( "onClientMouseEnter",shRegister2,function() alpha["reg"]=40 end)
	addEventHandler("onClientMouseLeave",shRegister2,function() alpha["reg"]=0 end)
	guiSetAlpha ( shRegister2, 0 )
	guiSetVisible(shRegister2,false)
		
	edit_account_name = guiCreateEdit(logX-recX/2+7, logY+fAltUser-men, recX, recY,"Username",false)
	addEventHandler("onClientGUIClick",edit_account_name,function() guiSetText ( edit_account_name, "" ) end)
	guiEditSetMaxLength ( edit_account_name,25)
	guiSetVisible(edit_account_name,false)
	guiSetAlpha ( edit_account_name, 0 )
	
	edit__reg_tab_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep-men,recX, recY,"Password",false)
	addEventHandler("onClientGUIClick",edit__reg_tab_password,function() guiSetText ( edit__reg_tab_password, "" ) end)
	guiEditSetMaxLength ( edit__reg_tab_password,25)
	guiEditSetMasked ( edit__reg_tab_password, true )
	guiSetVisible(edit__reg_tab_password,false)
	guiSetAlpha ( edit__reg_tab_password, 0 )
	
	edit__reg_tab_Repassword = guiCreateEdit(logX-recX/2+7, logY+fAltUser*3+sep*2-men, recX, recY,"Password",false)
	addEventHandler("onClientGUIClick",edit__reg_tab_Repassword ,function() guiSetText ( edit__reg_tab_Repassword , "" ) end)
	guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
	guiEditSetMasked ( edit__reg_tab_Repassword, true )
	guiSetVisible(edit__reg_tab_Repassword,false)
	guiSetEnabled (edit__reg_tab_Repassword, true)
	guiSetAlpha ( edit__reg_tab_Repassword , 0 )
	
	
	setTimer(function() 
		checkbox_save = guiCreateCheckBox(logX-recX/2+10,logY+fAltUser*2+10+sep*3+5,20,20,"",false,false) 
	
		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,1100,1)
end

function interfaz()
    ahora = getTickCount()
	count=ahora-start[0]
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
	--dxDrawRectangle ( 0, 0, x, y, tocolor ( 0, 0, 0, 100 ) )	
	--dxDrawText ( count, 0, 0, x, y, tocolor ( 255, 255, 255, 255 ), 0.4, winFont )
	if (count>500) then
		varX[1],varY[1],varZ[1] = anim(start[0]+500,2500,0,0,0,255,200,80,"Linear")
		dxDrawText ( teamName, espX, espY, 10, 10, tocolor ( 15,192,252, varX[1] ), 0.6, winFont, nil, nil, true, false, false, true )
		dxDrawText ( tagName, fontLargo-fontLargo2+espX, fontAlto+espY, x, y, tocolor ( 255, 255, 255, varX[1]*0.8 ), 0.4, winFont )
		--dxDrawText ( tagName, 0, y*0.9, x, y, tocolor ( 255, 255, 255, varX[1] ), 0.4, winFont,"center" )
    end
    if (count>1000) then
		txtUser = guiGetText ( edit_Login )
		txtPass = guiGetText ( edit_password )
		txtPass = string.rep( '*', #txtPass )
		
		varX[2],varY[2],varZ[2] = anim(start[0]+1000,1000,0,0,0,255,recX,150,"Linear")
		
		dxDrawText ( txtUser, logX-recX/2+15, logY+fAltUser+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
		dxDrawText ( txtPass, logX-recX/2+15, logY+fAltUser*2+sep+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
		
		dxDrawRectangle ( logX-recX/2, logY+fAltUser, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)		
	
		dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )	
		dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)
	
		dxDrawText ( "Cancel", logX-recX/2+(recX-cancelX)+18, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
		dxDrawEmptyRec(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY,tocolor( 255, 0, 0, varX[2]),1)
		dxDrawRectangle ( logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, tocolor ( 255, 255, 255, alpha["cancel"] ) )	
	
		dxDrawText ( "دخول", logX-recX/2+(recX-cancelX-okX-10)+15, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
		dxDrawEmptyRec(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY,tocolor( 0, 255, 0, varX[2]),1)
		dxDrawRectangle ( logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, tocolor ( 255, 255, 255, alpha["دخول"] ) )
		
		dxDrawText ( "Remember me", logX-recX/2+30,logY+fAltUser*2+12+sep*3+5, x, y, tocolor ( 255, 255, 255, varX[2] ), 1, "default-bold" )
	end
	
	if (count>2000) then
	    varX[3],varY[3],varZ[3] = anim(start[0]+2000,1000,0,0,0,255,0,150,"Linear")
		--dxDrawImage(x-320*0.5, y-240*0.5-10, 320*0.5, 240*0.5, 'logo.png')
		dxDrawImage(logX-recX/2+recX-30, logY+fAltUser+4, 20, 20, 'user.png',varY[3])
		dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep+4, 20, 20, 'pass.png',varY[3])		
		dxDrawText ( "Don't have an account? Register "..alpha["here"].."Here#ffffff.", 0, logY+fAltUser*2+sep*3+70, x, y, tocolor ( 255, 255, 255, varX[3] ), 1, "default-bold", "center", nil,true,false,false,true  )	
	end
end

function register_panel()
    regAlto = 250
	regAncho = 370
	ahora2 = getTickCount()
	count2=ahora2-start[1]
	varX[4],varY[4],varZ[4] = anim(start[1],1000,0,0,0,regAncho,regAlto,150,"Linear")
    dxDrawRectangle ( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4], tocolor ( 15,192,252, 250 ) )
	dxDrawEmptyRec( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4],tocolor( 255, 255, 255, 255),2)
	if (count2>1000) then
	    txtRegUser = guiGetText ( edit_account_name )
		txtRegPass = guiGetText ( edit__reg_tab_password  )
		txtRegPass = string.rep( '*', #txtRegPass )
		txtRegRePass = guiGetText ( edit__reg_tab_Repassword  )
		txtRegRePass = string.rep( '*', #txtRegRePass)
		
		dxDrawText ( "Register", 0, logY+fAltUser-men-dxGetFontHeight(2,"default-bold"), x, y, tocolor ( 255, 255, 255, 255 ), 2, "default-bold", "center", nil,true,false,false,true  )
	    
		dxDrawText ( txtRegUser, logX-recX/2+15, logY+fAltUser-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
		dxDrawRectangle ( logX-recX/2, logY+fAltUser-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser-men, recX, recY,tocolor( 255, 255, 255, 255),1)		
	
		dxDrawText ( txtRegPass, logX-recX/2+15, logY+fAltUser*2+sep-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
		dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )	
		dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep-men, recX, recY,tocolor( 255, 255, 255, 255),1)
		
		dxDrawText ( txtRegRePass, logX-recX/2+15, logY+fAltUser*3+sep*2-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
		dxDrawRectangle ( logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )	
		dxDrawEmptyRec(logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY,tocolor( 255, 255, 255, 255),1)
		
		dxDrawEmptyRec(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, 255),1)
		dxDrawRectangle(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, alpha["reg"]))
		dxDrawText ( "Done", 0, logY+fAltUser*4+sep*3.5-men+3, x, y, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold", "center", nil,true,false,false,true  )
		
		dxDrawImage(logX-recX/2+recX-30, logY+fAltUser-men+4, 20, 20, 'user.png',varY[3])
		dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep-men+4, 20, 20, 'pass.png',varY[3])	
		dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*3+sep*2-men+4, 20, 20, 'pass.png',varY[3])
	    --dxDrawEmptyRec ( (x-varX[4])/2+regAncho-15, (y-varY[4])/2+5,11 , 11, tocolor ( 255, 255, 255, 255 ), 1 )
		--dxDrawText ( "x", (x-varX[4])/2+regAncho-12, (y-varY[4])/2+2, x, y, tocolor ( 255, 255, 255, 255 ), 1, "default" )
	end
end



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(shGuest, false)
		guiSetVisible(shLogin, false)
		guiSetVisible(shRegister, false)
		guiSetVisible(edit_password, false)
		guiSetVisible(edit_Login, false)
		guiSetVisible(checkbox_save, 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)
			removeEventHandler("onClientRender", getRootElement(), interfaz)

		end
	end
end

function OnBtnRegister ()

	guiSetVisible(shRegister2, true)
	guiSetVisible(lbl_reg_top_info,true)
	guiSetVisible(edit__reg_tab_Repassword,true)
	guiSetEnabled (edit__reg_tab_Repassword, true)
	guiSetVisible(edit__reg_tab_password,true)
	guiSetVisible(edit_account_name,true)
	   guiSetVisible(shGuest, false)
		guiSetVisible(shLogin, false)
		guiSetVisible(shRegister, false)
		guiSetVisible(edit_password, false)
		guiSetVisible(edit_Login, false)
		guiSetVisible(checkbox_save, false)
	start[1] = getTickCount()
	addEventHandler("onClientRender", getRootElement(), register_panel)	
end

function onClickBtnRegister(button,state)

	if (guiGetText (edit_account_name)=="Username") or (guiGetText (edit_account_name)=="") then
		triggerEvent("addNotification", getLocalPlayer(),"Please enter a user name",2)
	elseif ((guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="")) and (guiGetText (edit__reg_tab_password)==guiGetText (edit__reg_tab_Repassword)) then 
		triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
	elseif (guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="") then
		triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
	elseif (guiGetText (edit__reg_tab_Repassword)=="Password") or (guiGetText (edit__reg_tab_Repassword)=="") then
	    triggerEvent("addNotification", getLocalPlayer(),"Please repeat pasword",2)
	elseif (guiGetText (edit__reg_tab_password)~=guiGetText (edit__reg_tab_Repassword)) then
		triggerEvent("addNotification", getLocalPlayer(),"Passwords don't match",2)
	else

	guiStaticImageLoadImage(Login_img, "Login_window.png" )

		guiSetVisible(shGuest, true)
	    guiSetVisible(shLogin, true)
		guiSetVisible(shRegister, true)
		guiSetVisible(edit_password, true)
		guiSetVisible(edit_Login, true)
		guiSetVisible(checkbox_save, true)
		guiSetVisible(shRegister2, false)
		guiSetVisible(edit__reg_tab_password, false)
		guiSetVisible(edit__reg_tab_Repassword, false)
		guiSetVisible(edit_account_name, false)
		guiSetVisible(lbl_reg_top_info, false)
	--
			username = guiGetText(edit_account_name)
			password = guiGetText(edit__reg_tab_password)
			passwordConfirm = guiGetText(edit__reg_tab_Repassword)
			triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
			
            triggerEvent("addNotification", getLocalPlayer(),"Successful register!",1)
			triggerEvent("addNotification", getLocalPlayer(),"Now log in!",1)			

	removeEventHandler("onClientRender", getRootElement(), register_panel)
	end
end



function Error_msg(Tab, Text)
	showCursor(true)
	showChat(false)
	if Tab == "Login" then
		setTimer(function() 
			addEventHandler ( "onClientRender", getRootElement(), interfaz )
		end,1100,1)
	    guiSetVisible(btnGuest, true)
		guiSetVisible(shGuest, true)
		guiSetVisible(shLogin, true)
		guiSetVisible(shRegister, true)
		guiSetVisible(btn_reg_tab_register, true)
		guiSetVisible(edit_password, true)
		guiSetVisible(edit_Login, true)
		guiSetVisible(checkbox_save, true)

        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
	elseif Tab == "Register" then
	    triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
	end
end
addEvent("set_warning_text",true)
addEventHandler("set_warning_text",getRootElement(),Error_msg)


function onClickGuest()

	showChat(true)

		guiSetVisible(shGuest, false)
		guiSetVisible(shLogin, false)
		guiSetVisible(shRegister, false)
		guiSetVisible(edit_password, false)
		guiSetVisible(edit_Login, false)
		guiSetVisible(checkbox_save, false)
		guiSetVisible(Login_img, false)
	removeEventHandler("onClientRender", getRootElement(), login_panel)
    triggerServerEvent("Don't", getLocalPlayer ( ),"You have to login to play!")
end


function hideLoginWindow()

	destroyElement(zene)
	stopSound(zene)
	showChat(true)
	removeEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)

function CursorError ()
outputChatBox("Kurzor elrejtve")
showCursor(false)
end
addCommandHandler("showc", CursorError)

function dxDrawEmptyRec(absX,absY,sizeX,sizeY,color,ancho)
    dxDrawRectangle ( absX,absY,sizeX,ancho,color )
	dxDrawRectangle ( absX,absY+ancho,ancho,sizeY-ancho,color )
	dxDrawRectangle ( absX+ancho,absY+sizeY-ancho,sizeX-ancho,ancho,color )
	dxDrawRectangle ( absX+sizeX-ancho,absY+ancho,ancho,sizeY-ancho*2,color )	
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end
Link to comment
2 hours ago, iMr ~ MnHmAr said:

---Clinet
x, y = guiGetScreenSize()

local winFont = dxCreateFont ( "CODE_Bold.ttf",52,false )

local fontTam = dxGetFontHeight(1,winFont)

local teamName = "# #646464Welcome To Libyan monstres Server"
local tagName = "[L.M] Login Panel"

local user = "Username"
local pass = "Password"

local fontAlto = dxGetFontHeight(0.6,winFont)
local fontLargo = dxGetTextWidth ("iGamers Gaming",0.6,winFont)
local fontLargo2 = dxGetTextWidth (tagName,0.4,winFont)
local zene = playSound("music.mp3", true)
setSoundVolume(zene, 0.4)

local fAltUser = dxGetFontHeight (2,"default")

local start={}
local varX={}
local varY={}
local varZ={}
local alpha = {}
local loginError=0

alpha["دخول"]=0
alpha["cancel"]=0
alpha["reg"]=0
alpha["here"]="#0fc0fc"
comprobar=0

local espX = 30
local espY = 60

local recX = 350
local recY = 30

local logX = x/2
local logY = y/2.7

local cancelX=100
local okX=60

local sep=20
local men=15

--bindKey("F2", "down",
addEvent("onFinishIntro",true)
addEventHandler("onFinishIntro",getRootElement(),
function()
    setTimer(function()
       showChat(false)
    end,300,1)
    showCursor(true)

    start[0] = getTickCount()
    guiPart()
    addEventHandler ( "onClientRender", getRootElement(), interfaz )
end
)


function guiPart()
    shLogin = guiCreateButton(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, "دخول", false)
    addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
    addEventHandler( "onClientMouseEnter",shLogin,function() alpha["دخول"]=20 end)
    addEventHandler("onClientMouseLeave",shLogin,function() alpha["دخول"]=0 end)
    guiSetAlpha ( shLogin, 0 )
    
    shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
    
    shRegister = guiCreateButton(x/2+75, logY+fAltUser*2+sep*3+70+3, 30, 10, "", false)
    addEventHandler("onClientGUIClick",shRegister,OnBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister,function() alpha["here"]="#999999" end)
    addEventHandler("onClientMouseLeave",shRegister,function() alpha["here"]="#0fc0fc" end)
    guiSetAlpha ( shRegister, 0 )
    
        
    edit_Login = guiCreateEdit(logX-recX/2+7, logY+fAltUser, recX, recY, "Username", false)
    addEventHandler("onClientGUIClick",edit_Login,function() guiSetText ( edit_Login, "" ) end)
    guiSetAlpha ( edit_Login, 0 )
    
    edit_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep, recX, recY, "Password", false)
    addEventHandler("onClientGUIClick",edit_password,function() guiSetText ( edit_password, "" ) end)
    guiSetAlpha ( edit_password, 0 )    
    
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
    
    --Register
    shRegister2 = guiCreateButton(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY, "", false)
    addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister2,function() alpha["reg"]=40 end)
    addEventHandler("onClientMouseLeave",shRegister2,function() alpha["reg"]=0 end)
    guiSetAlpha ( shRegister2, 0 )
    guiSetVisible(shRegister2,false)
        
    edit_account_name = guiCreateEdit(logX-recX/2+7, logY+fAltUser-men, recX, recY,"Username",false)
    addEventHandler("onClientGUIClick",edit_account_name,function() guiSetText ( edit_account_name, "" ) end)
    guiEditSetMaxLength ( edit_account_name,25)
    guiSetVisible(edit_account_name,false)
    guiSetAlpha ( edit_account_name, 0 )
    
    edit__reg_tab_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep-men,recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_password,function() guiSetText ( edit__reg_tab_password, "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
    guiEditSetMasked ( edit__reg_tab_password, true )
    guiSetVisible(edit__reg_tab_password,false)
    guiSetAlpha ( edit__reg_tab_password, 0 )
    
    edit__reg_tab_Repassword = guiCreateEdit(logX-recX/2+7, logY+fAltUser*3+sep*2-men, recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_Repassword ,function() guiSetText ( edit__reg_tab_Repassword , "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
    guiEditSetMasked ( edit__reg_tab_Repassword, true )
    guiSetVisible(edit__reg_tab_Repassword,false)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetAlpha ( edit__reg_tab_Repassword , 0 )
    
    
    setTimer(function()
        checkbox_save = guiCreateCheckBox(logX-recX/2+10,logY+fAltUser*2+10+sep*3+5,20,20,"",false,false)
    
        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,1100,1)
end

function interfaz()
    ahora = getTickCount()
    count=ahora-start[0]
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    --dxDrawRectangle ( 0, 0, x, y, tocolor ( 0, 0, 0, 100 ) )    
    --dxDrawText ( count, 0, 0, x, y, tocolor ( 255, 255, 255, 255 ), 0.4, winFont )
    if (count>500) then
        varX[1],varY[1],varZ[1] = anim(start[0]+500,2500,0,0,0,255,200,80,"Linear")
        dxDrawText ( teamName, espX, espY, 10, 10, tocolor ( 15,192,252, varX[1] ), 0.6, winFont, nil, nil, true, false, false, true )
        dxDrawText ( tagName, fontLargo-fontLargo2+espX, fontAlto+espY, x, y, tocolor ( 255, 255, 255, varX[1]*0.8 ), 0.4, winFont )
        --dxDrawText ( tagName, 0, y*0.9, x, y, tocolor ( 255, 255, 255, varX[1] ), 0.4, winFont,"center" )
    end
    if (count>1000) then
        txtUser = guiGetText ( edit_Login )
        txtPass = guiGetText ( edit_password )
        txtPass = string.rep( '*', #txtPass )
        
        varX[2],varY[2],varZ[2] = anim(start[0]+1000,1000,0,0,0,255,recX,150,"Linear")
        
        dxDrawText ( txtUser, logX-recX/2+15, logY+fAltUser+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawText ( txtPass, logX-recX/2+15, logY+fAltUser*2+sep+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        
        dxDrawRectangle ( logX-recX/2, logY+fAltUser, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)        
    
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)
    
        dxDrawText ( "Cancel", logX-recX/2+(recX-cancelX)+18, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY,tocolor( 255, 0, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, tocolor ( 255, 255, 255, alpha["cancel"] ) )    
    
        dxDrawText ( "دخول", logX-recX/2+(recX-cancelX-okX-10)+15, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY,tocolor( 0, 255, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, tocolor ( 255, 255, 255, alpha["دخول"] ) )
        
        dxDrawText ( "Remember me", logX-recX/2+30,logY+fAltUser*2+12+sep*3+5, x, y, tocolor ( 255, 255, 255, varX[2] ), 1, "default-bold" )
    end
    
    if (count>2000) then
        varX[3],varY[3],varZ[3] = anim(start[0]+2000,1000,0,0,0,255,0,150,"Linear")
        --dxDrawImage(x-320*0.5, y-240*0.5-10, 320*0.5, 240*0.5, 'logo.png')
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep+4, 20, 20, 'pass.png',varY[3])        
        dxDrawText ( "Don't have an account? Register "..alpha["here"].."Here#ffffff.", 0, logY+fAltUser*2+sep*3+70, x, y, tocolor ( 255, 255, 255, varX[3] ), 1, "default-bold", "center", nil,true,false,false,true  )    
    end
end

function register_panel()
    regAlto = 250
    regAncho = 370
    ahora2 = getTickCount()
    count2=ahora2-start[1]
    varX[4],varY[4],varZ[4] = anim(start[1],1000,0,0,0,regAncho,regAlto,150,"Linear")
    dxDrawRectangle ( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4], tocolor ( 15,192,252, 250 ) )
    dxDrawEmptyRec( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4],tocolor( 255, 255, 255, 255),2)
    if (count2>1000) then
        txtRegUser = guiGetText ( edit_account_name )
        txtRegPass = guiGetText ( edit__reg_tab_password  )
        txtRegPass = string.rep( '*', #txtRegPass )
        txtRegRePass = guiGetText ( edit__reg_tab_Repassword  )
        txtRegRePass = string.rep( '*', #txtRegRePass)
        
        dxDrawText ( "Register", 0, logY+fAltUser-men-dxGetFontHeight(2,"default-bold"), x, y, tocolor ( 255, 255, 255, 255 ), 2, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawText ( txtRegUser, logX-recX/2+15, logY+fAltUser-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser-men, recX, recY,tocolor( 255, 255, 255, 255),1)        
    
        dxDrawText ( txtRegPass, logX-recX/2+15, logY+fAltUser*2+sep-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawText ( txtRegRePass, logX-recX/2+15, logY+fAltUser*3+sep*2-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawEmptyRec(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, 255),1)
        dxDrawRectangle(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, alpha["reg"]))
        dxDrawText ( "Done", 0, logY+fAltUser*4+sep*3.5-men+3, x, y, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser-men+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep-men+4, 20, 20, 'pass.png',varY[3])    
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*3+sep*2-men+4, 20, 20, 'pass.png',varY[3])
        --dxDrawEmptyRec ( (x-varX[4])/2+regAncho-15, (y-varY[4])/2+5,11 , 11, tocolor ( 255, 255, 255, 255 ), 1 )
        --dxDrawText ( "x", (x-varX[4])/2+regAncho-12, (y-varY[4])/2+2, x, y, tocolor ( 255, 255, 255, 255 ), 1, "default" )
    end
end

 

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(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, 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)
            removeEventHandler("onClientRender", getRootElement(), interfaz)

        end
    end
end

function OnBtnRegister ()

    guiSetVisible(shRegister2, true)
    guiSetVisible(lbl_reg_top_info,true)
    guiSetVisible(edit__reg_tab_Repassword,true)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetVisible(edit__reg_tab_password,true)
    guiSetVisible(edit_account_name,true)
       guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
    start[1] = getTickCount()
    addEventHandler("onClientRender", getRootElement(), register_panel)    
end

function onClickBtnRegister(button,state)

    if (guiGetText (edit_account_name)=="Username") or (guiGetText (edit_account_name)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a user name",2)
    elseif ((guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="")) and (guiGetText (edit__reg_tab_password)==guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_Repassword)=="Password") or (guiGetText (edit__reg_tab_Repassword)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please repeat pasword",2)
    elseif (guiGetText (edit__reg_tab_password)~=guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Passwords don't match",2)
    else

    guiStaticImageLoadImage(Login_img, "Login_window.png" )

        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)
        guiSetVisible(shRegister2, false)
        guiSetVisible(edit__reg_tab_password, false)
        guiSetVisible(edit__reg_tab_Repassword, false)
        guiSetVisible(edit_account_name, false)
        guiSetVisible(lbl_reg_top_info, false)
    --
            username = guiGetText(edit_account_name)
            password = guiGetText(edit__reg_tab_password)
            passwordConfirm = guiGetText(edit__reg_tab_Repassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
            
            triggerEvent("addNotification", getLocalPlayer(),"Successful register!",1)
            triggerEvent("addNotification", getLocalPlayer(),"Now log in!",1)            

    removeEventHandler("onClientRender", getRootElement(), register_panel)
    end
end

 

function Error_msg(Tab, Text)
    showCursor(true)
    showChat(false)
    if Tab == "Login" then
        setTimer(function()
            addEventHandler ( "onClientRender", getRootElement(), interfaz )
        end,1100,1)
        guiSetVisible(btnGuest, true)
        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(btn_reg_tab_register, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)

        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    elseif Tab == "Register" then
        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    end
end
addEvent("set_warning_text",true)
addEventHandler("set_warning_text",getRootElement(),Error_msg)


function onClickGuest()

    showChat(true)

        guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
        guiSetVisible(Login_img, false)
    removeEventHandler("onClientRender", getRootElement(), login_panel)
    triggerServerEvent("Don't", getLocalPlayer ( ),"You have to login to play!")
end


function hideLoginWindow()

    destroyElement(zene)
    stopSound(zene)
    showChat(true)
    removeEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)

function CursorError ()
outputChatBox("Kurzor elrejtve")
showCursor(false)
end
addCommandHandler("showc", CursorError)

function dxDrawEmptyRec(absX,absY,sizeX,sizeY,color,ancho)
    dxDrawRectangle ( absX,absY,sizeX,ancho,color )
    dxDrawRectangle ( absX,absY+ancho,ancho,sizeY-ancho,color )
    dxDrawRectangle ( absX+ancho,absY+sizeY-ancho,sizeX-ancho,ancho,color )
    dxDrawRectangle ( absX+sizeX-ancho,absY+ancho,ancho,sizeY-ancho*2,color )    
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 

 
-- Clinet


font="default-bold"
fontTam=5

spcGam=dxGetTextWidth ("Gamers",fontTam,font)
function main()
    showChat(false)
    start = getTickCount()
    addEventHandler("onClientRender",getRootElement(),intro)
    setTimer ( function()
        removeEventHandler("onClientRender",getRootElement(),intro)
    triggerEvent("onFinishIntro",getRootElement())
    end, 5000, 1 )
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),main)

function intro()
    ahora = getTickCount()
    count=ahora-start
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    sizeX=64*1.21
    sizeY=64*1.21
    varX,varY,varZ = anim(start,1000,spcGam,0,0,0,spcGam,150,"Linear")
    dxDrawText("منور وحوش Monstres",0+x/2-varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,true)
    dxDrawText("#0088FF?",x/2+varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,false,false,false,true)
    if (count>1500) then
    varX2,varY2,varZ2 = anim(start+1500,1000,0,0,0,200,250,360,"Linear")
    dxDrawText("#00FF00~ #FFFFFFWelcome#ff0000To #ffffffLib#0088ffyan #FFFFFFMonstres #00FF00~",0+x/2-varY/2,y/2-100+dxGetFontHeight(fontTam,font),varY+x/2-varY/2,y,tocolor(255,255,255,varX2),1,font,"center",nil,false,false,false,true)    
    end
    if (count>2000) then
        varX2,varY3,varZ3 = anim(start+2000,1000*10,0,0,0,200,250,360*20,"Linear")
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando1.png',varZ3)
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando2.png',180+varZ3)
    dxDrawText("تحميل",12,y/2+60+sizeY+1,x,y,tocolor(0,0,0,85),1.5,font,"center",nil,false,false,false,true)
    dxDrawText("تحميل",10,y/2+60+sizeY,x,y,tocolor(255,255,255,255),1.5,font,"center",nil,false,false,false,true)
    end
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 


 --- Server

function PlayerLogin(username,password,checksave)
    if not (username == "") then
        if not (password == "") then
            local account = getAccount ( username, password )
            if ( account ~= false ) then
                logIn(source, account, password)
                triggerClientEvent ('stopsong',source)
                triggerClientEvent (source,"hideLoginWindow",getRootElement())
                
                    if checksave == true then
                        triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password)
                    else
                        triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password)
                    end
                
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Wrong username and/or password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your username!")
    end
end
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

 

function registerPlayer(username,password,passwordConfirm)
    if not (username == "") then
        if not (password == "") then
            if not (passwordConfirm == "") then
                if password == passwordConfirm then
                    local account = getAccount (username,password)
                    if (account == false) then
                        local accountAdded = addAccount(tostring(username),tostring(password))
                        if (accountAdded) then
                            outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [Username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true )
                        else
                            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An unknown error has occured! Please choose a different username/password and try again.")
                        end
                    else
                        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An account with this username already exists!")
                    end
                else
                    triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Passwords do not match!")
                end
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a username you would like to register with!")
    end
end
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)

 

جرب

في بعض الاخطاء صلحته بس مدري يمكن مايشتغل انت جرب

و اذا ما اشتغل اكتب في اف8

debugscript 3  

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

و هات الي يطلعلك في الدي بوق او صور الشاشه و ارفع و هات الصوره

debugscript 3  كتبت هادي ف اف 8 قالي اسل ما اسل ف مشكلة وحدة حاليا هي لما اندير cancel يعلق مود وبدا ايسجل

 

مشكلة مانحلت شباب

 

Link to comment
1 hour ago, Mohamed_king said:

debugscript 3  كتبت هادي ف اف 8 قالي اسل ما اسل ف مشكلة وحدة حاليا هي لما اندير cancel يعلق مود وبدا ايسجل

 

مشكلة مانحلت شباب

 

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

Link to comment

خخخخ لالا مزال حاجة وحدة بس كلمة CANCEL انرص عليها يعلق المود

 

 

3 hours ago, iMr ~ MnHmAr said:

---Clinet
x, y = guiGetScreenSize()

local winFont = dxCreateFont ( "CODE_Bold.ttf",52,false )

local fontTam = dxGetFontHeight(1,winFont)

local teamName = "# #646464Welcome To Libyan monstres Server"
local tagName = "[L.M] Login Panel"

local user = "Username"
local pass = "Password"

local fontAlto = dxGetFontHeight(0.6,winFont)
local fontLargo = dxGetTextWidth ("iGamers Gaming",0.6,winFont)
local fontLargo2 = dxGetTextWidth (tagName,0.4,winFont)
local zene = playSound("music.mp3", true)
setSoundVolume(zene, 0.4)

local fAltUser = dxGetFontHeight (2,"default")

local start={}
local varX={}
local varY={}
local varZ={}
local alpha = {}
local loginError=0

alpha["دخول"]=0
alpha["cancel"]=0
alpha["reg"]=0
alpha["here"]="#0fc0fc"
comprobar=0

local espX = 30
local espY = 60

local recX = 350
local recY = 30

local logX = x/2
local logY = y/2.7

local cancelX=100
local okX=60

local sep=20
local men=15

--bindKey("F2", "down",
addEvent("onFinishIntro",true)
addEventHandler("onFinishIntro",getRootElement(),
function()
    setTimer(function()
       showChat(false)
    end,300,1)
    showCursor(true)

    start[0] = getTickCount()
    guiPart()
    addEventHandler ( "onClientRender", getRootElement(), interfaz )
end
)


function guiPart()
    shLogin = guiCreateButton(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, "دخول", false)
    addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
    addEventHandler( "onClientMouseEnter",shLogin,function() alpha["دخول"]=20 end)
    addEventHandler("onClientMouseLeave",shLogin,function() alpha["دخول"]=0 end)
    guiSetAlpha ( shLogin, 0 )
    
    shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
    
    shRegister = guiCreateButton(x/2+75, logY+fAltUser*2+sep*3+70+3, 30, 10, "", false)
    addEventHandler("onClientGUIClick",shRegister,OnBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister,function() alpha["here"]="#999999" end)
    addEventHandler("onClientMouseLeave",shRegister,function() alpha["here"]="#0fc0fc" end)
    guiSetAlpha ( shRegister, 0 )
    
        
    edit_Login = guiCreateEdit(logX-recX/2+7, logY+fAltUser, recX, recY, "Username", false)
    addEventHandler("onClientGUIClick",edit_Login,function() guiSetText ( edit_Login, "" ) end)
    guiSetAlpha ( edit_Login, 0 )
    
    edit_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep, recX, recY, "Password", false)
    addEventHandler("onClientGUIClick",edit_password,function() guiSetText ( edit_password, "" ) end)
    guiSetAlpha ( edit_password, 0 )    
    
    guiEditSetMaxLength ( edit_Login,25)
    guiEditSetMaxLength ( edit_password,25)
    guiEditSetMasked ( edit_password, true )
    
    --Register
    shRegister2 = guiCreateButton(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY, "", false)
    addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister)
    addEventHandler( "onClientMouseEnter",shRegister2,function() alpha["reg"]=40 end)
    addEventHandler("onClientMouseLeave",shRegister2,function() alpha["reg"]=0 end)
    guiSetAlpha ( shRegister2, 0 )
    guiSetVisible(shRegister2,false)
        
    edit_account_name = guiCreateEdit(logX-recX/2+7, logY+fAltUser-men, recX, recY,"Username",false)
    addEventHandler("onClientGUIClick",edit_account_name,function() guiSetText ( edit_account_name, "" ) end)
    guiEditSetMaxLength ( edit_account_name,25)
    guiSetVisible(edit_account_name,false)
    guiSetAlpha ( edit_account_name, 0 )
    
    edit__reg_tab_password = guiCreateEdit(logX-recX/2+7, logY+fAltUser*2+sep-men,recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_password,function() guiSetText ( edit__reg_tab_password, "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_password,25)
    guiEditSetMasked ( edit__reg_tab_password, true )
    guiSetVisible(edit__reg_tab_password,false)
    guiSetAlpha ( edit__reg_tab_password, 0 )
    
    edit__reg_tab_Repassword = guiCreateEdit(logX-recX/2+7, logY+fAltUser*3+sep*2-men, recX, recY,"Password",false)
    addEventHandler("onClientGUIClick",edit__reg_tab_Repassword ,function() guiSetText ( edit__reg_tab_Repassword , "" ) end)
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25)
    guiEditSetMasked ( edit__reg_tab_Repassword, true )
    guiSetVisible(edit__reg_tab_Repassword,false)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetAlpha ( edit__reg_tab_Repassword , 0 )
    
    
    setTimer(function()
        checkbox_save = guiCreateCheckBox(logX-recX/2+10,logY+fAltUser*2+10+sep*3+5,20,20,"",false,false)
    
        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,1100,1)
end

function interfaz()
    ahora = getTickCount()
    count=ahora-start[0]
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    --dxDrawRectangle ( 0, 0, x, y, tocolor ( 0, 0, 0, 100 ) )    
    --dxDrawText ( count, 0, 0, x, y, tocolor ( 255, 255, 255, 255 ), 0.4, winFont )
    if (count>500) then
        varX[1],varY[1],varZ[1] = anim(start[0]+500,2500,0,0,0,255,200,80,"Linear")
        dxDrawText ( teamName, espX, espY, 10, 10, tocolor ( 15,192,252, varX[1] ), 0.6, winFont, nil, nil, true, false, false, true )
        dxDrawText ( tagName, fontLargo-fontLargo2+espX, fontAlto+espY, x, y, tocolor ( 255, 255, 255, varX[1]*0.8 ), 0.4, winFont )
        --dxDrawText ( tagName, 0, y*0.9, x, y, tocolor ( 255, 255, 255, varX[1] ), 0.4, winFont,"center" )
    end
    if (count>1000) then
        txtUser = guiGetText ( edit_Login )
        txtPass = guiGetText ( edit_password )
        txtPass = string.rep( '*', #txtPass )
        
        varX[2],varY[2],varZ[2] = anim(start[0]+1000,1000,0,0,0,255,recX,150,"Linear")
        
        dxDrawText ( txtUser, logX-recX/2+15, logY+fAltUser+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawText ( txtPass, logX-recX/2+15, logY+fAltUser*2+sep+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        
        dxDrawRectangle ( logX-recX/2, logY+fAltUser, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)        
    
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep, varY[2], recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep, varY[2], recY,tocolor( 255, 255, 255, varX[2]),1)
    
        dxDrawText ( "Cancel", logX-recX/2+(recX-cancelX)+18, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY,tocolor( 255, 0, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, tocolor ( 255, 255, 255, alpha["cancel"] ) )    
    
        dxDrawText ( "دخول", logX-recX/2+(recX-cancelX-okX-10)+15, logY+fAltUser*2+sep*3+10+3, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.5, "default-bold" )
        dxDrawEmptyRec(logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY,tocolor( 0, 255, 0, varX[2]),1)
        dxDrawRectangle ( logX-recX/2+(recX-cancelX-okX-10), logY+fAltUser*2+sep*3+10,okX, recY, tocolor ( 255, 255, 255, alpha["دخول"] ) )
        
        dxDrawText ( "Remember me", logX-recX/2+30,logY+fAltUser*2+12+sep*3+5, x, y, tocolor ( 255, 255, 255, varX[2] ), 1, "default-bold" )
    end
    
    if (count>2000) then
        varX[3],varY[3],varZ[3] = anim(start[0]+2000,1000,0,0,0,255,0,150,"Linear")
        --dxDrawImage(x-320*0.5, y-240*0.5-10, 320*0.5, 240*0.5, 'logo.png')
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep+4, 20, 20, 'pass.png',varY[3])        
        dxDrawText ( "Don't have an account? Register "..alpha["here"].."Here#ffffff.", 0, logY+fAltUser*2+sep*3+70, x, y, tocolor ( 255, 255, 255, varX[3] ), 1, "default-bold", "center", nil,true,false,false,true  )    
    end
end

function register_panel()
    regAlto = 250
    regAncho = 370
    ahora2 = getTickCount()
    count2=ahora2-start[1]
    varX[4],varY[4],varZ[4] = anim(start[1],1000,0,0,0,regAncho,regAlto,150,"Linear")
    dxDrawRectangle ( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4], tocolor ( 15,192,252, 250 ) )
    dxDrawEmptyRec( (x-varX[4])/2, logY+fAltUser-men-10-dxGetFontHeight(2,"default-bold"),varX[4] , varY[4],tocolor( 255, 255, 255, 255),2)
    if (count2>1000) then
        txtRegUser = guiGetText ( edit_account_name )
        txtRegPass = guiGetText ( edit__reg_tab_password  )
        txtRegPass = string.rep( '*', #txtRegPass )
        txtRegRePass = guiGetText ( edit__reg_tab_Repassword  )
        txtRegRePass = string.rep( '*', #txtRegRePass)
        
        dxDrawText ( "Register", 0, logY+fAltUser-men-dxGetFontHeight(2,"default-bold"), x, y, tocolor ( 255, 255, 255, 255 ), 2, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawText ( txtRegUser, logX-recX/2+15, logY+fAltUser-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser-men, recX, recY,tocolor( 255, 255, 255, 255),1)        
    
        dxDrawText ( txtRegPass, logX-recX/2+15, logY+fAltUser*2+sep-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*2+sep-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*2+sep-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawText ( txtRegRePass, logX-recX/2+15, logY+fAltUser*3+sep*2-men+6, x, y, tocolor ( 255, 255, 255, varX[2] ), 1.01, "default" )
        dxDrawRectangle ( logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY, tocolor ( 255, 255, 255, 50 ) )    
        dxDrawEmptyRec(logX-recX/2, logY+fAltUser*3+sep*2-men, recX, recY,tocolor( 255, 255, 255, 255),1)
        
        dxDrawEmptyRec(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, 255),1)
        dxDrawRectangle(logX-100/2, logY+fAltUser*4+sep*3.5-men, 100, recY,tocolor( 255, 255, 255, alpha["reg"]))
        dxDrawText ( "Done", 0, logY+fAltUser*4+sep*3.5-men+3, x, y, tocolor ( 255, 255, 255, 255 ), 1.5, "default-bold", "center", nil,true,false,false,true  )
        
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser-men+4, 20, 20, 'user.png',varY[3])
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*2+sep-men+4, 20, 20, 'pass.png',varY[3])    
        dxDrawImage(logX-recX/2+recX-30, logY+fAltUser*3+sep*2-men+4, 20, 20, 'pass.png',varY[3])
        --dxDrawEmptyRec ( (x-varX[4])/2+regAncho-15, (y-varY[4])/2+5,11 , 11, tocolor ( 255, 255, 255, 255 ), 1 )
        --dxDrawText ( "x", (x-varX[4])/2+regAncho-12, (y-varY[4])/2+2, x, y, tocolor ( 255, 255, 255, 255 ), 1, "default" )
    end
end

 

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(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, 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)
            removeEventHandler("onClientRender", getRootElement(), interfaz)

        end
    end
end

function OnBtnRegister ()

    guiSetVisible(shRegister2, true)
    guiSetVisible(lbl_reg_top_info,true)
    guiSetVisible(edit__reg_tab_Repassword,true)
    guiSetEnabled (edit__reg_tab_Repassword, true)
    guiSetVisible(edit__reg_tab_password,true)
    guiSetVisible(edit_account_name,true)
       guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
    start[1] = getTickCount()
    addEventHandler("onClientRender", getRootElement(), register_panel)    
end

function onClickBtnRegister(button,state)

    if (guiGetText (edit_account_name)=="Username") or (guiGetText (edit_account_name)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a user name",2)
    elseif ((guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="")) and (guiGetText (edit__reg_tab_password)==guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_password)=="Password") or (guiGetText (edit__reg_tab_password)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please enter a password",2)
    elseif (guiGetText (edit__reg_tab_Repassword)=="Password") or (guiGetText (edit__reg_tab_Repassword)=="") then
        triggerEvent("addNotification", getLocalPlayer(),"Please repeat pasword",2)
    elseif (guiGetText (edit__reg_tab_password)~=guiGetText (edit__reg_tab_Repassword)) then
        triggerEvent("addNotification", getLocalPlayer(),"Passwords don't match",2)
    else

    guiStaticImageLoadImage(Login_img, "Login_window.png" )

        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)
        guiSetVisible(shRegister2, false)
        guiSetVisible(edit__reg_tab_password, false)
        guiSetVisible(edit__reg_tab_Repassword, false)
        guiSetVisible(edit_account_name, false)
        guiSetVisible(lbl_reg_top_info, false)
    --
            username = guiGetText(edit_account_name)
            password = guiGetText(edit__reg_tab_password)
            passwordConfirm = guiGetText(edit__reg_tab_Repassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
            
            triggerEvent("addNotification", getLocalPlayer(),"Successful register!",1)
            triggerEvent("addNotification", getLocalPlayer(),"Now log in!",1)            

    removeEventHandler("onClientRender", getRootElement(), register_panel)
    end
end

 

function Error_msg(Tab, Text)
    showCursor(true)
    showChat(false)
    if Tab == "Login" then
        setTimer(function()
            addEventHandler ( "onClientRender", getRootElement(), interfaz )
        end,1100,1)
        guiSetVisible(btnGuest, true)
        guiSetVisible(shGuest, true)
        guiSetVisible(shLogin, true)
        guiSetVisible(shRegister, true)
        guiSetVisible(btn_reg_tab_register, true)
        guiSetVisible(edit_password, true)
        guiSetVisible(edit_Login, true)
        guiSetVisible(checkbox_save, true)

        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    elseif Tab == "Register" then
        triggerEvent("addNotification", getLocalPlayer(),tostring(Text),2)
    end
end
addEvent("set_warning_text",true)
addEventHandler("set_warning_text",getRootElement(),Error_msg)


function onClickGuest()

    showChat(true)

        guiSetVisible(shGuest, false)
        guiSetVisible(shLogin, false)
        guiSetVisible(shRegister, false)
        guiSetVisible(edit_password, false)
        guiSetVisible(edit_Login, false)
        guiSetVisible(checkbox_save, false)
        guiSetVisible(Login_img, false)
    removeEventHandler("onClientRender", getRootElement(), login_panel)
    triggerServerEvent("Don't", getLocalPlayer ( ),"You have to login to play!")
end


function hideLoginWindow()

    destroyElement(zene)
    stopSound(zene)
    showChat(true)
    removeEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
end
addEvent("hideLoginWindow", true)
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)

function CursorError ()
outputChatBox("Kurzor elrejtve")
showCursor(false)
end
addCommandHandler("showc", CursorError)

function dxDrawEmptyRec(absX,absY,sizeX,sizeY,color,ancho)
    dxDrawRectangle ( absX,absY,sizeX,ancho,color )
    dxDrawRectangle ( absX,absY+ancho,ancho,sizeY-ancho,color )
    dxDrawRectangle ( absX+ancho,absY+sizeY-ancho,sizeX-ancho,ancho,color )
    dxDrawRectangle ( absX+sizeX-ancho,absY+ancho,ancho,sizeY-ancho*2,color )    
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 

 
-- Clinet


font="default-bold"
fontTam=5

spcGam=dxGetTextWidth ("Gamers",fontTam,font)
function main()
    showChat(false)
    start = getTickCount()
    addEventHandler("onClientRender",getRootElement(),intro)
    setTimer ( function()
        removeEventHandler("onClientRender",getRootElement(),intro)
    triggerEvent("onFinishIntro",getRootElement())
    end, 5000, 1 )
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),main)

function intro()
    ahora = getTickCount()
    count=ahora-start
    dxDrawImage(0, 0, x, y, 'fondo.png',0,0,0,tocolor(255,255,255),false)
    sizeX=64*1.21
    sizeY=64*1.21
    varX,varY,varZ = anim(start,1000,spcGam,0,0,0,spcGam,150,"Linear")
    dxDrawText("منور وحوش Monstres",0+x/2-varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,true)
    dxDrawText("#0088FF?",x/2+varY/2,y/2-100,varY+x/2-varY/2,y,tocolor(255,255,255,255),fontTam,font,nil,nil,false,false,false,true)
    if (count>1500) then
    varX2,varY2,varZ2 = anim(start+1500,1000,0,0,0,200,250,360,"Linear")
    dxDrawText("#00FF00~ #FFFFFFWelcome#ff0000To #ffffffLib#0088ffyan #FFFFFFMonstres #00FF00~",0+x/2-varY/2,y/2-100+dxGetFontHeight(fontTam,font),varY+x/2-varY/2,y,tocolor(255,255,255,varX2),1,font,"center",nil,false,false,false,true)    
    end
    if (count>2000) then
        varX2,varY3,varZ3 = anim(start+2000,1000*10,0,0,0,200,250,360*20,"Linear")
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando1.png',varZ3)
    dxDrawImage ( x/2-sizeX/2, y/2+50, sizeX, sizeY, 'img/cargando2.png',180+varZ3)
    dxDrawText("تحميل",12,y/2+60+sizeY+1,x,y,tocolor(0,0,0,85),1.5,font,"center",nil,false,false,false,true)
    dxDrawText("تحميل",10,y/2+60+sizeY,x,y,tocolor(255,255,255,255),1.5,font,"center",nil,false,false,false,true)
    end
end

function anim(tag,animTime,de1,de2,de3,hasta1,hasta2,hasta3,typeAnim)
    local now = getTickCount()
    local endTime = tag + animTime
    local elapsedTime = now - tag
    local duration = endTime - tag
    local progress = elapsedTime / duration
    local a, b, c = interpolateBetween ( de1,de2,de3,hasta1,hasta2,hasta3, progress, typeAnim)
    
    return a, b, c
end

 


 --- Server

function PlayerLogin(username,password,checksave)
    if not (username == "") then
        if not (password == "") then
            local account = getAccount ( username, password )
            if ( account ~= false ) then
                logIn(source, account, password)
                triggerClientEvent ('stopsong',source)
                triggerClientEvent (source,"hideLoginWindow",getRootElement())
                
                    if checksave == true then
                        triggerClientEvent(source,"saveLoginToXML",getRootElement(),username,password)
                    else
                        triggerClientEvent(source,"resetSaveXML",getRootElement(),username,password)
                    end
                
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Wrong username and/or password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Login","Please enter your username!")
    end
end
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

 

function registerPlayer(username,password,passwordConfirm)
    if not (username == "") then
        if not (password == "") then
            if not (passwordConfirm == "") then
                if password == passwordConfirm then
                    local account = getAccount (username,password)
                    if (account == false) then
                        local accountAdded = addAccount(tostring(username),tostring(password))
                        if (accountAdded) then
                            outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [Username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true )
                        else
                            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An unknown error has occured! Please choose a different username/password and try again.")
                        end
                    else
                        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","An account with this username already exists!")
                    end
                else
                    triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Passwords do not match!")
                end
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please confirm your password!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a password!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Please enter a username you would like to register with!")
    end
end
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)

 

جرب

في بعض الاخطاء صلحته بس مدري يمكن مايشتغل انت جرب

و اذا ما اشتغل اكتب في اف8

debugscript 3  

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

و هات الي يطلعلك في الدي بوق او صور الشاشه و ارفع و هات الصوره

كفو  مشكلة تسجيل حساب جديد انحلت لاكن امتع CANCEL NO

Link to comment
8 minutes ago, Mohamed_king said:

خخخخ لالا مزال حاجة وحدة بس كلمة CANCEL انرص عليها يعلق المود

 

 

كفو  مشكلة تسجيل حساب جديد انحلت لاكن امتع CANCEL NO

شني هادي كنسل اون ؟ شن ادير وشن موضوعها

Link to comment
1 minute ago, Mohamed_king said:

هادي ع اساس اني مداريها لما ترصها تصكر لوحة تسجيل دخول زي دخول ك زائر

 

ساهله هي تو نشوفها

3 minutes ago, Mohamed_king said:

هادي ع اساس اني مداريها لما ترصها تصكر لوحة تسجيل دخول زي دخول ك زائر

 

اول شي لوحتك dx ولا عادية وهات اسم الزر متع اغلاق

Link to comment
Just now, Mohamed_king said:

انجيبلك كود امتع  اغلاق ؟ ولا كود كامل ؟

 

كود متع اغلاق

13 minutes ago, mahmod3 said:

كود متع اغلاق

 shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
	
--لو انت تبي هادا الزر الي تغلق به اللوحة هكي ادير
addEventHandler("onClientGUIClick",root,
function()
if source == shGuest then
guiSetVisible(اسم للوحه,false)--تحط اسم اللوحة
showCursor(false)
end
end
)

 

  • Like 1
Link to comment
36 minutes ago, mahmod3 said:

كود متع اغلاق


 shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
	
--لو انت تبي هادا الزر الي تغلق به اللوحة هكي ادير
addEventHandler("onClientGUIClick",root,
function()
if source == shGuest then
guiSetVisible(اسم للوحه,false)--تحط اسم اللوحة
showCursor(false)
end
end
)

 

 

36 minutes ago, mahmod3 said:

كود متع اغلاق


 shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
	
--لو انت تبي هادا الزر الي تغلق به اللوحة هكي ادير
addEventHandler("onClientGUIClick",root,
function()
if source == shGuest then
guiSetVisible(اسم للوحه,false)--تحط اسم اللوحة
showCursor(false)
end
end
)

 

 

36 minutes ago, mahmod3 said:

كود متع اغلاق


 shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)
    addEventHandler("onClientGUIClick",shGuest,onClickGuest)
    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)
    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)
    guiSetAlpha ( shGuest, 0 )
	
--لو انت تبي هادا الزر الي تغلق به اللوحة هكي ادير
addEventHandler("onClientGUIClick",root,
function()
if source == shGuest then
guiSetVisible(اسم للوحه,false)--تحط اسم اللوحة
showCursor(false)
end
end
)

 

 

36 minutes ago, mahmod3 said:

كود متع اغلاق


 shGuest = guiCreateButton(logX-recX/2+(recX-cancelX), logY+fAltUser*2+sep*3+10,cancelX, recY, "Cancel", false)    addEventHandler("onClientGUIClick",shGuest,onClickGuest)    addEventHandler( "onClientMouseEnter",shGuest,function() alpha["cancel"]=20 end)    addEventHandler("onClientMouseLeave",shGuest,function() alpha["cancel"]=0 end)    guiSetAlpha ( shGuest, 0 )	--لو انت تبي هادا الزر الي تغلق به اللوحة هكي اديرaddEventHandler("onClientGUIClick",root,function()if source == shGuest thenguiSetVisible(اسم للوحه,false)--تحط اسم اللوحةshowCursor(false)endend)

 

شكرا اخي علي مساعداتك انا فاتح من موبايل غدا بجربها وشكرا

  • Like 1
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...