Reading files - 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)
+--- Thread: Reading files (
/showthread.php?tid=394516)
Reading files -
thefatshizms - 22.11.2012
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?
Re: Reading files -
Vince - 22.11.2012
Click here for all your string splitting needs.
Mind telling on what page you found that? I ought to remove that immediately.
Re: Reading files -
thefatshizms - 22.11.2012
Quote:
Originally Posted by Vince
|
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