on connection routine to be local user based

  • I have a on connection routine that tells you some status items about your gameplay but in testing I see that on connection is not a local event. It is a global event. That is if two people log on at relatively the same time the last guy that logs on sees his status ok but the first one loggin on sees the latter as the variable playername obviously becomes updated prior to the delayed output of this data. I delayed it because if you took a few seconds to log / come into game fully then you would not see the data at all.


    So I am asking if I can write this information to the client then delay its output? That way two people logging on a close time can see their own data.

  • What do you mean with "local" and "global" event? If you're using the PlayerConnectEvent: It's triggered every time a player joins the server. The player object that can be retrieved from the event is always the player who triggered this event (i.e. the player who established the connection to the server).
    If you want to send messages to the player, the PlayerConnectEvent isn't very suitable for that, since the player still sees the loading screen at that time and probably won't see the message at all. Instead, you can use the PlayerSpawnEvent, which is called when the loading process is completed (i.e. when the player actually spawns on the server), so there is no artificial delay needed if you want to send a message to the player ;)

  • What do you mean with "local" and "global" event? If you're using the PlayerConnectEvent: It's triggered every time a player joins the server. The player object that can be retrieved from the event is always the player who triggered this event (i.e. the player who established the connection to the server).
    If you want to send messages to the player, the PlayerConnectEvent isn't very suitable for that, since the player still sees the loading screen at that time and probably won't see the message at all. Instead, you can use the PlayerSpawnEvent, which is called when the loading process is completed (i.e. when the player actually spawns on the server), so there is no artificial delay needed if you want to send a message to the player ;)

    Thanks will change it and use that. That one of the problems with testing things alone you don't see these things in testing. Also not having the knowledge of the innerworkings like you do.. lol. Thanks I assume the same API for Player events applies.


    Local was to the player.. Global is relative to what the server is seeing. To me a global event was the server is tracking the variable do it changed as two players logged in the variable was update with the last player who logged in. I think the playerspawnevent might be more individualized.. I was trying to come up with another way of storing the different connection events in an array but that I guess would have been silly.



    Hmm.. will it trigger everytime they spawn? Even after they die or sleep?

  • Hmm.. will it trigger everytime they spawn? Even after they die or sleep?

    After you sleep you don't spawn you just exit sleeping mode see PlayerSleepEvent


    After you die you don't spawn but you RE-spawn see PlayerRespawnEvent :)

  • After you sleep you don't spawn you just exit sleeping mode see PlayerSleepEvent
    After you die you don't spawn but you RE-spawn see PlayerRespawnEvent :)

    Picky Picky || thanks


    any good GUI tutorials. I think I figured out the buttons thing but need some pass back to main class thingies..

  • hmmm no there isn't really a tutorial but I can post some code snippets of how I do GUIs in the game, I like simple so my approach is very simple to follow :)


    So first you need to create your panel and a label e.g.

    Then you need to instance your panel, add to the player as an attribute and add it to their Gui

    Then I create my show/hide method to display the panel and label


Participate now!

Don’t have an account yet? Create a new account now and be part of our community!