Save problem - 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: Save problem (
/showthread.php?tid=263132)
Save problem -
The Woody - 20.06.2011
whats wrong with this "SaveFamilie"? inside scriptfiles i have a folder called "Families" and inside that i have 3 .ini files called Familie_1, Familie_2 and Familie_3.
And when i try to save the familie with
Код:
SaveFamilie( Player[playerid][Familie]);
it just prints:
Код:
Could not execute SaveFamilie(number).
What could be the problem?
Stock savefamilie:
pawn Код:
stock SaveFamilie( i )
{
new FileName[ 21 ];
format(FileName, sizeof(FileName), "Families/Familie_%d.ini", i);
if(fexist(FileName) )
{
dini_IntSet(FileName, "Test1", Families[i][Test1]); // This is just a test it should work.
dini_IntSet(FileName, "Test2", Families[i][Test2]); // This is just a test it should work.
dini_IntSet(FileName, "Test3", Families[i][Test3]); // This is just a test it should work.
printf( "[system] Familie %d saved.", i);
}
else
{
printf( "Could not execute SaveFamilie(%d).", i);
}
}
Re: Save problem -
=WoR=Varth - 20.06.2011
Are you sure you have the file? ("Families/Familie_%d.ini")
Re: Save problem -
The Woody - 20.06.2011
Quote:
Originally Posted by varthshenon
Are you sure you have the file? ("Families/Familie_%d.ini")
|
Yes i have it like this: scriptfiles/Families/And in here i have Familie_1, Familie_2, Familie_3.
I have no idea what could be wrong.
Re: Save problem -
The Woody - 20.06.2011
Quote:
Originally Posted by [HLF]Southclaw
The line
[pawn if(fexist(FileName) )[/pawn]
isn't returning because the file doesn't exist.
Check case and do some data prints [printf] to check if the variables are all right
Also make sure you have the extension right aswell [.ini]
|
Im gonna check up on everything.
Quote:
Originally Posted by [HLF]Southclaw
And also the singular of families isn't familie, it's family.
|
Okaaay? i don't think thats my problem. But thanks anyway for pointing that out
.
Re: Save problem -
The Woody - 20.06.2011
Okay i changed this
To this
and now it saves, i guess i don't really understand that 100% then....
Re: Save problem -
=WoR=Varth - 20.06.2011
That's the length of your string.
Re: Save problem -
The Woody - 20.06.2011
Quote:
Originally Posted by [HLF]Southclaw
Because your string length was too short, the file location didn't fit into the string, you probably ended up with something like
"Families/Familie_1.i" 21 chars, misses out the rest of the file extension
Understand now?
|
Oh yes thank you. That explains it all thank you
.