SA-MP Forums Archive
how to store a string in a file with more than 4 chars - 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: how to store a string in a file with more than 4 chars (/showthread.php?tid=66502)



how to store a string in a file with more than 4 chars - fredl - 22.02.2009

i want to know how to store any string in any file. im packing a string(the line in the file) into my other string. this string is later saved in the same file.
but if i read "Player" later there is just "Play" in the file. but at first why?? and then how can i change this??


Re: how to store a string in a file with more than 4 chars - Lewwy - 22.02.2009

Change the array size?


Re: how to store a string in a file with more than 4 chars - fredl - 22.02.2009

it works with numbers.. 48343439943994343 is no problem


Re: how to store a string in a file with more than 4 chars - Lewwy - 22.02.2009

Can you post the part of your script where you add the Player line?


Re: how to store a string in a file with more than 4 chars - yom - 22.02.2009

http://forum.sa-mp.com/index.php?topic=90512.0



Re: how to store a string in a file with more than 4 chars - fredl - 22.02.2009

this is in gamemodeinit
Код:
servinf = fopen("serva",io_read);
while(fread(servinf,string,200,false))
	{
	strpack(servi[zeile], string[0],256);
	print(string[0]);
	zeile = zeile +1;
	}
strpack(hbi[0][25],servi[2],256);
fclose(servinf);
and this in the gamemodeexit to write the code
Код:
new string[200];
servinf = fopen("serva",io_write);
strunpack(string,hbi[0][25],256);
format(string,200,"%s\r\n",string);
fwrite(servinf,string);
fclose(servinf);