SA-MP Forums Archive
Q Is it possible to do it like this? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Q Is it possible to do it like this? (/showthread.php?tid=84176)



Q Is it possible to do it like this? - Ignas1337 - 29.06.2009

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?


Re: Q Is it possible to do it like this? - Ignas1337 - 29.06.2009

Umm, people is it possible?


Re: Q Is it possible to do it like this? - Ignas1337 - 29.06.2009

ahh, damn... where can i get pawn_lang.pdf?


Re: Q Is it possible to do it like this? - ducati09 - 30.06.2009

Quote:
Originally Posted by Thanatos
ahh, damn... where can i get pawn_lang.pdf?
There ya go buddy

http://forum.sa-mp.com/index.php?topic=139.0


Re: Q Is it possible to do it like this? - Ignas1337 - 30.06.2009

thanks but no thanks ;]


Re: Q Is it possible to do it like this? - [HiC]TheKiller - 30.06.2009

Quote:
Originally Posted by Thanatos
thanks but no thanks ;]
You asked for the pawn_lang.pdf, he gave you a link which has the link to it.


Re: Q Is it possible to do it like this? - Ignas1337 - 30.06.2009

I said thanks for his link and no thaks cuz I found it, so... whatever ;P