03.10.2012, 11:42
For dcmd you only need to put this line below your includes at the top of your script:
Then you can make a cmd like this:
And I looked on wiki, it seems the zcmd is faster, I don't know how but it seems to be: here you can find zcmd: clicky
Код:
#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(heal, 4, cmdtext); return 0; } dcmd_heal(playerid, params[]) { new id; if (strlen(params)) { id = strval(params); if (IsPlayerConnected(id)) { SetPlayerHealth(id, 100.0); SendClientMessage(id, 0x00FF00AA, "You have been healed"); SendClientMessage(playerid, 0x00FF00AA, "Player healed"); } else { SendClientMessage(playerid, 0xFF0000AA, "Player not found"); } } else { SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\""); } return 1; }