Ziemys Posted January 9, 2010 Share Posted January 9, 2010 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
Ziemys Posted January 9, 2010 Author Share Posted January 9, 2010 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
Gamesnert Posted January 9, 2010 Share Posted January 9, 2010 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
Gamesnert Posted January 9, 2010 Share Posted January 9, 2010 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
Ziemys Posted January 10, 2010 Author Share Posted January 10, 2010 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
Ziemys Posted January 10, 2010 Author Share Posted January 10, 2010 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
robhol Posted January 10, 2010 Share Posted January 10, 2010 There's a reason you need a password for that function, you know. And I meant NEED. Link to comment
robhol Posted January 10, 2010 Share Posted January 10, 2010 There's a reason you need a password for that function, you know. And I meant NEED. 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