Deep thinker Posted July 13, 2017 Share Posted July 13, 2017 --client function clientSubmitRegister(button, state) if button == "left" and state == "up" then local arg1 = guiGetText(editUsername) local arg2 = guiGetText(editPassword) if arg1 and arg2 then triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password) else guiSetText(labelInfo, "Enter username and password.") end end end addEventHandler("onClientGUIClick", buttonRegister, clientSubmitRegister, false) function weakPW() guiSetText(labelInfo, "Password should be at least 4 characters long") end function unknownError() guiSetText(labelInfo, "An unknown error occured.") end function RegisterSuccess() guiSetText(labelInfo, "you've successfully registered,Press Login") end function registerTaken() guiSetText(labelInfo, "This username is already taken.") end addEvent("unknownError", true) addEvent("registerTaken", true) addEvent("RegisterSuccess", true) addEvent("weakPW", true) addEventHandler("unknownError", getRootElement(), unknownError) addEventHandler("registerTaken", getRootElement(), registerTaken) addEventHandler("RegisterSuccess", getRootElement(), RegisterSuccess) addEventHandler("weakPW", getRootElement(), weakPW) --server function register( player, arg1, arg2 ) local username = getPlayerName ( player ) local password = arg1 if ( arg2 ) then username = arg1 password = arg2 end if ( password ~= nil ) then if ( string.len ( password ) < 4 ) then outputChatBox ( "register: - Password should be at least 4 characters long", player, 255, 100, 70 ) elseif ( addAccount ( username, password ) ) then outputChatBox ( "You have successfully registered! Username: '"..username.."', Password: '"..password.."'(Remember it)", player, 255, 100, 70 ) outputServerLog ( "ADMIN: "..getPlayerName ( player ).." registered account '"..username.."' (IP: "..getPlayerIP(player).." Serial: "..getPlayerSerial(player)..")" ) elseif ( getAccount ( username ) ) then outputChatBox ( "register: - Account with this name already exists.", player, 255, 100, 70 ) else triggerClientEvent (player, "unknownError", getRootElement()) end end end addEvent("submitRegister", true) addEventHandler("submitRegister", root, register) السلام عليكم انا عندي مشكلة بالكود واللي هو المفروض انه لوحة تسجيل بس انا لما اضغط علي الزر ما بيحصلي شي Labelوبيكتبلي ب ال "An unknown error occured." وبس Link to comment
1337.Ibrahim Posted July 13, 2017 Share Posted July 13, 2017 function clientSubmitRegister(button, state) if button == "left" and state == "up" then local arg1 = guiGetText(editUsername) local arg2 = guiGetText(editPassword) if arg1 and arg2 then triggerServerEvent("submitRegister", getRootElement(), localPlayer, arg1, arg2) else guiSetText(labelInfo, "Enter username and password.") end end end addEventHandler("onClientGUIClick", buttonRegister, clientSubmitRegister, false) function weakPW() guiSetText(labelInfo, "Password should be at least 4 characters long") end function unknownError() guiSetText(labelInfo, "An unknown error occured.") end function RegisterSuccess() guiSetText(labelInfo, "you've successfully registered,Press Login") end function registerTaken() guiSetText(labelInfo, "This username is already taken.") end addEvent("unknownError", true) addEvent("registerTaken", true) addEvent("RegisterSuccess", true) addEvent("weakPW", true) addEventHandler("unknownError", getRootElement(), unknownError) addEventHandler("registerTaken", getRootElement(), registerTaken) addEventHandler("RegisterSuccess", getRootElement(), RegisterSuccess) addEventHandler("weakPW", getRootElement(), weakPW) --server function register( player, arg1, arg2 ) local username = getPlayerName ( player ) local password = arg1 if ( arg2 ) then username = arg1 password = arg2 end if ( password ~= nil ) then if ( string.len ( password ) < 4 ) then outputChatBox ( "register: - Password should be at least 4 characters long", player, 255, 100, 70 ) elseif ( addAccount ( username, password ) ) then outputChatBox ( "You have successfully registered! Username: '"..username.."', Password: '"..password.."'(Remember it)", player, 255, 100, 70 ) outputServerLog ( "ADMIN: "..getPlayerName ( player ).." registered account '"..username.."' (IP: "..getPlayerIP(player).." Serial: "..getPlayerSerial(player)..")" ) elseif ( getAccount ( username ) ) then outputChatBox ( "register: - Account with this name already exists.", player, 255, 100, 70 ) else triggerClientEvent (player, "unknownError", getRootElement()) end end end addEvent("submitRegister", true) addEventHandler("submitRegister", root, register) Link to comment
Deep thinker Posted July 13, 2017 Author Share Posted July 13, 2017 10 hours ago, #BrosS said: ضيف المود لقروب ادمن دي كانت اول شي عملته 12 hours ago, Talis said: function clientSubmitRegister(button, state) if button == "left" and state == "up" then local arg1 = guiGetText(editUsername) local arg2 = guiGetText(editPassword) if arg1 and arg2 then triggerServerEvent("submitRegister", getRootElement(), localPlayer, arg1, arg2) else guiSetText(labelInfo, "Enter username and password.") end end end addEventHandler("onClientGUIClick", buttonRegister, clientSubmitRegister, false) function weakPW() guiSetText(labelInfo, "Password should be at least 4 characters long") end function unknownError() guiSetText(labelInfo, "An unknown error occured.") end function RegisterSuccess() guiSetText(labelInfo, "you've successfully registered,Press Login") end function registerTaken() guiSetText(labelInfo, "This username is already taken.") end addEvent("unknownError", true) addEvent("registerTaken", true) addEvent("RegisterSuccess", true) addEvent("weakPW", true) addEventHandler("unknownError", getRootElement(), unknownError) addEventHandler("registerTaken", getRootElement(), registerTaken) addEventHandler("RegisterSuccess", getRootElement(), RegisterSuccess) addEventHandler("weakPW", getRootElement(), weakPW) --server function register( player, arg1, arg2 ) local username = getPlayerName ( player ) local password = arg1 if ( arg2 ) then username = arg1 password = arg2 end if ( password ~= nil ) then if ( string.len ( password ) < 4 ) then outputChatBox ( "register: - Password should be at least 4 characters long", player, 255, 100, 70 ) elseif ( addAccount ( username, password ) ) then outputChatBox ( "You have successfully registered! Username: '"..username.."', Password: '"..password.."'(Remember it)", player, 255, 100, 70 ) outputServerLog ( "ADMIN: "..getPlayerName ( player ).." registered account '"..username.."' (IP: "..getPlayerIP(player).." Serial: "..getPlayerSerial(player)..")" ) elseif ( getAccount ( username ) ) then outputChatBox ( "register: - Account with this name already exists.", player, 255, 100, 70 ) else triggerClientEvent (player, "unknownError", getRootElement()) end end end addEvent("submitRegister", true) addEventHandler("submitRegister", root, register) تصدق وتامن بالله ماخدت بالي ض1 تسلم اخي 1 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