27.03.2010, 08:31
This is my command givecash and when I sen someone $5000 it shows $2 or $0. Anyway, it's wrong and I don't know what's causing it, the money increases with 5000 but it shows the wrong message.
pawn Код:
dcmd_givecash(playerid, params[])
{
new amount, str[128];
if(sscanf(params, "ud", giveplayerid, amount)) return SystemMessage(playerid, "USAGE: /givecash [playername/id] [amount]");
if(!IsPlayerConnected(giveplayerid) || giveplayerid == playerid) return SystemMessage(playerid, "This player is not active.");
if(amount < 1 || amount > GetPlayerMoney(playerid)) return SystemMessage(playerid, "Invalid amount.");
GetName(playerid, playername);
GetName(giveplayerid, giveplayer);
GivePlayerMoney(playerid, -amount);
GivePlayerMoney(giveplayerid, amount);
format(str, sizeof(str), "You have given $%d to %s.", amount, giveplayer, giveplayerid);
SystemMessage(playerid, str);
format(str, sizeof(str), "%s has given you $%d.", playername, playerid, amount);
SystemMessage(giveplayerid, str);
return 1;
}