diff --git a/docs/scripting/callbacks/OnPickupStreamIn.md b/docs/scripting/callbacks/OnPickupStreamIn.md new file mode 100644 index 000000000..e77c00b9e --- /dev/null +++ b/docs/scripting/callbacks/OnPickupStreamIn.md @@ -0,0 +1,55 @@ +--- +title: OnPickupStreamIn +description: This callback is called when a pickup enters the visual range of a player. +tags: ["player"] +--- + + + +## 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. diff --git a/docs/scripting/callbacks/OnPickupStreamOut.md b/docs/scripting/callbacks/OnPickupStreamOut.md new file mode 100644 index 000000000..74d840512 --- /dev/null +++ b/docs/scripting/callbacks/OnPickupStreamOut.md @@ -0,0 +1,55 @@ +--- +title: OnPickupStreamOut +description: This callback is called when a pickup leaves the visual range of a player. +tags: ["player"] +--- + + + +## 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. diff --git a/docs/scripting/callbacks/OnPlayerPickUpPickup.md b/docs/scripting/callbacks/OnPlayerPickUpPickup.md index f1fce78dc..3ea748532 100644 --- a/docs/scripting/callbacks/OnPlayerPickUpPickup.md +++ b/docs/scripting/callbacks/OnPlayerPickUpPickup.md @@ -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 @@ -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; } @@ -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. diff --git a/docs/scripting/callbacks/OnPlayerPickUpPlayerPickup.md b/docs/scripting/callbacks/OnPlayerPickUpPlayerPickup.md new file mode 100644 index 000000000..739d84e4a --- /dev/null +++ b/docs/scripting/callbacks/OnPlayerPickUpPlayerPickup.md @@ -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. diff --git a/docs/scripting/callbacks/OnPlayerPickupStreamIn.md b/docs/scripting/callbacks/OnPlayerPickupStreamIn.md new file mode 100644 index 000000000..6f37fdcf2 --- /dev/null +++ b/docs/scripting/callbacks/OnPlayerPickupStreamIn.md @@ -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"] +--- + + + +## 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. diff --git a/docs/scripting/callbacks/OnPlayerPickupStreamOut.md b/docs/scripting/callbacks/OnPlayerPickupStreamOut.md new file mode 100644 index 000000000..eba71ca62 --- /dev/null +++ b/docs/scripting/callbacks/OnPlayerPickupStreamOut.md @@ -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"] +--- + + + +## 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. diff --git a/docs/scripting/functions/AddStaticPickup.md b/docs/scripting/functions/AddStaticPickup.md index 4a89d531c..c880fe114 100644 --- a/docs/scripting/functions/AddStaticPickup.md +++ b/docs/scripting/functions/AddStaticPickup.md @@ -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 @@ -42,7 +42,7 @@ 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. ::: @@ -50,4 +50,3 @@ This function doesn't return a pickup ID that you can use in, for example, OnPla - [CreatePickup](CreatePickup): Create a pickup. - [DestroyPickup](DestroyPickup): Destroy a pickup. -- [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup): Called when a player picks up a pickup. diff --git a/docs/scripting/functions/CreatePickup.md b/docs/scripting/functions/CreatePickup.md index e69d7ea18..cfd402dac 100644 --- a/docs/scripting/functions/CreatePickup.md +++ b/docs/scripting/functions/CreatePickup.md @@ -1,21 +1,21 @@ --- title: CreatePickup description: This function does exactly the same as AddStaticPickup, except it returns a pickup ID which can be used to destroy it afterwards and be tracked using OnPlayerPickUpPickup. -tags: [] +tags: ["pickup"] --- ## Description This function does exactly the same as AddStaticPickup, except it returns a pickup ID which can be used to destroy it afterwards and be tracked using OnPlayerPickUpPickup. -| 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 of the pickup. Use -1 to make the pickup show 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 of the pickup. Use -1 to make the pickup show in all worlds. | ## Returns @@ -56,4 +56,27 @@ Known Bug(s): Pickups that have a X or Y lower than -4096.0 or bigger than 4096. - [AddStaticPickup](AddStaticPickup): Add a static pickup. - [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. + +## Related Callbacks + +The following callbacks might be useful, as they're related to this function. + - [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup): Called when a player picks up a pickup. +- [OnPickupStreamIn](../callbacks/OnPickupStreamIn): Called when a pickup enters the visual range of a player. +- [OnPickupStreamOut](../callbacks/OnPickupStreamOut): Called when a pickup leaves the visual range of a player. diff --git a/docs/scripting/functions/CreatePlayerPickup.md b/docs/scripting/functions/CreatePlayerPickup.md new file mode 100644 index 000000000..c22b46c42 --- /dev/null +++ b/docs/scripting/functions/CreatePlayerPickup.md @@ -0,0 +1,73 @@ +--- +title: CreatePlayerPickup +description: Creates a pickup which will be visible to only one player. +tags: ["player", "pickup", "playerpickup"] +--- + +## Description + +Creates a pickup which will be visible to only one player. + +| Name | Description | +|----------------------------------|-----------------------------------------------------------------------------------| +| playerid | The ID of the player to create the pickup for. | +| [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 of the pickup. Use -1 to make the pickup show in all worlds. | + +## Returns + +The ID of the created player-pickup, -1 on failure (pickup max limit). + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; // Create a variable to store the player-pickup ID in + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1); + // Create an armour pickup and store the ID in 'PlayerPickup[playerid]' + return 1; +} +``` + +## Notes + +:::tip + +The only type of pickup that can be picked up from inside a vehicle is 14 (except for special pickups such as bribes). Pickups are shown to, and can be picked up by all players. It is possible that if DestroyPlayerPickup() is used when a pickup is picked up, more than one player can pick up the pickup, due to lag. This can be circumvented through the use of variables. Certain pickup types come with 'automatic responses', for example using an M4 model in the pickup will automatically give the player the weapon and some ammo. For fully scripted pickups, type 1 should be used. + +::: + +:::warning + +Known Bug(s): Pickups that have a X or Y lower than -4096.0 or bigger than 4096.0 won't show up and won't trigger OnPlayerPickUpPlayerPickup either. + +::: + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. + +## Related Callbacks + +The following callbacks might be useful, as they're related to this function. + +- [OnPlayerPickUpPlayerPickup](../callbacks/OnPlayerPickUpPlayerPickup): Called when a player picks up a player-pickup. +- [OnPlayerPickupStreamIn](../callbacks/OnPlayerPickupStreamIn): Called when a player-pickup enters the visual range of the player. +- [OnPlayerPickupStreamOut](../callbacks/OnPlayerPickupStreamOut): Called when a player-pickup leaves the visual range of the player. diff --git a/docs/scripting/functions/DestroyPickup.md b/docs/scripting/functions/DestroyPickup.md index 0c8a51125..0c369c46a 100644 --- a/docs/scripting/functions/DestroyPickup.md +++ b/docs/scripting/functions/DestroyPickup.md @@ -1,7 +1,7 @@ --- title: DestroyPickup description: Destroys a pickup created with CreatePickup. -tags: [] +tags: ["pickup"] --- ## Description @@ -19,14 +19,20 @@ This function does not return any specific values. ## Examples ```c +new g_PickupArmour; + // Create a pickup for armor. -pickup_armour = CreatePickup ( 1242, 2, 1503.3359, 1432.3585, 10.1191 ); +g_PickupArmour = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191); //some time later... -DestroyPickup(pickup_armour); +DestroyPickup(g_PickupArmour); ``` ## Related Functions - [CreatePickup](CreatePickup): Create a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. + +## Related Callbacks + - [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup): Called when a player picks up a pickup. diff --git a/docs/scripting/functions/DestroyPlayerPickup.md b/docs/scripting/functions/DestroyPlayerPickup.md new file mode 100644 index 000000000..826af735c --- /dev/null +++ b/docs/scripting/functions/DestroyPlayerPickup.md @@ -0,0 +1,43 @@ +--- +title: DestroyPlayerPickup +description: Destroys a player-pickup created with CreatePlayerPickup. +tags: ["player", "pickup", "playerpickup"] +--- + +## Description + +Destroys a player-pickup created with [CreatePlayerPickup](CreatePlayerPickup). + +| Name | Description | +|----------|--------------------------------------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup to destroy (returned by CreatePlayerPickup). | + +## Returns + +This function does not return any specific values. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; // Create a variable to store the player-pickup ID in + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1); + // Create an armour pickup and store the ID in 'PlayerPickup[playerid]' + return 1; +} + +//some time later... +DestroyPlayerPickup(playerid, PlayerPickup[playerid]); +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. + +## Related Callbacks + +- [OnPlayerPickUpPlayerPickup](../callbacks/OnPlayerPickUpPlayerPickup): Called when a player picks up a player-pickup. diff --git a/docs/scripting/functions/GetPickupModel.md b/docs/scripting/functions/GetPickupModel.md new file mode 100644 index 000000000..9c97c089a --- /dev/null +++ b/docs/scripting/functions/GetPickupModel.md @@ -0,0 +1,53 @@ +--- +title: GetPickupModel +description: Gets the model ID of a pickup. +tags: ["pickup"] +--- + + + +## Description + +Gets the model ID of a pickup. + +| Name | Description | +|----------|----------------------------------------------| +| pickupid | The ID of the pickup to get the model ID of. | + +## Returns + +Returns the model ID of the pickup. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + + new model = GetPickupModel(g_Pickup); + // model = 1239 + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/GetPickupPos.md b/docs/scripting/functions/GetPickupPos.md new file mode 100644 index 000000000..551595b4f --- /dev/null +++ b/docs/scripting/functions/GetPickupPos.md @@ -0,0 +1,63 @@ +--- +title: GetPickupPos +description: Gets the coordinates of a pickup. +tags: ["pickup"] +--- + + + +## Description + +Gets the coordinates of a pickup. + +| Name | Description | +|----------|---------------------------------------------------------------------------| +| pickupid | The ID of the pickup to get the position of. | +| &Float:x | A float variable in which to store the x coordinate, passed by reference. | +| &Float:y | A float variable in which to store the y coordinate, passed by reference. | +| &Float:z | A float variable in which to store the z coordinate, passed by reference. | + +## Returns + +This function does not return a specific value. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + + new + Float:x, + Float:y, + Float:z; + + GetPickupPos(g_Pickup, x, y, z); + // x = 1686.6160 + // y = 1455.4277 + // z = 10.7705 + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/GetPickupType.md b/docs/scripting/functions/GetPickupType.md new file mode 100644 index 000000000..e3c9b13c7 --- /dev/null +++ b/docs/scripting/functions/GetPickupType.md @@ -0,0 +1,55 @@ +--- +title: GetPickupType +description: Gets the type of a pickup. +tags: ["pickup"] +--- + + + +## Description + +Gets the type of a pickup. + +| Name | Description | +|----------|------------------------------------------| +| pickupid | The ID of the pickup to get the type of. | + +## Returns + +Returns the type of the pickup. + +**-1** if the pickup is not valid. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + + new type = GetPickupType(g_Pickup); + // type = 1 + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/GetPickupVirtualWorld.md b/docs/scripting/functions/GetPickupVirtualWorld.md new file mode 100644 index 000000000..f1bf0dade --- /dev/null +++ b/docs/scripting/functions/GetPickupVirtualWorld.md @@ -0,0 +1,53 @@ +--- +title: GetPickupVirtualWorld +description: Gets the virtual world ID of a pickup. +tags: ["pickup"] +--- + + + +## Description + +Gets the virtual world ID of a pickup. + +| Name | Description | +|----------|------------------------------------------------------| +| pickupid | The ID of the pickup to get the virtual world ID of. | + +## Returns + +Returns the virtual world ID of the pickup. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, 20); + + new worldid = GetPickupVirtualWorld(g_Pickup); + // worldid = 20 + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/GetPlayerPickupModel.md b/docs/scripting/functions/GetPlayerPickupModel.md new file mode 100644 index 000000000..8edf4b88d --- /dev/null +++ b/docs/scripting/functions/GetPlayerPickupModel.md @@ -0,0 +1,49 @@ +--- +title: GetPlayerPickupModel +description: Gets the model ID of a player-pickup. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Gets the model ID of a player-pickup. + +| Name | Description | +|----------|-----------------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup to get the model ID of. | + +## Returns + +Returns the model ID of the player-pickup. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1239, 1, 2010.0979, 1222.0642, 10.8206, -1); + + new model = GetPlayerPickupModel(playerid, PlayerPickup[playerid]); + // model = 1239 + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/GetPlayerPickupPos.md b/docs/scripting/functions/GetPlayerPickupPos.md new file mode 100644 index 000000000..5a4df7ed5 --- /dev/null +++ b/docs/scripting/functions/GetPlayerPickupPos.md @@ -0,0 +1,59 @@ +--- +title: GetPlayerPickupPos +description: Gets the coordinates of a player-pickup. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Gets the coordinates of a player-pickup. + +| Name | Description | +|----------|---------------------------------------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup to get the position of. | +| &Float:x | A float variable in which to store the x coordinate, passed by reference. | +| &Float:y | A float variable in which to store the y coordinate, passed by reference. | +| &Float:z | A float variable in which to store the z coordinate, passed by reference. | + +## Returns + +This function does not return a specific value. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1239, 1, 2010.0979, 1222.0642, 10.8206, -1); + + new + Float:x, + Float:y, + Float:z; + + GetPickupPos(g_Pickup, x, y, z); + // x = 2010.0979 + // y = 1222.0642 + // z = 10.8206 + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/GetPlayerPickupType.md b/docs/scripting/functions/GetPlayerPickupType.md new file mode 100644 index 000000000..58e3edb7e --- /dev/null +++ b/docs/scripting/functions/GetPlayerPickupType.md @@ -0,0 +1,51 @@ +--- +title: GetPlayerPickupType +description: Gets the type of a player-pickup. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Gets the type of a player-pickup. + +| Name | Description | +|----------|-------------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup to get the type of. | + +## Returns + +Returns the type of the player-pickup. + +**-1** if the player-pickup is not valid. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1239, 1, 2010.0979, 1222.0642, 10.8206, -1); + + new type = GetPlayerPickupType(playerid, PlayerPickup[playerid]); + // type = 1 + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/GetPlayerPickupVirtualWorld.md b/docs/scripting/functions/GetPlayerPickupVirtualWorld.md new file mode 100644 index 000000000..7c1965c1e --- /dev/null +++ b/docs/scripting/functions/GetPlayerPickupVirtualWorld.md @@ -0,0 +1,49 @@ +--- +title: GetPlayerPickupVirtualWorld +description: Gets the virtual world ID of a player-pickup. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Gets the virtual world ID of a player-pickup. + +| Name | Description | +|----------|-------------------------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup to get the virtual world ID of. | + +## Returns + +Returns the virtual world ID of the player-pickup. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1239, 1, 2010.0979, 1222.0642, 10.8206, 20); + + new worldid = GetPlayerPickupVirtualWorld(playerid, PlayerPickup[playerid]); + // worldid = 20 + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/HidePickupForPlayer.md b/docs/scripting/functions/HidePickupForPlayer.md new file mode 100644 index 000000000..12d147773 --- /dev/null +++ b/docs/scripting/functions/HidePickupForPlayer.md @@ -0,0 +1,57 @@ +--- +title: HidePickupForPlayer +description: Hides a pickup for a specific player. +tags: ["player", "pickup"] +--- + + + +## Description + +Hides a pickup for a specific player. + +| Name | Description | +|----------|----------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the pickup to hide for the player. | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + return 1; +} + +public OnPlayerSpawn(playerid) +{ + HidePickupForPlayer(playerid, g_Pickup); + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/IsPickupHiddenForPlayer.md b/docs/scripting/functions/IsPickupHiddenForPlayer.md new file mode 100644 index 000000000..8c3fc1aea --- /dev/null +++ b/docs/scripting/functions/IsPickupHiddenForPlayer.md @@ -0,0 +1,62 @@ +--- +title: IsPickupHiddenForPlayer +description: Checks if a pickup is hidden for a specific player. +tags: ["player", "pickup"] +--- + + + +## Description + +Checks if a pickup is hidden for a specific player. + +| Name | Description | +|----------|-----------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the pickup. | + +## Returns + +This function returns **true** if the pickup is hidden for the player, or **false** if it is not. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1); + return 1; +} + +public OnPlayerSpawn(playerid) +{ + HidePickupForPlayer(playerid, g_Pickup); + + if (IsPickupHiddenForPlayer(playerid, g_Pickup)) + { + // Do something + } + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/IsPickupStreamedIn.md b/docs/scripting/functions/IsPickupStreamedIn.md new file mode 100644 index 000000000..07c93e16a --- /dev/null +++ b/docs/scripting/functions/IsPickupStreamedIn.md @@ -0,0 +1,60 @@ +--- +title: IsPickupStreamedIn +description: Checks if a pickup is streamed in for a specific player. +tags: ["player", "pickup"] +--- + + + +## Description + +Checks if a pickup is streamed in for a specific player. + +| Name | Description | +|----------|-----------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the pickup. | + +## Returns + +This function returns **true** if the pickup is streamed in for the player, or **false** if it is not. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1); + return 1; +} + +public OnPlayerDeath(playerid, killerid, WEAPON:reason) +{ + if (IsPickupStreamedIn(playerid, g_Pickup)) + { + // Do something + } + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/IsPlayerPickupStreamedIn.md b/docs/scripting/functions/IsPlayerPickupStreamedIn.md new file mode 100644 index 000000000..82fe87fd4 --- /dev/null +++ b/docs/scripting/functions/IsPlayerPickupStreamedIn.md @@ -0,0 +1,56 @@ +--- +title: IsPlayerPickupStreamedIn +description: Checks if a player-pickup is streamed in for the player. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Checks if a player-pickup is streamed in for the player. + +| Name | Description | +|----------|------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup. | + +## Returns + +This function returns **true** if the player-pickup is streamed in for the player, or **false** if it is not. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; // Create a variable to store the player-pickup ID in + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1); + // Create an armour pickup and store the ID in 'PlayerPickup[playerid]' + return 1; +} + +public OnPlayerDeath(playerid, killerid, WEAPON:reason) +{ + if (IsPlayerPickupStreamedIn(playerid, PlayerPickup[playerid])) + { + // Do something + } + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/IsValidPickup.md b/docs/scripting/functions/IsValidPickup.md new file mode 100644 index 000000000..b53e5afb2 --- /dev/null +++ b/docs/scripting/functions/IsValidPickup.md @@ -0,0 +1,55 @@ +--- +title: IsValidPickup +description: Checks if a pickup is valid. +tags: ["pickup"] +--- + + + +## Description + +Checks if a pickup is valid. + +| Name | Description | +|----------|--------------------------------| +| pickupid | The ID of the pickup to check. | + +## Returns + +This function returns **true** if the pickup is valid, or **false** if it is not. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1242, 2, 1503.3359, 1432.3585, 10.1191, -1); + + if (IsValidPickup(g_Pickup)) + { + // Do something + } + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/IsValidPlayerPickup.md b/docs/scripting/functions/IsValidPlayerPickup.md new file mode 100644 index 000000000..6feba840e --- /dev/null +++ b/docs/scripting/functions/IsValidPlayerPickup.md @@ -0,0 +1,52 @@ +--- +title: IsValidPlayerPickup +description: Checks if a player-pickup is valid. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Checks if a player-pickup is valid. + +| Name | Description | +|----------|---------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup to check. | + +## Returns + +This function returns **true** if the player-pickup is valid, or **false** if it is not. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; // Create a variable to store the player-pickup ID in + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1); + // Create an armour pickup and store the ID in 'PlayerPickup[playerid]' + + if (IsValidPlayerPickup(playerid, PlayerPickup[playerid])) + { + // Do something + } + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/SetPickupForPlayer.md b/docs/scripting/functions/SetPickupForPlayer.md new file mode 100644 index 000000000..49f9231fc --- /dev/null +++ b/docs/scripting/functions/SetPickupForPlayer.md @@ -0,0 +1,64 @@ +--- +title: SetPickupForPlayer +description: Adjusts the pickup model, type, and position for a specific player. +tags: ["player", "pickup"] +--- + + + +## Description + +Adjusts the pickup model, type, and position for a specific player. + +| Name | Description | +|----------|-----------------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the pickup. | +| model | The [model](../resources/pickupids) to set. | +| type | The [pickup type](../resources/pickuptypes) to set. | +| Float:x | The x coordinate to set the pickup at. | +| Float:y | The y coordinate to set the pickup at. | +| Float:z | The z coordinate to set the pickup at. | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + return 1; +} + +public OnPlayerSpawn(playerid) +{ + new Float:x, Float:y, Float:z; + GetPlayerPos(playerid, x, y, z); + SetPickupForPlayer(playerid, g_Pickup, 1210, 2, x + 2.0, y + 2.0, z); + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. diff --git a/docs/scripting/functions/SetPickupModel.md b/docs/scripting/functions/SetPickupModel.md new file mode 100644 index 000000000..d220829d4 --- /dev/null +++ b/docs/scripting/functions/SetPickupModel.md @@ -0,0 +1,54 @@ +--- +title: SetPickupModel +description: Sets the model of a pickup. +tags: ["pickup"] +--- + + + +## Description + +Sets the model of a pickup. + +| Name | Description | +|--------------------|---------------------------------------------| +| pickupid | The ID of the pickup. | +| model | The [model](../resources/pickupids) to set. | +| bool:update = true | Update pickup for everyone. (true/false) | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + + SetPickupModel(g_Pickup, 1210); + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/SetPickupPos.md b/docs/scripting/functions/SetPickupPos.md new file mode 100644 index 000000000..bc82857cc --- /dev/null +++ b/docs/scripting/functions/SetPickupPos.md @@ -0,0 +1,56 @@ +--- +title: SetPickupPos +description: Sets the position of a pickup. +tags: ["pickup"] +--- + + + +## Description + +Sets the position of a pickup. + +| Name | Description | +|--------------------|------------------------------------------| +| pickupid | The ID of the pickup. | +| Float:x | The x coordinate to set the pickup at. | +| Float:y | The y coordinate to set the pickup at. | +| Float:z | The z coordinate to set the pickup at. | +| bool:update = true | Update pickup for everyone. (true/false) | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + + SetPickupPos(g_Pickup, 1958.5488, 1344.9137, 15.3613); + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/SetPickupType.md b/docs/scripting/functions/SetPickupType.md new file mode 100644 index 000000000..60ed18b07 --- /dev/null +++ b/docs/scripting/functions/SetPickupType.md @@ -0,0 +1,54 @@ +--- +title: SetPickupType +description: Sets the type of a pickup. +tags: ["pickup"] +--- + + + +## Description + +Sets the type of a pickup. + +| Name | Description | +|--------------------|-----------------------------------------------------| +| pickupid | The ID of the pickup. | +| type | The [pickup type](../resources/pickuptypes) to set. | +| bool:update = true | Update pickup for everyone. (true/false) | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + + SetPickupType(g_Pickup, 2); + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/SetPickupVirtualWorld.md b/docs/scripting/functions/SetPickupVirtualWorld.md new file mode 100644 index 000000000..28c5f2e90 --- /dev/null +++ b/docs/scripting/functions/SetPickupVirtualWorld.md @@ -0,0 +1,53 @@ +--- +title: SetPickupVirtualWorld +description: Sets the virtual world ID of a pickup. +tags: ["pickup"] +--- + + + +## Description + +Sets the virtual world ID of a pickup. + +| Name | Description | +|--------------|------------------------------| +| pickupid | The ID of the pickup. | +| virtualWorld | The virtual world ID to set. | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, 20); + + SetPickupVirtualWorld(g_Pickup, 10); + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [ShowPickupForPlayer](ShowPickupForPlayer): Shows a pickup for a specific player. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/functions/SetPlayerPickupModel.md b/docs/scripting/functions/SetPlayerPickupModel.md new file mode 100644 index 000000000..ec6cb974e --- /dev/null +++ b/docs/scripting/functions/SetPlayerPickupModel.md @@ -0,0 +1,50 @@ +--- +title: SetPlayerPickupModel +description: Sets the model of a player-pickup. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Sets the model of a player-pickup. + +| Name | Description | +|--------------------|---------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup. | +| model | The [model](../resources/pickupids) to set. | +| bool:update = true | Update pickup for player. (true/false) | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1); + + SetPlayerPickupModel(playerid, PlayerPickup[playerid], 1210); + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/SetPlayerPickupPos.md b/docs/scripting/functions/SetPlayerPickupPos.md new file mode 100644 index 000000000..cda58fdd3 --- /dev/null +++ b/docs/scripting/functions/SetPlayerPickupPos.md @@ -0,0 +1,52 @@ +--- +title: SetPlayerPickupPos +description: Sets the position of a player-pickup. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Sets the position of a player-pickup. + +| Name | Description | +|--------------------|----------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup. | +| Float:x | The x coordinate to set the pickup at. | +| Float:y | The y coordinate to set the pickup at. | +| Float:z | The z coordinate to set the pickup at. | +| bool:update = true | Update pickup for player. (true/false) | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 2, 2010.0979, 1222.0642, 10.8206, -1); + + SetPlayerPickupPos(playerid, PlayerPickup[playerid], 1958.5488, 1344.9137, 15.3613); + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/SetPlayerPickupType.md b/docs/scripting/functions/SetPlayerPickupType.md new file mode 100644 index 000000000..6563615f3 --- /dev/null +++ b/docs/scripting/functions/SetPlayerPickupType.md @@ -0,0 +1,50 @@ +--- +title: SetPlayerPickupType +description: Sets the type of a player-pickup. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Sets the type of a player-pickup. + +| Name | Description | +|--------------------|-----------------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup. | +| type | The [pickup type](../resources/pickuptypes) to set. | +| bool:update = true | Update pickup for player. (true/false) | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 1, 2010.0979, 1222.0642, 10.8206, -1); + + SetPlayerPickupType(playerid, PlayerPickup[playerid], 2); + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [SetPlayerPickupVirtualWorld](SetPlayerPickupVirtualWorld): Sets the virtual world ID of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/SetPlayerPickupVirtualWorld.md b/docs/scripting/functions/SetPlayerPickupVirtualWorld.md new file mode 100644 index 000000000..4c7cd30c3 --- /dev/null +++ b/docs/scripting/functions/SetPlayerPickupVirtualWorld.md @@ -0,0 +1,49 @@ +--- +title: SetPlayerPickupVirtualWorld +description: Sets the virtual world ID of a player-pickup. +tags: ["player", "pickup", "playerpickup"] +--- + + + +## Description + +Sets the virtual world ID of a player-pickup. + +| Name | Description | +|--------------|------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the player-pickup. | +| virtualWorld | The virtual world ID to set. | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new PlayerPickup[MAX_PLAYERS]; + +public OnPlayerConnect(playerid) +{ + PlayerPickup[playerid] = CreatePlayerPickup(playerid, 1242, 1, 2010.0979, 1222.0642, 10.8206, 20); + + SetPlayerPickupVirtualWorld(playerid, PlayerPickup[playerid], 10); + return 1; +} +``` + +## Related Functions + +- [CreatePlayerPickup](CreatePlayerPickup): Creates a pickup which will be visible to only one player. +- [DestroyPlayerPickup](DestroyPlayerPickup): Destroy a player-pickup. +- [IsValidPlayerPickup](IsValidPlayerPickup): Checks if a player-pickup is valid. +- [IsPlayerPickupStreamedIn](IsPlayerPickupStreamedIn): Checks if a player-pickup is streamed in for the player. +- [SetPlayerPickupPos](SetPlayerPickupPos): Sets the position of a player-pickup. +- [GetPlayerPickupPos](GetPlayerPickupPos): Gets the coordinates of a player-pickup. +- [SetPlayerPickupModel](SetPlayerPickupModel): Sets the model of a player-pickup. +- [GetPlayerPickupModel](GetPlayerPickupModel): Gets the model ID of a player-pickup. +- [SetPlayerPickupType](SetPlayerPickupType): Sets the type of a player-pickup. +- [GetPlayerPickupType](GetPlayerPickupType): Gets the type of a player-pickup. +- [GetPlayerPickupVirtualWorld](GetPlayerPickupVirtualWorld): Gets the virtual world ID of a player-pickup. diff --git a/docs/scripting/functions/ShowPickupForPlayer.md b/docs/scripting/functions/ShowPickupForPlayer.md new file mode 100644 index 000000000..9dca0bbc4 --- /dev/null +++ b/docs/scripting/functions/ShowPickupForPlayer.md @@ -0,0 +1,57 @@ +--- +title: ShowPickupForPlayer +description: Shows a pickup for a specific player. +tags: ["player", "pickup"] +--- + + + +## Description + +Shows a pickup for a specific player. + +| Name | Description | +|----------|-------------------------------------------------| +| playerid | The ID of the player. | +| pickupid | The ID of the pickup to display for the player. | + +## Returns + +This function always returns **true**. + +## Examples + +```c +new g_Pickup; + +public OnGameModeInit() +{ + g_Pickup = CreatePickup(1239, 1, 1686.6160, 1455.4277, 10.7705, -1); + return 1; +} + +public OnPlayerSpawn(playerid) +{ + ShowPickupForPlayer(playerid, g_Pickup); + return 1; +} +``` + +## Related Functions + +- [CreatePickup](CreatePickup): Create a pickup. +- [AddStaticPickup](AddStaticPickup): Add a static pickup. +- [DestroyPickup](DestroyPickup): Destroy a pickup. +- [IsValidPickup](IsValidPickup): Checks if a pickup is valid. +- [IsPickupStreamedIn](IsPickupStreamedIn): Checks if a pickup is streamed in for a specific player. +- [IsPickupHiddenForPlayer](IsPickupHiddenForPlayer): Checks if a pickup is hidden for a specific player. +- [SetPickupPos](SetPickupPos): Sets the position of a pickup. +- [GetPickupPos](GetPickupPos): Gets the coordinates of a pickup. +- [SetPickupModel](SetPickupModel): Sets the model of a pickup. +- [GetPickupModel](GetPickupModel): Gets the model ID of a pickup. +- [SetPickupType](SetPickupType): Sets the type of a pickup. +- [GetPickupType](GetPickupType): Gets the type of a pickup. +- [SetPickupVirtualWorld](SetPickupVirtualWorld): Sets the virtual world ID of a pickup. +- [GetPickupVirtualWorld](GetPickupVirtualWorld): Gets the virtual world ID of a pickup. +- [HidePickupForPlayer](HidePickupForPlayer): Hides a pickup for a specific player. +- [SetPickupForPlayer](SetPickupForPlayer): Adjusts the pickup model, type, and position for a specific player. diff --git a/docs/scripting/resources/pickupids.md b/docs/scripting/resources/pickupids.md index 2d0595662..d56256e88 100644 --- a/docs/scripting/resources/pickupids.md +++ b/docs/scripting/resources/pickupids.md @@ -4,7 +4,7 @@ title: "Pickup IDs" :::note -ANY valid object model can be used for [pickups](../functions/CreatePickup). This page just lists some common object models that are around the right size to be used as a pickup. +ANY valid object model can be used for [CreatePickup](../functions/CreatePickup) and [CreatePlayerPickup](../functions/CreatePlayerPickup). This page just lists some common object models that are around the right size to be used as a pickup. ::: diff --git a/docs/scripting/resources/pickuptypes.md b/docs/scripting/resources/pickuptypes.md index 41d4c8b79..73997371a 100644 --- a/docs/scripting/resources/pickuptypes.md +++ b/docs/scripting/resources/pickuptypes.md @@ -6,14 +6,20 @@ title: "Pickup Types" :::note +These pickup types are used by [CreatePickup](../functions/CreatePickup) and [CreatePlayerPickup](../functions/CreatePlayerPickup). + +::: + +:::note + Most other IDs are either undocumented or are similar to type 1 (but do not use them just because they seem similar to ID 1, they might have side-effects like ID 18 and 20). ::: | ID | Description | | --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| 0 | It has no special attributes and cannot be picked up. It also does not trigger [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup), and is not removed when closing the server | -| 1 | Exists always. Disables pickup scripts such as horseshoes and oysters to allow for scripted actions ONLY. Will trigger [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup) every few seconds. This is likely a SA-MP bug | +| 0 | It has no special attributes and cannot be picked up. It also does not trigger [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup) or [OnPlayerPickUpPlayerPickup](../callbacks/OnPlayerPickUpPlayerPickup), and is not removed when closing the server | +| 1 | Exists always. Disables pickup scripts such as horseshoes and oysters to allow for scripted actions ONLY. Will trigger [OnPlayerPickUpPickup](../callbacks/OnPlayerPickUpPickup) or [OnPlayerPickUpPlayerPickup](../callbacks/OnPlayerPickUpPlayerPickup) every few seconds. This is likely a SA-MP bug | | 2 | Disappears after pickup, respawns after 30 seconds if the player is at a distance of at least 15 meters (used for money pickups) | | 3 | Disappears after pickup, respawns after death | | 4 | Disappears after 20 seconds. Respawns after death | diff --git a/docs/tutorials/PickupGuide.md b/docs/tutorials/PickupGuide.md index 85c8ec53a..1710e78c1 100644 --- a/docs/tutorials/PickupGuide.md +++ b/docs/tutorials/PickupGuide.md @@ -75,3 +75,5 @@ Congratulations, you now know how to create and handle pickups! ## Further Reading You can use the [Streamer](https://github.com/samp-incognito/samp-streamer-plugin) plugin to create unlimited pickups with [CreateDynamicPickup]() + +You can also create per-player pickup with [CreatePlayerPickup](../scripting/functions/CreatePlayerPickup).