[help] cellarray.inc
Hello again.
Now i need help with cellarray.inc. :crab: I want to store data (like id, key=> value) in array and easy access to it. But i wasted a lot of time trying to do it myself. I need to create array for each player like this to retrieve data ("key" and "value") Code:
player_id => array(Basically i want to store for each player id their settings on connect in array like: nvg color, language, hat and etc. data which is loading from DB and i don't want to create a lot of arrays for this (data can be dynamic, like some player have "nvg" key, another don't) |
Re: [help] cellarray.inc
You need to look at celltrie.inc for this.
CellArrays only use integer keys like normal arrays, but CellTries use string keys. The problem with CellTries is that you can't iterate through all of the keys, so a combination of both would be needed. |
Re: [help] cellarray.inc
Quote:
|
Re: [help] cellarray.inc
It looks like, to me, that he needs an array of Tries (one Trie for each player).
Depending on your actual implementation it's possible that you could just use an Enum/data structure and an array (probably best if your list of keys is not too many). Something like this: PHP Code:
If he uses Tries I don't think he would need to traverse it from his explaination. |
Re: [help] cellarray.inc
Ok, i'll try both methods later and post the result. Thanks for help. :)
|
Re: [help] cellarray.inc
Solved!
Thanks to all. Some code example: Code:
public parse_cfg(id,settings[]) { |
| All times are GMT -4. The time now is 11:21. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.