Jump to content

Help with login /regitster System


^Dev-PoinT^

Recommended Posts

Hi its work fine but i wnat when Player Join the he have To register To Show the gamemode

Like PCP= SERVER bomb da base

mybe it fadeCamera?

clientside...

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(264,152,255,341,"GTAT:T Login/Register",false) 
guiSetAlpha(GUIEditor_Window[1],1) 
LoginUsername = guiCreateEdit(0.298,0.1701,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(LoginUsername,1) 
LoginPassword = guiCreateEdit(0.298,0.2815,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(LoginPassword,1) 
guiEditSetMasked ( LoginPassword, true ) 
GUIEditor_Label[2] = guiCreateLabel(0.0431,0.1906,0.2471,0.0616,"UserName:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[2],1) 
guiLabelSetColor(GUIEditor_Label[2],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Label[3] = guiCreateLabel(0.0471,0.2962,0.251,0.0704,"Password:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[3],1) 
guiLabelSetColor(GUIEditor_Label[3],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) 
guiSetFont(GUIEditor_Label[3],"default-bold-small") 
GUIEditor_Label[4] = guiCreateLabel(0.0745,0.5279,0.8314,0.0645,"Register a account here!",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[4],1) 
guiLabelSetColor(GUIEditor_Label[4],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Label[5] = guiCreateLabel(0.0784,0.0792,0.8314,0.0645,"Login in your account here!",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[5],1) 
guiLabelSetColor(GUIEditor_Label[5],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
GUIEditor_Button[1] = guiCreateButton(0.5216,0.4164,0.3961,0.0909,"Login",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Button[1],1) 
EditRegisterUsername = guiCreateEdit(0.2902,0.5924,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiSetAlpha(EditRegisterUsername,1) 
EditRegisterPassword = guiCreateEdit(0.2902,0.7038,0.6157,0.1026,"",true,GUIEditor_Window[1]) 
guiEditSetMasked ( EditRegisterPassword, true ) 
guiSetAlpha(EditRegisterPassword,1) 
GUIEditor_Label[6] = guiCreateLabel(0.0392,0.61,0.2471,0.0616,"UserName:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[6],1) 
guiLabelSetColor(GUIEditor_Label[6],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) 
guiSetFont(GUIEditor_Label[6],"default-bold-small") 
GUIEditor_Label[7] = guiCreateLabel(0.0392,0.7185,0.251,0.0704,"Password:",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Label[7],1) 
guiLabelSetColor(GUIEditor_Label[7],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[7],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[7],"left",false) 
guiSetFont(GUIEditor_Label[7],"default-bold-small") 
GUIEditor_Button[2] = guiCreateButton(0.5216,0.8328,0.3961,0.0909,"Register",true,GUIEditor_Window[1]) 
guiSetAlpha(GUIEditor_Button[2],1) 
  
guiSetVisible ( GUIEditor_Window[1], false ) 
  
local localPlayer = getLocalPlayer ( ) 
  
function windowHandler( ) 
    local playername = getPlayerName(localPlayer) 
     
    guiSetText(LoginUsername, "") 
    guiSetText(EditRegisterUsername, "") 
  
    guiSetText(LoginUsername, playername) 
    guiSetText(EditRegisterUsername, playername) 
  
    guiSetVisible (  GUIEditor_Window[1], true ) 
  
    guiSetInputEnabled(true) 
    showCursor ( true ) 
end 
  
function onClickBtn ( button, state ) 
    if (source == GUIEditor_Button[1]) then 
        triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) ) 
    end 
end 
  
function onClickBtn2 ( button, state ) 
    if (source == GUIEditor_Button[2]) then 
        triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword)) 
    end 
end 
  
  
function hideLoginWindow() 
    guiSetInputEnabled(false) 
    guiSetVisible ( GUIEditor_Window[1], false ) 
    showCursor ( false ) 
end 
addEvent( "hideLoginWindow", true ) 
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) 
  
addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false ) 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], onClickBtn2, false ) 

server Side ..

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) 
    end 
end 
  
addEvent( "onLogin", true ) 
addEventHandler( "onLogin", getRootElement(), onLogin ) 
  
function onRegister ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) 
        end 
    else 
        account = addAccount ( user, pass ) 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) 
        end 
    end 
end 
  
addEvent( "onRegister", true ) 
addEventHandler( "onRegister", getRootElement(), onRegister ) 

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