Skip to content

Commit ca3ed9d

Browse files
authored
Merge branch 'openmultiplayer:master' into patch-1
2 parents 5b6bf9d + 0c451df commit ca3ed9d

File tree

489 files changed

+12763
-890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

489 files changed

+12763
-890
lines changed

app/transports/api/launcher/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Release beta version`, // Deprecated, keeping it for backward compatibility
5151
},
5252
"6": map[string]string{
5353
"download": "https://github.com/openmultiplayer/launcher/releases/latest",
54-
"ompPluginChecksum": "0e5e8f780d83e8c69b0a3b792524bddd",
54+
"ompPluginChecksum": "865da2905ba33153c9db9462915db006",
5555
"ompPluginDownload": "https://assets.open.mp/omp-client-6.dll",
5656
},
5757
},

frontend/docs/scripting/callbacks/OnClientMessage.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ description: This callback gets called whenever the NPC sees a ClientMessage.
55
tags: []
66
---
77

8+
:::warning
9+
10+
This callback is deprecated.
11+
12+
:::
13+
814
## Description
915

1016
This callback gets called whenever the NPC sees a ClientMessage. This will be everytime a [SendClientMessageToAll](../functions/SendClientMessageToAll) function is used and everytime a [SendClientMessage](../functions/SendClientMessage) function is sent towards the NPC. This callback won't be called when someone says something. For a version of this with player text, see [NPC:OnPlayerText](OnPlayerText).
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: OnNPCChangeNode
3+
sidebar_label: OnNPCChangeNode
4+
description: This callback is called when an NPC attempts to change from one navigation node to another during node-based movement.
5+
tags: ["npc", "node", "navigation"]
6+
---
7+
8+
<VersionWarn version='omp v1.5.8.3079' />
9+
10+
## Description
11+
12+
This callback is called when an NPC attempts to change from one navigation node to another during node-based movement. This allows you to control whether the node change should be allowed or denied.
13+
14+
| Name | Description |
15+
| --------- | ----------------------------------------------- |
16+
| npcid | The ID of the NPC attempting to change nodes |
17+
| newnodeid | The ID of the new node the NPC wants to move to |
18+
| oldnodeid | The ID of the current node the NPC is on |
19+
20+
## Returns
21+
22+
Return `true` to allow the node change, or `false` to deny it.
23+
24+
## Examples
25+
26+
```c
27+
public OnNPCChangeNode(npcid, newnodeid, oldnodeid)
28+
{
29+
printf("[NPC] NPC %d changed from node %d to node %d", npcid, oldnodeid, newnodeid);
30+
31+
// Notify players tracking this NPC
32+
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
33+
{
34+
if (!IsPlayerConnected(playerid))
35+
continue;
36+
37+
if (PlayerNPC[playerid] == npcid)
38+
{
39+
SendClientMessage(playerid, 0x00FF00FF, "NPC %d changed from node %d to node %d", npcid, oldnodeid, newnodeid);
40+
}
41+
}
42+
return 1;
43+
}
44+
```
45+
46+
## Notes
47+
48+
- This callback is only called when NPCs are using node-based navigation via `NPC_PlayNode`
49+
- Returning `false` will prevent the NPC from changing nodes and may cause it to stop navigation
50+
- Node files must be loaded using `NPC_OpenNode` before NPCs can navigate between them
51+
52+
## Related Functions
53+
54+
The following functions might be useful, as they're related to this callback in one way or another.
55+
56+
- [NPC_PlayNode](../functions/NPC_PlayNode): Start NPC node-based navigation
57+
- [NPC_OpenNode](../functions/NPC_OpenNode): Open a navigation node file
58+
- [NPC_CloseNode](../functions/NPC_CloseNode): Close a navigation node file
59+
- [NPC_StopPlayingNode](../functions/NPC_StopPlayingNode): Stop NPC node navigation
60+
61+
## Related Callbacks
62+
63+
- [OnNPCFinishNode](OnNPCFinishNode): Called when NPC finishes navigating a complete node
64+
- [OnNPCFinishNodePoint](OnNPCFinishNodePoint): Called when NPC reaches a specific point in a node

frontend/docs/scripting/callbacks/OnNPCConnect.md

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: OnNPCCreate
3+
sidebar_label: OnNPCCreate
4+
description: This callback is called when an NPC is successfully created.
5+
tags: ["npc"]
6+
---
7+
8+
<VersionWarn version='omp v1.5.8.3079' />
9+
10+
## Description
11+
12+
This callback is called when an NPC is successfully created and added to the server.
13+
14+
| Name | Description |
15+
| ----- | ---------------------------------- |
16+
| npcid | The ID of the NPC that was created |
17+
18+
## Examples
19+
20+
```c
21+
public OnNPCCreate(npcid)
22+
{
23+
printf("[NPC] NPC %d has been created", npcid);
24+
25+
// Notify all connected players
26+
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
27+
{
28+
if (!IsPlayerConnected(playerid))
29+
continue;
30+
31+
SendClientMessage(playerid, 0x00FF00FF, "NPC %d has been created", npcid);
32+
}
33+
return 1;
34+
}
35+
```
36+
37+
## Notes
38+
39+
- This callback is called immediately after the NPC is created but before it's spawned
40+
- The NPC will need to be spawned using `NPC_Spawn` to become visible in the game world
41+
42+
## Related Functions
43+
44+
The following functions might be useful, as they're related to this callback in one way or another.
45+
46+
- [NPC_Create](../functions/NPC_Create): Create a new NPC
47+
- [NPC_Destroy](../functions/NPC_Destroy): Destroy an existing NPC
48+
- [NPC_Spawn](../functions/NPC_Spawn): Spawn the NPC in the game world
49+
50+
## Related Callbacks
51+
52+
- [OnNPCDestroy](OnNPCDestroy): Called when an NPC is destroyed
53+
- [OnNPCSpawn](OnNPCSpawn): Called when an NPC is spawned
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: OnNPCDeath
3+
sidebar_label: OnNPCDeath
4+
description: This callback is called when an NPC dies.
5+
tags: ["npc"]
6+
---
7+
8+
<VersionWarn version='omp v1.5.8.3079' />
9+
10+
## Description
11+
12+
This callback is called when an NPC dies.
13+
14+
| Name | Description |
15+
| -------- | --------------------------------------------------------------------------- |
16+
| npcid | The ID of the NPC that died |
17+
| killerid | The ID of the player/NPC that killed the NPC (or INVALID_PLAYER_ID if none) |
18+
| reason | The reason for death (weapon ID or death cause) |
19+
20+
## Examples
21+
22+
```c
23+
public OnNPCDeath(npcid, killerid, WEAPON:reason)
24+
{
25+
printf("[NPC] NPC %d died (killer: %d, weapon: %d)", npcid, killerid, _:reason);
26+
27+
// Notify players tracking this NPC
28+
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
29+
{
30+
if (!IsPlayerConnected(playerid))
31+
continue;
32+
33+
if (PlayerNPC[playerid] == npcid)
34+
{
35+
if (killerid == INVALID_PLAYER_ID)
36+
{
37+
SendClientMessage(playerid, 0xFF0000FF, "Your tracked NPC %d died (weapon: %d)", npcid, _:reason);
38+
}
39+
else
40+
{
41+
SendClientMessage(playerid, 0xFF0000FF, "Your tracked NPC %d was killed by player %d (weapon: %d)", npcid, killerid, _:reason);
42+
}
43+
}
44+
}
45+
return 1;
46+
}
47+
```
48+
49+
## Notes
50+
51+
- The `killerid` parameter will be `INVALID_PLAYER_ID` if the NPC death was not player inflicted
52+
- The `reason` parameter contains the weapon ID that caused the death (255 for unknown/other causes)
53+
54+
## Related Functions
55+
56+
The following functions might be useful, as they're related to this callback in one way or another.
57+
58+
- [NPC_Kill](../functions/NPC_Kill): Kill an NPC
59+
- [NPC_Respawn](../functions/NPC_Respawn): Respawn a dead NPC
60+
- [NPC_GetHealth](../functions/NPC_GetHealth): Get NPC's health
61+
- [NPC_SetHealth](../functions/NPC_SetHealth): Set NPC's health
62+
63+
## Related Callbacks
64+
65+
- [OnNPCSpawn](OnNPCSpawn): Called when an NPC spawns
66+
- [OnNPCRespawn](OnNPCRespawn): Called when an NPC respawns
67+
- [OnNPCTakeDamage](OnNPCTakeDamage): Called when an NPC takes damage
68+
- [OnPlayerDeath](OnPlayerDeath): Called when a player dies
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: OnNPCDestroy
3+
sidebar_label: OnNPCDestroy
4+
description: This callback is called when an NPC is destroyed.
5+
tags: ["npc"]
6+
---
7+
8+
<VersionWarn version='omp v1.5.8.3079' />
9+
10+
## Description
11+
12+
This callback is called when an NPC is destroyed and removed from the server.
13+
14+
| Name | Description |
15+
| ----- | ------------------------------------ |
16+
| npcid | The ID of the NPC that was destroyed |
17+
18+
## Examples
19+
20+
```c
21+
public OnNPCDestroy(npcid)
22+
{
23+
printf("[NPC] NPC %d has been destroyed", npcid);
24+
25+
// Clear any player tracking this NPC and notify
26+
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
27+
{
28+
if (!IsPlayerConnected(playerid))
29+
continue;
30+
31+
if (PlayerNPC[playerid] == npcid)
32+
{
33+
PlayerNPC[playerid] = INVALID_NPC_ID;
34+
SendClientMessage(playerid, 0xFF0000FF, "Your tracked NPC %d has been destroyed", npcid);
35+
}
36+
else
37+
{
38+
SendClientMessage(playerid, 0xFFFF00FF, "NPC %d has been destroyed", npcid);
39+
}
40+
}
41+
return 1;
42+
}
43+
44+
```
45+
46+
## Notes
47+
48+
- This callback is called immediately before the NPC is removed from the server
49+
- The NPC will be disconnected and its player slot freed after this callback
50+
51+
## Related Functions
52+
53+
The following functions might be useful, as they're related to this callback in one way or another.
54+
55+
- [NPC_Create](../functions/NPC_Create): Create a new NPC
56+
- [NPC_Destroy](../functions/NPC_Destroy): Destroy an existing NPC
57+
- [NPC_IsValid](../functions/NPC_IsValid): Check if NPC ID is valid
58+
59+
## Related Callbacks
60+
61+
- [OnNPCCreate](OnNPCCreate): Called when an NPC is created

frontend/docs/scripting/callbacks/OnNPCDisconnect.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

frontend/docs/scripting/callbacks/OnNPCEnterVehicle.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

frontend/docs/scripting/callbacks/OnNPCExitVehicle.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)