01.01.2015, 17:37
I make this function:
I try to use it in my cmd:
When i use this cmd with high negative value (ex: -100.000.000), it cause a crash -_- ! Someone help me pls, tks!
P/s: Sr for my bad English
PHP код:
stock GiveMoney(playerid, money)
{
new str[128];
if(money > 0)
{
format(str, sizeof(str), "~g~+%s$", AddCommas(money));
GameTextForPlayer(playerid, str, 3000, 1);
}
else if(money < 0)
{
format(str, sizeof(str), "~r~%s$", AddCommas(money));
GameTextForPlayer(playerid, str, 3000, 1);
}
PInfo[playerid][Cash] += money;
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PInfo[playerid][money]);
return 0;
}
PHP код:
CMD:givemoney(playerid, params[])
{
new str[128], player, money;
if(sscanf(params, "ud", player, money)) return SendMessage(playerid, COLOR_LENH, "/givemoney [ID] [Money]", SMLENH);
GiveMoney(player, money);
return 1;
}
P/s: Sr for my bad English