Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 0
Given 1 thank(s) in 16 post(s)
Hello, my first question here.
How can I set and get random per-player (cPlayer) data. I want to use it eg to store current effects of a player (when overriding them) or a position or something. A bit like just a random space to save data tied to a player
Maybe there is an obvious solution, but thanks, anyway
Posts: 4,621
Threads: 113
Joined: Dec 2011
Thanks: 51
Given 55 thank(s) in 409 post(s)
Perhaps you can open a player's json file to add/change stuff. Every player has one in the players folder. Since we just got a JSON serializer and deserializer it shouldn't be too hard.
Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 0
Given 1 thank(s) in 16 post(s)
I would prefer writing a separate file for each player, but how to store any data just in memory? (and accessing it, with the corresponding cPlayer object)
Posts: 6,486
Threads: 176
Joined: Jan 2012
Thanks: 40
Given 156 thank(s) in 838 post(s)
Rather than addressing by playername, you should address by UUID, other than that, this is most likely the best approach so far. Also, it allows you to serialize the data to a DB when you decide to make it permanent at a later point in the development.
Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 0
Given 1 thank(s) in 16 post(s)
Zzzzzz playsrName = GetUUID .... But thanks, I will use it