Paradox Posted January 21, 2012 Share Posted January 21, 2012 Hey guys. So I want that when a player joins a server his camera starts moving. I made the script for a moving camera, but how to make that when a player joins the server for the first time, the client side event is triggered? Link to comment
Kenix Posted January 21, 2012 Share Posted January 21, 2012 Player connect -> downloading -> can use client side scripts.( If player downloading you can't use client side scripts ) You need if player downloading move camera? Link to comment
Paradox Posted January 21, 2012 Author Share Posted January 21, 2012 No. I need when a player joins and he downloads all the necessary files, the camera starts moving. Link to comment
Kenix Posted January 21, 2012 Share Posted January 21, 2012 Example -- server side addEvent ( "onStopMoveCamera",true ) local tCamera = { } local tPos = { } local function moveCamera( source ) tPos[ source ]["x"] = tPos[ source ]["x"] + 1 if tPos[ source ]["x"] > 50 then tPos[ source ]["x"] = 0 end setCameraMatrix( source,tPos[ source ]["x"],tPos[ source ]["y"],tPos[ source ]["z"] ) end addEventHandler( "onPlayerJoin",root, function( ) tPos[ source ] = { } tPos[ source ]["x"] = 0 tPos[ source ]["y"] = 0 tPos[ source ]["z"] = 0 tCamera[ source ] = setTimer( moveCamera,50,0,source ) end ) addEventHandler( "onStopMoveCamera",root, function( ) if isTimer( tCamera[ source ] ) then killTimer( tCamera[ source ] ) end end ) addEventHandler( "onPlayerQuit",root, function( ) if isTimer( tCamera[ source ] ) then killTimer( tCamera[ source ] ) end tCamera[ source ] = nil tPos[ source ] = nil end ) -- client side triggerServerEvent( "onStopMoveCamera",localPlayer ) You need if player downloading move camera? I need when a player joins and he downloads all the necessary files, the camera starts moving. LOL P.S Update code Link to comment
Paradox Posted January 21, 2012 Author Share Posted January 21, 2012 I forgot the timers. Thanks for reminding me about the timer. 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