SA-MP Forums Archive
I need some help [Money problem in game] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need some help [Money problem in game] (/showthread.php?tid=317946)



I need some help [Money problem in game] - R3pp3ru92 - 13.02.2012

Hi , i have a question about bank money in player stats.How can i expend the bank money limit ? ex on my server if a player has $2,100,000,000 in bank or cash , money will be in minus ( $-2,100,000,000 ) how can i expand the limit for example to $ 10,000,000,000 in bank and cash $ 5,000,000,000 ? thanks.

P.S. Sorry for my bad english.


Re: I need some help [Money problem in game] - milanosie - 13.02.2012

Cant, after a while big numbers go negative


Re: I need some help [Money problem in game] - R3pp3ru92 - 13.02.2012

Quote:
Originally Posted by milanosie
Посмотреть сообщение
Cant, after a while big numbers go negative
ok, thx for help


Re: I need some help [Money problem in game] - Cameltoe - 13.02.2012

Quote:
Originally Posted by R3pp3ru92
Посмотреть сообщение
ok, thx for help
There is one way to do this though.

Store the value to a file or to a mysql database, then upon for example /buyhouse :

pawn Код:
stock GetPlayerBigMoney(playerid, Amount)
{
      new Query[150]; // Note this variable is set to 150, so it can contain large amount, though if your amount of money exceeds 79 chars you would have to extend this value to over 150 :)
      format(Query, sizeof(Query), "SELECT * FROM users_info WHERE money >= %d AND username = '%s';", Amount, GetPlayerNameEx(playerid));
      mysql_query(Query);
      mysql_store_result(Query);
      if(!mysql_num_rows()) return 0;
      return 1;
}
For example:

pawn Код:
if(!GetPlayerBigMoney(playerid, 100000000000)) SendClientMessage(playerid, COLOR_INFO, "You need at least 100,000,000,000 to buy this object!");
else
{
     // Let the user buy the object / car whatever
}



Re: I need some help [Money problem in game] - R3pp3ru92 - 13.02.2012

so , GetPlayerBigMoney , can i create a command that sets the player max money amount? this is what i am interested to do , because on my server , players make money easely and in one or two monts they have over 2kkk
( $ 2,000,000,000 ) and this is the problem , because money became negative.


Re: I need some help [Money problem in game] - Cameltoe - 14.02.2012

Quote:
Originally Posted by R3pp3ru92
Посмотреть сообщение
so , GetPlayerBigMoney , can i create a command that sets the player max money amount? this is what i am interested to do , because on my server , players make money easely and in one or two monts they have over 2kkk
( $ 2,000,000,000 ) and this is the problem , because money became negative.
Yes, storing the value in flatfiles or mysql could help you solve this problem.


Re : I need some help [Money problem in game] - ricardo178 - 14.02.2012

Or, make like 5 or 6 bank accounts in their playerfile instead of one, and when they try to deposit in the first one, if there is already too much, they have to deposit in other.


Re: I need some help [Money problem in game] - RicaNiel - 14.02.2012

umm wait
you can create a textdraw if you want to


Re: Re : I need some help [Money problem in game] - R3pp3ru92 - 15.02.2012

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
Or, make like 5 or 6 bank accounts in their playerfile instead of one, and when they try to deposit in the first one, if there is already too much, they have to deposit in other.
it's a great ideea , thx