SA-MP Forums Archive
/akill? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /akill? (/showthread.php?tid=116654)



/akill? - Rubennnnn - 29.12.2009

Hi,

How to make an a(dmin)kill command?


Re: /akill? - GTAguillaume - 29.12.2009

OnPlayerCommand:
pawn Код:
new cmd[256], idx, tmp[256];
  cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/akill", true) || !strcmp(cmd, "/adminkill", true) )
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xff0000,"Your not an admin!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,0xff0000,"usage /akill");
new ID = strval(tmp);
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,0xff0000,"Player is not connected");
SetPlayerHealth(ID,0);
SendClientMessage(playerid,0xff0000,"Done!");
return 1;
}
If you dont got strtok:
pawn Код:
strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }
 
    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}



Re: /akill? - Rubennnnn - 30.12.2009

Thanks