26.04.2012, 21:45
(
Последний раз редактировалось Falco-Ger; 27.04.2012 в 13:33.
Причина: edit2
)
Hi guys,
i am to make a dynamic property system filterscript for a reallife server, but i got some wired problems...
when i read out a float from string with sscanf with the "f" it seems allright. when i print it with printf("%f", value) it shows up correctly.
but when i do something like
new Float:temp = value;
printf("%f", temp);
it shows extraordinary high numbers?!
global:
in ReadFile(), own function
Example Line: 427.896759 2532.036132 16.600128 225.630996 1022.479980 1084.069946 7 20000 2 500 4 Falco NOONE NOONE NOONE NOONE NOONE NOONE NOONE NOONE NOONE
in OnPlayerKeyStateChange (but shouldn't matter where)
example console output is:
strangely enough i get this output when compiling, guess thats related to that dump values i get 
the lines
but no such warnings for things like
edit: sorry, that tab layout in the bb code thingy, it's better in my pawno editor
edit2: i guess 2 of theese warnings are because Text3D is no integer i should print with printf, but no static_cast in that c(?) language. anyone know how i can force it cast to integer so that it doesn't give me a warning for such things?
i am to make a dynamic property system filterscript for a reallife server, but i got some wired problems...
when i read out a float from string with sscanf with the "f" it seems allright. when i print it with printf("%f", value) it shows up correctly.
but when i do something like
new Float:temp = value;
printf("%f", temp);
it shows extraordinary high numbers?!
global:
Код:
#define MAXPROPETIES 100 Float:PropDataF[MAXPROPERTIES][6]; enum { PWORLDX, PWORLDY, PWORLDZ, PINTX, PINTY, PINTZ }
Код:
while (fread(FHandle,Prop)) { printf("Reading Line %i: %s", i+1, Prop); if(sscanf(Prop,"ffffffdddddssssssssss" , PropDataF[j][PWORLDX], PropDataF[j][PWORLDY], PropDataF[j][PWORLDZ] , PropDataF[j][PINTX], PropDataF[j][PINTY], PropDataF[j][PINTZ] , PropDataI[j][PINTID], PropDataI[j][PPRICE] , PropDataI[j][PLEVEL], PropDataI[j][PRENT], PropDataI[j][PMAXIN] , PropDataS[j][0], PropDataS[j][1], PropDataS[j][2], PropDataS[j][3], PropDataS[j][4] , PropDataS[j][5], PropDataS[j][6], PropDataS[j][7], PropDataS[j][8], PropDataS[j][9] ) ) { printf ("invalid format in line %i: %s", i, Prop); PropDataB[i] = false; } else { printf ("Property Loaded into memory: ID: %i", j); fwrite(FBackupHandle, Prop); PropDataB[j] = true; j = j+1; if (j >= MAXPROPERTIES) { break; } } i = i+1; }
in OnPlayerKeyStateChange (but shouldn't matter where)
Код:
new Float:tempx = PropDataF[i][PWORLDX], Float:tempy = PropDataF[i][PWORLDY], Float:tempz = PropDataF[i][PWORLDZ]; printf("temp values are: %f %f %f",tempx, tempy, tempz); printf("printing with printf shows %f %f %f", PropDataF[i][PWORLDX], PropDataF[i][PWORLDY], PropDataF[i][PWORLDZ]);
Код:
temp values are: 1137971712.000000 1159627392.000000 1098985472.000000 printing with printf shows 424.142181 2536.166015 16.148437

Код:
...\filterscripts\easyprop.pwn(269) : warning 213: tag mismatch ...\filterscripts\easyprop.pwn(269) : warning 213: tag mismatch ...\filterscripts\easyprop.pwn(269) : warning 213: tag mismatch ...\filterscripts\easyprop.pwn(667) : warning 213: tag mismatch ...\filterscripts\easyprop.pwn(714) : warning 213: tag mismatch
Код:
269 - GetPlayerPos(playerid, PropDataF[ID][PWORLDX], PropDataF[ID][PWORLDY], PropDataF[ID][PWORLDZ]); 667 - printf("creating 3DText %i for property %i at %f %f %f: %s", Prop3DText[i], i, PropDataF[i][PWORLDX], PropDataF[i][PWORLDY], PropDataF[i][PWORLDZ], str); 714 - printf("creating 3DText %i for property %i at %f %f %f: %s", Prop3DText[ID], ID, PropDataF[ID][PWORLDX], PropDataF[ID][PWORLDY], PropDataF[ID][PWORLDZ], str);
Код:
Prop3DText[ID] = Create3DTextLabel(str, 0xFFFFFFAA , PropDataF[ID][PWORLDX], PropDataF[ID][PWORLDY], PropDataF[ID][PWORLDZ], 500.0, true);
edit2: i guess 2 of theese warnings are because Text3D is no integer i should print with printf, but no static_cast in that c(?) language. anyone know how i can force it cast to integer so that it doesn't give me a warning for such things?