Object manipulation disscusion -
Gigi-The-Beast - 11.12.2013
Hey guys, I just need a sugestion about the easiest way.
I plan to add a system to my gamemode that will allow players to create objects ingame (something similar to a mini object editor).
The system should save all object variables in mysql database, destroy the player objects when players logout and recreate them again.
So the sugestion that I need is the easiest way to store objects variables.
Should I make it like this:
#define MAX_CREATE_OBJECTS 10000
enum test
{
ID,
Model,
X,
Y,
.
.
.
rotZ
}
new Objects[MAX_CREATE_OBJECTS][test];
This way I would have easier object manipulation but the problem would be with the rise of objects number, but the downside is
that the objects are not binded directly to players so I would need to make functions to find object of a particular player.
I should note that the players have also a limit of how much objects they can create, per player (limit is 100).
The other method that came to my mind is to bind the objects directy to players instead of doing it in the global way, but
with this method I am unable to use an enum so all variables should be separated:
#define MAX_PLAYER_OBJECTS 100
new objectID[MAX_PLAYERS][MAX_PLAYER_OBJECTS];
new objectModel[MAX_PLAYERS][MAX_PLAYER_OBJECTS];
.
.
.
This way the pros are that the object could be directly used from the playerid as it is a "player object" but the negative is that
I am unable to organize all objects variables in a enum.
Another method would be to use the container plugin, this way the first method would be more dynamic, as the container would
grow or shrink depending on amount of created objects, so there would be no need for #define MAX_CREATE_OBJECTS 10000.
Or should I use the second method and make it a 3 dimension array so I could use enum at the end?
Do you have a easier solution? I can't quite see how could I make this easier to script.