-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #813 from adib-yg/master
Update pickup docs and add new pickup docs
- Loading branch information
Showing
38 changed files
with
1,781 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: OnPickupStreamIn | ||
description: This callback is called when a pickup enters the visual range of a player. | ||
tags: ["player"] | ||
--- | ||
|
||
<VersionWarn version='omp v1.1.0.2612' /> | ||
|
||
## Description | ||
|
||
This callback is called when a pickup enters the visual range of a player. | ||
|
||
| Name | Description | | ||
|----------|-----------------------------------------------------------------------------| | ||
| pickupid | The ID of the pickup, returned by [CreatePickup](../functions/CreatePickup) | | ||
| playerid | The ID of the player that pickup enters the visual range. | | ||
|
||
## Returns | ||
|
||
It is always called first in gamemode. | ||
|
||
## Examples | ||
|
||
```c | ||
new g_PickupHealth; | ||
|
||
public OnGameModeInit() | ||
{ | ||
g_PickupHealth = CreatePickup(1240, 2, 2009.8474, 1218.0459, 10.8175); | ||
return 1; | ||
} | ||
|
||
public OnPickupStreamIn(pickupid, playerid) | ||
{ | ||
if (pickupid == g_PickupHealth) | ||
{ | ||
printf("g_PickupHealth is streamed in for player id %d", playerid); | ||
} | ||
return 1; | ||
} | ||
``` | ||
## Related Callbacks | ||
The following callbacks might be useful, as they're related to this callback in one way or another. | ||
- [OnPlayerPickUpPickup](OnPlayerPickUpPickup): Called when a player picks up a pickup. | ||
- [OnPickupStreamOut](OnPickupStreamOut): Called when a pickup leaves the visual range of a player. | ||
## Related Functions | ||
The following functions might be useful, as they're related to this callback in one way or another. | ||
- [CreatePickup](../functions/CreatePickup): Create a pickup. | ||
- [DestroyPickup](../functions/DestroyPickup): Destroy a pickup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: OnPickupStreamOut | ||
description: This callback is called when a pickup leaves the visual range of a player. | ||
tags: ["player"] | ||
--- | ||
|
||
<VersionWarn version='omp v1.1.0.2612' /> | ||
|
||
## Description | ||
|
||
This callback is called when a pickup leaves the visual range of a player. | ||
|
||
| Name | Description | | ||
|----------|-----------------------------------------------------------------------------| | ||
| pickupid | The ID of the pickup, returned by [CreatePickup](../functions/CreatePickup) | | ||
| playerid | The ID of the player that pickup leaves the visual range. | | ||
|
||
## Returns | ||
|
||
It is always called first in gamemode. | ||
|
||
## Examples | ||
|
||
```c | ||
new g_PickupHealth; | ||
|
||
public OnGameModeInit() | ||
{ | ||
g_PickupHealth = CreatePickup(1240, 2, 2009.8474, 1218.0459, 10.8175); | ||
return 1; | ||
} | ||
|
||
public OnPickupStreamOut(pickupid, playerid) | ||
{ | ||
if (pickupid == g_PickupHealth) | ||
{ | ||
printf("g_PickupHealth is streamed out for player id %d", playerid); | ||
} | ||
return 1; | ||
} | ||
``` | ||
## Related Callbacks | ||
The following callbacks might be useful, as they're related to this callback in one way or another. | ||
- [OnPlayerPickUpPickup](OnPlayerPickUpPickup): Called when a player picks up a pickup. | ||
- [OnPickupStreamIn](OnPickupStreamIn): Called when a pickup enters the visual range of a player. | ||
## Related Functions | ||
The following functions might be useful, as they're related to this callback in one way or another. | ||
- [CreatePickup](../functions/CreatePickup): Create a pickup. | ||
- [DestroyPickup](../functions/DestroyPickup): Destroy a pickup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
title: OnPlayerPickUpPlayerPickup | ||
description: This callback is called when a player picks up a player-pickup created with CreatePlayerPickup. | ||
tags: ["player", "pickup", "playerpickup"] | ||
--- | ||
|
||
## Description | ||
|
||
This callback is called when a player picks up a player-pickup created with [CreatePlayerPickup](../functions/CreatePlayerPickup). | ||
|
||
| Name | Description | | ||
|----------|------------------------------------------------------------------------------------------------| | ||
| playerid | The ID of the player that picked up the player-pickup. | | ||
| pickupid | The ID of the player-pickup, returned by [CreatePlayerPickup](../functions/CreatePlayerPickup) | | ||
|
||
## Returns | ||
|
||
It is always called first in gamemode. | ||
|
||
## Examples | ||
|
||
```c | ||
new player_pickup_Cash[MAX_PLAYERS]; | ||
new player_pickup_Health[MAX_PLAYERS]; | ||
|
||
public OnPlayerConnect(playerid) | ||
{ | ||
player_pickup_Cash[playerid] = CreatePlayerPickup(playerid, 1274, 2, 2009.8658, 1220.0293, 10.8206, -1); | ||
player_pickup_Health[playerid] = CreatePlayerPickup(playerid, 1240, 2, 2009.8474, 1218.0459, 10.8175, -1); | ||
return 1; | ||
} | ||
|
||
public OnPlayerPickUpPlayerPickup(playerid, pickupid) | ||
{ | ||
if (pickupid == player_pickup_Cash[playerid]) | ||
{ | ||
GivePlayerMoney(playerid, 1000); | ||
} | ||
else if (pickupid == player_pickup_Health[playerid]) | ||
{ | ||
SetPlayerHealth(playerid, 100.0); | ||
} | ||
return 1; | ||
} | ||
``` | ||
## Related Callbacks | ||
The following callbacks might be useful, as they're related to this callback in one way or another. | ||
- [OnPlayerPickupStreamIn](OnPlayerPickupStreamIn): Called when a player-pickup enters the visual range of the player. | ||
- [OnPlayerPickupStreamOut](OnPlayerPickupStreamOut): Called when a player-pickup leaves the visual range of the player. | ||
## Related Functions | ||
The following functions might be useful, as they're related to this callback in one way or another. | ||
- [CreatePlayerPickup](../functions/CreatePlayerPickup): Creates a pickup which will be visible to only one player. | ||
- [DestroyPlayerPickup](../functions/DestroyPlayerPickup): Destroy a player-pickup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: OnPlayerPickupStreamIn | ||
description: This callback is called when a player-pickup enters the visual range of the player. | ||
tags: ["player", "pickup", "playerpickup"] | ||
--- | ||
|
||
<VersionWarn version='omp v1.1.0.2612' /> | ||
|
||
## Description | ||
|
||
This callback is called when a player-pickup enters the visual range of the player. | ||
|
||
| Name | Description | | ||
|----------|------------------------------------------------------------------------------------------------| | ||
| pickupid | The ID of the player-pickup, returned by [CreatePlayerPickup](../functions/CreatePlayerPickup) | | ||
| playerid | The ID of the player that player-pickup enters the visual range. | | ||
|
||
## Returns | ||
|
||
It is always called first in gamemode. | ||
|
||
## Examples | ||
|
||
```c | ||
new g_PlayerPickupHealth[MAX_PLAYERS]; | ||
|
||
public OnPlayerConnect(playerid) | ||
{ | ||
g_PlayerPickupHealth[playerid] = CreatePlayerPickup(playerid, 1240, 2, 2009.8474, 1218.0459, 10.8175); | ||
return 1; | ||
} | ||
|
||
public OnPlayerPickupStreamIn(pickupid, playerid) | ||
{ | ||
if (pickupid == g_PlayerPickupHealth[playerid]) | ||
{ | ||
printf("g_PlayerPickupHealth is streamed in for player id %d", playerid); | ||
} | ||
return 1; | ||
} | ||
``` | ||
## Related Callbacks | ||
The following callbacks might be useful, as they're related to this callback in one way or another. | ||
- [OnPlayerPickUpPlayerPickup](OnPlayerPickUpPlayerPickup): Called when a player picks up a player-pickup. | ||
- [OnPlayerPickupStreamOut](OnPlayerPickupStreamOut): Called when a player-pickup leaves the visual range of the player. | ||
## Related Functions | ||
The following functions might be useful, as they're related to this callback in one way or another. | ||
- [CreatePlayerPickup](../functions/CreatePlayerPickup): Creates a pickup which will be visible to only one player. | ||
- [DestroyPlayerPickup](../functions/DestroyPlayerPickup): Destroy a player-pickup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
title: OnPlayerPickupStreamOut | ||
description: This callback is called when a player-pickup leaves the visual range of the player. | ||
tags: ["player", "pickup", "playerpickup"] | ||
--- | ||
|
||
<VersionWarn version='omp v1.1.0.2612' /> | ||
|
||
## Description | ||
|
||
This callback is called when a player-pickup leaves the visual range of the player. | ||
|
||
| Name | Description | | ||
|----------|------------------------------------------------------------------------------------------------| | ||
| pickupid | The ID of the player-pickup, returned by [CreatePlayerPickup](../functions/CreatePlayerPickup) | | ||
| playerid | The ID of the player that player-pickup leaves the visual range. | | ||
|
||
## Returns | ||
|
||
It is always called first in gamemode. | ||
|
||
## Examples | ||
|
||
```c | ||
new g_PlayerPickupHealth[MAX_PLAYERS]; | ||
|
||
public OnPlayerConnect(playerid) | ||
{ | ||
g_PlayerPickupHealth[playerid] = CreatePlayerPickup(playerid, 1240, 2, 2009.8474, 1218.0459, 10.8175); | ||
return 1; | ||
} | ||
|
||
public OnPlayerPickupStreamOut(pickupid, playerid) | ||
{ | ||
if (pickupid == g_PlayerPickupHealth[playerid]) | ||
{ | ||
printf("g_PlayerPickupHealth is streamed out for player id %d", playerid); | ||
} | ||
return 1; | ||
} | ||
``` | ||
## Related Callbacks | ||
The following callbacks might be useful, as they're related to this callback in one way or another. | ||
- [OnPlayerPickUpPlayerPickup](OnPlayerPickUpPlayerPickup): Called when a player picks up a player-pickup. | ||
- [OnPlayerPickupStreamIn](OnPlayerPickupStreamIn): Called when a player-pickup enters the visual range of the player. | ||
## Related Functions | ||
The following functions might be useful, as they're related to this callback in one way or another. | ||
- [CreatePlayerPickup](../functions/CreatePlayerPickup): Creates a pickup which will be visible to only one player. | ||
- [DestroyPlayerPickup](../functions/DestroyPlayerPickup): Destroy a player-pickup. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.