Skip to content

Commit

Permalink
Merge pull request #1056 from openmultiplayer/revert-1055-master
Browse files Browse the repository at this point in the history
Revert "Remove unimplemented functions and callbacks"
  • Loading branch information
midosvt authored Sep 6, 2024
2 parents 5682b03 + 6712d10 commit 9d167ea
Show file tree
Hide file tree
Showing 40 changed files with 889 additions and 22 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,11 @@ Release Candidate 2 (RC2) of the open.mp server.
- [GetVehicleRespawnDelay](scripting/functions/GetVehicleRespawnDelay)
- [GetVehicleTower](scripting/functions/GetVehicleTower)
- [GetVehicleCab](scripting/functions/GetVehicleCab)
- [GetVehicleOccupiedTick](scripting/functions/GetVehicleOccupiedTick)
- [HasVehicleBeenOccupied](scripting/functions/HasVehicleBeenOccupied)
- [IsVehicleOccupied](scripting/functions/IsVehicleOccupied)
- [GetVehicleRespawnTick](scripting/functions/GetVehicleRespawnTick)
- [IsVehicleDead](scripting/functions/IsVehicleDead)
- [ToggleVehicleSirenEnabled](scripting/functions/ToggleVehicleSirenEnabled)
- [IsVehicleSirenEnabled](scripting/functions/IsVehicleSirenEnabled)
- [GetVehicleModelCount](scripting/functions/GetVehicleModelCount)
Expand Down
50 changes: 50 additions & 0 deletions docs/scripting/callbacks/OnScriptCash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: OnScriptCash
description: This callback is called when something in-game like casinos give the player money.
tags: ["player"]
---

:::warning

This callback is currently NOT working.

:::

## Description

This callback is called when something in-game like casinos give the player money.

| Name | Description |
|----------|-------------------------------------------------|
| playerid | The ID of the player who got cash from the game |
| amount | The amount of cash given or taken |
| source | Where the money came from |

## Returns

Unknown as this function does not currently work.

## Examples

