tinnetju Posted August 1, 2010 Share Posted August 1, 2010 So, i need help with my join script. If a player joins he sees a nice hotel, and some information in the chatbox. And if you log in, you go to the pirateship if this is the first time you visit the server or spawn where you quited your last visit. Buy everytime i start/restart a script, you get back to the hotel vieuw! And every 80+/- sec you automatically see the hotel vieuw! Can someone please help me? addEventHandler( "onClientResourceStart", getRootElement(), function(startedRes) OnPlayerJoinToServer(getLocalPlayer()) -- use the local player as first parameter end ); function OnPlayerJoinToServer(theplayer) local player = theplayer or source outputChatBox ( "Welcome to the FOBI RPG/Freeroam server!", getRootElement(), 0, 0, 255 ) outputChatBox ( "In FOBI you have to register with /register [Password] and /login [Password]", getRootElement(), 0, 0, 255 ) outputChatBox ( "But be careful! Always use the same name! Otherwise the server wont recognize you!", getRootElement(), 0, 0, 255 ) outputChatBox ( "You are now ready to join the server. Play fair, be nice and have fun!", getRootElement(), 0, 0, 255 ) fadeCamera(true) setCameraTarget(getLocalPlayer()) setCameraMatrix(2051.3527832031, 1343.1384277344, 19.391807556152, 1981.9815673828, 1343.0343017578, 12.447468757629) -- end addEventHandler("onClientPlayerJoin", getRootElement(), OnPlayerJoinToServer) Link to comment
dzek (varez) Posted August 2, 2010 Share Posted August 2, 2010 onClientPlayerJoin will never fire for local player you didnt get idea how to make it.. addEventHandler( "onClientResourceStart", getRootElement(), function(startedRes) if (startedRes == getResourceRootElement()) then -- only if THIS resource starts (not any resource) OnPlayerJoinToServer() end end ) function OnPlayerJoinToServer() outputChatBox ( "Welcome to the FOBI RPG/Freeroam server!", getRootElement(), 0, 0, 255 ) outputChatBox ( "In FOBI you have to register with /register [Password] and /login [Password]", getRootElement(), 0, 0, 255 ) outputChatBox ( "But be careful! Always use the same name! Otherwise the server wont recognize you!", getRootElement(), 0, 0, 255 ) outputChatBox ( "You are now ready to join the server. Play fair, be nice and have fun!", getRootElement(), 0, 0, 255 ) fadeCamera(true) setCameraTarget(getLocalPlayer()) setCameraMatrix(2051.3527832031, 1343.1384277344, 19.391807556152, 1981.9815673828, 1343.0343017578, 12.447468757629) -- end and it will output that text and show hotel every restart. why you want to restart it over and over? for testing you should use local server i think .. 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