SetPlayerCheckpoint
From SA-MP Wiki
(Difference between revisions)
Revision as of 07:55, 31 January 2013 Smithy (Talk | contribs) ← Previous diff |
Revision as of 18:02, 5 February 2014 Connor Mead (Talk | contribs) Next diff → |
||
Line 1: | Line 1: | ||
{{Scripting}} | {{Scripting}} | ||
- | {{Title}} | ||
{{Description|Sets a checkpoint (red circle) for a player. Also shows a red blip on the radar.}} | {{Description|Sets a checkpoint (red circle) for a player. Also shows a red blip on the radar.}} | ||
Line 53: | Line 52: | ||
[[Category:Scripting Functions]] | [[Category:Scripting Functions]] | ||
+ | [[fr:SetPlayerCheckpoint]] | ||
[[ru:SetPlayerCheckpoint]] | [[ru:SetPlayerCheckpoint]] |
Revision as of 18:02, 5 February 2014
Description:
Sets a checkpoint (red circle) for a player. Also shows a red blip on the radar.
(playerid, Float:x, Float:y, Float:z, Float:size)
playerid | The ID of the player to set the checkpoint of |
Float:x | The X coordinate to set the checkpoint at |
Float:y | The Y coordinate to set the checkpoint at |
Float:z | The Z coordinate to set the checkpoint at |
Float:size | The size of the checkpoint |
Return Values:
This function does not return any specific values.
Warning | Known Bug(s): Checkpoints created on server-created objects (CreateObject/CreatePlayerObject) will appear down on the 'real' ground, but will still function correctly. There is no fix available for this issue. A pickup can be used instead. |
Important | Checkpoints are asynchronous, meaning only one can be shown at a time. To 'stream' checkpoints (only show them when players are close enough), use a checkpoint streamer. |
Note | If you would like to be able to get the position of a checkpoint, you can use this include: http://forum.sa-mp.com/showthread.php?t=251483 |
// In this example the player's checkpoint will be set when they spawn. // On entering the checkpoint they will receive $1000 and the checkpoint will be disabled. public OnPlayerSpawn(playerid) { SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0); return 1; } public OnPlayerEnterCheckpoint(playerid) { GivePlayerMoney(playerid, 1000); DisablePlayerCheckpoint(playerid); return 1; }
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- DisablePlayerCheckpoint: Disable the player's current checkpoint.
- IsPlayerInCheckpoint: Check if a player is in a checkpoint.
- SetPlayerRaceCheckpoint: Create a race checkpoint for a player.
- DisablePlayerRaceCheckpoint: Disable the player's current race checkpoint.
- IsPlayerInRaceCheckpoint: Check if a player is in a race checkpoint.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnPlayerEnterCheckpoint: Called when a player enters a checkpoint.
- OnPlayerLeaveCheckpoint: Called when a player leaves a checkpoint.
- OnPlayerEnterRaceCheckpoint: Called when a player enters a race checkpoint.
- OnPlayerLeaveRaceCheckpoint: Called when a player leaves a race checkpoint.