How to set this textdraw string?
#5

Use switch statement, it's much faster than using if-else statements.

pawn Код:
stock GiveMoney(playerid,money)
{
    new str[64];
    switch(money)
    {
        case 1 .. 9: format(str, sizeof(str), "$0000000%d", money);
        case 10 .. 99: format(str, sizeof(str), "$000000%d", money);
        case 100 .. 999: format(str, sizeof(str), "$00000%d", money);
        case 1000 .. 9999: format(str, sizeof(str), "$0000%d", money);
        case 10000 .. 99999: format(str, sizeof(str), "$000%d", money);
        case 100000 .. 999999: format(str, sizeof(str), "$00%d", money);
        case 1000000 .. 9999999: format(str, sizeof(str), "$00%d", money);
        case 10000000 .. 99999999: format(str, sizeof(str), "$0%d", money);
        case 100000000 .. 999999999: format(str, sizeof(str), "$%d", money);
        default: format(str, sizeof(str), "$00000000");

        TextDrawSetString(ShowMoneyEarned[playerid], str);
    }
    pInfo[playerid][pMoney] += money;
    TextDrawShowForPlayer(playerid, ShowMoneyEarned[playerid]);
    return 1;
}
Reply


Messages In This Thread
How to set this textdraw string? - by HitterHitman - 14.05.2014, 07:01
Re: How to set this textdraw string? - by Lynn - 14.05.2014, 07:09
Re: How to set this textdraw string? - by HitterHitman - 14.05.2014, 07:16
Re: How to set this textdraw string? - by Lynn - 14.05.2014, 07:19
Re: How to set this textdraw string? - by iZN - 14.05.2014, 07:43
Re: How to set this textdraw string? - by HitterHitman - 14.05.2014, 08:46
Re: How to set this textdraw string? - by Vince - 14.05.2014, 08:55
Re: How to set this textdraw string? - by iZN - 14.05.2014, 09:16

Forum Jump:


Users browsing this thread: 1 Guest(s)