Raised This Month: $ Target: $400
 0% 

[Solved] Ask about 'ArrayCreate'


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
UchihaMadara
Junior Member
Join Date: Jun 2014
Location: The South
Old 12-01-2014 , 08:56   [Solved] Ask about 'ArrayCreate'
Reply With Quote #1

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?

Last edited by UchihaMadara; 12-01-2014 at 18:22.
UchihaMadara is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-01-2014 , 09:06   Re: Ask about 'ArrayCreate'
Reply With Quote #2

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.
__________________

Last edited by HamletEagle; 12-01-2014 at 09:06.
HamletEagle is offline
UchihaMadara
Junior Member
Join Date: Jun 2014
Location: The South
Old 12-01-2014 , 09:09   Re: Ask about 'ArrayCreate'
Reply With Quote #3

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)
... 

Last edited by UchihaMadara; 12-01-2014 at 09:10.
UchihaMadara is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-01-2014 , 09:11   Re: Ask about 'ArrayCreate'
Reply With Quote #4

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
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 12-01-2014 , 13:44   Re: Ask about 'ArrayCreate'
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
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.
.Dare Devil. is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-01-2014 , 14:24   Re: Ask about 'ArrayCreate'
Reply With Quote #6

Quote:
Originally Posted by .Dare Devil. View Post
how many bytes does one array take? 12, 14?
Depends on how many entries are stored within them
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-01-2014 , 10:03   Re: Ask about 'ArrayCreate'
Reply With Quote #7

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)
__________________

Last edited by HamletEagle; 12-01-2014 at 10:03.
HamletEagle is offline
UchihaMadara
Junior Member
Join Date: Jun 2014
Location: The South
Old 12-01-2014 , 18:22   Re: Ask about 'ArrayCreate'
Reply With Quote #8

got it
UchihaMadara is offline
Reply


Thread Tools
Display Modes

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 15:31.


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