27.06.2011, 07:55
Hello, I'm creating a command, reservedd to admins, witch gives money to a player, from his name.
It's that :
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 =)
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;
}
How can I fix that please ? Thanks =)