05.07.2018, 12:59
Quote:
AmigaBlizzard has got a point. Instead of saving money as string, you can have 2 integer arrays. One being for money and the other for coins. Showing the money would look like this (an example):
pawn Код:
%02d ads zero in front in case it is 1 digit. "9" becomes "09". |
Quote:
_givePlayerMoney(playerid, cash, coin) // I think this will be the best |
Quote:
_givePlayerMoney(playerid, Float:cash) |
Sorry but I don't understand much. I haven't found out the way to work with those two functions.
And this is how I use string to do my thing:
PHP код:
_givePlayerMoney(playerid, Float:amount)
{
new _money[18],
_cash,
_coin;
format(_money, sizeof(_money), "%.2f", amount);
sscanf(_money, "p<.>dd", _cash, _coin);
ResetPlayerMoney(playerid);
character[playerid][cash] += _cash;
character[playerid][coin] += _coin;
SetPlayerMoney(playerid, character[playerid][cash]);
updatePlayerCoinTextDraw(playerid); // I create a textdraw to display player's coin
return 1;
}