Jump to content

Using default mta login.


Yazir

Recommended Posts

Posted

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?

Posted

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?

Posted

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.

Posted

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?

Posted
  
        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




			
		
Posted

Nope, it doesn't work. I put whole resource here:

xxx

Nvm. I found the error... I wrote sumbitLogin instead of submitLogin xD . Damn, I'm too goofy.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...