Author Topic: About playersAll and playersOnline  (Read 2064 times)

Dechcaudron

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
About playersAll and playersOnline
« on: June 16, 2014, 06:19:42 PM »
Hi again GCC!

Hope you guys are doing awesome, as always. The thing is, I want not only to extend your defined Player class, but also to store that information in the DB and load it onto memory. I created a new table in the DB with the id and username columns shared with the players table, but also adding columns for the info I need to store as well. Every time the server starts, it stores into a dictionary called all_mygame_players all the players defined in that table, and every time a player gets online,  stores into online_mygame_players the player that just got online. So far so good. The problem comes when a new user registers: is there a way to trigger registration events? That way I'd know when to launch a query to the database to load a new player into all_mygame_players without relaunching the server.

Also, I am aware having two separate tables for the same players, one defined by you guys, and other by me, might not be the best way to deal with things. Is there any way I can extend the functionality of the automatic registration handler? Adding custom columns to the player table would not do it, since your automatic system, I assume, simply loads from the server id, password and username of the players into Player instances, so I would have to perform a query again to the DB to get the additional info into PlayerExtension instances, which thing would present the same problem upon new registrations: no updates.

Can you help me on this? Thanks beforehand!  :D
Dechcaudron

Dechcaudron

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: About playersAll and playersOnline
« Reply #1 on: June 17, 2014, 11:05:53 AM »
Nevermind guys! Your demo on the server solved my question :D

GCC is so fast, it answers before you even ask
Dechcaudron

AMarinov

  • Global Moderator
  • Newbie
  • *****
  • Posts: 17
    • View Profile
Re: About playersAll and playersOnline
« Reply #2 on: June 17, 2014, 11:34:00 AM »
Hi Dechcaudron,
Yes, at this stage you can check for new registrations inside the PlayerConnected event handler.
There definitely will be more events related to players data, and a more generic and flexible approach to extending player information.

Regards,
Atanas