PDA

View Full Version : Reading files


thefatshizms
22/11/2012, 07:08 PM
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:
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?

Vince
22/11/2012, 07:33 PM
Click here for all your string splitting needs. (http://forum.sa-mp.com/showthread.php?t=120356)
Mind telling on what page you found that? I ought to remove that immediately.

thefatshizms
22/11/2012, 07:34 PM
Click here for all your string splitting needs. (http://forum.sa-mp.com/showthread.php?t=120356)
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: http://wiki.sa-mp.com/wiki/File_Functions

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