05.05.2012, 18:31
CheckPoints:
Checkpoints are the red cylinders you may see around many servers. They are quite useful for jobs, missions, or events. There are two types of checkpoints, one being race checkpoints and the other is normal checkpoints. Race checkpoints are large checkpoints, they are either a very large cylinder, used in GTA:San Andreas Single Player for street races, or large circle checkpoints, used in GTA:San Andreas Single Player for airplane license missions. Then there are normal checkpoints, usually a small cylinder that can be narrow or wide, used in GTA:San Andreas Single Player for food stores, barber shops, etc.
Race Checkpoints:
Creating Race Checkpoints is with the following function.
Removing, or disabling, Race Checkpoints is with the following function.
Normal Checkpoints:
Creating Normal Checkpoints is with the following function.
Removing, or disabling, Normal Checkpoints is with the following function.
The Code:
Now that we know what the two types of checkpoints are in SAMP and how to create and remove both of them, we can continue. We began by finding the following function:
Inside the function we choose what kind of checkpoint we are planning to make, so lets for now pick a normal checkpoint:
When creating the checkpoint there are 5 parts, you first put the player's id, then their x, y, z coordinates, and finally the width of the cylinder checkpoint, in this case 5. The following checkpoint will be created at coordinates 0, 0, 0, when the player is spawned. Now let us say we want to make it so when the player enters this checkpoint, they should get a weapon, so we find the following function:
This function does as it says, when the player enters a checkpoint, it does something. But wait, how does it know what checkpoint? Well we have to identify it, we can do this by finding out if the player is near a certain coordinates, that we created our checkpoint at, an example:
Now the player will enter the checkpoint we created, once they enter the script will check if they are in the range of 0, 0, 0, and then give them a weapon with 9999 ammo, and then remove our checkpoint. This is one example of what a checkpoint can do, but it can be changed to give Armour, Health, or even kill the player.
Checkpoints are the red cylinders you may see around many servers. They are quite useful for jobs, missions, or events. There are two types of checkpoints, one being race checkpoints and the other is normal checkpoints. Race checkpoints are large checkpoints, they are either a very large cylinder, used in GTA:San Andreas Single Player for street races, or large circle checkpoints, used in GTA:San Andreas Single Player for airplane license missions. Then there are normal checkpoints, usually a small cylinder that can be narrow or wide, used in GTA:San Andreas Single Player for food stores, barber shops, etc.
Race Checkpoints:
Creating Race Checkpoints is with the following function.
pawn Code:
SetPlayerRaceCheckpoint();
pawn Code:
DisablePlayerRaceCheckpoint();
Creating Normal Checkpoints is with the following function.
pawn Code:
SetPlayerCheckpoint();
pawn Code:
DisablePlayerCheckpoint();
Now that we know what the two types of checkpoints are in SAMP and how to create and remove both of them, we can continue. We began by finding the following function:
pawn Code:
public OnPlayerSpawn(playerid)
pawn Code:
public OnPlayerSpawn(playerid)
{
SetPlayerCheckpoint(playerid, 0, 0, 0, 5);
return 1;
}
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 5, 0, 0, 0))
{
GivePlayerWeapon(playerid, 24, 9999);
DisablePlayerCheckpoint(playerid);
}
return 1;
}