SA-MP Forums Archive
how to make a kill - 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)
+--- Thread: how to make a kill (/showthread.php?tid=388978)



how to make a kill - DerickClark - 31.10.2012

i wanna khow how to make a /kill cmd


Re: how to make a kill - [HK]Ryder[AN] - 31.10.2012

In STRCMP
pawn Код:
if (strcmp("/kill", cmdtext, true, 5) == 0)
    {
        SetPlayerHealth(playerid, 0.0);
        return 1;
    }
In ZCMD
pawn Код:
CMD:kill(playerid, params[])
{
     SetPlayerHealth(playerid, 0.0);
     return 1;
}



Re: how to make a kill - 'Pawno. - 31.10.2012

pawn Код:
if(strcmp(cmdtext, "/kill", true) == 0)
{
    new Float:health;
    GetPlayerHealth(playerid, health);
    if(health > 0.0)
        SetPlayerHealth(playerid);
    else
        return SendClientMessage(playerid, 0xFFFFFFFF, "** You can't do that because you already type that in!");
    return 1;
}



Re: how to make a kill - Mustafa6155 - 31.10.2012

Quote:

#include <zcmd>

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/kill", true))//the command
    {
        SetPlayerHealth(playerid, 0);
        SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You Killed u self shame u!");//the text if the player died
        return 1;
    }
    return 0;
}
Or with zcmd
Quote:

#include <zcmd>

Код:
CMD:kill(playerid, params[])
{
         SetPlayerHealth(playerid, 0);
         return 1;
}
get zcmd from here http://www.solidfiles.com/d/d20f/ placein /servername/pawno/include

here u are NOTE:U get an error reply i will help!


Re: how to make a kill - [HK]Ryder[AN] - 31.10.2012

Quote:
Originally Posted by 'Pawno.
Посмотреть сообщение
pawn Код:
if(strcmp(cmdtext, "/kill", true) == 0)
{
    new Float:health;
    GetPlayerHealth(playerid, health);
    if(health > 0.0)
        SetPlayerHealth(playerid);
    else
        return SendClientMessage(playerid, 0xFFFFFFFF, "** You can't do that because you already type that in!");
    return 1;
}
You shud use Playerstates..PLAYER_STATE_WASTED to accurately check if hes dead or not