stock GiveMoney(playerid,money)
{
new str[64];
format(str,sizeof(str),"+$%i",money);
TextDrawSetString(ShowMoneyEarned[playerid],str);
pInfo[playerid][pMoney] += money;
TextDrawShowForPlayer(playerid, ShowMoneyEarned[playerid]);
return 1;
}
stock GiveMoney(playerid,money)
{
new str[64];
if(money < 10) { format(str,sizeof(str),"+$00000000%i",money); }
else if(money < 100) { format(str,sizeof(str),"+$0000000%i",money); }
else if(money < 1000) { format(str,sizeof(str),"+$000000%i",money); }
else if(money < 10000) { format(str,sizeof(str),"+$00000%i",money); }
else if(money < 100000) { format(str,sizeof(str),"+$0000%i",money); }
else if(money < 1000000) { format(str,sizeof(str),"+$000%i",money); }
else if(money < 10000000) { format(str,sizeof(str),"+$00%i",money); }
else if(money < 100000000) { format(str,sizeof(str),"+$0%i",money); }
else if(money < 1000000000) { format(str,sizeof(str),"+$%i",money); }
TextDrawSetString(ShowMoneyEarned[playerid],str);
pInfo[playerid][pMoney] += money;
TextDrawShowForPlayer(playerid, ShowMoneyEarned[playerid]);
return 1;
}
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;
}
format(str,sizeof(str),"+$%09d",money);
Wow, I though this would be common knowledge by now. There is absolutely NO need for extensive functions. The only thing you need is:
pawn Код:
|