Skip to content
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnDialogResponse.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: OnDialogResponse
sidebar_label: OnDialogResponse
description: This callback is called when a player responds to a dialog shown using ShowPlayerDialog. The response can be by clicking a button, pressing ENTER/ESC, or double-clicking a list item (in the case of a list-style dialog).
description: This callback is called when a player responds to a dialog shown using ShowPlayerDialog.
tags: ["dialog"]
---

Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/callbacks/OnPlayerEnterVehicle.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This callback is called when a player starts to enter a vehicle, meaning the pla

## Returns

This callback does not handle returns.

It is always called first in filterscripts.

## Examples
Expand Down
18 changes: 13 additions & 5 deletions frontend/docs/scripting/callbacks/OnPlayerRequestDownload.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ tags: ["player"]

This callback is called when a player request for custom model downloads.

| Name | Description |
| --------------------- | ---------------------------------------------------------- |
| playerid | The ID of the player that request custom model download. |
| DOWNLOAD_REQUEST:type | The [type](../resources/download-requests) of the request. |
| crc | The CRC checksum of custom model file. |
| Name | Description |
| --------------------- | ----------------------------------------------------------------------------------------------- |
| playerid | The ID of the player that request custom model download. |
| DOWNLOAD_REQUEST:type | The [type](../resources/download-requests) of the request. |
| crc | The [CRC](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of custom model file. |

## Returns

Expand Down Expand Up @@ -68,6 +68,14 @@ The following callbacks might be useful, as they're related to this callback in

- [OnPlayerFinishedDownloading](OnPlayerFinishedDownloading): This callback is called when a player finishes downloading custom models.

## Related Functions

The following functions might be useful, as they're related to this callback in one way or another.

- [FindModelFileNameFromCRC](../functions/FindModelFileNameFromCRC): Find an existing custom skin or simple object model file.
- [FindTextureFileNameFromCRC](../functions/FindTextureFileNameFromCRC): Find an existing custom skin or simple object texture file.
- [RedirectDownload](../functions/RedirectDownload): Redirect a player's custom AddCharModel or AddSimpleModel download to a specific HTTP webpage.

## Related Resources

- [Download Request Types](../resources/download-requests)
2 changes: 2 additions & 0 deletions frontend/docs/scripting/callbacks/OnPlayerRequestSpawn.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ This callback is called when a player attempts to spawn via class selection eith

## Returns

Returning 0 in this callback will prevent the player from spawning.

It is always called first in filterscripts so returning 0 there also blocks other scripts from processing it.

## Examples
Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/callbacks/OnPlayerUpdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public OnPlayerWeaponChange(playerid, WEAPON:oldWeapon, WEAPON:newWeapon)
}
```

In this example you will probably also want to reset `gPlayerCurrentWeapon[playerid]` in [OnPlayerConnect](OnPlayerConnect).

**Example 2**

```c
Expand Down
10 changes: 5 additions & 5 deletions frontend/docs/scripting/callbacks/OnVehicleMod.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ tags: ["vehicle"]

This callback is called when a vehicle is modded.

| Name | Description |
| ----------- | ------------------------------------------------------- |
| playerid | The ID of the driver of the vehicle. |
| vehicleid | The ID of the vehicle which is modded. |
| componentid | The ID of the component which was added to the vehicle. |
| Name | Description |
| ----------- | -------------------------------------------------------------------------------------- |
| playerid | The ID of the driver of the vehicle. |
| vehicleid | The ID of the vehicle which is modded. |
| componentid | The [ID of the component](../resources/carcomponentid) which was added to the vehicle. |

## Returns

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnVehiclePaintjob.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This callback is called when a player previews a vehicle paintjob inside a mod s
| ---------- | ---------------------------------------------------------------- |
| playerid | The ID of the player that changed the paintjob of their vehicle. |
| vehicleid | The ID of the vehicle that had its paintjob changed. |
| paintjobid | The ID of the new paintjob. |
| paintjobid | The ID of the new [paintjob](../resources/paintjobs). |

