Looping and returning multiple values with 1 function
#1

How can I loop files and return each identical value (in 1 string) with 1 function?

Here is my code:
pawn Код:
for(new i; i < MAX_FILES; i++)//Loop my files
{
    if(strcmp(FileInfo[i][Owner], GetName(playerid), true))//if the playerid's name is the files "Owner"
    {
        new biz[50];
        format(biz, sizeof(biz), "%s" FileInfo[i][Name]);
        //Store biz and continue loop to get the rest of the files Names? :S
    }
}
Reply
#2

You would need all the file names of the files in a separate file because you cannot find all the file names in a directory using PAWN. The alternative is to create a plugin that does this for you.
Reply
#3

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
You would need all the file names of the files in a separate file because you cannot find all the file names in a directory using PAWN. The alternative is to create a plugin that does this for you.
Can you please show me an example with the plugin?

Quote:
Originally Posted by [HiC]TheKiller
Посмотреть сообщение
You would need all the file names of the files in a separate file
Then what if there is multiple names? How can I read them all (in one go) from the new file?
Reply
#4

As Killer knows I'm new to sscanf, but would it be possible to store all names in biz and then use sscanf to get the right name or something?
pawn Код:
new biz[500];
        format(biz, sizeof(biz), "%s %s", biz, FileInfo[i][Name]);
Just an idea.
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
If I understand you correctly, you want to store the owner in a file and then find all files owned by a person?
The owner(name) is stored in the file with the name(2nd value) is stored in that file, I want to get all the name/s(2nd values) from the files the owner(name) owns. :/
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)