```c
// Imaginary:

public OnScriptCash(playerid, amount, source)
{
if (source == SCRIPT_CASH_CASINO)
{
SendClientMessage(playerid, -1, "You have won $%d from the casino!", amount);
}
else if (source == SCRIPT_CASH_VENDING_MACHINE)
{
SendClientMessage(playerid, -1, "You buyed a coke from vending machine for $%d", amount);
}
return 1;
}
```
## Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- [GetPlayerMoney](../functions/GetPlayerMoney): Retrieves the amount of money a player has.
2 changes: 1 addition & 1 deletion docs/scripting/functions/CreatePickup.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Known Bug(s):
- [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.
Expand Down
2 changes: 1 addition & 1 deletion docs/scripting/functions/GetPickupModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public OnGameModeInit()
- [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.
2 changes: 1 addition & 1 deletion docs/scripting/functions/GetPickupPos.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ public OnGameModeInit()
- [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.
2 changes: 1 addition & 1 deletion docs/scripting/functions/GetPickupType.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ public OnGameModeInit()
- [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.
2 changes: 1 addition & 1 deletion docs/scripting/functions/GetPickupVirtualWorld.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public OnGameModeInit()
- [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.
37 changes: 37 additions & 0 deletions docs/scripting/functions/GetPlayerLastSyncedTrailerID.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: GetPlayerLastSyncedTrailerID
description: Gets the player's last synced trailer ID.
tags: ["player", "vehicle"]
---

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

:::warning

This function has not yet been implemented.

:::

## Description

Gets the player's last synced trailer ID.

## Parameters

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

## Return Values

Returns the last synced trailer ID.

## Examples

```c
new trailerid = GetPlayerLastSyncedTrailerID(playerid);
```

## Related Functions

- [GetPlayerLastSyncedVehicleID](GetPlayerLastSyncedVehicleID): Gets the player's last synced vehicle ID.
37 changes: 37 additions & 0 deletions docs/scripting/functions/GetPlayerLastSyncedVehicleID.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: GetPlayerLastSyncedVehicleID
description: Gets the player's last synced vehicle ID.
tags: ["player", "vehicle"]
---

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

:::warning

This function has not yet been implemented.

:::

## Description

Gets the player's last synced vehicle ID.

## Parameters

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

## Return Values

Returns the last synced vehicle ID.

## Examples

```c
new vehicleid = GetPlayerLastSyncedVehicleID(playerid);
```

## Related Functions

- [GetPlayerLastSyncedTrailerID](GetPlayerLastSyncedTrailerID): Gets the player's last synced trailer ID.
42 changes: 42 additions & 0 deletions docs/scripting/functions/GetServerRuleFlags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: GetServerRuleFlags
description: Gets the flags of a server rule.
tags: ["rule"]
---

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

:::warning

This function has not yet been implemented.

:::

## Description

Gets the flags of a server rule.

## Return Values

Returns the server rule flags.

## Examples

```c
public OnGameModeInit()
{
AddServerRule("discord", "discord.gg/samp");
SetServerRuleFlags("discord", 1);

new E_SERVER_RULE_FLAGS:flags = GetServerRuleFlags("discord");
printf("Flags: %d", _:flags); // Flags: 1
return 1;
}
```

## Related Functions

- [AddServerRule](AddServerRule): Add a server rule.
- [RemoveServerRule](RemoveServerRule): Remove the server rule.
- [IsValidServerRule](IsValidServerRule): Checks if the given server rule is valid.
- [SetServerRuleFlags](SetServerRuleFlags): Sets the flags of a server rule.
38 changes: 38 additions & 0 deletions docs/scripting/functions/GetVehicleOccupiedTick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: GetVehicleOccupiedTick
description: Get the occupied tick of a vehicle.
tags: ["vehicle"]
---

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

## Description

Get the occupied tick of a vehicle.

## Parameters

| Name | Description |
|-----------|------------------------|
| vehicleid | The ID of the vehicle. |

## Return Values

Returns occupied tick in milliseconds.

## Examples

```c
public OnGameModeInit()
{
new vehicleid = CreateVehicle(560, 2096.1917, -1328.5150, 25.1059, 0.0000, 1, 8, 60);

new occupiedTick = GetVehicleOccupiedTick(vehicleid);
printf("Vehicle ID %d occupied tick: %d ms", vehicleid, occupiedTick);
return 1;
}
```

## Related Functions

- [SetVehicleOccupiedTick](SetVehicleOccupiedTick): Set the occupied tick of a vehicle.
3 changes: 3 additions & 0 deletions docs/scripting/functions/GetVehicleRespawnTick.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ public OnGameModeInit()
}
```

## Related Functions

- [SetVehicleRespawnTick](SetVehicleRespawnTick): Set the respawn tick of a vehicle.
4 changes: 4 additions & 0 deletions docs/scripting/functions/HasVehicleBeenOccupied.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ else
// Vehicle is not occupied
}
```

## Related Functions

- [SetVehicleBeenOccupied](SetVehicleBeenOccupied): Sets the vehicle's occupancy.
48 changes: 48 additions & 0 deletions docs/scripting/functions/HideObjectForPlayer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: HideObjectForPlayer
description: Hide an object for a player.
tags: ["player", "object"]
---

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

## Description

Hide an object for a player.

## Parameters

| Name | Description |
|----------|------------------------------------------|
| playerid | The ID of the player. |
| objectid | The ID of the object to hide for player. |

## Returns

`true` - The function was executed successfully.

`false` - The function failed to execute. The playerid or objectid specified does not exist.

## Examples

```c
new gObject;

public OnGameModeInit()
{
gObject = CreateObject(1431, 921.12201, -1206.78613, 16.52670, 0.00000, 0.00000, 90.00000);
return 1;
}

public OnPlayerConnect(playerid)
{
HideObjectForPlayer(playerid, gObject);
return 1;
}
```
## Related Functions
- [ShowObjectForPlayer](ShowObjectForPlayer): Show an object for a player.
- [IsObjectHiddenForPlayer](IsObjectHiddenForPlayer): Checks if an object is hidden for a player.
- [CreateObject](CreateObject): Create an object.
2 changes: 1 addition & 1 deletion docs/scripting/functions/HidePickupForPlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ public OnPlayerSpawn(playerid)
- [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.
65 changes: 65 additions & 0 deletions docs/scripting/functions/IsObjectHiddenForPlayer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: IsObjectHiddenForPlayer
description: Checks if an object is hidden for a player.
tags: ["player", "object"]
---

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

## Description

Checks if an object is hidden for a player.

## Parameters

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

## Returns

`true` - Object is hidden for the player.

`false` - Object is not hidden for the player.

## Examples

```c
new gObject;

public OnGameModeInit()
{
gObject = CreateObject(1431, 921.12201, -1206.78613, 16.52670, 0.00000, 0.00000, 90.00000);
return 1;
}

public OnPlayerConnect(playerid)
{
HideObjectForPlayer(playerid, gObject);
return 1;
}

public OnPlayerSpawn(playerid)
{
if (IsObjectHiddenForPlayer(playerid, gObject))
{
printf("Object %d is hidden for player %d", gObject, playerid);
}
return 1;
}
```
## Notes
:::tip
You can hide objects for a specific player with [HideObjectForPlayer](HideObjectForPlayer) function.
:::
## Related Functions
- [HideObjectForPlayer](HideObjectForPlayer): Hide an object for a player.
- [ShowObjectForPlayer](ShowObjectForPlayer): Show an object for a player.
- [CreateObject](CreateObject): Create an object.
2 changes: 1 addition & 1 deletion docs/scripting/functions/IsPickupHiddenForPlayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ public OnPlayerSpawn(playerid)
- [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.
Loading

0 comments on commit 9d167ea

Please sign in to comment.