19.03.2011, 10:31
I can see a couple of problems.
First of all, if you're using SSCANF2, it should be
If you're using SSCANF 1, it should be
But I highly recommend you to use SSCANF2.
Let's try this:
At OnPlayerCommandText:
Somewhere in your script:
If it still doesn't work, try to define DCMD again, but then this line:
It is possible you made a typo at defining DCMD.
First of all, if you're using SSCANF2, it should be
pawn Код:
if(sscanf(params, "us[64]", targetid, reason)) [...]
pawn Код:
if(sscanf(params, "us", targetid, reason)) [...]
Let's try this:
At OnPlayerCommandText:
pawn Код:
dcmd(kick, 4, cmdtext);
pawn Код:
dcmd_kick(playerid, params[])
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(!IsPlayerAdmin(playerid)) return 0;
new targetid, reason[64], string[128];
if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /kick [playerid/partofname] [reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player not connected or is yourself!");
format(string, sizeof(string), "%s has been kicked by Rcon Admin (Reason: %s)",pName, reason);
SendClientMessageToAll(COLOR_RED, string); // The yellow define will be up!
Kick(targetid);
}
pawn Код:
#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