Zcmd problem
#2

try using sscanf
pawn Код:
CMD:donate(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new moneys, string[256];
        if(sscanf(params,"i",moneys)) return SendClientMessage(playerid, -1, "USAGE: /donate [amount]");
        if(PlayerInfo[playerid][pLocal] == 106) return SendClientMessage(playerid, COLOR_GREY, "You can't use this comand right here.");
        if(moneys < 0 || moneys > 1000000) return SendClientMessage(playerid, COLOR_GREY, "You can't donate less than $1.000 or more than $1.000.000!");
        if(GetPlayerMoney(playerid) < moneys) return SendClientMessage(playerid, COLOR_GREY, "Transaction amount is invalid.");
        GivePlayerMoney(playerid, -moneys);
        GetPlayerName(playerid, sendername, sizeof(sendername));
        format(string, sizeof(string), "* %s donated %s!",sendername, FormatMoney(moneys));
        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
        PayLog(string);
        format(string, sizeof(string), "~w~Thank you for your donation of~n~~r~~h~%s~w~, ~b~~h~%s ~w~!",sendername, FormatMoney(moneys));
        GameTextForPlayer(playerid, string, 3000, 5);
        format(string, sizeof(string), "* %s donated %s to The Mayor.",sendername, FormatMoney(moneys));
        SendFamilyMessage(7, COLOR_YAKUZA, string);
    }
    return 1;
}
Reply


Messages In This Thread
Zcmd problem - by k3nw00d_kri5ty - 18.03.2012, 14:25
Re: Zcmd problem - by Tanush123 - 18.03.2012, 14:41
Re: Zcmd problem - by k3nw00d_kri5ty - 18.03.2012, 17:37
Re: Zcmd problem - by Tanush123 - 18.03.2012, 19:27
Re: Zcmd problem - by k3nw00d_kri5ty - 18.03.2012, 19:38
Re: Zcmd problem - by new121 - 18.03.2012, 20:20
Re: Zcmd problem - by k3nw00d_kri5ty - 18.03.2012, 21:06
Re: Zcmd problem - by Tanush123 - 18.03.2012, 21:13
Re: Zcmd problem - by k3nw00d_kri5ty - 18.03.2012, 21:34
Re: Zcmd problem - by Soumi - 18.03.2012, 21:37

Forum Jump:


Users browsing this thread: 3 Guest(s)