fwrite
#1

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?
Reply
#2

what does the error say?
Reply
#3

oh sorry xD argument type mismatch
Reply
#4

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
Reply
#5

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);
Reply
#6

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
Reply
#7

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

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")
Reply
#9

Could you show line 825?
Reply
#10

Maybe this helps:

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


Forum Jump:


Users browsing this thread: 1 Guest(s)