Jump to content

onPlayerJoin problem


Piorun

Recommended Posts

Hi,

I want to ask you why if i have code:

addEventHandler("onPlayerJoin",root, 
    function() 
        triggerClientEvent(source,"playerJoined",root) 
    end 
) 

Someone who enters first time to server gots an error :

server triggered client side event, but event is not added client side
?
Link to comment

I think he knows about adding the code to the client, it's all in the documentation of:

triggerClientEvent 

The problem however is that the client files haven't been downloaded when onPlayerJoin is triggered server side which means that the client code doesn't exist yet. A better solution would be to use the client sided event:

addEventHandler( "onClientResourceStart", getRootElement( ), 
    function ( startedRes ) 
        -- Client resources has finished downloading here. 
    end 
); 

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