SA-MP Forums Archive
Saving weapon info - 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: Saving weapon info (/showthread.php?tid=618212)



Saving weapon info - GoldenLion - 02.10.2016

Hi, I'm trying to update my filterscript right now by saving the weapon positions. The problem is that the string I format stays empty.
This is the code:
Код:
SaveWeaponInfo(playerid)
{
	new INI:File = INI_Open(WeaponInfoFile(playerid)), string[68], weapon[2];
	
	for (new i = 22; i <= 38; i++)
	{
		format(string, sizeof(string), "%.5f | %.5f | %.5f | %.5f | %.5f | %.5f | %d | %d", WeaponInfo[playerid][i][Position][0], WeaponInfo[playerid][i][Position][1], WeaponInfo[playerid][i][Position][2], WeaponInfo[playerid][i][Position][3], WeaponInfo[playerid][i][Position][4],  WeaponInfo[playerid][i][Position][5], WeaponInfo[playerid][i][Bone], WeaponInfo[playerid][i][Hidden]);
		valstr(weapon, i);
		INI_WriteString(File, weapon, string);
		printf("%s", string);
		printf("%s", weapon);
	}
	INI_Close(File);
}
This is what it prints:
Код:
[20:36:21] 
[20:36:21] 22
[20:36:21] 
[20:36:21] 23
[20:36:21] 
[20:36:21] 24
[20:36:21] 
[20:36:21] 25
[20:36:21] 
[20:36:21] 26
[20:36:21] 
[20:36:21] 27
[20:36:21] 
[20:36:21] 28
[20:36:21] 
[20:36:21] 29
[20:36:21] 
[20:36:21] 30
[20:36:21] 
[20:36:21] 31
[20:36:21] 
[20:36:21] 32
[20:36:21] 
[20:36:21] 33
[20:36:21] 
[20:36:21] 34
[20:36:21] 
[20:36:21] 35
[20:36:21] 
[20:36:21] 36
[20:36:21] 
[20:36:21] 37
[20:36:21] 
[20:36:21] 38
What am I doing wrong here?


Re: Saving weapon info - AMouldyLemon - 02.10.2016

Try without specifying a decimal amount. I think I had a similar issue and this resolved it


Re: Saving weapon info - GoldenLion - 02.10.2016

Quote:
Originally Posted by AMouldyLemon
Посмотреть сообщение
Try without specifying a decimal amount. I think I had a similar issue and this resolved it
Eh, what do you mean?


Re: Saving weapon info - AMouldyLemon - 02.10.2016

%f | %f


Re: Saving weapon info - GoldenLion - 02.10.2016

Oh, alright thanks. I don't really understand why it would cause any problems, but I'll try it tomorrow anyways.


Re: Saving weapon info - GoldenLion - 03.10.2016

Still doesn't work. Anyone?


Re: Saving weapon info - GoldenLion - 04.10.2016

I could fix it by creating a function that formats the weapon info...