Posts: 204
Threads: 6
Joined: Oct 2015
Thanks: 23
Given 17 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,628
Threads: 115
Joined: Dec 2011
Thanks: 693
Given 494 thank(s) in 423 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: 23
Given 17 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,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 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: 23
Given 17 thank(s) in 16 post(s)
Zzzzzz playsrName = GetUUID .... But thanks, I will use it