Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnDialogResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

## Notes

:::tip
:::note

The parameters can have different values depending on the dialog's style. ([Click here for more examples](../resources/dialogstyles)).

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnObjectMoved.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public OnObjectMoved(objectid)

## Notes

:::tip
:::note

[SetObjectPos](../functions/SetObjectPos) does not work when used in this callback. To fix it, recreate the object.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnPlayerClickMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)

## Notes

:::tip
:::note

As the callback name says, its only called when the player click to mark the target and not when pressed the key. The Z value returned will be 0 (invalid) if the clicked area on the map is far away from the player; use the [MapAndreas](https://github.com/philip1337/samp-plugin-mapandreas) or [ColAndreas](https://github.com/Pottus/ColAndreas) plugin to get a more accurate Z coordinate.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnPlayerClickPlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public OnPlayerClickPlayer(playerid, clickedplayerid, CLICK_SOURCE:source)

## Notes

:::tip
:::note

There is currently only one 'source' (0 - `CLICK_SOURCE_SCOREBOARD`).

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnPlayerDeath.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public OnPlayerDeath(playerid, killerid, WEAPON:reason)

## Notes

:::tip
:::note

The reason will return 37 (flame thrower) from any fire sources (e.g. molotov, 18) The reason will return 51 from any weapon that creates an explosion (e.g. RPG, grenade) You do not need to check whether killerid is valid before using it in [SendDeathMessage](../functions/SendDeathMessage). INVALID_PLAYER_ID is a valid killerid ID parameter in that function. playerid is the only one who can call the callback. (good to know for anti fake death)

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnPlayerDisconnect.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public OnPlayerDisconnect(playerid, reason)

## Notes

:::tip
:::note

Some functions might not work correctly when used in this callback because the player is already disconnected when the callback is called. This means that you can't get unambiguous information from functions like [GetPlayerIp](../functions/GetPlayerIp) and [GetPlayerPos](../functions/GetPlayerPos).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)

## Notes

:::tip
:::note

- This callback is called when a player BEGINS to enter a vehicle, not when they HAVE entered it. See [OnPlayerStateChange](OnPlayerStateChange).
- This callback is still called if the player is denied entry to a vehicle (e.g. it is locked or full) but only as a passenger.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public OnPlayerFinishedDownloading(playerid, virtualworld)

## Notes

:::tip
:::note

This callback is called every time a player changes virtual worlds, even if there are no custom models present in that world.

Expand Down
9 changes: 7 additions & 2 deletions frontend/docs/scripting/callbacks/OnPlayerGiveDamage.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,22 @@ public OnPlayerGiveDamage(playerid, damagedid, Float:amount, WEAPON:weaponid, bo

## Notes

:::tip
:::note

- Keep in mind this function can be inaccurate in some cases.
- If you want to prevent certain players from damaging eachother, use [SetPlayerTeam](../functions/SetPlayerTeam).
- The weaponid will return 37 (flame thrower) from any fire sources (e.g. molotov, 18)
- The weaponid will return 51 from any weapon that creates an explosion (e.g. RPG, grenade)
- **playerid** is the only one who can call the callback.
- The amount is always the maximum damage the weaponid can do, even when the health left is less than that maximum damage. So when a player has 100.0 health and gets shot with a Desert Eagle which has a damage value of 46.2, it takes 3 shots to kill that player. All 3 shots will show an amount of 46.2, even though when the last shot hits, the player only has 7.6 health left.

:::

:::tip

If you want to prevent certain players from damaging eachother, use [SetPlayerTeam](../functions/SetPlayerTeam).

:::

## Related Callbacks

The following callbacks might be useful, as they're related to this callback in one way or another.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float:amount, WEAPON:w

## Notes

:::tip
:::note

This function does not get called if the actor is set invulnerable (WHICH IS BY DEFAULT). See [SetActorInvulnerable](../functions/SetActorInvulnerable).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This callback is called when the state of any [supported](../resources/keys) key

## Notes

:::info
:::note

This callback can also be called by NPC.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public OnPlayerRequestClass(playerid,classid)

## Notes

:::tip
:::note

This callback is also called when a player presses F4.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public OnPlayerSelectedMenuRow(playerid, row)

## Notes

:::tip
:::note

The menu ID is not passed to this callback. [GetPlayerMenu](../functions/GetPlayerMenu) must be used to determine which menu the player selected an item on.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnPlayerSpawn.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public OnPlayerSpawn(playerid)

## Notes

:::tip
:::note

When a player dies in San Andreas they get $100 deducted from them to cover hospital bills automatically. This feature remains in SA:MP, but is removed from open.mp to allow scripts to manage all their own money. Several scripts attempt to fix this already by adding $100 to a player after death, or on spawn. If this is your script simply delete the additional fix, although the code in open.mp does attempt to account for scripts that do this. If your script relied on this feature, simply add the following code to [OnPlayerDeath](OnPlayerDeath):

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnPlayerTakeDamage.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public OnPlayerTakeDamage(playerid, issuerid, Float:amount, WEAPON:weaponid, bod

## Notes

:::tip
:::note

- The weaponid will return 37 (flame thrower) from any fire sources (e.g. molotov, 18).
- The weaponid will return 51 from any weapon that creates an explosion (e.g. RPG, grenade)
Expand Down
25 changes: 6 additions & 19 deletions frontend/docs/scripting/callbacks/OnPlayerWeaponShot.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public OnPlayerWeaponShot(playerid, WEAPON:weaponid, BULLET_HIT_TYPE:hittype, hi

## Notes

:::tip
:::note

This callback is only called when lag compensation is enabled. If hittype is:

Expand All @@ -54,29 +54,16 @@ This callback is only called when lag compensation is enabled. If hittype is:

[GetPlayerLastShotVectors](../functions/GetPlayerLastShotVectors) can be used in this callback for more detailed bullet vector information.

# Known bugs and issues

:::warning

This callback isn't called when firing from a vehicle as the driver or when shooting while looking backward with the aim enabled (shooting into the air).

:::

:::warning

When shooting a player inside a vehicle, this callback will be triggered as BULLET_HIT_TYPE_VEHICLE with the correct hitid (the hit player's vehicleid). It won't be triggered as BULLET_HIT_TYPE_PLAYER.

:::

:::warning

Partially fixed in SA-MP 0.3.7: If fake weapon data is sent by a malicious client, other players' clients may freeze or crash. To prevent this, check if the reported weaponid can, in fact, fire projectiles.

:::
# Known bugs and issues

:::warning

This callback is not called when driving-by as a driver, firing the turret of a Seasparrow, Hunter, or any other armed vehicle.
- This callback isn't called when firing from a vehicle as the driver or when shooting while looking backward with the aim enabled (shooting into the air).
- When shooting a player inside a vehicle, this callback will be triggered as BULLET_HIT_TYPE_VEHICLE with the correct hitid (the hit player's vehicleid). It won't be triggered as BULLET_HIT_TYPE_PLAYER.
- Partially fixed in SA-MP 0.3.7: If fake weapon data is sent by a malicious client, other players' clients may freeze or crash. To prevent this, check if the reported weaponid can, in fact, fire projectiles.
- This callback is not called when driving-by as a driver, firing the turret of a Seasparrow, Hunter, or any other armed vehicle.

:::

Expand Down
11 changes: 4 additions & 7 deletions frontend/docs/scripting/callbacks/OnRconCommand.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,16 @@ public OnRconCommand(cmd[])

## Notes

:::warning

The /rcon prefix is not included in the cmd parameter when a player types a command. If you use the print function here, it will send a message to both the player who typed the command in-game and the server log.
:::note

This callback is not called if the player is not logged in as an RCON admin. When a player uses /rcon login to log in, this callback will not be called, instead, OnRconLoginAttempt is called. Once logged in as an RCON admin, any subsequent commands will trigger this callback.
- The /rcon prefix is not included in the cmd parameter when a player types a command. If you use the print function here, it will send a message to both the player who typed the command in-game and the server log.
- This callback is not called if the player is not logged in as an RCON admin. When a player uses /rcon login to log in, this callback will not be called, instead, OnRconLoginAttempt is called. Once logged in as an RCON admin, any subsequent commands will trigger this callback.

:::

:::warning

In SA-MP, you need to include this callback in a loaded filterscript for it to work.

However, this issue was fixed in open.mp.
In SA-MP, you need to include this callback in a loaded filterscript for it to work. However, this issue was fixed in open.mp.

:::

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnRconLoginAttempt.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public OnRconLoginAttempt(ip[], password[], success)

## Notes

:::tip
:::note

This callback is only called when /rcon login is used in-game. This callback is only called when the player is not yet logged in. When the player is logged in, [OnRconCommand](OnRconCommand) is called instead.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnScriptLoadPlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public OnScriptLoadPlayer(playerid, bool:isEntryScript)

## Notes

:::tip
:::note

This callback is called when you are **loading** a side script (filterscript) at runtime.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public OnScriptUnloadPlayer(playerid, bool:isEntryScript)

## Notes

:::tip
:::note

This callback is called when you are **unloading** a side script (filterscript) at runtime.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public OnVehicleDamageStatusUpdate(vehicleid, playerid)

## Notes

:::tip
:::note

This does not include vehicle health changes.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnVehicleDeath.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public OnVehicleDeath(vehicleid, killerid)

## Notes

:::tip
:::note

- This callback will also be called when a vehicle enters water, but the vehicle can be saved from destruction by teleportation or driving out (if only partially submerged).
- The callback won't be called a second time, and the vehicle may disappear when the driver exits, or after a short time.
Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnVehicleMod.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public OnVehicleMod(playerid, vehicleid, componentid)

## Notes

:::tip
:::note

This callback is NOT called by AddVehicleComponent.

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 @@ -33,7 +33,7 @@ public OnVehiclePaintjob(playerid, vehicleid, paintjobid)

## Notes

:::tip
:::note

This callback is not called by ChangeVehiclePaintjob. You might use OnVehicleChangePaintjob from vSync in order to know when the player buys the paintjob.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/callbacks/OnVehicleRespray.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public OnVehicleRespray(playerid, vehicleid, color1, color2)

## Notes

:::tip
:::note

This callback is not called by ChangeVehicleColor. Misleadingly, this callback is not called for pay 'n' spray (only modshops).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public OnVehicleSirenStateChange(playerid, vehicleid, newstate)

## Notes

:::tip
:::note

This callback is only called when a vehicle's siren is toggled on or off, NOT when the alternate siren is in use (holding horn).

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/AddCharModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ AddCharModel(305, 20002, "lapdpd2.dff", "lapdpd2.txd");

## Notes

:::tip
:::note

**useartwork** or **artwork.enable** must be enabled first in server settings in order for this to work.

Expand Down
9 changes: 7 additions & 2 deletions frontend/docs/scripting/functions/AddMenuItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ public OnGameModeInit()

## Notes

:::tip
:::warning

Crashes when passed an invalid menu ID. (Fixed in open.mp)

:::

:::note

- Crashes when passed an invalid menu ID.
- You can only have 12 items per menu (13th goes to the right side of the header of column name (colored), 14th and higher not display at all).
- You can only use 2 columns (0 and 1).
- You can only add 8 color codes per one item (`~r~`, `~g~` etc.). Maximum length of menu item is 31 symbols.
Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/AddPlayerClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public OnGameModeInit()

## Notes

:::tip
:::note

The maximum class ID is 319 (starting from 0, so a total of 320 classes). When this limit is reached, any more classes that are added will replace ID 319.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/AddPlayerClassEx.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public OnGameModeInit()

## Notes

:::tip
:::note

The maximum class ID is 319 (starting from 0, so a total of 320 classes). When this limit is reached, any more classes that are added will replace ID 319.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/AddSimpleModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ AddSimpleModel(-1, 19379, -2000, "wallzzz.dff", "wallzzz.txd");

## Notes

:::tip
:::note

**useartwork** or **artwork.enable** must be enabled first in server settings in order for this to work.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/AddSimpleModelTimed.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public OnGameModeInit()

## Notes

:::tip
:::note

**useartwork** or **artwork.enable** must be enabled first in server settings in order for this to work.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/AddStaticPickup.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public OnGameModeInit()

## Notes

:::tip
:::note

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.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/ApplyActorAnimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public OnPlayerConnect(playerid)

## Notes

:::tip
:::note

You must preload the animation library for the player the actor will be applying the animation for, and not for the actor. Otherwise, the animation won't be applied to the actor until the function is executed again.

Expand Down
2 changes: 1 addition & 1 deletion frontend/docs/scripting/functions/ApplyAnimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ApplyAnimation(playerid, "PED", "WALK_DRUNK", 4.1, true, true, true, true, 1, SY

## Notes

:::tip
:::note

- The 'forceSync' optional parameter, which defaults to 0 (SYNC_NONE), in most cases is not needed since players sync animations themselves.
- The 'forcesync' parameter can force all players who can see 'playerid' to play the animation regardless of whether the player is performing that animation. This is useful in circumstances where the player can't sync the animation themselves. For example, they may be paused.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public OnPlayerCommandText(playerid, cmdtext[])

## Notes

:::tip
:::note

You need to create the object first, before attempting to attach a player camera for that.

Expand Down
Loading
Loading