Command cash
#1

Hello, I'm creating a command, reservedd to admins, witch gives money to a player, from his name.

It's that :

pawn Код:
dcmd_cash(playerid, params[])
{
    new id, string[256], pname[24], amount;
    if (sscanf(params, "s", pname))
    return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/cash <playername> <amount>\"");
    if (!IsPlayerAdmin(playerid))
    return SendClientMessage(playerid, 0xFF0000AA, "Not admin !");
    else
    {
        id = GetPlayerID(pname);
        if(!IsPlayerConnected(id))
        return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        else
        {
            GivePlayerMoney(id, amount);
            format(string, sizeof(string), "You gave %s $ to %i.", amount, GetName(id));
            SendClientMessage(playerid, 0xFFFF00AA, string);
            SendClientMessage(id, 0xFFF00AA, "Admin %s gave you %i", playerid, amount);
        }
    }
    return 1;
}
It works when I type /cash <playername>, I have a message that say that I gave money to a player (without amount !), but when I enter amount, it say player not found.

How can I fix that please ? Thanks =)
Reply


Messages In This Thread
Command cash - by ludesert - 27.06.2011, 07:55
Re: Command cash - by iPLEOMAX - 27.06.2011, 08:06
Re : Command cash - by ludesert - 27.06.2011, 08:17
Re: Command cash - by Basicz - 27.06.2011, 08:39
Re : Command cash - by ludesert - 27.06.2011, 09:14
Re : Re: Command cash - by ludesert - 27.06.2011, 10:15
Re : Re: Command cash - by ludesert - 27.06.2011, 10:21
Re: Command cash - by iPLEOMAX - 27.06.2011, 11:41
Re : Re: Command cash - by ludesert - 27.06.2011, 19:49
Re: Command cash - by iPLEOMAX - 27.06.2011, 19:53

Forum Jump:


Users browsing this thread: 3 Guest(s)