Decimal Money - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Decimal Money (
/showthread.php?tid=252259)
Decimal Money -
Ubuntu - 30.04.2011
Is there any ways to make the GTA money to Decimal, like adding a TextDraw and make it Decimal.
I've heard the float could help for decimal money, the problem is that I don't know how to change it to like this:
Let's say you use "float" how would you know it's .00 or like .45 so the TextDraw could change to those variables just like a Speedo System.
Re: Decimal Money -
Outcast - 30.04.2011
Well, you can make two textdraws and two normal number variables for money. If the second variable hits 100, increase the first variable by 1 and set the 2nd var to 0, if the 2nd var hits -1, decrease the 1st var by 1 and set the second var to 99. Then, make a textdraw that will show the first variable, and the second variable. Also, you can make a third textdraw that will represent the seperation (comma). But, as much as I know, you can't have decimal money in GTA.
Re: Decimal Money -
Ubuntu - 30.04.2011
No, this is not what I want.
I want to make only 1 Variable in "float" like example:
new float:money;
Then I want to make it unique variable for all the script.
So when I pay someone I do /pay [playerid] [0.0]
float:money will change the TextDraw.
Yes you can have Decimal Money in GTA.
Everything is possible you just need to think how you are going to do it.
Re: Decimal Money -
Outcast - 30.04.2011
Quote:
Originally Posted by Ubuntu
No, this is not what I want.
I want to make only 1 Variable in "float" like example:
new float:money;
Then I want to make it unique variable for all the script.
So when I pay someone I do /pay [playerid] [0.0]
float:money will change the TextDraw.
Yes you can have Decimal Money in GTA.
Everything is possible you just need to think how you are going to do it.
|
Well, you can round that number up with floatround and then if that rounded number is bigger than the float number, you can substract it (rounded number - float number). Then you can substract 1,00 - result, to get the decimal numbers. If the number is smaller, you can then increase rounded number by 1 and then do the same thing as above. Don't know if it will work, just an idea.
Example:
Money = 124,63
When you round that up, you get 125,00
125-124,63 = 0,37
1,00 - 0,37 = 0,63
Re: Decimal Money -
Ubuntu - 01.05.2011
Hmmm, interesting, floatround. That would work on TextDraw? If yes give me an example.
Re: Decimal Money -
willsuckformoney - 01.05.2011
Like this?
https://sampforum.blast.hk/showthread.php?tid=173881
Re: Decimal Money -
Ubuntu - 01.05.2011
Kinda like this but I want like only 1 variable instead of cents and dollars.
floatround is not so bad.
I really need to what the solution that would be revolutionary for SA-MP.
Re: Decimal Money -
Joe Staff - 01.05.2011
Just divide the players money by 100 after setting it to a float
pawn Код:
Float:money=GetPlayerMoney(playerid)/100;
Re: Decimal Money -
Ubuntu - 01.05.2011
Genius bro.