Somebody helpme with sum of floats?
#1

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)

Код:
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;
}
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:
Код:
[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)
Reply


Messages In This Thread
Somebody helpme with sum of floats? - by OdgFox - 23.01.2018, 23:19
Re: Somebody helpme with sum of floats? - by Misiur - 23.01.2018, 23:48
Re: Somebody helpme with sum of floats? - by OdgFox - 24.01.2018, 02:40
Re: Somebody helpme with sum of floats? - by OdgFox - 24.01.2018, 02:45
Re: Somebody helpme with sum of floats? - by Dayrion - 24.01.2018, 10:53
Re: Somebody helpme with sum of floats? - by edyun - 24.01.2018, 10:57

Forum Jump:


Users browsing this thread: 5 Guest(s)