SA-MP Forums Archive
fwrite - 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: fwrite (/showthread.php?tid=90662)



fwrite - thuron - 09.08.2009

when i do this, i get an error on the second argument of fwrite:

Код:
	new economyvalcal = (floatstr(economyval))+0.005;
	fwrite(economyfile,economyvalcal);
economyval is defined well. but the fwrite wont work. how can i fix this?


Re: fwrite - wilcock33 - 09.08.2009

what does the error say?


Re: fwrite - thuron - 09.08.2009

oh sorry xD argument type mismatch


Re: fwrite - wilcock33 - 09.08.2009

Quote:
Originally Posted by thuron
oh sorry xD argument type mismatch
hmm, i havnt dealt with this before (ive only been scripting 2/3 months XD)

if its an argument mismatch, check out the wiki, hey have tutorials there


Re: fwrite - bogeymanEST - 09.08.2009

economyvalcal is an integer, fwrite requires a string to write, to make it a string, try this:
pawn Код:
new economyvalcal[128] = floatstr(economyval+0.005);
fwrite(economyfile,economyvalcal);



Re: fwrite - thuron - 09.08.2009

when i do that, i get these errors:

Код:
C:\Users\Thuron\Desktop\SIR server 16-5-09\gamemodes\SIRRP.pwn(822) : error 033: array must be indexed (variable "economyval")
C:\Users\Thuron\Desktop\SIR server 16-5-09\gamemodes\SIRRP.pwn(822) : error 008: must be a constant expression; assumed zero



Re: fwrite - bogeymanEST - 09.08.2009

Oops, my bad
pawn Код:
new economyvalcal[128];
economyvalcal = floatstr(economyval+0.005);
fwrite(economyfile,economyvalcal);



Re: fwrite - thuron - 09.08.2009

ok, now im getting those:

Код:
C:\Users\Thuron\Desktop\SIR server 16-5-09\gamemodes\SIRRP.pwn(825) : error 033: array must be indexed (variable "economyval")
C:\Users\Thuron\Desktop\SIR server 16-5-09\gamemodes\SIRRP.pwn(825) : error 033: array must be indexed (variable "economyvalcal")



Re: fwrite - bogeymanEST - 09.08.2009

Could you show line 825?


Re: fwrite - MadeMan - 09.08.2009

Maybe this helps:

pawn Код:
new economyvalcal[128];
format(economyvalcal, sizeof(economyvalcal), "%f", floatstr(economyval)+0.005);
fwrite(economyfile,economyvalcal);