Jump to content

Register problem


Recommended Posts

client side

function registering() 
    if ( source == GUIEditor_Button[4] ) then 
        local g_textR = guiGetText( GUIEditor_Edit[3] ) 
        local g_textR2 = guiGetText( GUIEditor_Edit[4] ) 
        local g_textR3 = guiGetText( GUIEditor_Edit[5] ) 
        triggerServerEvent("g_textToRegister", getRootElement(), getLocalPlayer(), g_textR, g_textR2, g_textR3) 
    end 
end 
addEventHandler("onClientGUIClick", getRootElement(), registering) 

server side

function g_textToRegister( player, user, password, g_textR3) 
    if password == g_textR3 then 
    account = addAccount ( user, password ) 
    else 
    triggerClientEvent(player,"confirmError",player) 
    if (logIn ( player, account2, password ) == true) then 
    outputChatBox ( "successfully registered, welcome ".. getPlayerName( source ), player, 255, 255, 0 , true ) 
            randomModel = math.random( 26, 37 ) 
            setElementModel ( player, randomModel ) 
    else 
    triggerClientEvent(player,"registerEroor",player) 
    end 
    end 
    end 
addEvent("g_textToRegister", true) 
addEventHandler("g_textToRegister", getRootElement(), g_textToRegister) 

every " else " that i put were happened, registerError and confirmError

sorry, I've been confused with this code

Link to comment

try

function g_textToRegister(player, user, password, g_textR3) 
     if password ~= g_textR3 then 
          triggerClientEvent(player,"confirmError",player) 
     return end 
    if getAccount(user) then 
        -- the Account already registred before.. 
     return end 
          local account = addAccount(user, password) 
     if logIn(player, account, password) then 
          outputChatBox("successfully registered, welcome "..getPlayerName(player), player, 255, 255, 0 , true) 
          randomModel = math.random(26, 37) 
          setElementModel(player, randomModel) 
     else 
          triggerClientEvent(player,"registerEroor",player) 
     end 
end 
addEvent("g_textToRegister", true) 
addEventHandler("g_textToRegister", root, g_textToRegister) 

Link to comment

i have another problem

        if #guiGetText ( GUIEditor_Edit[6] ) == 0 then 
        guiSetVisible( GUIEditor_Label[15], true ) 
        setTimer( guiSetVisible, 3000, 1, GUIEditor_Label[15], false )  
        return  
        end 

i want here if gui-edit[6] wasn't completed then stop every thing and show the error inside the gui-label[15]

Edited by Guest
Link to comment
i have another problems
        if #guiGetText ( GUIEditor_Edit[6] ) == 0 then 
        guiSetVisible( GUIEditor_Label[15], true ) 
        setTimer( guiSetVisible, 3000, 1, GUIEditor_Label[15], false )  
        return  
        end 

i want here if gui-edit[6] wasn't completed then stop every thing and show the error inside the gui-label[15]

Can you explain better ?

Link to comment

try this,

Client:

function registering() 
    if ( source == GUIEditor_Button[4] ) then 
        local g_textR = guiGetText( GUIEditor_Edit[3] ) 
        local g_textR2 = guiGetText( GUIEditor_Edit[4] ) 
        local g_textR3 = guiGetText( GUIEditor_Edit[5] ) 
        if g_textR ~= "" and g_textR2~="" and g_textR3~="" then --check if the field actually have something 
            triggerServerEvent("g_textToRegister",localPlayer, g_textR, g_textR2, g_textR3) 
        end 
    end 
end 
addEventHandler("onClientGUIClick",guiRoot, registering) 

Server:

function g_textToRegister( user, password, g_textR3) 
    if password == g_textR3 then 
        local account = addAccount ( user, password ) 
    else 
        triggerClientEvent(client,"confirmError",root) 
        return --automatically end the script if the password doesn't match 
    end 
    if logIn ( client, account, password) then --you used account2 instead of account 
        outputChatBox ( "successfully registered, welcome ".. getPlayerName( client ), client, 255, 255, 0 , true ) 
        randomModel = math.random( 26, 37 ) 
        setElementModel ( client, randomModel ) 
    else 
        triggerClientEvent(client,"registerEroor",root) 
    end 
