Jump to content

Login script. No login button


Xakep_SDK

Recommended Posts

Posted

Code:

  
function createLoginWindow() 
    local X = 0.375 
    local Y = 0.375 
    local Width = 0.25 
    local Height = 0.25 
    wdwLogin = guiCreateWindow(X, Y, Width, Height, "Пожалуйста, залогиньтесь", true) 
    X = 0.0825 
    Y = 0.2 
    Width = 0.25 
    Heidht = 0.25 
    guiCreateLabel(X, Y, Width, Height, "Имя", true, wdwLogin) 
    Y = 0.5 
    guiCreateLabel(X, Y, Width, Height, "Пароль", true, wdwLogin) 
    X = 0.415 
    Y = 0.2 
    Width = 0.5 
    Height = 0.15 
    edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) 
    Y = 0.5 
    edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) 
    guiEditSetMaxLenght(edtUser, 50) 
    guiEditSetMaxLenght(edtPass, 50) 
    X = 0.415 
    Y = 0.7 
    Width = 0.25 
    Height = 0.2 
    btnLogin = guiCreateButton(X, Y, Width, Height, "Логин", true, wdwLogin) 
    guiSetVisible(wdwLogin, false) 
    addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
    function() 
        createLoginWindow() 
        outputChatBox("Добро пожаловать на мой MTA:SA сервер, пожалуйста зологиньтесь") 
        if(wdwLogin ~=nil) then 
            guiSetVisible(wdwLogin, true) 
        else 
            outputChatBox("Ошибка, GUI не был создан.") 
        end 
        showCursor(true) 
        guiSetInputEnabled(true) 
    end 
) 
function clientSubmitLogin(button,state) 
    if button == "left" and state == "up" then 
        local username = guiGetText(edtUser) 
        local password = guiGetText(edtPass) 
        if username and password then 
            triggerServerEvent("submitLogin", getRootElement(), username, password) 
            guiSetInputEnabled(false) 
            guiSetVisible(wdwLogin, false) 
            showCursor(false) 
        else 
            outputChatBox("Пожалуйста, введите логин и пароль.") 
        end 
    end 
end 
  

Posted

So, you expect us to guess what your problem is? tell us what is wrong with it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

That is because you put:

guiEditSetMaxLenght 

Instead of:

guiEditSetMaxLength 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
dbConnect 
dbExec 
dbQuery 
dbPoll 
dbFree 

These are the MySQL functions, click on each one and read the syntax. They all have examples.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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