Jump to content

/login


[DMC]

Recommended Posts

I had an question on how to disable /login

and make my own login code

and yes i know from wiki but i wanna cancel the mta /login event

function loginPlayer ( thePlayer, command, username, password ) 
    local account = getAccount ( username, password ) -- Return the account 
        if ( account ~= false ) then -- If the account exists. 
            logIn ( thePlayer, account, password ) -- Log them in. 
        else 
            outputChatBox ( "Wrong username or password!", thePlayer, 255, 255, 0 ) 
        end 
end 
addCommandHandler ( "login", loginPlayer ) 

or

is it possible to

example

my name is dmc and i wanna login to sss it says, error you cant login to a other name

so it needs to be dmc,

if this is possible without the above stuff please help, tell me :mrgreen:

Link to comment

onPlayerLogin should have an argument with account element or account name.. just compare it to source name. if different - cancel event.

6-8 lines of script.

anyway players can change their nick after login, until you block it too of course so what is the point? and even if you block changing nick - they can disconnect, change, get back

Link to comment
anyway players can change their nick after login, until you block it too of course so what is the point? and even if you block changing nick - they can disconnect, change, get back

but they can't join with his/her account ;) so they have to disconnect, change and return with loggeable nick ;)

Link to comment

this is what i got

function loginPlayer ( thePlayer, command, username, password ) 
    local account = getAccount ( username, password ) 
        if ( account ~= false ) then 
        name = getPlayerName(thePlayer) 
         if getAccountName(account) == name then 
            logIn ( thePlayer, account, password ) 
            outputChatBox ( "Welcome", thePlayer, 255, 255, 0 ) 
        else 
             outputChatBox ( "ERROR: Your Username or Password is invalid", thePlayer, 255, 255, 0 ) 
    end 
        else 
        cancelEvent() 
        outputChatBox("ERROR: You can't login to this name",thePlayer,255,0,0) 
    end 
end 
addCommandHandler ( "login", loginPlayer  
  

Link to comment

this?

function loginPlayer ( thePlayer, command, username, password ) 
    local account = getAccount ( username, password ) 
        if ( account ~= false ) then 
        name = getPlayerName(thePlayer) 
         if getAccountName(account) == name then 
            logIn ( thePlayer, account, password ) 
            outputChatBox ( "Welcome", thePlayer, 255, 255, 0 ) 
        else 
             outputChatBox ( "ERROR: Your Username or Password is invalid", thePlayer, 255, 255, 0 ) 
    end 
        else 
        cancelEvent() 
        outputChatBox("ERROR: You can't login to this name",thePlayer,255,0,0) 
    end 
end 
addEventHandler( "onPlayerLogin", rootElement, loginPlayer ) 

Link to comment
  
function loginPlayer (prev,curr,auto) 
  local accname = getAccountName(curr) 
  local plname = getPlayerName(source) 
  if (accname~=plname) then 
    outputChatBox("You can't login to this account.", source) 
    cancelEvent() 
  end 
end 
addEventHandler("onPlayerLogin", rootElement, loginPlayer) 
  

Link to comment

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...