Decimal Money
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

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
Reply
#5

Hmmm, interesting, floatround. That would work on TextDraw? If yes give me an example.
Reply
#6

Like this?

https://sampforum.blast.hk/showthread.php?tid=173881
Reply
#7

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.
Reply
#8

Just divide the players money by 100 after setting it to a float
pawn Код:
Float:money=GetPlayerMoney(playerid)/100;
Reply
#9

Genius bro.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)