## Returns

Expand Down
16 changes: 8 additions & 8 deletions frontend/docs/scripting/functions/AddCharModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ tags: ["custom skin", "char model"]

## Description

Adds a new custom character model for download. The model files will be stored in player's Documents\GTA San Andreas User Files\SAMP\cache under the Server IP and Port folder in a CRC-form file name.

| Name | Description |
| ---------------------- | -------------------------------------------------------------------------------------------------------------- |
| baseid | The base skin model ID to use (behavior of the character & original character to use when download is failed). |
| newid | The new skin model ID ranged from 20001 to 30000 (10000 slots) to be used later with SetPlayerSkin |
| const dff[] | Name of the .dff model collision file located in models server folder by default (artpath setting). |
| const textureLibrary[] | Name of the .txd model texture file located in models server folder by default (artpath setting). |
Adds a new custom character model for download. The model files will be stored in player's Documents\GTA San Andreas User Files\SAMP\cache under the Server IP and Port folder in a [CRC-form](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) file name.

| Name | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| baseid | The base [skin model ID](../resources/skins) to use (behavior of the character & original character to use when download is failed). |
| newid | The new skin model ID ranged from 20001 to 30000 (10000 slots) to be used later with SetPlayerSkin |
| const dff[] | Name of the .dff model collision file located in models server folder by default (artpath setting). |
| const textureLibrary[] | Name of the .txd model texture file located in models server folder by default (artpath setting). |

## Returns

Expand Down
1 change: 1 addition & 0 deletions frontend/docs/scripting/functions/AddSimpleModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ There are currently no restrictions on when you can call this function, but be a

## Related Functions

- [AddSimpleModelTimed](AddSimpleModelTimed): Adds a new custom simple object model for download, which is only visible during a set time of day.
- [IsValidCustomModel](IsValidCustomModel): Checks if a custom model ID is valid.
- [GetCustomModelPath](GetCustomModelPath): Get a custom model path.

Expand Down
1 change: 1 addition & 0 deletions frontend/docs/scripting/functions/AddSimpleModelTimed.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ There are currently no restrictions on when you can call this function, but be a

## Related Functions

- [AddSimpleModel](AddSimpleModel): Adds a new custom simple object model for download.
- [IsValidCustomModel](IsValidCustomModel): Checks if a custom model ID is valid.
- [GetCustomModelPath](GetCustomModelPath): Get a custom model path.

Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/functions/CallLocalFunction.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ If the function does not exist, returns 0.
| `f` | Passes a floating point number. |
| `s` | Passes a string. |

The values for the placeholders follow in the exact same order as parameters in the call.

## Examples

```c
Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/functions/CallRemoteFunction.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The value that the last public function returned.
| `f` | Passes a floating point number. |
| `s` | Passes a string. |

The values for the placeholders follow in the exact same order as parameters in the call.

## Examples

```c
Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/ClearAnimations.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: ClearAnimations
sidebar_label: 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).
description: Clears all animations for the given player.
tags: ["player", "animation"]
---

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/CreatePickup.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: CreatePickup
sidebar_label: 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.
description: This function does exactly the same as AddStaticPickup, except it returns a pickup ID.
tags: ["pickup"]
---

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/EditAttachedObject.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public OnPlayerCommandText(playerid, cmdtext[])

:::note

There are 7 clickable buttons in edition mode. The three single icons that have X/Y/Z on them can be dragged to edit position/rotation/scale. The four buttons in a row are to select the edition mode and save edition: Move, Rotate, Scale and Save.
There are 7 clickable buttons in edition mode. The three single icons that have X/Y/Z on them can be dragged to edit position/rotation/scale. The four buttons in a row are to select the edition mode and save edition: Move, Rotate, Scale and Save. Clicking Save will call [OnPlayerEditAttachedObject](../callbacks/OnPlayerEditAttachedObject).

