Jump to content

Problems with loging in.


Ziemys

Recommended Posts

Hi, everyone. So I have one problem, I want to spawn player and start the game when he logs in, but I don't know how.

I've tried to do that in this way, but it don't works.

function loggingIn ( source )
 
local logedIn = logIn ( source, getPlayerName(source), password )
if ( logedIn ) then
spawnPlayer(source,15,123,154)
outputChatBox ("Welcome to my server.", source)
fadeCamera (source, true)
	setCameraTarge (source, source)
else
outputChatBox ("Please login.", source)
end
end
addEventHandler ( "onPlayerJoin", getRootElement(), loggingIn )

Link to comment

Hi, everyone. So I have one problem, I want to spawn player and start the game when he logs in, but I don't know how.

I've tried to do that in this way, but it don't works.

function loggingIn ( source )
 
local logedIn = logIn ( source, getPlayerName(source), password )
if ( logedIn ) then
spawnPlayer(source,15,123,154)
outputChatBox ("Welcome to my server.", source)
fadeCamera (source, true)
	setCameraTarge (source, source)
else
outputChatBox ("Please login.", source)
end
end
addEventHandler ( "onPlayerJoin", getRootElement(), loggingIn )

Link to comment
local logedIn = logIn ( source, getPlayerName(source), password )

What is "password" here? It doesn't appear to be defined at all.

function loggingIn ( source )

NEVER specify source yourself! MTA will use this in the case of events, however doing as you did in the above line likely overrides it. Therefore, it should be:

function loggingIn ( )

Link to comment

local logedIn = logIn ( source, getPlayerName(source), password )

What is "password" here? It doesn't appear to be defined at all.

function loggingIn ( source )

NEVER specify source yourself! MTA will use this in the case of events, however doing as you did in the above line likely overrides it. Therefore, it should be:

function loggingIn ( )

Link to comment

Thanks for help, but it doesn't work. :?

If I do it like this and type /check when I'm loged in and loged out, the effect is the same, server prints "Please login." in chat box.

function loggingIn ( )
 
local logedIn = logIn ( source, getPlayerName(source) )
if ( logedIn ) then
spawnPlayer(source,15,123,154)
outputChatBox ("Welcome to my server.", source)
fadeCamera (source, true)
	setCameraTarge (source, source)
else
outputChatBox ("Please login.", source)
end
end
addCommandHandler ( "check", loggingIn )

Link to comment

Thanks for help, but it doesn't work. :?

If I do it like this and type /check when I'm loged in and loged out, the effect is the same, server prints "Please login." in chat box.

function loggingIn ( )
 
local logedIn = logIn ( source, getPlayerName(source) )
if ( logedIn ) then
spawnPlayer(source,15,123,154)
outputChatBox ("Welcome to my server.", source)
fadeCamera (source, true)
	setCameraTarge (source, source)
else
outputChatBox ("Please login.", source)
end
end
addCommandHandler ( "check", loggingIn )

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