Yazir Posted February 14, 2016 Share Posted February 14, 2016 Hey, i was wondering, if i could register and login a player by using the default mta login system. Can i write any console command on player as a server? Link to comment
Captain Cody Posted February 14, 2016 Share Posted February 14, 2016 /login /register Link to comment
Yazir Posted February 14, 2016 Author Share Posted February 14, 2016 Yes, but how do i make player get registered like this by gui? And also, how do i check, what error I've made in client-side scripts? Link to comment
Captain Cody Posted February 14, 2016 Share Posted February 14, 2016 #1 To Login - logIn(source, account, password) To register - addAccount(username, password) #2 Trying using debugscript3 Link to comment
EstrategiaGTA Posted February 14, 2016 Share Posted February 14, 2016 So you basically want a GUI-based login panel? Link to comment
Yazir Posted February 14, 2016 Author Share Posted February 14, 2016 I have a problem, i don't have idea why it won't start function clientSubmitLogin(button,state) outputChatBox( "test") if button == "left" and state == "up" then local username = guiGetText(loginLogin) local password = guiGetText(loginPwd) if username and password then if source == loginButtonLogin then triggerServerEvent("submitLogin", client, username, password,"login") elseif source == loginButtonRegister then triggerServerEvent("submitLogin", client, username, password,"register") end guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else outputChatBox("Please enter a username and password.") end end end addEventHandler("onClientGUIClick", getRootElement( ), clientSubmitLogin, false) It doesn't even exec the outputChatBox("test") Script is client-side. Got no errors on debugscript. @edit Neverming, i see i made my fault at handler, where fourth parameter is false, and that disables activating it by clicking children elements. Link to comment
Yazir Posted February 14, 2016 Author Share Posted February 14, 2016 But even though, I don't know why i have error "ERROR: Client (Yazir) triggered serverside event submitLogin, but event is not added serverside" addEvent( "sumbitLogin", true ) addEventHandler( "sumbitLogin", getRootElement( ), function(username,password,mode) if mode == "login" then if logIn( source, username, password ) then outputChatBox( "You've logged in successfully!", source, 231, 217, 176) else outputChatBox( "There was an error in loggining in. There might be no account on that name or you have put wrong password!", source, 231, 217, 176) end elseif mode == "register" then if addAccount( username, password ) then outputChatBox( "You've registered successfully!", source,231,217, 176) else outputChatBox( "There was an error in registering. There might be account on the same name!", source,255,217, 176) end end end) I've registered event at the beggining. What is wrong there? Link to comment
Captain Cody Posted February 14, 2016 Share Posted February 14, 2016 Try adding the server side script before the client side script in the meta file if it is not already. Link to comment
Yazir Posted February 14, 2016 Author Share Posted February 14, 2016 I did that, and that didn't do a thing. Link to comment
Captain Cody Posted February 14, 2016 Share Posted February 14, 2016 function loginMEIN (username,password,mode) if mode == "login" then if logIn( source, username, password ) then outputChatBox( "You've logged in successfully!", source, 231, 217, 176) else outputChatBox( "There was an error in loggining in. There might be no account on that name or you have put wrong password!", source, 231, 217, 176) end elseif mode == "register" then if addAccount( username, password ) then outputChatBox( "You've registered successfully!", source,231,217, 176) else outputChatBox( "There was an error in registering. There might be account on the same name!", source,255,217, 176) end end end addEvent( "sumbitLogin", true ) addEventHandler( "sumbitLogin", rootElement, loginMEIN ) Try that And use [lua] instead of Link to comment
Yazir Posted February 14, 2016 Author Share Posted February 14, 2016 Nope, it doesn't work. I put whole resource here: xxx Nvm. I found the error... I wrote sumbitLogin instead of submitLogin . Damn, I'm too goofy. 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