Raised This Month: $ Target: $400
 0% 

Array VS Multiple Array


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-17-2021 , 22:03   Re: Array VS Multiple Array
Reply With Quote #2

I think there is ArrayPushArray and ArrayGetArray act like nested arrays for AMXX. (I have never messing around with it though)
Something like this

PHP Code:
enum _:wpn_data
{
    
W_Name[50],
    
W_Type,
    
W_Cost
}

new Array:
g_Weapon
new g_WeaponCount

public plugin_precache()
{
    
g_Weapon ArrayCreate(wpn_data)
}

public 
RegisterWeapon(const Name[], typecost)
{
    new 
g_Data[wpn_data]

    
copy(g_Data[W_Name], charsmax(g_Data), Name)
    
g_Data[W_Type] = type;
    
g_Data[W_Cost] = cost

    ArrayPushArray
(g_Weapong_Data//Push it all into g_Weapon (so it is only 1 Array)

    
g_WeaponCount++
    return 
g_WeaponCont //Give out WeaponID
}

public 
Native_Get_Weapon_Info(weaponid, const info[])
{
    new 
g_Data[wpn_data]

    
ArrayGetArray(g_Weaponweaponidg_Data)
    
    
//Now we got all data we need in g_Data
    //I forget how to push it to Info parameter to retrieve it other plugins :P

But usually, I would prefer only getting what I need (for example: classname) via 1 Array since I am not sure how costly it is if getting a lot of it when getting all of class data at once and then never use the remaining data.

But hey, I haven't use it before so I might being bs here
__________________
My plugin:
Celena Luna 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 02:31.


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