12.06.2010, 17:42
Hello! My givecash command worked fine, but I replaced SystemMessage by SendClientMessage because I wanted to change colour. The command is still working but sending the wrong messages. Here is my command. What is wrong?
Код:
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); SendClientMessage(playerid, COLOR_GREEN, str); format(str, sizeof(str), "%s has given you $%d.", playername, amount); SendClientMessage(playerid, COLOR_GREEN, str); return 1; }