:::

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/GetMaxPlayers.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: GetMaxPlayers
sidebar_label: GetMaxPlayers
description: Returns the maximum number of players that can join the server, as set by the server variable 'maxplayers' in server.
description: Returns the maximum number of players that can join the server, as set by the server variable 'max_players'.
tags: ["player"]
---

Expand Down
4 changes: 3 additions & 1 deletion frontend/docs/scripting/functions/GetPVarType.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Gets the type (integer, float or string) of a player variable.

## Returns

Returns the type of the PVar. See table below.
Returns the [type](../resources/pvartypes) of the PVar.

Returns `PLAYER_VARTYPE_NONE` (0) if a player variable with the given name does not exist.

## Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ The ID of the actor the player is looking at.

## Examples

Actors perform a 'hands up' animation when aimed at:

```c
new bool:ActorHandsup[MAX_ACTORS];

Expand Down Expand Up @@ -63,7 +65,7 @@ public OnPlayerUpdate(playerid)
:::tip
This function only tells you which actor (if any) the player is looking at. To find out if they are aiming at them, you need to use GetPlayerTargetActor.
This function only tells you which actor (if any) the player is looking at. To find out if they are aiming at them, you need to use [GetPlayerTargetActor](GetPlayerTargetActor).
:::
Expand Down
4 changes: 4 additions & 0 deletions frontend/docs/scripting/functions/GetPlayerIp.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Get the specified player's IP address and store it in a string.

## Returns

The length of the player's IP address.

**-1** if player specified doesn't exist.

The player's IP address is stored in the specified array.

## Examples
Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/functions/GetPlayerKeys.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The keys are stored in the specified variables.

## Examples

The following example shows how you can regularly check the up/down/left/right values using [OnPlayerUpdate](../callbacks/OnPlayerUpdate).

```c
public OnPlayerUpdate(playerid)
{
Expand Down
4 changes: 4 additions & 0 deletions frontend/docs/scripting/functions/GetPlayerVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Returns the SA-MP client version, as reported by the player.

## Returns

The length of the player's client version.

**0** if player specified doesn't exist.

The client version is stored in the specified array.

## Examples
Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/functions/GetSVarType.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Gets the type (integer, float or string) of a server variable.

Returns the [type](../resources/svartypes) of the SVar.

Returns `SERVER_VARTYPE_NONE` (0) if a server variable with the given name does not exist.

## Examples

```c
Expand Down
4 changes: 4 additions & 0 deletions frontend/docs/scripting/functions/GetSVarsUpperIndex.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ tags: ["server variable", "svar"]

Each SVar (server-variable) has its own unique identification number for lookup, this function returns the highest ID.

## Returns

The highest set SVar ID.

## Examples

```c
Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/Kick.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Kick
sidebar_label: Kick
description: Kicks a player from the server. They will have to quit the game and re-connect if they wish to continue playing.
description: Kicks a player from the server.
tags: ["player", "administration"]
---

Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/functions/SetActorInvulnerable.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ Once set invulnerable, the actor does not call [OnPlayerGiveDamageActor](../call

## Related Functions

- [CreateActor](CreateActor): Create an actor (static NPC).
- [IsActorInvulnerable](IsActorInvulnerable): Check if an actor is invulnerable.
- [SetActorHealth](SetActorHealth): Set the health of an actor.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public OnPlayerCommandText(playerid, cmdtext[])

:::tip

Color embedding can be used for multiple colors in the text.
[Color embedding](../resources/colorslist#color-embedding) can be used for multiple colors in the text.

:::

Expand Down
17 changes: 17 additions & 0 deletions frontend/docs/scripting/functions/SetTimerEx.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ Sets a timer to call a function after the specified interval. This variant ('Ex'

The ID of the timer that was started. Timer IDs start at 1 and are never reused.

## Format Specifiers

| Specifier | Meaning |
| --------- | -------------------------------------------------------------------------------- |
| `i` | Integer. |
| `d` | Integer. |
| `a` | Array. The next parameter must be an integer (`i` or `d`) with the array's size. |
| `s` | String. |
| `f` | Float. |
| `b` | Boolean (true/false). |

:::note

The array (`a`) and string (`s`) specifiers are unusable in SA-MP. Passing arrays and strings to timers is only supported in open.mp.

:::

## Examples

```c
Expand Down
3 changes: 3 additions & 0 deletions frontend/docs/scripting/functions/SetVehicleVelocity.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ This function has no affect on un-occupied vehicles and does not affect trains.
## Related Functions

- [GetVehicleVelocity](GetVehicleVelocity): Get the velocity of a vehicle on the X, Y and Z axes.
- [SetVehicleAngularVelocity](SetVehicleAngularVelocity): Set the angular velocity of a vehicle.
- [SetPlayerVelocity](SetPlayerVelocity): Set a player's velocity.
- [GetPlayerVelocity](GetPlayerVelocity): Get a player's velocity.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: StartRecordingPlayback
sidebar_label: StartRecordingPlayback
description: This will run a .rec file which has to be saved in the npcmodes/recordings folder. These files allow the NPC to follow certain actions. Their actions can be recorded manually. For more information, check the related functions.
description: This will run a .rec file which has to be saved in the npcmodes/recordings folder.
tags: []
---

Expand Down
6 changes: 6 additions & 0 deletions frontend/docs/scripting/functions/TextDrawColor.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public OnGameModeInit()

## Notes

:::tip

You can also use [GameText colors](../resources/gametextstyles) in textdraws (e.g. `~r~` `~g~` `~b~`).

:::

:::note

If the TextDraw is already shown, it must be re-shown ([TextDrawShowForAll](TextDrawShowForAll)/[TextDrawShowForPlayer](TextDrawShowForPlayer)) for the changes of this function to take effect.
Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/TextDrawCreate.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tags: ["textdraw"]

## Description

Creates a textdraw. Textdraws are, as the name implies, text (mainly - there can be boxes, sprites and model previews (skins/vehicles/weapons/objects too) that is drawn on a player's screens. See this page for extensive information about textdraws.
Creates a textdraw. Textdraws are, as the name implies, text (mainly - there can be boxes, sprites and model previews (skins/vehicles/weapons/objects too) that is drawn on a player's screens. See [this page](../resources/textdraws) for extensive information about textdraws.

| Name | Description |
| ---------------- | -------------------------------------------------------- |
Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/functions/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ The values for the placeholders follow in the exact same order as parameters in

You may optionally put a number between the `%` and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces. To cut the number of decimal places beeing shown of a float, you can add '.\<max number\>' between the `%` and the `f`, i.e. `%.2f`.

You can also specify a variable field width or precision by using an asterisk (`*`) instead of the number, for example `%*d` or `%.*f`. The width or precision is then taken from an extra argument, passed right before the value it applies to.

## Examples

```c
Expand Down
2 changes: 2 additions & 0 deletions frontend/docs/scripting/functions/printf.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ The values for the placeholders follow in the exact same order as parameters in

You may optionally put a number between the `%` and the letter of the placeholder code. This number indicates the field width; if the size of the parameter to print at the position of the placeholder is smaller than the field width, the field is expanded with spaces. To cut the number of decimal places beeing shown of a float, you can add '.\<max number\>' between the `%` and the `f`, i.e. `%.2f`.

You can also specify a variable field width or precision by using an asterisk (`*`) instead of the number, for example `%*d` or `%.*f`. The width or precision is then taken from an extra argument, passed right before the value it applies to.

## Examples

```c
Expand Down
7 changes: 7 additions & 0 deletions frontend/docs/scripting/language/ControlStructures.md
Original file line number Diff line number Diff line change
Expand Up @@ -709,3 +709,10 @@ MyFunction(num)
return 0;
}
```

## See also

- [Keywords: Statements](Statements)
- [Keywords: Operators](Operators)
- [Keywords: Directives](Directives)
- [Keywords: Initialisers](Initialisers)
Loading
Loading