How to set dynamic array size
Hello guys, I recently started reading about arrays and how to sort integers etc.
Anyway, I have a stored data file with a list of clients, and I'm trying to set the array count to the numbers in the list. Then I will sort these clients in a Descending way with certain value. PHP Code:
Quote:
|
Re: How to set dynamic array size
https://wiki.alliedmods.net/Introduc...awn_1.7#Arrays
PHP Code:
|
Re: How to set dynamic array size
Should probably use an ArrayList for this
|
Re: How to set dynamic array size
I have mental block now, just to clear my point I will list the callback function here
PHP Code:
So this part would be dunno something like this PHP Code:
|
Re: How to set dynamic array size
A struct would probably be better suited for this, various datatype entries, no size limit, then you can store the struct inside an ArrayList and read/update as you need. Are you updating points to a KV file? The more entries you have the slower it'll be, suggest using a database instead. There are plenty of plugins already existing with various point style systems, suggest looking at those. KV system is slow for something like this where it's constantly being read/written to.
|
Re: How to set dynamic array size
Awww I see, you are right
Thanks Silvers I will take a look then |
Re: How to set dynamic array size
2 Attachment(s)
This is continue of that KeyValue thing.
If your rank system is same as in previous topic How to loop steamid while using keyvalues PHP Code:
Spoiler
And in l4d2_rank_system.txt file have data of players scores in KeyValue. But have to say this is like pain in ass using KeyValues. One mistake in code can lead easily to data loss. Another way is using SMC parse to look those KeyValue data from file. But like @Silvers mentioned already, use SQL. SourceMod local sqlite. You can expand more features with tables. But make first simple rank system without Database or else storage save, use global variable (array) to keep scores update. - And then, you update scores every round_end into Database or else. Main idea is handle scores in global variables, it is much faster. |
Re: How to set dynamic array size
Thank you Bacardi, that makes sense now, and it worked as expected :up:
I was trying something out to sort arrays in general but damn I was totally lost smh, I kinda got it now, and its good as a reference for me. Quote:
I still never dealt with SQL yet. Already reading about it, but still kinda complicated for me, hopefully will be upgrading it later |
| All times are GMT -4. The time now is 00:58. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.