Skip to content

Commit

Permalink
Merge pull request #813 from adib-yg/master
Browse files Browse the repository at this point in the history
Update pickup docs and add new pickup docs
  • Loading branch information
adib-yg authored Jan 7, 2024
2 parents 7580266 + 834b832 commit 6ed5f66
Show file tree
Hide file tree
Showing 38 changed files with 1,781 additions and 30 deletions.
55 changes: 55 additions & 0 deletions docs/scripting/callbacks/OnPickupStreamIn.md
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.
55 changes: 55 additions & 0 deletions docs/scripting/callbacks/OnPickupStreamOut.md
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.
19 changes: 13 additions & 6 deletions docs/scripting/callbacks/OnPlayerPickUpPickup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ tags: ["player"]

This callback is called when a player picks up a pickup created with [CreatePickup](../functions/CreatePickup).

| Name | Description |
| -------- | ----------------------------------------------- |
| playerid | The ID of the player that picked up the pickup. |
| pickupid | The ID of the pickup, returned by [CreatePickup](../functions/CreatePickup)|
| Name | Description |
|----------|-----------------------------------------------------------------------------|
| playerid | The ID of the player that picked up the pickup. |
| pickupid | The ID of the pickup, returned by [CreatePickup](../functions/CreatePickup) |

## Returns

Expand All @@ -25,8 +25,8 @@ new pickup_Health;

public OnGameModeInit()
{
pickup_Cash = CreatePickup(1274, 2, 0.0, 0.0, 9.0);
pickup_Health = CreatePickup(1240, 2, 0.0, 0.0, 9.0);
pickup_Cash = CreatePickup(1274, 2, 2009.8658, 1220.0293, 10.8206, -1);
pickup_Health = CreatePickup(1240, 2, 2009.8474, 1218.0459, 10.8175, -1);
return 1;
}

Expand All @@ -44,6 +44,13 @@ public OnPlayerPickUpPickup(playerid, pickupid)
}
```
## Related Callbacks
The following callbacks might be useful, as they're related to this callback in one way or another.
- [OnPickupStreamIn](OnPickupStreamIn): Called when a pickup enters the visual range of a player.
- [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.
Expand Down
59 changes: 59 additions & 0 deletions docs/scripting/callbacks/OnPlayerPickUpPlayerPickup.md
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.
55 changes: 55 additions & 0 deletions docs/scripting/callbacks/OnPlayerPickupStreamIn.md
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.
55 changes: 55 additions & 0 deletions docs/scripting/callbacks/OnPlayerPickupStreamOut.md
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.
21 changes: 10 additions & 11 deletions docs/scripting/functions/AddStaticPickup.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
---
title: AddStaticPickup
description: This function adds a 'static' pickup to the game.
tags: []
tags: ["pickup"]
---

## Description

This function adds a 'static' pickup to the game. These pickups support weapons, health, armor etc., with the ability to function without scripting them (weapons/health/armor will be given automatically).

| Name | Description |
| ----------------------------------- | ----------------------------------------------------------------------------------- |
| Name | Description |
|----------------------------------|-------------------------------------------------------------------------------------|
| [model](../resources/pickupids) | The model of the pickup. |
| [type](../resources/pickuptypes) | The pickup type. Determines how the pickup responds when picked up. |
| Float:X | The X coordinate to create the pickup at. |
| Float:Y | The Y coordinate to create the pickup at. |
| Float:Z | The Z coordinate to create the pickup at. |
| virtualworld | The virtual world ID to put tht pickup in. Use -1 to show the pickup in all worlds. |
| Float:x | The X coordinate to create the pickup at. |
| Float:y | The Y coordinate to create the pickup at. |
| Float:z | The Z coordinate to create the pickup at. |
| virtualWorld | The virtual world ID to put tht pickup in. Use -1 to show the pickup in all worlds. |

## Returns

1 if the pickup is successfully created.
**1** - if the pickup is successfully created.

0 if failed to create.
**0** - if failed to create.

## Examples

Expand All @@ -42,12 +42,11 @@ public OnGameModeInit()

:::tip

This function doesn't return a pickup ID that you can use in, for example, OnPlayerPickUpPickup. Use CreatePickup if you'd like to assign IDs.
This function doesn't return a pickup ID that you can use in, for example, OnPlayerPickUpPickup. Use [CreatePickup](CreatePickup) if you'd like to assign IDs.

:::

## Related Functions

- [CreatePickup](CreatePickup): Create a pickup.
- [DestroyPickup](DestroyPickup): Destroy a pickup.
- [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup): Called when a player picks up a pickup.
Loading

0 comments on commit 6ed5f66

Please sign in to comment.