Jump to content

Triggering an client side event when a player joins


Paradox

Recommended Posts

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

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