20.12.2016, 11:11
Hello,
I'm working on my inventory system and I want a function that counts the weight from all the slots.
This is what is made:
This is what I get:
The GetObjectWeightFromInvID is working perfectly but why isn't it adding to counting?
I'm working on my inventory system and I want a function that counts the weight from all the slots.
This is what is made:
PHP код:
Float:GetInventoryWeight(playerid)
{
new Float:counting;
for(new i=1; i < MAX_SLOTS; i++)
{
floatadd(counting, GetObjectWeightFromInvID(Player[playerid][InvSlots][i]));
printf("%i. Weight = %.2f || counting = %f", i, GetObjectWeightFromInvID(Player[playerid][InvSlots][i]), counting);
}
return Float:counting;
}
Код HTML:
1. Weight = 2.50 || counting = 0.000000 2. Weight = 0.10 || counting = 0.000000 3. Weight = 0.10 || counting = 0.000000 4. Weight = 0.10 || counting = 0.000000 5. Weight = 0.10 || counting = 0.000000 6. Weight = 1.00 || counting = 0.000000 7. Weight = 1.00 || counting = 0.000000 8. Weight = 1.00 || counting = 0.000000 9. Weight = 0.50 || counting = 0.000000 10. Weight = 0.50 || counting = 0.000000 11. Weight = 0.50 || counting = 0.000000 12. Weight = 0.00 || counting = 0.000000 13. Weight = 0.00 || counting = 0.000000 14. Weight = 0.00 || counting = 0.000000 15. Weight = 0.00 || counting = 0.000000 16. Weight = 0.00 || counting = 0.000000 17. Weight = 0.00 || counting = 0.000000 18. Weight = 0.00 || counting = 0.000000 19. Weight = 0.00 || counting = 0.000000 20. Weight = 0.00 || counting = 0.000000