end 
addEvent("g_textToRegister", true) 
addEventHandler("g_textToRegister",root, g_textToRegister) 

Edited by Guest
Link to comment

Listen andrel,

if #guiGetText ( GUIEditor_Edit[6] ) == 0 then 
            guiSetVisible( GUIEditor_Label[15], true ) 
            setTimer( guiSetVisible, 3000, 1, GUIEditor_Label[15], false ) 
            return 
            end 

this is register code

so GUIEditor_Edit[6] is the player's e-mail so if he typed nothing then guiSetVisible true to GUIEditor_Label[15] this gui-label is an error

GUIEditor_Label[15] = guiCreateLabel(443,310,148,18,"enter your e-mail !",false,GUIEditor_Window[2]) 

i hope you understood me.

Edited by Guest
Link to comment
try this,

Client:

function registering() 
    if ( source == GUIEditor_Button[4] ) then 
        local g_textR = guiGetText( GUIEditor_Edit[3] ) 
        local g_textR2 = guiGetText( GUIEditor_Edit[4] ) 
        local g_textR3 = guiGetText( GUIEditor_Edit[5] ) 
        if g_textR ~= "" and g_textR2~="" and g_textR3~="" then --check if the field actually have something 
            triggerServerEvent("g_textToRegister",localPlayer, g_textR, g_textR2, g_textR3) 
        end 
    end 
end 
addEventHandler("onClientGUIClick",guiRoot, registering) 

Server:

function g_textToRegister( user, password, g_textR3) 
    if password == g_textR3 then 
        account = addAccount ( user, password ) 
    else 
        triggerClientEvent(client,"confirmError",root) 
        return 
    end 
    if logIn ( client, account, password) then 
        outputChatBox ( "successfully registered, welcome ".. getPlayerName( client ), client, 255, 255, 0 , true ) 
        randomModel = math.random( 26, 37 ) 
        setElementModel ( client, randomModel ) 
    else 
        triggerClientEvent(client,"registerEroor",root) 
    end 
end 
addEvent("g_textToRegister", true) 
addEventHandler("g_textToRegister",root, g_textToRegister) 

jaysds this problem was solved

i'm talking now about this

        if #guiGetText ( GUIEditor_Edit[6] ) == 0 then 
        guiSetVisible( GUIEditor_Label[15], true ) 
        setTimer( guiSetVisible, 3000, 1, GUIEditor_Label[15], false ) 
        return 
        end 

thanks anyway :)

Link to comment
if #guiGetText ( GUIEditor_Edit[6] ) == 0 then 
        guiSetVisible( GUIEditor_Label[15], true ) 
        setTimer( guiSetVisible, 3000, 1, GUIEditor_Label[15], false ) 
        return 
        end 

if guiGetText ( GUIEditor_Edit[6] ) == "" then 
    guiSetVisible( GUIEditor_Label[15], true ) 
    setTimer( guiSetVisible, 3000, 1, GUIEditor_Label[15], false ) 
    return 
end 

Link to comment
if #guiGetText ( GUIEditor_Edit[6] ) == 0 then 
        guiSetVisible( GUIEditor_Label[15], true ) 
        setTimer( guiSetVisible, 3000, 1, GUIEditor_Label[15], false ) 
        return 
        end 

if guiGetText ( GUIEditor_Edit[6] ) == "" then 
    guiSetVisible( GUIEditor_Label[15], true ) 
    setTimer( guiSetVisible, 3000, 1, GUIEditor_Label[15], false ) 
    return 
end 

it doesn't work,

i see the error and the account was created.. ?

i want if the Edit[6] is empty then stop the registering process.

if full code needed then tell me

Edited by Guest
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...