Amount of items in an array.
#5

Quote:
Originally Posted by RajatPawar
Посмотреть сообщение
pawn Код:
new arr[][] =
    {
        {1, 2, 3, 4},
        {3, 4, 6, 6}
    };
   
    printf("%d %d", sizeof(arr), sizeof(arr[]));
Gave me results as 2 & 4.
Why didn't it work with yours?
Probably because I do this all in a very different way, I use enums as well but I just couldn't think of the right terms when posting this topic.

I usually make an enum like this:
PHP код:
enum _VehicleData
{
    
vID,
    
vOwner[128],
    
vLocation[128],
    
    
vModel,
    
Float:vPosX,
    
Float:vPosY,
    
Float:vPosZ,
    
Float:vPosAngle,
    
vColor1,
    
vColor2,
    
    
vPrice,
    
vDefaultPrice,
    
vForSale,
    
    
Text3D:vText,
    
curVehID,
}; 
And then use this:
PHP код:
new VehicleData[MAX_VEHICLES][_VehicleData]; 
Whereas the items for this array get loaded with a MySQL query when the server starts.
Reply


Messages In This Thread
Amount of items in an array. - by Jimmy0wns - 18.06.2015, 08:47
Re: Amount of items in an array. - by Darrenr - 18.06.2015, 10:52
Re: Amount of items in an array. - by Jimmy0wns - 18.06.2015, 11:10
Re: Amount of items in an array. - by RajatPawar - 18.06.2015, 11:43
Re: Amount of items in an array. - by Jimmy0wns - 18.06.2015, 11:45
Re: Amount of items in an array. - by Jimmy0wns - 18.06.2015, 12:06

Forum Jump:


Users browsing this thread: 3 Guest(s)