Jump to content

[HELP] A small registering help


LabiVila

Recommended Posts

Hey

function submitRegister (newUser, newPass) 
    if (newUser ~= "") then 
        if not (newPass ~= "") then 
            local newAcc = addAccount (newUser, newPass) 
            if (newAcc) then 
                outputChatBox ("Acc add") 
            end 
        end 
    end 
end 
addEvent ("registerReq", true) 
addEventHandler ("registerReq", getRootElement(), submitRegister) 
  

is anything wrong here? I don't think there's any error at other scripting side... tho I don't get any error

Link to comment
Hey
function submitRegister (newUser, newPass) 
    if (newUser ~= "") then 
        if not (newPass ~= "") then 
            local newAcc = addAccount (newUser, newPass) 
            if (newAcc) then 
                outputChatBox ("Acc add") 
            end 
        end 
    end 
end 
addEvent ("registerReq", true) 
addEventHandler ("registerReq", getRootElement(), submitRegister) 
  

is anything wrong here? I don't think there's any error at other scripting side... tho I don't get any error

function submitRegister (player, newUser, newPass) 
local account = getAccount(newUser, newPass) 
    if (account == false) then 
        newAcc = addAccount (newUser, newPass) 
        outputChatBox ("Acc add", player) 
    end 
end 
addEvent ("registerReq", true) 
addEventHandler ("registerReq", getRootElement(), submitRegister) 

Link to comment
function submitLogin (source, user, pass) 
    if (user ~= "") then 
        if (pass ~= "") then 
            local acc = getAccount (user, pass) 
            if (acc ~= false) then 
                logIn (source, acc, pass) 
                outputChatBox ("You logged in successfully.") 
                triggerClientEvent (source, "hideWindow", source) 
            else 
                outputChatBox ("Wrong username or password, please try again!", getRootElement(), 255, 255, 255, false) 
            end 
        else 
            outputChatBox ("Password can not be blank.", getRootElement(), 255, 255, 255, false) 
        end 
    else 
        outputChatBox ("Username can not be blank.", getRootElement(), 255, 255, 255, false) 
    end 
end 
addEvent ("loginReq", true) 
addEventHandler ("loginReq", getRootElement(), submitLogin) 
  

function initializing () 
    showCursor (true, true) 
     
    main = guiCreateWindow (0.25, 0.25, 0.50, 0.50, "Login Window", true) 
     
    local usernameLabel = guiCreateLabel (0.10, 0.17, 0.50, 0.10, "Username: ", true, main) 
    local username = guiCreateEdit (0.25, 0.15, 0.60, 0.10, "", true, main) 
     
    local passwordLabel = guiCreateLabel (0.10, 0.42, 0.50, 0.10, "Password: ", true, main) 
    local password = guiCreateEdit (0.25, 0.40, 0.60, 0.10, "", true, main) 
  
    local loginB = guiCreateButton (0.15, 0.65, 0.30, 0.12, "Login", true, main) 
    local regB = guiCreateButton (0.60, 0.65, 0.30, 0.12, "Register", true, main) 
  
    addEventHandler ("onClientGUIClick", loginB, 
        function (us, pa) 
            local us = guiGetText (username) 
            local pa = guiGetText (password) 
            triggerServerEvent ("loginReq", getRootElement(), getLocalPlayer(), us, pa) 
        end, false 
    ) 
  
    addEventHandler ("onClientGUIClick", regB, 
        function (us, pa) 
            local us = guiGetText (username) 
            local pa = guiGetText (password) 
            triggerServerEvent ("registerReq", getRootElement(), getLocalPlayer(), us, pa) 
        end, false 
    ) 
  
end 
addEventHandler ("onClientResourceStart", getRootElement(), initializing) 
  
function hiding () 
    showCursor (false, false) 
    guiSetVisible (main, false) 
end 
addEvent ("hideWindow", true) 
addEventHandler ("hideWindow", getRootElement(), hiding) 

I got this, trying to make register button work but it isn't. The script you sent me does output the chatbox but it doesn't really register someone, I'd like a bit of help

EDIT: Fixed, thanks

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