15.01.2011, 12:51
Hi i'm trying to use DCMD for first time, but i failed :P
I'll get few errors, "undefined symbol "targetid""
I'll get few errors, "undefined symbol "targetid""
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(akill, 5, cmdtext);
return 0;
}
dcmd_akill(playerid, params[])
{
new pName [MAX_PLAYER_NAME], tName [MAX_PLAYER_NAME], string [128];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
GetPlayerName(targetid, tName, MAX_PLAYER_NAME);
new Reason;
if(!sscanf(params,"ds", playerid, Reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /akill [playerid] [reason]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
if(playerid) return SendClientMessage(playerid,COLOR_RED,"You can`t KILL yourself");
format(string, sizeof(string), "ADMIN KILL: %s(%d) killed %s(%d) %d", pName, playerid, tName, targetid, reason);
SendClientMessageToAll(COLOR_RED, string);
SetPlayerHealth(targetid, 0.0);
return 1;
}