Number separator
#17

Quote:
Originally Posted by CheezIt
View Post
Don't use his code, it's rubbish.

Here's an example:
pawn Code:
public OnPlayerConnect(playerid)
{
    new string[144], var = 215161241;
    format(string, sizeof(string), "Without the use of function: %d - With prior use: %s", var, FormatNumber(var));
    SendClientMessage(playerid, -1, string);
    return 1;
}

FormatNumber(integer, const separator[] = ",")
{
    new string[16];
    valstr(string, integer);

    if(integer >= 1000)
    {
        for(new i = (strlen(string) - 3); i > 0; i -= 3)
        {
            strins(string, separator, i);
        }
    }
    return string;
}
You will get the following message in-game when you connect:


If you still don't know how to use the function then there is absolutely no way to help you any further.
It is known, you are a fetus, this code is used on many Romanian servers and does not even produce a bug.

My code works as follows:

Ex:

Your code

Code:
format(string, 256, "Money: $%d", FormatNumber(money));
My code:

Code:
format(string, 256, "Money: $%s", FormatNumber(money));
My function is string type, it requires %s
Reply


Messages In This Thread
Number separator - by Cyboorg - 01.06.2017, 21:07
Re: Number separator - by CheezIt - 01.06.2017, 21:22
Re: Number separator - by Cyboorg - 01.06.2017, 21:28
Re: Number separator - by MattTucker - 01.06.2017, 23:13
Re: Number separator - by Cyboorg - 02.06.2017, 12:22
Re: Number separator - by Dice_ - 02.06.2017, 13:56
Re: Number separator - by Cyboorg - 02.06.2017, 17:54
Re: Number separator - by Dice_ - 02.06.2017, 18:02
Re: Number separator - by CheezIt - 03.06.2017, 03:26
Re: Number separator - by Cyboorg - 03.06.2017, 16:22
Re: Number separator - by Ilias_ - 05.06.2017, 11:13
Re: Number separator - by skuller12 - 05.06.2017, 11:17
Re: Number separator - by CheezIt - 05.06.2017, 18:08
Re: Number separator - by Cyboorg - 05.06.2017, 18:11
Re: Number separator - by skuller12 - 05.06.2017, 18:31
Re: Number separator - by CheezIt - 05.06.2017, 20:38
Re: Number separator - by skuller12 - 05.06.2017, 20:46
Re: Number separator - by JasonRiggs - 05.06.2017, 20:49
Re: Number separator - by GaByM - 05.06.2017, 20:56
Re: Number separator - by Toroi - 05.06.2017, 21:48
Re: Number separator - by Dice_ - 05.06.2017, 22:35
Re: Number separator - by CheezIt - 05.06.2017, 23:43

Forum Jump:


Users browsing this thread: 2 Guest(s)