Raised This Month: $ Target: $400
 0% 

Solved is in array ?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
leonardo121
Member
Join Date: Sep 2013
Old 07-27-2017 , 09:18   Re: is in array ?
Reply With Quote #6

Quote:
Originally Posted by Black Rose View Post
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
what is this error ?
leonardo121 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode