Skip to content

Commit

Permalink
Merge pull request #811 from adib-yg/master
Browse files Browse the repository at this point in the history
Update race checkpoint docs and add document for race checkpoint types
  • Loading branch information
adib-yg committed Jan 6, 2024
2 parents b86b091 + 6032204 commit ec95a75
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ prisma/Studio/
*.sublime-project
*.sublime-workspace
# Visual Studio
*.wsuo
*.wsuo
VSWorkspaceState.json
60 changes: 37 additions & 23 deletions docs/scripting/functions/SetPlayerRaceCheckpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ tags: ["player", "checkpoint", "racecheckpoint"]

Creates a race checkpoint. When the player enters it, the OnPlayerEnterRaceCheckpoint callback is called.

| Name | Description |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| playerid | The ID of the player to set the checkpoint for |
| type | Type of checkpoint.0-Normal, 1-Finish, 2-Nothing(Only the checkpoint without anything on it), 3-Air normal, 4-Air finish, 5-Air (rotates and stops), 6-Air (increases, decreases and disappears), 7-Air (swings down and up), 8-Air (swings up and down) |
| Float:x | X-Coordinate |
| Float:y | Y-Coordinate |
| Float:z | Z-Coordinate |
| Float:nextx | X-Coordinate of the next point, for the arrow facing direction |
| Float:nexty | Y-Coordinate of the next point, for the arrow facing direction |
| Float:nextz | Z-Coordinate of the next point, for the arrow facing direction |
| Float:size | Size (diameter) of the checkpoint |
| Name | Description |
|---------------|----------------------------------------------------------------|
| playerid | The ID of the player to set the checkpoint for |
| CP_TYPE:type | [Type of race checkpoint](../resources/race-checkpoint-types) |
| Float:centreX | X-Coordinate |
| Float:centreY | Y-Coordinate |
| Float:centreZ | Z-Coordinate |
| Float:nextX | X-Coordinate of the next point, for the arrow facing direction |
| Float:nextY | Y-Coordinate of the next point, for the arrow facing direction |
| Float:nextZ | Z-Coordinate of the next point, for the arrow facing direction |
| Float:radius | Size (diameter) of the checkpoint |

## Returns

Expand All @@ -28,22 +28,32 @@ Creates a race checkpoint. When the player enters it, the OnPlayerEnterRaceCheck

## Examples

```c
SetPlayerRaceCheckpoint(playerid, CP_TYPE_GROUND_NORMAL, 644.3091, 1767.0223, 4.9970, 650.6734, 1812.0367, 4.9970, 3.0);
```
Another example:
```c
//from Yagu's race filterscript, (c) by Yagu
public SetRaceCheckpoint(playerid, Airrace, target, next)
{
if (next == -1 && Airrace == 0)
SetPlayerRaceCheckpoint(playerid,1,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
0.0,0.0,0.0,CPsize);
else if (next == -1 && Airrace == 1)
SetPlayerRaceCheckpoint(playerid,4,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
0.0,0.0,0.0,CPsize);
else if (Airrace == 1)
SetPlayerRaceCheckpoint(playerid,3,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
RaceCheckpoints[next][0],RaceCheckpoints[next][1],RaceCheckpoints[next][2],CPsize);
else
SetPlayerRaceCheckpoint(playerid,0,RaceCheckpoints[target][0],RaceCheckpoints[target][1],RaceCheckpoints[target][2],
RaceCheckpoints[next][0],RaceCheckpoints[next][1],RaceCheckpoints[next][2],CPsize);
if (next == -1 && Airrace == 0)
{
SetPlayerRaceCheckpoint(playerid, CP_TYPE_GROUND_FINISH, RaceCheckpoints[target][0], RaceCheckpoints[target][1], RaceCheckpoints[target][2], 0.0, 0.0, 0.0, CPsize);
}
else if (next == -1 && Airrace == 1)
{
SetPlayerRaceCheckpoint(playerid, CP_TYPE_AIR_FINISH, RaceCheckpoints[target][0], RaceCheckpoints[target][1], RaceCheckpoints[target][2], 0.0, 0.0, 0.0, CPsize);
}
else if (Airrace == 1)
{
SetPlayerRaceCheckpoint(playerid, CP_TYPE_AIR_NORMAL, RaceCheckpoints[target][0], RaceCheckpoints[target][1], RaceCheckpoints[target][2], RaceCheckpoints[next][0], RaceCheckpoints[next][1], RaceCheckpoints[next][2], CPsize);
}
else
{
SetPlayerRaceCheckpoint(playerid, CP_TYPE_GROUND_NORMAL, RaceCheckpoints[target][0], RaceCheckpoints[target][1], RaceCheckpoints[target][2], RaceCheckpoints[next][0], RaceCheckpoints[next][1], RaceCheckpoints[next][2], CPsize);
}
}
```

Expand All @@ -68,3 +78,7 @@ Race checkpoints are asynchronous, meaning only one can be shown at a time. To '
- [OnPlayerLeaveCheckpoint](../callbacks/OnPlayerLeaveCheckpoint): Called when a player leaves a checkpoint.
- [OnPlayerEnterRaceCheckpoint](../callbacks/OnPlayerEnterRaceCheckpoint): Called when a player enters a race checkpoint.
- [OnPlayerLeaveRaceCheckpoint](../callbacks/OnPlayerLeaveRaceCheckpoint): Called when a player leaves a race checkpoint.

## Related Resources

- [Types of race checkpoints](../resources/race-checkpoint-types).
23 changes: 23 additions & 0 deletions docs/scripting/resources/race-checkpoint-types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Types Of Race Checkpoints
description: Race checkpoints definitions.
---

:::note

These definitions are used by [SetPlayerRaceCheckpoint](../functions/SetPlayerRaceCheckpoint).

:::

| Definition | Value | Description |
|-----------------------|-------|------------------------------------------------------|
| UNKNOWN_CP_TYPE | -1 | |
| CP_TYPE_GROUND_NORMAL | 0 | Normal |
| CP_TYPE_GROUND_FINISH | 1 | Finish |
| CP_TYPE_GROUND_EMPTY | 2 | Nothing (Only the checkpoint without anything on it) |
| CP_TYPE_AIR_NORMAL | 3 | Air normal |
| CP_TYPE_AIR_FINISH | 4 | Air finish |
| CP_TYPE_AIR_ROTATING | 5 | Air (rotates and stops) |
| CP_TYPE_AIR_STROBING | 6 | Air (increases, decreases and disappears) |
| CP_TYPE_AIR_SWINGING | 7 | Air (swings down and up) |
| CP_TYPE_AIR_BOBBING | 8 | Air (swings up and down) |

0 comments on commit ec95a75

Please sign in to comment.