Reading files
#1

Ok, I'm trying to learn how to use the sa-mp file functions. Ive gotten stuck on reading the file and assigning the correct ammount of score etc like any loading system would do.

I went on the wiki and came across this:
pawn Код:
GetVal(numb, str[]) {
    new tmp[256], idx;
    for(new i=0; i<numb; i++) {
        tmp=strtok(str, idx);
    }
    return strval(tmp);
}
I dont understand it and this is what they use to load the stats out of the file, could someone please explain it to me?
Reply
#2

Click here for all your string splitting needs.
Mind telling on what page you found that? I ought to remove that immediately.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Click here for all your string splitting needs.
Mind telling on what page you found that? I ought to remove that immediately.
Thanks How would i use sscanf to split the strings?

And here is where i found it: https://sampwiki.blast.hk/wiki/File_Functions

EDIT: I have tried it like this:
pawn Код:
sscanf(file, "e<ii>", PlayerInfo[playerid][G_pdata]);
But i get a tag mismatch
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)