15.07.2012, 10:50
pawn Code:
#include <a_samp>
#include <sscanf2>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
public OnPlayerCommandText(playerid, cmdtext[])
{
* * dcmd(givecash,8,cmdtext);
* * return 0;
}
dcmd_givecash(playerid, params[])
{
* * new
* * * * giveplayerid,
* * * * amount;
* * if (sscanf(params, "ud", giveplayerid, amount)) SendClientMessage(playerid, 0xFF0000AA, "USAGE: /givecash <playerid> <amount>");
* * else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not found!");
* * else if (amount > GetPlayerMoney(playerid)) SendClientMessage(playerid, 0xFF0000AA, "ERROR: Insufficient funds!");
* * else
* * {
* * * * GivePlayerMoney(giveplayerid, amount);
* * * * GivePlayerMoney(playerid, 0 - amount);
* * * * SendClientMessage(playerid, 0x00FF00AA, "INFO: You have sent money.");
* * * * SendClientMessage(giveplayerid, 0x00FF00AA, "INFO: You have received money.");
* * }
* * return 1;
}
Got this compiled , but when i use /givecash in game its an unknown command? :S pls help