Jump to content

onPlayerJoin acting too quickly?


LonelyRoad

Recommended Posts

I am trying to make a login system, but when the player first connects to the server and downloads all the resources - it seems to be the case that either this doesn't work at all, or goes too quickly and nothing happens on the client:

function showLogin() 
    triggerClientEvent(source, "showLoginWindow", source) 
end 
addEventHandler("onPlayerJoin", getRootElement(), showLogin) 

Here is the client of the event: showLoginWindow

function playerConnect() 
    showPlayerHudComponent("all", false) 
    setAmbientSoundEnabled( "gunfire", false ) 
    clearChat() 
    setElementDimension(getLocalPlayer(), 9999) 
    setElementInterior(getLocalPlayer(), 0) 
    setCameraMatrix( 2149.0729980469, 1901.8781738281, 15, 1381.1181640625, 1904.9548339844, 200) 
    fadeCamera(true) 
    connect_openLoginWindow() 
end 
addEvent("showLoginWindow", true) 
addEventHandler("showLoginWindow", getRootElement(), playerConnect) 

And connect_openLoginWindow() is supposed to be the thing that actually draws the login GUI - I am not sure at what step it fails, but if the player reconnects everything functions as it should do (ie. all the functions get called and the GUI shows up as anticipated).

Any ideas please?

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