/givecash command
#1

Hi all, I need a command like : givecash/pay.

Givecash : Normal Player to Other Player.
Reply
#2

I made this quickly and haven't tested it, but it should work.

pawn Код:
COMMAND:givecash(playerid, params[])
{
    new player, amount,name1[24], name2[24], string[128];
    if(!sscanf(params, "ui",player,amount))
    {
        if(playerid != player)
        {
            if(GetPlayerMoney(playerid) >= amount)
            {
                GetPlayerName(playerid, name1, 24);
                GetPlayerName(player, name2, 24);
                format(string, sizeof(string), "You gaved $%d to %s.",amount,name2);
                SendClientMessage(playerid, 0xFFFF00FF, string);
                format(string, sizeof(string), "%s gave you $%d!", name1, amount);
                SendClientMessage(player, 0xFFFF00FF, string);
                GivePlayerMoney(playerid, -amount);
                GivePlayerMoney(player, amount);
            }
            else return SendClientMessage(playerid, 0xFF0000FF,"You don't have that much.");
        }
        else return SendClientMessage(playerid, 0xFF0000FF,"You can't pay to yourself.");
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF,"Usage: /givecash [ID][Amount]");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)