Kill/heal command -
Twizted - 15.07.2013
Hey, how's everybody doing? In this
BEGINNER FRIENDLY tutorial, I will teach you
how to make a suicide command using ZCMD. For this tutorial, you pretty much need to know the basics of Pawno and you're ready to go.
________________________
Step 1. To make a suicide command, we're going to use ZCMD. You can use another command processor but I prefer using ZCMD. This is the format of ZCMD:
pawn Code:
COMMAND:mycommand(playerid, params[])
{
// Do something
return 1;
}
We'll need to change it to something like this:
pawn Code:
COMMAND:kill(playerid, params[])
{
// Do something
return 1;
}
Step 2. Now that we have the basic command, we'll need to set the player's health to 0, in order for him to die. For that, we'll use the
SetPlayerHealth function. This function has 2 parameters.
- playerid The ID of the player to set the health of.
- health The value to set the player's health to.
Let's insert the function in our code. For that, let's remove the comment from above ("// Do something") and replace it with our function.
pawn Code:
COMMAND:kill(playerid, params[])
{
SetPlayerHealth(playerid, 0);
return 1;
}
And there you have your /kill command.
________________________
Now, for our healing command, we'll use the same structure but instead of setting the player's health to 0, we'll set it to 100.
pawn Code:
COMMAND:heal(playerid, params[])
{
SetPlayerHealth(playerid, 100);
return 1;
}
Re: Kill/heal command -
Chrisis - 15.07.2013
repeated many many times ! we don't need old tutorials to be doubleposted ! people can just visite old threads that have Heal / Kill
Re: Kill/heal command -
doreto - 15.07.2013
There are milions tutorials about those two commands , why do you thing your is different from others ?
Re: Kill/heal command -
Twizted - 15.07.2013
Yeah, most of these don't explain what to do in depth, simply give away a code.
Re: Kill/heal command -
x96664 - 16.07.2013
You could add messages to notify them like:
pawn Code:
SendClientMessage(playerid,-1,"You have committed a suicide!");
//and
SendClientMessage(playerid,-1,"You have healed yourself!");
And instead of writing COMMAND you may write CMD.
Re: Kill/heal command -
SwisherSweet - 16.07.2013
Wtf is this playerid is the id of a player so basically you told newbie scripters that you would have to do this
SetPlayerHealth(playerid0,0);
SetPlayerHealth(playerid1,100);
Now all we need is some newbies asking for help in the
Scripting help section because you confused them what playerid really means
Playerid basically just means player...
And dont they have the same cmd in the wiki
Re: Kill/heal command -
Nahin - 19.07.2013
How do i set to so that it is restricted to an admin level?
Re: Kill/heal command -
BigGroter - 20.07.2013
Quote:
Originally Posted by Nahin
How do i set to so that it is restricted to an admin level?
|
pawn Code:
COMMAND:heal(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "This command is only for RCON admins.");
SetPlayerHealth(playerid, 100);
return 1;
}
Re : Re: Kill/heal command -
Garwan50 - 23.07.2013
Quote:
Originally Posted by zeeshanaayan07
Thanks for sharing a great information
|
Yes, it helped me a lot