Array size
#1

Suppose I have this -
pawn Код:
enum _pINFO
{
   var
}
new PlayerInfo[MAX_PLAYERS][_pINFO];


stock _function( variable )
{
    new counter;
    for(.. 'i' loop through all the players )
    {
         if( PlayerInfo[i][var] == variable ) counter ++;
         else continue;
     }
}
And now I want to do this-
pawn Код:
online_ = _function( 1 );
new array[online];
But that won't work right?
So is there a way to do this? Dynamically allocate memory? Runtime?
Reply
#2

You could make a plugin for dynamic memory, or use an existing one.

There may be other libs that allow something similar, y_malloc maybe - although iv never used that so don't know what is does for sure. Name suggests its for allocating memory though.

But as for dynamically assigning sizes to arrays at runtime - can't be done.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)