23.01.2018, 23:19
I need great help with this problem, the one I want to find but I can not find the way (first time I do a system with floats)
It should print the data correctly ..
(The weight the player has and the weight of the object) but adding amber in a single print gives another value (as seen at the end)
LOG:
Код:
new MarketInventory[][] = { {float:0.3500, 10, " Sprunks" }, {float:0.1000, 15, " Cigarrillos" }, {float:0.0100, 5, " Billetes de loteria" } };
Код:
Dialog:BusinessMarketMenu(playerid, response, listitem, inputtext[]) { if(!response)return SendClientMessage(playerid, COLOR_WHITE, "Decidiste no comprar en este negocio."); if(PlayerData[playerid][Money] < MarketInventory[listitem][2])return SendClientMessage(playerid, COLOR_WHITE, ERROR_MONEY); if(PlayerData[playerid][InventoryWeight] >= MAX_INVENTORY_WEIGHT)return SendClientMessage(playerid, COLOR_WHITE, ERROR_INVENTORY_WEIGHT); new i = GetNearestBusinessPoint(playerid); switch(listitem) { case 0: // SPRUNKS { if(BusinessData[i][Sprunks] == 0)return SendClientMessage(playerid, COLOR_WHITE, "Este negocio no tiene sprunks en su inventario..."); printf("Pesa: %f", MarketInventory[listitem][0]); printf("Inventario del jugador: %f", PlayerData[playerid][InventoryWeight]); printf("%f", PlayerData[playerid][InventoryWeight]+MarketInventory[listitem][0]); } case 1: // CIGARRILLOS { } } return true; }
(The weight the player has and the weight of the object) but adding amber in a single print gives another value (as seen at the end)
LOG:
Код:
[20:13:32] Pesa: 0.349999 [20:13:32] Inventario del jugador: 1.000000 [20:13:32] 1051931456.000000 // This is supposed to be the sum of both. (1.349999)