[Tutorial] Kill/heal command
#1

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.
  1. playerid The ID of the player to set the health of.
  2. 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;
}
Reply


Messages In This Thread
Kill/heal command - by Twizted - 15.07.2013, 11:21
Re: Kill/heal command - by Chrisis - 15.07.2013, 15:42
Re: Kill/heal command - by doreto - 15.07.2013, 15:47
Re: Kill/heal command - by Twizted - 15.07.2013, 16:00
Re: Kill/heal command - by x96664 - 16.07.2013, 07:08
Re: Kill/heal command - by SwisherSweet - 16.07.2013, 08:56
Re: Kill/heal command - by Nahin - 19.07.2013, 18:23
Re: Kill/heal command - by BigGroter - 20.07.2013, 00:49
Re : Re: Kill/heal command - by Garwan50 - 23.07.2013, 18:57

Forum Jump:


Users browsing this thread: 3 Guest(s)