Adham Posted March 2, 2016 Share Posted March 2, 2016 مشكله انا صنعت مود الlogin في مشكله فيه اول ما اخش السرفر يجيلي اللوحه في وجهي + لما احط الكود بتاع اللوحه ما تيجي في وجهي اللوحه login ما تيجي خالص و لما اضعط register مش بتعمل حل كود client --[[------------------------------------------------- Notes: > This code is using a relative image filepath. This will only work as long as the location it is from always exists, and the resource it is part of is running. To ensure it does not break, it is highly encouraged to move images into your local resource and reference them there. --]]------------------------------------------------- GUIEditor = { staticimage = {}, edit = {}, button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(60, 103, 705, 421, ":: Login Systeam ::", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.staticimage[1] = guiCreateStaticImage(9, 22, 675, 189, ":Shop/images/adham.png", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(184, 217, 328, 15, "Welcome @ To Server, Please Login to Enter the game", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(170, 246, 93, 24, "Username:", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(232, 242, 239, 28, "", false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(232, 280, 239, 28, "", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(170, 280, 93, 24, "Password:", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(127, 314, 173, 47, "Login", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(372, 318, 173, 47, "Register", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "sa-header") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.label[4] = guiCreateLabel(522, 396, 355, 15, "#Created By #[L]e3bA | v3.4.1", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[4], 255, 0, 0) end ) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[1] then triggerServerEvent("onLogin",getRootElement(),getLocalPlayer(),guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]) ) elseif source == GUIEditor.button[2] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) showChat(true) fadeCamera(true,5) elseif source == GUIEditor.button[2] then triggerServerEvent("onReg",getRootElement(),getLocalPlayer(),guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]) ) end end ) addEvent("Hidewindow",true) addEventHandler("Hidewindow",root, function () guiSetVisible(GUIEditor.window[1],false) showCursor(false) showChat(true) fadeCamera(true,5) end ) server -- addEvent("onLogin", true) addEventHandler("onLogin",root, function (player, user, pass, NameAccount, Password) local account = getAccount ( user, pass ) if ( account ~= true ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Logged in Sucessfuly!", player, 255, 255, 0 , true ) triggerClientEvent (player, "Hidewindow", player) else outputChatBox ( "Login Error!", player, 255, 0, 0 ) end else outputChatBox ( "Wrong username or password!", player, 255, 0, 0 ) end end ) -- addEvent("onReg", true) addEventHandler("onReg",root, function ( player, user, pass, NameAccount, Password ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) triggerClientEvent (player, "Hidewindow", player) else outputChatBox ( "You Are Already Logged in !", player, 255, 255, 0 ) triggerClientEvent (player, "Hidewindow", player) end else account = addAccount ( user, pass ) if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) triggerClientEvent (player, "Hidewindow", player) else outputChatBox ( "Register Error !", player, 255, 0, 0 ) end end end ) Link to comment
Adham Posted March 2, 2016 Author Share Posted March 2, 2016 اول ما حد يخش السرفر لما يخلص التحميل Link to comment
Adham Posted March 2, 2016 Author Share Posted March 2, 2016 ومشكله تانيه لما احد يخش السرفر لازم يضعط علي ف1 او ف5 عشان يظهر السهم عشان يسجل ارجو حل Link to comment
iMr.SFA7 Posted March 2, 2016 Share Posted March 2, 2016 --[[------------------------------------------------- Notes: > This code is using a relative image filepath. This will only work as long as the location it is from always exists, and the resource it is part of is running. To ensure it does not break, it is highly encouraged to move images into your local resource and reference them there. --]]------------------------------------------------- GUIEditor = { staticimage = {}, edit = {}, button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(60, 103, 705, 421, ":: Login Systeam ::", false) guiWindowSetSizable(GUIEditor.window[1], false) showCursor(true) GUIEditor.staticimage[1] = guiCreateStaticImage(9, 22, 675, 189, ":Shop/images/adham.png", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(184, 217, 328, 15, "Welcome @ To Server, Please Login to Enter the game", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(170, 246, 93, 24, "Username:", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(232, 242, 239, 28, "", false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(232, 280, 239, 28, "", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(170, 280, 93, 24, "Password:", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(127, 314, 173, 47, "Login", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(372, 318, 173, 47, "Register", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "sa-header") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.label[4] = guiCreateLabel(522, 396, 355, 15, "#Created By #[L]e3bA | v3.4.1", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[4], 255, 0, 0) end ) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[1] then triggerServerEvent("onLogin",getRootElement(),getLocalPlayer(),guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]) ) elseif source == GUIEditor.button[2] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) showChat(true) fadeCamera(true,5) elseif source == GUIEditor.button[2] then triggerServerEvent("onReg",getRootElement(),getLocalPlayer(),guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]) ) end end ) addEvent("Hidewindow",true) addEventHandler("Hidewindow",root, function () guiSetVisible(GUIEditor.window[1],false) showCursor(false) showChat(true) fadeCamera(true,5) end ) Link to comment
Adham Posted March 2, 2016 Author Share Posted March 2, 2016 طيب لما بعمل register بتقفل اللوحه ابي لما حد يضعط register يعمل حساب يعني يكتب اسم حسابو الباسورد وييضعط register يعمل الحساب Link to comment
iMr.SFA7 Posted March 2, 2016 Share Posted March 2, 2016 أنت ليه مسوي الترايقر لجميع الالمنتات؟ عدل أكواد الضغط على الزر بهذا addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[1] then triggerServerEvent("onLogin",localPlayer,localPlayer,guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]) ) elseif source == GUIEditor.button[2] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) showChat(true) fadeCamera(true,5) elseif source == GUIEditor.button[2] then triggerServerEvent("onReg",localPlayer,localPlayer,guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]) ) end end ) addAccount ; للمعلومية وظيفة اضافة حساب تحتاج صلاحيات فـ هذا يعني أنك تضيف السكربت لقروب الأدمن أو الكونسل Link to comment
YourMind Posted March 2, 2016 Share Posted March 2, 2016 --client local sx, sy = guiGetScreenSize() function centerTheGUI( guiElement ) local width, height = guiGetSize( guiElement, false ) local x, y = sx / 2 - width / 2, sy / 2 - height / 2 guiSetPosition( guiElement, x, y, false ) end GUIEditor = { staticimage = {}, edit = {}, button = {}, window = {}, label = {} } GUIEditor.window[1] = guiCreateWindow(60, 103, 705, 421, ":: Login System ::", false) guiWindowSetSizable(GUIEditor.window[1], false) centerTheGUI( GUIEditor.window[1] ) GUIEditor.staticimage[1] = guiCreateStaticImage(9, 22, 675, 189, ":Shop/images/adham.png", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(184, 217, 328, 15, "Welcome @ To Server, Please Login to Enter the game", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(170, 246, 93, 24, "Username:", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(232, 242, 239, 28, "", false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(232, 280, 239, 28, "", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(170, 280, 93, 24, "Password:", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(127, 314, 173, 47, "Login", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(372, 318, 173, 47, "Register", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "sa-header") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.label[4] = guiCreateLabel(522, 396, 355, 15, "#Created By #[L]e3bA | v3.4.1", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[4], 255, 0, 0) guiSetVisible (GUIEditor.window[1],false) addEventHandler("onClientGUIClick",root, function () if source == GUIEditor.button[1] then local uss,passs = guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]) triggerServerEvent("onLogin",localPlayer,uss,passs) elseif source == GUIEditor.button[2] then local uss,passs = guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]) triggerServerEvent("onReg",localPlayer,uss,passs) end end ) addEvent("Hidewindow",true) addEventHandler("Hidewindow",root, function () guiSetVisible(GUIEditor.window[1],false) showCursor(false) showChat(true) fadeCamera(true,5) setCameraTarget (localPlayer) end ) addEvent("show",true) addEventHandler("show",root, function () guiSetVisible(GUIEditor.window[1],true) showCursor(true) showChat(true) end ) --server addEvent("onLogin", true) addEventHandler("onLogin",root, function (user, pass) local account = getAccount ( user, pass ) if ( account ~= true ) then local log = logIn (source,account,pass) if log then outputChatBox ( "You Logged in Sucessfuly!", source, 255, 255, 0 , true ) triggerClientEvent (source, "Hidewindow", source) else outputChatBox ( "Login Error!", source, 255, 0, 0 ) end else outputChatBox ( "Wrong username or password!", source, 255, 0, 0 ) end end ) -- addEvent("onReg", true) addEventHandler("onReg",root, function (user, pass) if not getAccount (user,pass) then local acc = addAccount (user,pass) if acc then local account = getAccount ( user, pass ) outputChatBox ("You've registered successfully!",source,0,255,0) else outputChatBox ("Error creating account !",source,255,0,0) end else outputChatBox ("This account is already exists !",source,255,0,0) end end ) addEventHandler ("onPlayerJoin",root, function () l = source repeat until setTimer(function() triggerClientEvent (l,"show",l) end,2000,1) end ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now