يب الي قبل فيه عطل جرب ذا تابين
--client side--
-----------------------------------------------
tab5 = guiCreateTab("Login",tabPanel)
------------------------------------------------
LoginUsername = guiCreateEdit(0.298,0.1701,0.6157,0.1026,"",true,tab5)
guiSetAlpha(LoginUsername,1)
LoginPassword = guiCreateEdit(0.298,0.2815,0.6157,0.1026,"",true,tab5)
guiSetAlpha(LoginPassword,1)
guiEditSetMasked ( LoginPassword, true )
GUIEditor_Label[2] = guiCreateLabel(0.0431,0.1906,0.2471,0.0616,"Username:",true,tab5)
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,tab5)
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")
guiSetAlpha(GUIEditor_Label[4],1)
guiLabelSetColor(GUIEditor_Label[4],255,150,255)
guiLabelSetVerticalAlign(GUIEditor_Label[4],"top")
guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false)
guiSetFont(GUIEditor_Label[4],"clear-normal")
GUIEditor_Label[5] = guiCreateLabel(0.0784,0.0792,0.8314,0.0645,"Welcome in server Please Login",true,tab5)
guiSetAlpha(GUIEditor_Label[5],1)
guiLabelSetColor(GUIEditor_Label[5],255,150,255)
guiLabelSetVerticalAlign(GUIEditor_Label[5],"top")
guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false)
guiSetFont(GUIEditor_Label[5],"clear-normal")
GUIEditor_Button[1] = guiCreateButton(0.5216,0.4164,0.3961,0.0909,"Login!",true,tab5)
guiSetAlpha(GUIEditor_Button[1],1)
---------------------
tab6 = guiCreateTab("Register",tabPanel)
---------------------
EditRegisterUsername = guiCreateEdit(0.298,0.1701,0.6157,0.1026,"",true,tab6)
guiSetAlpha(EditRegisterUsername,1)
EditRegisterPassword = guiCreateEdit(0.298,0.2815,0.6157,0.1026,"",true,tab6)
guiEditSetMasked ( EditRegisterPassword, true )
guiSetAlpha(EditRegisterPassword,1)
GUIEditor_Label[6] = guiCreateLabel(0.0431,0.1906,0.2471,0.0616,"Username:",true,tab6)
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.0471,0.2962,0.251,0.0704,"Password:",true,tab6)
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.4164,0.3961,0.0909,"Register!",true,tab6)
guiSetAlpha(GUIEditor_Button[2],1)
GUIEditor_Label[4] = guiCreateLabel(0.0784,0.0792,0.8314,0.0645,"Welome in Server Please Register",true,tab6)
-----------------------------ربط الازراربلأوامر----------------
local localPlayer = getLocalPlayer ( )
function windowHandler( )
local playername = getPlayerName(localPlayer)
guiSetText(LoginUsername, "")
guiSetText(EditRegisterUsername, "")
guiSetText(LoginUsername, playername)
guiSetText(EditRegisterUsername, playername)
guiSetInputEnabled(true)
showCursor ( false)
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)
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 ) -- Output they got the details wrong.
end
else
outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong.
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 ) -- Output they got the details wrong.
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 ) -- Output they got the details wrong.
end
end
end
addEvent( "onRegister", true )
addEventHandler( "onRegister", getRootElement(), onRegister )
اي خطأ يصادفك طرحه وبصلحه