diff --git a/.gitignore b/.gitignore index fa4bc3171..b14021e9d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ prisma/Studio/ *.sublime-project *.sublime-workspace # Visual Studio -*.wsuo \ No newline at end of file +*.wsuo +VSWorkspaceState.json \ No newline at end of file diff --git a/docs/scripting/functions/SetPlayerRaceCheckpoint.md b/docs/scripting/functions/SetPlayerRaceCheckpoint.md index 7a0753e68..30b17f75e 100644 --- a/docs/scripting/functions/SetPlayerRaceCheckpoint.md +++ b/docs/scripting/functions/SetPlayerRaceCheckpoint.md @@ -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 @@ -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); + } } ``` @@ -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). diff --git a/docs/scripting/resources/race-checkpoint-types.md b/docs/scripting/resources/race-checkpoint-types.md new file mode 100644 index 000000000..91c72f8a7 --- /dev/null +++ b/docs/scripting/resources/race-checkpoint-types.md @@ -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) |