Spice Posted July 1, 2015 Share Posted July 1, 2015 Why it's not working when i enter a valid account name and pw ? There isn't debugscript output tho Client addEventHandler ( "onClientGUIClick", root, function () if (source == logi) then acc = guiGetText (acctype) pw = guiGetText (pwtype) triggerServerEvent ("login", getRootElement(), getLocalPlayer(), acc, pw) end end ) panel = guiCreateWindow(357, 119, 319, 277, "Login Panel", false) guiWindowSetSizable(panel, false) acctype = guiCreateEdit(74, 74, 158, 34, "", false, panel) pwtype = guiCreateEdit(74, 143, 158, 34, "", false, panel) guiEditSetMasked ( pwtype, true ) lab1 = guiCreateLabel(9, 82, 55, 16, "Account :", false, panel) lab2 = guiCreateLabel(10, 151, 64, 16, "Password :", false, panel) logi = guiCreateButton(26, 211, 116, 39, "Login", false, panel) create = guiCreateButton(190, 211, 116, 39, "Create Account", false, panel) guiSetVisible (panel, false) function ShowWindow1 ( ) guiSetVisible ( panel,true ) showCursor ( true ) end addEvent( "onJoin", true ) addEventHandler( "onJoin", localPlayer, ShowWindow1 ) Server function ShowWindow1 ( ) triggerClientEvent ( source, "onJoin", source ) setCameraMatrix ( source, -1630.71509, 440.49222, 142.57805, -1540.49854, 600.08282, 69.90792 ) end addEventHandler("onPlayerJoin",root,ShowWindow1) addEvent ( "login", true ) addEventHandler ("login", root, function () local account = getAccount (acc, pw) if ( account ~= false ) then logIn ( source, acc, pw ) else outputChatBox ( "Wrong username or password!", thePlayer, 255, 255, 0 ) end end ) Link to comment
Drakath Posted July 1, 2015 Share Posted July 1, 2015 Try this addEvent ( "login", true ) addEventHandler ("login", root, function (thePlayer, acc, pw) local account = getAccount (acc, pw) if ( account ~= false ) then logIn ( thePlayer, acc, pw ) else outputChatBox ( "Wrong username or password!", thePlayer, 255, 255, 0 ) end end Link to comment
Spice Posted July 1, 2015 Author Share Posted July 1, 2015 Try this addEvent ( "login", true ) addEventHandler ("login", root, function (thePlayer, acc, pw) local account = getAccount (acc, pw) if ( account ~= false ) then logIn ( thePlayer, acc, pw ) else outputChatBox ( "Wrong username or password!", thePlayer, 255, 255, 0 ) end end Thanks <3 Link to comment
Spice Posted July 1, 2015 Author Share Posted July 1, 2015 1 more question, how to disable /login command Link to comment
Drakath Posted July 1, 2015 Share Posted July 1, 2015 1 more question, how to disable /login command /login and /register commands are default functions of admin resource. You can search for them there and remove it. Link to comment
Spice Posted July 1, 2015 Author Share Posted July 1, 2015 1 more question, how to disable /login command /login and /register commands are default functions of admin resource. You can search for them there and remove it. can't find it , aslo how to use GUIsetVisible to hide the gui if the player was logged in ? addEvent ( "login", true ) addEventHandler ("login", root, function (thePlayer, acc, pw) local account = getAccount (acc, pw) if ( account ~= false ) then logIn ( thePlayer, acc, pw ) -- I want to hide the gui now where should i add GUISetVisible ? else outputChatBox ( "Wrong username or password!", thePlayer, 255, 255, 0 ) end end Link to comment
LabiVila Posted July 2, 2015 Share Posted July 2, 2015 After you trigger the event, you should only do guiSetVisible (panel, false) https://wiki.multitheftauto.com/wiki/GuiSetVisible - it's quite clear tho Link to comment
xXMADEXx Posted July 2, 2015 Share Posted July 2, 2015 Rather than searching for the login/register commands in the admin resource, you can deny access to them in acl.xml. If you still don't want to do that for whatever reason but don't want to search for the script, then you can do something like this to block the command from being created: local _addCommandHandler = addCommandHandler function addCommandHandler ( ... ) local args = { ... } if ( args [ 1 ]:lower ( ) == "login" or args [ 1]:lower( ) == "register" ) then return false; end return _addCommandHandler ( ... ) end Link to comment
Spice Posted July 2, 2015 Author Share Posted July 2, 2015 After you trigger the event, you should only do guiSetVisible (panel, false)https://wiki.multitheftauto.com/wiki/GuiSetVisible - it's quite clear tho I wanna it gets hidden if the the "if statment" in the server side was made so anyway ? Link to comment
Spice Posted July 2, 2015 Author Share Posted July 2, 2015 After you trigger the event, you should only do guiSetVisible (panel, false)https://wiki.multitheftauto.com/wiki/GuiSetVisible - it's quite clear tho I wanna it gets hidden if the the "if statment" in the server side was made so anyway ? nvm fixed it thanks guys 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