How can I bypass the 32 bit integer limit? (2,147,483,647)
#9

Quote:
Originally Posted by danielpalade
Посмотреть сообщение
But let's say I'd calculate the total sum of the array, I would use a loop. And the variable that returns the total amount is still a 32 bit integer. So I could I do that?

I mean, I already kinda know how to add the money, but I don't know how to calculate it.

Код:
new money[MAX_PLAYERS][20];

stock AddMoney(playerid, money)
{
	for(new i; i < 20; i++)
	{
	    if(money[playerid][i] < 2147483647)
	    {	
	    	if(money[playerid][i] + money <= 2147483647)
	    	{
	    		money[playerid][i] += money;
	    		break;
	    	}       
	    }
	}
}
Just return a string of adding up all of the values.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)