Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update race checkpoint docs and add document for race checkpoint types #811

Merged
merged 3 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) |
Loading