This script i made,
when i click Register or login..Nothing happened..even i don't see the label with errors of the register or login errors..or in debugscript 3..can you check it please?.thanks
server:
function PlayerLogin(username,password,checksave)
if not (username == "") then
if not (password == "") then
local account = getAccount ( username, password )
if ( account ~= false ) then
logIn(source, account, password)
triggerClientEvent (source,"hideLoginWindow",getRootElement())
else
triggerClientEvent(source,"WarningText",getRootElement(),"Login","Wrong username and/or password!")
end
else
triggerClientEvent(source,"WarningText",getRootElement(),"Login","Please enter your password!")
end
else
triggerClientEvent(source,"WarningText",getRootElement(),"Login","Please enter your username!")
end
end
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)
function registerPlayer(username,password,passwordConfirm)
if not (username == "") then
if not (password == "") then
if not (passwordConfirm == "") then
if password == passwordConfirm then
local account = getAccount (username,password)
if (account == false) then
local accountAdded = addAccount(tostring(username),tostring(password))
if (accountAdded) then
outputChatBox ("#FF0000* #00FF00You have sucessfuly registered! [username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true )
else
triggerClientEvent(source,"WarningText",getRootElement(),"Register","Error ocurred. Choose a different username/password.")
end
else
triggerClientEvent(source,"WarningText",getRootElement(),"Register","An account with this username already exists")
end
else
triggerClientEvent(source,"WarningText",getRootElement(),"Register","Passwords do not match")
end
else
triggerClientEvent(source,"WarningText",getRootElement(),"Register","Please confirm your password")
end
else
triggerClientEvent(source,"WarningText",getRootElement(),"Register","Please enter a password")
end
else
triggerClientEvent(source,"WarningText",getRootElement(),"Register","Please enter a username you would like to register")
end
end
addEvent("Register",true)
addEventHandler("Register",getRootElement(),registerPlayer)
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 = { tab = {}, staticimage = {}, tabpanel = {}, edit = {}, button = {}, window = {}, label = {}, checkbox = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0, 0, 1024, 768, "[Register & Login Panel] [ System By LiOneLMeSsI]", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) GUIEditor.staticimage[1] = guiCreateStaticImage(9, 0, 1005, 758, ":Login_System/images/Zombie.png", false, GUIEditor.window[1]) GUIEditor.tabpanel[1] = guiCreateTabPanel(321, 236, 381, 281, false, GUIEditor.staticimage[1]) guiSetAlpha(GUIEditor.tabpanel[1], 0.60) GUIEditor.tab[1] = guiCreateTab("Login", GUIEditor.tabpanel[1]) GUIEditor.label[1] = guiCreateLabel(0, 66, 60, 16, "Username:", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.label[2] = guiCreateLabel(0, 92, 60, 16, "Password:", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") GUIEditor.edit[1] = guiCreateEdit(61, 64, 187, 24, "", false, GUIEditor.tab[1]) GUIEditor.edit[2] = guiCreateEdit(61, 88, 187, 24, "", false, GUIEditor.tab[1]) guiEditSetMasked(GUIEditor.edit[2], true) GUIEditor.button[1] = guiCreateButton(167, 113, 81, 45, "Login", false, GUIEditor.tab[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFE0000") GUIEditor.checkbox[1] = guiCreateCheckBox(61, 112, 104, 22, "Save Details", true, false, GUIEditor.tab[1]) GUIEditor.tab[2] = guiCreateTab("Register", GUIEditor.tabpanel[1]) GUIEditor.label[3] = guiCreateLabel(56, 15, 60, 18, "Username:", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.label[3], "default-bold-small") GUIEditor.label[4] = guiCreateLabel(56, 44, 60, 18, "Password:", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.label[4], "default-bold-small") GUIEditor.label[5] = guiCreateLabel(12, 73, 104, 15, "Confirm Password:", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.label[5], "default-bold-small") GUIEditor.edit[3] = guiCreateEdit(144, 15, 135, 24, "", false, GUIEditor.tab[2]) GUIEditor.edit[4] = guiCreateEdit(144, 44, 135, 24, "", false, GUIEditor.tab[2]) guiEditSetMasked(GUIEditor.edit[4], true) GUIEditor.edit[5] = guiCreateEdit(144, 73, 135, 24, "", false, GUIEditor.tab[2]) guiEditSetMasked(GUIEditor.edit[5], true) GUIEditor.button[2] = guiCreateButton(154, 98, 127, 56, "Register", false, GUIEditor.tab[2]) guiSetFont(GUIEditor.button[2], "sa-header") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFE0000") GUIEditor.window[2] = guiCreateWindow(0, 0, 1024, 768, "[Register & Login Panel] [ System By LiOneLMeSsI]", false) guiWindowSetMovable(GUIEditor.window[2], false) guiWindowSetSizable(GUIEditor.window[2], false) guiSetAlpha(GUIEditor.window[2], 1.00) GUIEditor.staticimage[2] = guiCreateStaticImage(9, 0, 1005, 758, ":Login_System/images/Zombie.png", false, GUIEditor.window[2]) GUIEditor.tabpanel[2] = guiCreateTabPanel(321, 236, 381, 281, false, GUIEditor.staticimage[2]) guiSetAlpha(GUIEditor.tabpanel[2], 0.60) GUIEditor.tab[3] = guiCreateTab("Login", GUIEditor.tabpanel[2]) GUIEditor.label[6] = guiCreateLabel(0, 66, 60, 16, "Username:", false, GUIEditor.tab[3]) guiSetFont(GUIEditor.label[6], "default-bold-small") GUIEditor.label[7] = guiCreateLabel(0, 92, 60, 16, "Password:", false, GUIEditor.tab[3]) guiSetFont(GUIEditor.label[7], "default-bold-small") GUIEditor.edit[6] = guiCreateEdit(61, 64, 187, 24, "", false, GUIEditor.tab[3]) GUIEditor.edit[7] = guiCreateEdit(61, 88, 187, 24, "", false, GUIEditor.tab[3]) guiEditSetMasked(GUIEditor.edit[7], true) GUIEditor.button[3] = guiCreateButton(167, 113, 81, 45, "Login", false, GUIEditor.tab[3]) guiSetFont(GUIEditor.button[3], "sa-header") guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFE0000") GUIEditor.checkbox[2] = guiCreateCheckBox(61, 112, 104, 22, "Save Details", false, false, GUIEditor.tab[3]) GUIEditor.staticimage[3] = guiCreateStaticImage(0, 0, 381, 66, ":Login_System/images/Zombie1.png", false, GUIEditor.tab[3]) guiSetAlpha(GUIEditor.staticimage[3], 0.60) GUIEditor.staticimage[4] = guiCreateStaticImage(0, 191, 381, 66, ":Login_System/images/Zombie1.png", false, GUIEditor.tab[3]) guiSetAlpha(GUIEditor.staticimage[4], 0.60) GUIEditor.tab[4] = guiCreateTab("Register", GUIEditor.tabpanel[2]) GUIEditor.label[8] = guiCreateLabel(56, 15, 60, 18, "Username:", false, GUIEditor.tab[4]) guiSetFont(GUIEditor.label[8], "default-bold-small") GUIEditor.label[9] = guiCreateLabel(56, 44, 60, 18, "Password:", false, GUIEditor.tab[4]) guiSetFont(GUIEditor.label[9], "default-bold-small") GUIEditor.label[10] = guiCreateLabel(12, 73, 104, 15, "Confirm Password:", false, GUIEditor.tab[4]) guiSetFont(GUIEditor.label[10], "default-bold-small") GUIEditor.edit[8] = guiCreateEdit(144, 15, 135, 24, "", false, GUIEditor.tab[4]) GUIEditor.edit[9] = guiCreateEdit(144, 44, 135, 24, "", false, GUIEditor.tab[4]) guiEditSetMasked(GUIEditor.edit[9], true) GUIEditor.edit[10] = guiCreateEdit(144, 73, 135, 24, "", false, GUIEditor.tab[4]) guiEditSetMasked(GUIEditor.edit[10], true) GUIEditor.button[4] = guiCreateButton(154, 98, 127, 56, "Register", false, GUIEditor.tab[4]) guiSetFont(GUIEditor.button[4], "sa-header") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFE0000") GUIEditor.staticimage[5] = guiCreateStaticImage(2, 154, 379, 103, ":Login_System/images/Zombie1.png", false, GUIEditor.tab[4]) guiSetAlpha(GUIEditor.staticimage[5], 0.60) GUIEditor.window[3] = guiCreateWindow(0, 0, 1024, 768, "[Register & Login Panel] [ System By LiOneLMeSsI]", false) guiWindowSetMovable(GUIEditor.window[3], false) guiWindowSetSizable(GUIEditor.window[3], false) guiSetAlpha(GUIEditor.window[3], 1.00) GUIEditor.staticimage[6] = guiCreateStaticImage(9, 0, 1005, 758, ":Login_System/images/Zombie.png", false, GUIEditor.window[3]) GUIEditor.tabpanel[3] = guiCreateTabPanel(321, 236, 381, 281, false, GUIEditor.staticimage[6]) guiSetAlpha(GUIEditor.tabpanel[3], 0.60) GUIEditor.tab[5] = guiCreateTab("Login", GUIEditor.tabpanel[3]) GUIEditor.label[11] = guiCreateLabel(0, 66, 60, 16, "Username:", false, GUIEditor.tab[5]) guiSetFont(GUIEditor.label[11], "default-bold-small") GUIEditor.label[12] = guiCreateLabel(0, 92, 60, 16, "Password:", false, GUIEditor.tab[5]) guiSetFont(GUIEditor.label[12], "default-bold-small") GUIEditor.edit[11] = guiCreateEdit(61, 64, 187, 24, "", false, GUIEditor.tab[5]) GUIEditor.edit[12] = guiCreateEdit(61, 88, 187, 24, "", false, GUIEditor.tab[5]) guiEditSetMasked(GUIEditor.edit[12], true) GUIEditor.button[5] = guiCreateButton(167, 113, 81, 45, "Login", false, GUIEditor.tab[5]) guiSetFont(GUIEditor.button[5], "sa-header") guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFE0000") GUIEditor.checkbox[3] = guiCreateCheckBox(61, 112, 104, 22, "Save Details", true, false, GUIEditor.tab[5]) GUIEditor.tab[6] = guiCreateTab("Register", GUIEditor.tabpanel[3]) GUIEditor.label[13] = guiCreateLabel(56, 15, 60, 18, "Username:", false, GUIEditor.tab[6]) guiSetFont(GUIEditor.label[13], "default-bold-small") GUIEditor.label[14] = guiCreateLabel(56, 44, 60, 18, "Password:", false, GUIEditor.tab[6]) guiSetFont(GUIEditor.label[14], "default-bold-small") GUIEditor.label[15] = guiCreateLabel(12, 73, 104, 15, "Confirm Password:", false, GUIEditor.tab[6]) guiSetFont(GUIEditor.label[15], "default-bold-small") GUIEditor.edit[13] = guiCreateEdit(144, 15, 135, 24, "", false, GUIEditor.tab[6]) GUIEditor.edit[14] = guiCreateEdit(144, 44, 135, 24, "", false, GUIEditor.tab[6]) guiEditSetMasked(GUIEditor.edit[14], true) GUIEditor.edit[15] = guiCreateEdit(144, 73, 135, 24, "", false, GUIEditor.tab[6]) guiEditSetMasked(GUIEditor.edit[15], true) GUIEditor.button[6] = guiCreateButton(154, 98, 127, 56, "Register", false, GUIEditor.tab[6]) guiSetFont(GUIEditor.button[6], "sa-header") guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFFE0000") GUIEditor.window[4] = guiCreateWindow(0, 0, 1024, 768, "[Register & Login Panel] [ System By LiOneLMeSsI]", false) guiWindowSetMovable(GUIEditor.window[4], false) guiWindowSetSizable(GUIEditor.window[4], false) guiSetAlpha(GUIEditor.window[4], 1.00) GUIEditor.staticimage[7] = guiCreateStaticImage(9, 0, 1005, 758, ":Login_System/images/Zombie.png", false, GUIEditor.window[4]) GUIEditor.tabpanel[4] = guiCreateTabPanel(321, 236, 381, 281, false, GUIEditor.staticimage[7]) guiSetAlpha(GUIEditor.tabpanel[4], 0.60) GUIEditor.tab[7] = guiCreateTab("Login", GUIEditor.tabpanel[4]) GUIEditor.label[16] = guiCreateLabel(0, 66, 60, 16, "Username:", false, GUIEditor.tab[7]) guiSetFont(GUIEditor.label[16], "default-bold-small") GUIEditor.label[17] = guiCreateLabel(0, 92, 60, 16, "Password:", false, GUIEditor.tab[7]) guiSetFont(GUIEditor.label[17], "default-bold-small") GUIEditor.edit[16] = guiCreateEdit(61, 64, 187, 24, "", false, GUIEditor.tab[7]) GUIEditor.edit[17] = guiCreateEdit(61, 88, 187, 24, "", false, GUIEditor.tab[7]) guiEditSetMasked(GUIEditor.edit[17], true) GUIEditor.button[7] = guiCreateButton(167, 113, 81, 45, "Login", false, GUIEditor.tab[7]) guiSetFont(GUIEditor.button[7], "sa-header") guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFFE0000") GUIEditor.checkbox[4] = guiCreateCheckBox(61, 112, 104, 22, "Save Details", false, false, GUIEditor.tab[7]) GUIEditor.staticimage[8] = guiCreateStaticImage(0, 0, 381, 66, ":Login_System/images/Zombie1.png", false, GUIEditor.tab[7]) guiSetAlpha(GUIEditor.staticimage[8], 0.60) GUIEditor.staticimage[9] = guiCreateStaticImage(0, 191, 381, 66, ":Login_System/images/Zombie1.png", false, GUIEditor.tab[7]) guiSetAlpha(GUIEditor.staticimage[9], 0.60) GUIEditor.tab[8] = guiCreateTab("Register", GUIEditor.tabpanel[4]) GUIEditor.label[18] = guiCreateLabel(56, 15, 60, 18, "Username:", false, GUIEditor.tab[8]) guiSetFont(GUIEditor.label[18], "default-bold-small") GUIEditor.label[19] = guiCreateLabel(56, 44, 60, 18, "Password:", false, GUIEditor.tab[8]) guiSetFont(GUIEditor.label[19], "default-bold-small") GUIEditor.label[20] = guiCreateLabel(12, 73, 104, 15, "Confirm Password:", false, GUIEditor.tab[8]) guiSetFont(GUIEditor.label[20], "default-bold-small") GUIEditor.edit[18] = guiCreateEdit(144, 15, 135, 24, "", false, GUIEditor.tab[8]) GUIEditor.edit[19] = guiCreateEdit(144, 44, 135, 24, "", false, GUIEditor.tab[8]) guiEditSetMasked(GUIEditor.edit[19], true) GUIEditor.edit[20] = guiCreateEdit(144, 73, 135, 24, "", false, GUIEditor.tab[8]) guiEditSetMasked(GUIEditor.edit[20], true) GUIEditor.button[8] = guiCreateButton(154, 98, 127, 56, "Register", false, GUIEditor.tab[8]) guiSetFont(GUIEditor.button[8], "sa-header") guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFFE0000") GUIEditor.staticimage[10] = guiCreateStaticImage(2, 154, 379, 103, ":Login_System/images/Zombie1.png", false, GUIEditor.tab[8]) guiSetAlpha(GUIEditor.staticimage[10], 0.60) ---Controls: showCursor ( true ) toggleAllControls(false) Warning = guiCreateLabel(321, 114, 381, 62, "", false, GUIEditor.staticimage[7]) guiSetFont(Warning, "default-bold-small") guiLabelSetColor(Warning, 242, 0, 0) guiLabelSetHorizontalAlign(Warning, "center", false) guiLabelSetVerticalAlign(Warning, "center") guiSetText (Warning, "") end ) function onClickRegister(button,state) --При нажатии на кнопку Register and Cofirm if(button == "left" and state == "up") then if (source == GUIEditor.button[2]) then username = guiGetText(GUIEditor.edit[13]) password = guiGetText(GUIEditor.edit[14]) passwordConfirm = guiGetText(GUIEditor.edit[15]) triggerServerEvent("Register",getLocalPlayer(),username,password,passwordConfirm) end end end addEventHandler ("onClientGuiClick", GUIEditor.button[2], onClickRegister, false) function onClickLogin(button,state) if(button == "left" and state == "up") then if (source == GUIEditor.button[1]) then username = guiGetText(GUIEditor.edit[6]) password = guiGetText(GUIEditor.edit[7]) triggerServerEvent("Login",getLocalPlayer(),username,password,checksave) end end end addEventHandler ("onClientGuiClick", GUIEditor.button[1], onClickLogin, false) function Error_msg(Tab, Text) if Tab == "Login" then guiSetText(Warning, tostring(Text)) setTimer(function() guiSetText(Warning, "") end,6000,1) elseif Tab == "Register" then guiSetText(Warning, tostring(Text)) setTimer(function() guiSetText(Warning, "") end,6000,1) end end addEvent("WarningText",true) addEventHandler("WarningText",getRootElement(),Error_msg) function hideLoginWindow ()