AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Ask about 'ArrayCreate' (https://forums.alliedmods.net/showthread.php?t=252368)

UchihaMadara 12-01-2014 08:56

[Solved] Ask about 'ArrayCreate'
 
i'm developing a weapon system which supports a lot of attributes to modify a weapon.
My question is: What if i create too many Arrays by using 'ArrayCreate' ? Could the server start ? How many Arrays are allowed to be created?

HamletEagle 12-01-2014 09:06

Re: Ask about 'ArrayCreate'
 
You should explain better what are you trying to do, because your question shows that you may need a beter logic into your plugin. Give us your code or explain what atributes you have and where you would use them, and how.

You may use ArrayPushArray to store multiple datas in the same array, but if you are going to save this atributes for more weapons you should use a trie where you would use as key the weapon name.

UchihaMadara 12-01-2014 09:09

Re: Ask about 'ArrayCreate'
 
Like this. My System is to add weapons by writing file ini instead of writing sma for each weapon.
Actually. I developed it 99% completed. i just want to know if there will be problems if creating too many arrays

PHP Code:

public plugin_precache()
{
    
WeaponName ArrayCreate(321)
    
WeaponCodeName ArrayCreate(321)
    
WeaponType ArrayCreate(11)
    
WeaponSubType ArrayCreate(11)
    
WeaponPrice ArrayCreate(11)
    
WeaponLevel ArrayCreate(11)
    
WeaponBasedOn ArrayCreate(11)
    
WeaponModelV ArrayCreate(641)
    
WeaponModelP ArrayCreate(641)
    
WeaponModelW ArrayCreate(641)
    
WeaponSubModelP ArrayCreate(11)
    
WeaponSubModelW ArrayCreate(11)
    
WeaponFireSound ArrayCreate(641)
    
WeaponDamage ArrayCreate(11)
    
WeaponWSpeed ArrayCreate(11)
    
WeaponPSpeed ArrayCreate(11)
    
WeaponAccuracy ArrayCreate(11)
    
WeaponRecoil ArrayCreate(11)
    
WeaponClip ArrayCreate(11)
    
WeaponBPAmmo ArrayCreate(11)
    
WeaponZoom ArrayCreate(11)
    
WeaponStunPower ArrayCreate(11)
    
WeaponKnockbackPower ArrayCreate(11)
    
WeaponMeleeRange ArrayCreate(11)
    
WeaponAnimDraw ArrayCreate(11)
    
WeaponAnimShoot ArrayCreate(11)
    
WeaponAnimReload ArrayCreate(11)
    
WeaponTimeDraw ArrayCreate(11)
    
WeaponTimeReload ArrayCreate(11)
    
WeaponAnimExt ArrayCreate(161)
    
WeaponSpecial ArrayCreate(11)
    
WeaponRMPE ArrayCreate(11)
    
WeaponRMPF ArrayCreate(11)
... 


YamiKaitou 12-01-2014 09:11

Re: Ask about 'ArrayCreate'
 
Other than memory usage, there should be no problems. But if you need to create that many CellArrays, then I think you need to redesign your plugin

HamletEagle 12-01-2014 10:03

Re: Ask about 'ArrayCreate'
 
WOW, this is totally crap. Use something like this instead.

Code:
enum _: someData {     weaponCodeName[ 32]     weaponType     weaponRecoil } new data[ someData ]

And use tries, I don't know exactly what you want to do, but it seems to be a better option.
TrieSetArray(trie, "weapon_name", data, sizeof data)
TrieGetArray(trie, "weapon_name", data, sizeof data)

.Dare Devil. 12-01-2014 13:44

Re: Ask about 'ArrayCreate'
 
Quote:

Originally Posted by YamiKaitou (Post 2230086)
Other than memory usage, there should be no problems. But if you need to create that many CellArrays, then I think you need to redesign your plugin

how many bytes does one array take? 12, 14?


------------
There will be no problem using many arrays, use as much as you wish.

YamiKaitou 12-01-2014 14:24

Re: Ask about 'ArrayCreate'
 
Quote:

Originally Posted by .Dare Devil. (Post 2230177)
how many bytes does one array take? 12, 14?

Depends on how many entries are stored within them

UchihaMadara 12-01-2014 18:22

Re: Ask about 'ArrayCreate'
 
got it


All times are GMT -4. The time now is 15:31.

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