Q Is it possible to do it like this?
#1

Well i've been thinking that an array which does not posses enum as a its size can be done very nicely with a loop by doing (for example for palyer stat)
pInfo[playerid][i] = /*get a value which has an index and is a part of a string, using strtok function f.e.*/
now the question is can I still process an array (multi or single dimensional) which had enum using values to represent parts of it? example:
pawn Код:
// in code where I need it
#define MAX_STATS 3
enum stats
{
    Name,
    Password,
    Money
}

new pInfo[MAX_PLAYERS][stats];

for(new i = 0; i < MAX_STATS; i++)
{
        // this code was taken from moderntopia script
        new Data[1024];
        new Field[64];
        new rcnt = 1;
        MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);
        samp_mysql_strtok(Field, "|", Data);
        while (samp_mysql_strtok(Field, "|", "")==1)
        {
            pInfo[playerid][rcnt] = strval(Field);
            rcnt++;
        }
        samp_mysql_free_result();
    }
}
i cut this part from moderntopia script and removed what wasn't needed. I want to know whether the while could be done this way. and if it cannot is there any other way without enum to define values of an array?
Reply


Messages In This Thread
Q Is it possible to do it like this? - by Ignas1337 - 29.06.2009, 12:37
Re: Q Is it possible to do it like this? - by Ignas1337 - 29.06.2009, 14:02
Re: Q Is it possible to do it like this? - by Ignas1337 - 29.06.2009, 14:42
Re: Q Is it possible to do it like this? - by ducati09 - 30.06.2009, 02:02
Re: Q Is it possible to do it like this? - by Ignas1337 - 30.06.2009, 06:02
Re: Q Is it possible to do it like this? - by [HiC]TheKiller - 30.06.2009, 07:52
Re: Q Is it possible to do it like this? - by Ignas1337 - 30.06.2009, 08:11

Forum Jump:


Users browsing this thread: 3 Guest(s)