How can i keep zero's in a string with numbers?
#2

I was searching for your answer, as I really never tried making a money system with textdraw.
I found this, now of course, you have to re-write it in your code, as I just copy-pasted it.

pawn Код:
forward CheckMoney(playerid);
public CheckMoney(playerid)
{
    new string[128];
     
    if(GetPlayerMoney(playerid) < 10)
    {
        format(string, sizeof(string), "0000000%iFt", GetPlayerMoney(playerid));
        TextDrawSetString(Ft[playerid], string);
        TextDrawShowForPlayer(playerid, Ft[playerid]);
        TextDrawShowForPlayer(playerid, Box[playerid]);
    }

    if(10 <= GetPlayerMoney(playerid) < 100)
    {
        format(string, sizeof(string), "000000%iFt", GetPlayerMoney(playerid));
        TextDrawSetString(Ft[playerid], string);
        TextDrawShowForPlayer(playerid, Ft[playerid]);
        TextDrawShowForPlayer(playerid, Box[playerid]);
    }

    if(100 <= GetPlayerMoney(playerid) < 1000)
    {
        format(string, sizeof(string), "00000%iFt", GetPlayerMoney(playerid));
        TextDrawSetString(Ft[playerid], string);
        TextDrawShowForPlayer(playerid, Ft[playerid]);
        TextDrawShowForPlayer(playerid, Box[playerid]);
    }

    if(1000 <= GetPlayerMoney(playerid) < 10000)
    {
        format(string, sizeof(string), "0000%iFt", GetPlayerMoney(playerid));
        TextDrawSetString(Ft[playerid], string);
        TextDrawShowForPlayer(playerid, Ft[playerid]);
        TextDrawShowForPlayer(playerid, Box[playerid]);
    }

    if(10000 <= GetPlayerMoney(playerid) < 100000)
    {
        format(string, sizeof(string), "000%iFt", GetPlayerMoney(playerid));
        TextDrawSetString(Ft[playerid], string);
        TextDrawShowForPlayer(playerid, Ft[playerid]);
        TextDrawShowForPlayer(playerid, Box[playerid]);
    }

    if(100000 <= GetPlayerMoney(playerid) < 1000000)
    {
        format(string, sizeof(string), "00%iFt", GetPlayerMoney(playerid));
        TextDrawSetString(Ft[playerid], string);
        TextDrawShowForPlayer(playerid, Ft[playerid]);
        TextDrawShowForPlayer(playerid, Box[playerid]);
    }

    if(1000000 <= GetPlayerMoney(playerid) < 10000000)
    {
        format(string, sizeof(string), "0%iFt", GetPlayerMoney(playerid));
        TextDrawSetString(Ft[playerid], string);
        TextDrawShowForPlayer(playerid, Ft[playerid]);
        TextDrawShowForPlayer(playerid, Box[playerid]);
    }

    if(10000000 <= GetPlayerMoney(playerid) < 999999999)
    {
        format(string, sizeof(string), "%iFt", GetPlayerMoney(playerid));
        TextDrawSetString(Ft[playerid], string);
        TextDrawShowForPlayer(playerid, Ft[playerid]);
        TextDrawShowForPlayer(playerid, Box[playerid]);
    }
    return 1;
}
Reply


Messages In This Thread
How can i keep zero's in a string with numbers? - by AIped - 30.06.2014, 12:14
Re: How can i keep zero's in a string with numbers? - by Stinged - 30.06.2014, 12:22
Re: How can i keep zero's in a string with numbers? - by Vince - 30.06.2014, 12:28
Re: How can i keep zero's in a string with numbers? - by AIped - 30.06.2014, 12:48

Forum Jump:


Users browsing this thread: 1 Guest(s)