12.07.2013, 23:21
Hello there,
I have tried a lot to load floats using "File" Data, but what happens is, all the floats loads (0.0000) although they're saved correctly.
It prints after then (0.000|||0.000|||0.000|||0), I wonder why this is happening?
and In advance, I did a small test, I wonder if I make this problem
It saves well, but it loads quite bad.
Thank you in advance
I have tried a lot to load floats using "File" Data, but what happens is, all the floats loads (0.0000) although they're saved correctly.
pawn Код:
stock LoadBiz()
{
if(!fexist(PATH)) return 1;
new File:i=fopen(PATH, io_read), st[1020], idx;
while(idx < sizeof(BusinessInfo) && fread(i, st))
{
sscanf(st, "p<|>iis[32]iiiffffffffiiiis[128]",
BusinessInfo[idx][bOwned],
BusinessInfo[idx][bPrice],
BusinessInfo[idx][bOwner],
BusinessInfo[idx][bType],
BusinessInfo[idx][bLocked],
BusinessInfo[idx][bMoney],
BusinessInfo[idx][bEntranceX],
BusinessInfo[idx][bEntranceY],
BusinessInfo[idx][bEntranceZ],
BusinessInfo[idx][bEntranceA],
BusinessInfo[idx][bExitX],
BusinessInfo[idx][bExitY],
BusinessInfo[idx][bExitZ],
BusinessInfo[idx][bExitA],
BusinessInfo[idx][bInt],
BusinessInfo[idx][bWorld],
BusinessInfo[idx][bInsideInt],
BusinessInfo[idx][bInsideWorld],
BusinessInfo[idx][bName]
);
}
fclose(i);
BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]); //Creates a pickup at the business entrance.
BusinessInfo[idx][bInsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bExitX], BusinessInfo[idx][bExitY], BusinessInfo[idx][bExitZ], BusinessInfo[idx][bInsideWorld]); //Creates a pickup at the exit(Inside the interior)
printf("%f|||%f|||%f|||%d", BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]);
print("done");
return 1;
}
and In advance, I did a small test, I wonder if I make this problem
pawn Код:
if (strcmp("/savemyhp", cmdtext, true) == 0)
{
new pname[32],Float:health, str[200];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
GetPlayerHealth(playerid, health);
new File:hp=fopen("/UsersHP.ini", io_append);
if(hp)
{
format(str, sizeof(str), "%s(hp)=%f\r\n", pname, health); fwrite(hp, str);
fclose(hp);
}
return 1;
}
if (strcmp("/loadmyhp", cmdtext, true) == 0)
{
new File:hp=fopen("/UsersHP.ini", io_read), string[200], str[200];
fread(hp, str);
format(string, 200, "The health you saved = %f", floatstr(str));
SendClientMessage(playerid, -1, string);
fclose(hp);
return 1;
}
Thank you in advance