Skip to content

Commit

Permalink
Merge pull request #791 from adib-yg/master
Browse files Browse the repository at this point in the history
Added more scripting functions documents
  • Loading branch information
Y-Less authored Dec 14, 2023
2 parents 38974fe + b2f27d4 commit 3498f85
Show file tree
Hide file tree
Showing 49 changed files with 1,108 additions and 13 deletions.
1 change: 1 addition & 0 deletions docs/scripting/functions/AddMenuItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ Crashes when passed an invalid menu ID. You can only have 12 items per menu (13t
- [CreateMenu](CreateMenu): Create a menu.
- [SetMenuColumnHeader](SetMenuColumnHeader): Set the header for one of the columns in a menu.
- [DestroyMenu](DestroyMenu): Destroy a menu.
- [IsMenuRowDisabled](IsMenuRowDisabled): Check if a menu row is disabled.
- [OnPlayerSelectedMenuRow](../callbacks/OnPlayerSelectedMenuRow): Called when a player selected a row in a menu.
- [OnPlayerExitedMenu](../callbacks/OnPlayerExitedMenu): Called when a player exits a menu.
4 changes: 3 additions & 1 deletion docs/scripting/functions/AddPlayerClass.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: AddPlayerClass
description: Adds a class to class selection.
tags: ["player"]
tags: ["player", "class"]
---

## Description
Expand Down Expand Up @@ -51,5 +51,7 @@ The maximum class ID is 319 (starting from 0, so a total of 320 classes). When t
## Related Functions

- [AddPlayerClassEx](AddPlayerClassEx): Add a class with a default team.
- [GetAvailableClasses](GetAvailableClasses): Get the number of classes defined.
- [EditPlayerClass](EditPlayerClass): Edit a class data.
- [SetSpawnInfo](SetSpawnInfo): Set the spawn setting for a player.
- [SetPlayerSkin](SetPlayerSkin): Set a player's skin.
4 changes: 3 additions & 1 deletion docs/scripting/functions/AddPlayerClassEx.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: AddPlayerClassEx
description: This function is exactly the same as the AddPlayerClass function, with the addition of a team parameter.
tags: ["player"]
tags: ["player", "class"]
---

## Description
Expand Down Expand Up @@ -54,6 +54,8 @@ The maximum class ID is 319 (starting from 0, so a total of 320 classes). When t
## Related Functions

- [AddPlayerClass](AddPlayerClass): Add a class.
- [GetAvailableClasses](GetAvailableClasses): Get the number of classes defined.
- [EditPlayerClass](EditPlayerClass): Edit a class data.
- [SetSpawnInfo](SetSpawnInfo): Set the spawn setting for a player.
- [SetPlayerTeam](SetPlayerTeam): Set a player's team.
- [SetPlayerSkin](SetPlayerSkin): Set a player's skin.
5 changes: 5 additions & 0 deletions docs/scripting/functions/AddSimpleModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,9 @@ There are currently no restrictions on when you can call this function, but be a
## Related Functions
- [IsValidCustomModel](IsValidCustomModel): Checks if a custom model ID is valid.
- [GetCustomModelPath](GetCustomModelPath): Get a custom model path.
## Related Callbacks
- [OnPlayerFinishedDownloading](../callbacks/OnPlayerFinishedDownloading): Called when a player finishes downloading custom models.
5 changes: 5 additions & 0 deletions docs/scripting/functions/AddSimpleModelTimed.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ There are currently no restrictions on when you can call this function, but be a

## Related Functions

- [IsValidCustomModel](IsValidCustomModel): Checks if a custom model ID is valid.
- [GetCustomModelPath](GetCustomModelPath): Get a custom model path.

## Related Callbacks

- [OnPlayerFinishedDownloading](../callbacks/OnPlayerFinishedDownloading): Called when a player finishes downloading custom models.
35 changes: 35 additions & 0 deletions docs/scripting/functions/AllowPlayerWeapons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: AllowPlayerWeapons
description: Enable/Disable weapons for a player.
tags: ["player"]
---

<VersionWarn version='omp v1.1.0.2612' />

## Description

Enable/Disable weapons for a player.

| Name | Description |
| -------- | ----------------------------------------------------- |
| playerid | The ID of the player to allow weapons |
| bool:allow | true for allow and false for disallow. |

## Returns

This function always returns true.

## Examples

```c
public OnPlayerConnect(playerid)
{
AllowPlayerWeapons(playerid, true);

return 1;
}
```
## Related Functions
- [ArePlayerWeaponsAllowed](ArePlayerWeaponsAllowed): Can the player use weapons?
3 changes: 2 additions & 1 deletion docs/scripting/functions/ApplyAnimation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ApplyAnimation
description: Apply an animation to a player.
tags: []
tags: ["player", "animation"]
---

## Description
Expand Down Expand Up @@ -49,3 +49,4 @@ An invalid animation library will crash the player's game.
- [ClearAnimations](ClearAnimations): Clear any animations a player is performing.
- [SetPlayerSpecialAction](SetPlayerSpecialAction): Set a player's special action.
- [GetPlayerAnimFlags](GetPlayerAnimFlags): Get the player animation flags.
39 changes: 39 additions & 0 deletions docs/scripting/functions/ArePlayerWeaponsAllowed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: ArePlayerWeaponsAllowed
description: Can the player use weapons?
tags: ["player"]
---

<VersionWarn version='omp v1.1.0.2612' />

## Description

Can the player use weapons?

| Name | Description |
| -------- | ----------------------------------------------------------- |
| playerid | The ID of the player to check. |

## Returns

true: Allow.

false: Disallow.

## Examples

```c
public OnPlayerSpawn(playerid)
{
if (ArePlayerWeaponsAllowed(playerid))
{
// do something
}

return 1;
}
```
## Related Functions
- [AllowPlayerWeapons](AllowPlayerWeapons): Enable/Disable weapons for a player.
2 changes: 1 addition & 1 deletion docs/scripting/functions/ClearAnimations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ClearAnimations
description: Clears all animations for the given player (it also cancels all current tasks such as jetpacking, parachuting,entering vehicles, driving (removes player out of vehicle), swimming, etc.
tags: []
tags: ["player", "animation"]
---

## Description
Expand Down
1 change: 1 addition & 0 deletions docs/scripting/functions/DisableMenu.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ Crashes when passed an invalid menu ID.
- [CreateMenu](CreateMenu): Create a menu.
- [DestroyMenu](DestroyMenu): Destroy a menu.
- [AddMenuItem](AddMenuItem): Add an item to a menu.
- [IsMenuDisabled](IsMenuDisabled): Check if a menu is disabled.
1 change: 1 addition & 0 deletions docs/scripting/functions/DisableMenuRow.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ Crashes when passed an invalid menu ID. This function disabled the specified men
- [CreateMenu](CreateMenu): Create a menu.
- [DestroyMenu](DestroyMenu): Destroy a menu.
- [AddMenuItem](AddMenuItem): Add an item to a menu.
- [IsMenuRowDisabled](IsMenuRowDisabled): Check if a menu row is disabled.
40 changes: 40 additions & 0 deletions docs/scripting/functions/EditPlayerClass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: EditPlayerClass
description: Edit a class data.
tags: ["class"]
---

<VersionWarn version='omp v1.1.0.2612' />

## Description

Edit a class data.

| Name | Description |
| ------------- | ------------------------------------------------------------- |
| classid | The class id to edit. |
| team | The team you want the player to spawn in. |
| skin | The skin which the player will spawn with. |
| Float:spawnX | The X coordinate of the spawnpoint of this class. |
| Float:spawnY | The Y coordinate of the spawnpoint of this class. |
| Float:spawnZ | The Z coordinate of the spawnpoint of this class. |
| Float:angle | The direction in which the player will face after spawning. |
| WEAPON:weapon1 | The first spawn-weapon for the player. |
| ammo1 | The amount of ammunition for the first spawn weapon. |
| WEAPON:weapon2 | The second spawn-weapon for the player. |
| ammo2 | The amount of ammunition for the second spawn weapon. |
| WEAPON:weapon3 | The third spawn-weapon for the player. |
| ammo3 | The amount of ammunition for the third spawn weapon. |

## Examples

```c
// Edit class id 10
EditPlayerClass(10, TEAM_NONE, 299, -253.8291, 2602.9312, 62.8527, -90.0000, WEAPON_KNIFE, 1, WEAPON_MP5, 100, WEAPON_COLT45, 20);
```
## Related Functions
- [AddPlayerClass](AddPlayerClass): Adds a class.
- [AddPlayerClassEx](AddPlayerClassEx): Add a class with a default team.
- [GetAvailableClasses](GetAvailableClasses): Get the number of classes defined.
1 change: 1 addition & 0 deletions docs/scripting/functions/EnablePlayerCameraTarget.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public OnPlayerConnect(playerid)
## Related Functions
- [IsPlayerCameraTargetEnabled](IsPlayerCameraTargetEnabled): Check if the player camera target is enabled.
- [GetPlayerCameraTargetVehicle](GetPlayerCameraTargetVehicle): Get the ID of the vehicle a player is looking at.
- [GetPlayerCameraTargetPlayer](GetPlayerCameraTargetPlayer): Get the ID of the player a player is looking at.
- [GetPlayerCameraFrontVector](GetPlayerCameraFrontVector): Get the player's camera front vector
23 changes: 23 additions & 0 deletions docs/scripting/functions/GetAvailableClasses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: GetAvailableClasses
description: Get the number of classes defined.
tags: ["class"]
---

<VersionWarn version='omp v1.1.0.2612' />

## Description

Get the number of classes defined.

## Examples

```c
printf("Available classes: %d", GetAvailableClasses());
```
## Related Functions
- [AddPlayerClass](AddPlayerClass): Adds a class.
- [AddPlayerClassEx](AddPlayerClassEx): Add a class with a default team.
- [EditPlayerClass](EditPlayerClass): Edit a class data.
41 changes: 41 additions & 0 deletions docs/scripting/functions/GetCustomModelPath.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: GetCustomModelPath
description: Get a custom model path.
tags: []
---

<VersionWarn version='omp v1.1.0.2612' />

## Description

Get a custom model path.

| Name | Description |
| ------------- | ------------------------------------------------------------- |
| modelid | The custom model id to get path from. |
| dffPath[] | An array in which to store the dffPath in, passed by reference. |
| dffSize | The length of the dffPath that should be stored. |
| txdPath[] | An array in which to store the txdPath in, passed by reference. |
| txdSize | The length of the txdPath that should be stored. |

## Examples

```c
new
modelid = -2000,
dffPath[64],
txdPath[64];

GetCustomModelPath(modelid, dffPath, sizeof(dffPath), txdPath, sizeof(txdPath));

printf("[Custom model id %d path]\n\
dff: %s\n\
txd: %s",
modelid, dffPath, txdPath);
```
## Related Functions
- [AddSimpleModel](AddSimpleModel): Adds a new custom simple object model.
- [AddSimpleModelTimed](AddSimpleModelTimed): Adds a new custom simple object model.
- [IsValidCustomModel](IsValidCustomModel): Checks if a custom model ID is valid.
5 changes: 3 additions & 2 deletions docs/scripting/functions/GetGravity.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: GetGravity
description: Get the currently set gravity.
description: Get the currently global gravity.
tags: []
---

## Description

Get the currently set gravity.
Get the currently global gravity.

## Examples

Expand All @@ -29,3 +29,4 @@ This function is not defined by default. Add 'native Float:GetGravity();' under
## Related Functions
- [SetGravity](SetGravity): Set the global gravity.
- [GetPlayerGravity](GetPlayerGravity): Get a player's gravity.
35 changes: 35 additions & 0 deletions docs/scripting/functions/GetMenuColumnHeader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: GetMenuColumnHeader
description: Get the text in the header of the specified column.
tags: ["menu"]
---

<VersionWarn version='omp v1.1.0.2612' />

## Description

Get the text in the header of the specified column.

| Name | Description |
| --------- | ----------------------------------------------------------------- |
| Menu:menuid | The ID of the menu. |
| column | The column. |
| header[] | An array into which to store the text, passed by reference. |
| len | The length of the text that should be stored. |

## Returns

This function always returns true.

## Examples

```c
new text[32];

// Get the menu header text in the column 1
GetMenuColumnHeader(menuid, 1, text, sizeof(text));
```
## Related Functions
- [CreateMenu](CreateMenu): Creates a menu.
36 changes: 36 additions & 0 deletions docs/scripting/functions/GetMenuColumnWidth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: GetMenuColumnWidth
description: Get the width of the one or two columns.
tags: ["menu"]
---

<VersionWarn version='omp v1.1.0.2612' />

## Description

Get the width of the one or two columns.

| Name | Description |
| --------- | ----------------------------------------------------------------- |
| Menu:menuid | The ID of the menu. |
| &Float:column1Width | A float variable in which to store the column1 width in, passed by reference. |
| &Float:column2Width | A float variable in which to store the column2 width in, passed by reference. |

## Returns

This function always returns true.

## Examples

```c
new Float:column1Width, Float:column2Width;
GetMenuColumnWidth(menuid, column1Width, column2Width);

// Or you can only get column1 width
new Float:column1Width;
GetMenuColumnWidth(menuid, column1Width);
```
## Related Functions
- [GetMenuPos](GetMenuPos): Get the x/y screen position of the menu.
Loading

0 comments on commit 3498f85

Please sign in to comment.