Quote:
Originally Posted by Black Rose
How to store and access your data. This is one of the first things you consider because it is the most central function of a plugin.
It's not worth using a static array for something like this. You only create limitations and the speed is really nothing to talk about.
One dynamic array (array) that contains all the information about the skins (unique id, model, name, w/e...).
One dynamic array (integer) for each player containing the unique id of all the skins they own.
ArraySize() will replace iPlayerSkinsCount.
The problem here is how to make a unique id for each skin so if one skin is removed from the server it won't corrupt the whole array and shift all of the skins.
That problem could be solved by storing all of the information of the skin in each player array, but that's just bad practice and will increase the data size of each player, both online and offline.
The simple solution would be to store a separate vault containing a unique identifier of a skin (a model name?) and connect that to a unique id. That way there's no possibility for corruption. Load it when the plugin loads the skins and give all the skins an unique id. If they don't have a unique id because they are new, give them one.
|
you're right, thanks for this, i will try it!
What is the best way to create a unique id for each one skin ?
Quote:
|
One dynamic array (integer) for each player containing the unique id of all the skins they own.
|
How to make it ?
I have a problem whean im storing a skin data on
plugin_precache
when i put this *testing*
PHP Code:
ArrayPushCell(g_aSkins, *SKIN UNIQUE ID*)
the plugin giveme one error
Code:
invalid array handle provided (0)
i initialize the array like this
PHP Code:
g_aSkins = ArrayCreate( 1 )
what is this error ?