SA-MP Forums Archive
how can i make /kill like not for wanted player help - 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 can i make /kill like not for wanted player help (/showthread.php?tid=354178)



how can i make /kill like not for wanted player help - UserName31 - 25.06.2012

hey i have been trying to look for a script /kill

here how it need to work when a player with 1,2,3,4,5,6 wanted level they cant use the commands if tthe player have
0 wanted level they can use it please help i use dcmd(kill,5,cmdtext) plz help and onplayercommands


Re: how can i make /kill like not for wanted player help - [A]ndrei - 25.06.2012

i dont understand what you mean but here

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 5) == 0)
	{
	SetPlayerHealth(playerid, 0);
	SendClientMessage(playerid, 0x2200FF, "(INFO) You have commited suicide!");
	return 1;



Re: how can i make /kill like not for wanted player help - Kindred - 25.06.2012

pawn Код:
dcmd_kill(playerid,params[])
{
    if(GetPlayerWantedLevel(playerid) >= 1) return SendClientMessage(playerid, -1, "You are wanted, you cannot kill yourself!");
    SetPlayerHealth(playerid, 0);
    SendClientMessage(playerid, -1, "You killed yourself!");
    return 1;
}
Here. This prevents people with a wanted level to /kill.

Out of three of these posts, this is the most efficient way to do this. It has less lines and looks better.

EDIT: Below post, not really. Mine looks more easier to understand, in my opinion..


Re: how can i make /kill like not for wanted player help - TyThaBomb - 25.06.2012

pawn Код:
command(kill,playerid,params[])
{
    if(GetWantedLevel(playerid) >= 1)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You can't use that, you're wanted!");
        return 1;
    }
    else
    {
        SetPlayerHealth(playerid, 0):
    }
}



Re: how can i make /kill like not for wanted player help - TyThaBomb - 25.06.2012

Quote:
Originally Posted by Kindred
Посмотреть сообщение
pawn Код:
dcmd_kill(playerid,params[])
{
    if(GetPlayerWantedLevel(playerid) >= 1) return SendClientMessage(playerid, -1, "You are wanted, you cannot kill yourself!");
    SetPlayerHealth(playerid, 0);
    SendClientMessage(playerid, -1, "You killed yourself!");
    return 1;
}
Here. This prevents people with a wanted level to /kill.

Out of three of these posts, this is the most efficient way to do this. It has less lines and looks better.
Sure it's probably the most 'efficient', but for new-er scripters, mine would most likely be the easiest to read and comprehend.


Re: how can i make /kill like not for wanted player help - [KHK]Khalid - 25.06.2012

Use GetPlayerWantedLevel. Like this:

pawn Код:
if(GetPlayerWantedLevel(playerid) == 0) // if the player's wanted level equals to zero
{
    // kill
    SetPlayerHealth(playerid, -9.999999);
    return 1;
}
else
{
    // if it's something else
    SendClientMessage(playerid, -1, "You're wanted and cannot use this command!");
}



Re: how can i make /kill like not for wanted player help - UserName31 - 25.06.2012

omg thanks all you guys i learn different kind of way thanks all of yaa 5 start yaa