15.01.2011, 13:43
Hmm, It looks like it dont find the ID somethimes, and
This work:
/akill 0 h
This DONT work:
/akill 0 hello
This work:
/akill 0 h
This DONT work:
/akill 0 hello
pawn Код:
#include <a_samp>
#include <sscanf>
#define COLOR_RED 0xFF0000AA
#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(akill, 5, cmdtext);
return 0;
}
dcmd_akill(playerid, params[])
{
new targetid, reason;
new pName [MAX_PLAYER_NAME], tName [MAX_PLAYER_NAME], string [128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(targetid, tName, MAX_PLAYER_NAME);
if(sscanf(params,"ds", targetid, reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /akill [playerid] [reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
format(string, sizeof(string), "ADMIN KILL: %s(%d) killed %s(%d) %s", pName, playerid, tName, targetid, reason);
SendClientMessageToAll(COLOR_RED, string);
SetPlayerHealth(targetid, 0.0);
return 1;
}