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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions frontend/docs/scripting/callbacks/OnNPCDeath.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ tags: ["npc"]

This callback is called when an NPC dies.

| Name | Description |
| -------- | --------------------------------------------------------------------------- |
| npcid | The ID of the NPC that died |
| killerid | The ID of the player/NPC that killed the NPC (or INVALID_PLAYER_ID if none) |
| reason | The reason for death (weapon ID or death cause) |
| Name | Description |
| ------------- | --------------------------------------------------------------------------- |
| npcid | The ID of the NPC that died |
| killerid | The ID of the player/NPC that killed the NPC (or INVALID_PLAYER_ID if none) |
| WEAPON:reason | The reason for death (weapon ID or death cause) |

## Examples

Expand Down
14 changes: 7 additions & 7 deletions frontend/docs/scripting/callbacks/OnNPCGiveDamage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ tags: ["npc", "damage"]

This callback is called when an NPC gives damage to a player.

| Name | Description |
| --------- | ---------------------------------------------------- |
| npcid | The ID of the NPC that gave the damage |
| damagedid | The ID of the player that received the damage |
| amount | The amount of damage that was given |
| weaponid | The weapon ID used to give the damage |
| bodypart | The [body part](../resources/bodyparts) that was hit |
| Name | Description |
| --------------- | ---------------------------------------------------- |
| npcid | The ID of the NPC that gave the damage |
| damagedid | The ID of the player that received the damage |
| Float:amount | The amount of damage that was given |
| WEAPON:weaponid | The weapon ID used to give the damage |
| bodypart | The [body part](../resources/bodyparts) that was hit |

## Returns

Expand Down
14 changes: 7 additions & 7 deletions frontend/docs/scripting/callbacks/OnNPCTakeDamage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ tags: ["npc", "damage"]

This callback is called when an NPC takes damage from a player or another NPC.

| Name | Description |
| --------- | ---------------------------------------------------- |
| npcid | The ID of the NPC that took damage |
| issuerid | The ID of the player/NPC that caused the damage |
| amount | The amount of damage that was taken |
| weaponid | The weapon ID used to cause the damage |
| bodypart | The [body part](../resources/bodyparts) that was hit |
| Name | Description |
| --------------- | ---------------------------------------------------- |
| npcid | The ID of the NPC that took damage |
| issuerid | The ID of the player/NPC that caused the damage |
| Float:amount | The amount of damage that was taken |
| WEAPON:weaponid | The weapon ID used to cause the damage |
| bodypart | The [body part](../resources/bodyparts) that was hit |

## Returns

Expand Down
18 changes: 9 additions & 9 deletions frontend/docs/scripting/callbacks/OnNPCWeaponShot.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ tags: ["npc", "weapon", "shooting"]

This callback is called when an NPC fires a weapon.

| Name | Description |
| -------- | ------------------------------------------ |
| npcid | The ID of the NPC that fired the weapon |
| weaponid | The weapon ID that was fired |
| hittype | The type of entity that was hit (if any) |
| hitid | The ID of the entity that was hit (if any) |
| fX | The X coordinate where the bullet hit |
| fY | The Y coordinate where the bullet hit |
| fZ | The Z coordinate where the bullet hit |
| Name | Description |
| ----------------------- | ------------------------------------------ |
| npcid | The ID of the NPC that fired the weapon |
| WEAPON:weaponid | The weapon ID that was fired |
| BULLET_HIT_TYPE:hittype | The type of entity that was hit (if any) |
| hitid | The ID of the entity that was hit (if any) |
| Float:fX | The X coordinate where the bullet hit |
| Float:fY | The Y coordinate where the bullet hit |
| Float:fZ | The Z coordinate where the bullet hit |

## Returns

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ tags: ["npc"]

当 NPC 死亡时调用此回调。

| 参数 | 说明 |
| -------- | ----------------------------------------------------------- |
| npcid | 死亡的 NPC 的 ID |
| killerid | 击杀 NPC 的玩家/NPC 的 ID(如果没有则为 INVALID_PLAYER_ID) |
| reason | 死亡原因(武器 ID 或死亡原因) |
| 参数 | 说明 |
| ------------- | ----------------------------------------------------------- |
| npcid | 死亡的 NPC 的 ID |
| killerid | 击杀 NPC 的玩家/NPC 的 ID(如果没有则为 INVALID_PLAYER_ID) |
| Weapon:reason | 死亡原因(武器 ID 或死亡原因) |

## 示例

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ tags: ["npc", "伤害"]

当 NPC 对玩家造成伤害时调用此回调。

| 参数 | 说明 |
| --------- | ------------------------------------------ |
| npcid | 造成伤害的 NPC 的 ID |
| damagedid | 受到伤害的玩家的 ID |
| damage | 造成的伤害数量 |
| weaponid | 用于造成伤害的武器 ID |
| bodypart | 被击中的[身体部位](../resources/bodyparts) |
| 参数 | 说明 |
| --------------- | ------------------------------------------ |
| npcid | 造成伤害的 NPC 的 ID |
| damagedid | 受到伤害的玩家的 ID |
| Float:amount | 造成的伤害数量 |
| WEAPON:weaponid | 用于造成伤害的武器 ID |
| bodypart | 被击中的[身体部位](../resources/bodyparts) |

## 返回值

Expand All @@ -26,7 +26,7 @@ tags: ["npc", "伤害"]
## 示例

```c
public OnNPCGiveDamage(npcid, damagedid, Float:damage, WEAPON:weaponid, bodypart)
public OnNPCGiveDamage(npcid, damagedid, Float:amount, WEAPON:weaponid, bodypart)
{
// 仅通知追踪此 NPC 的玩家
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
Expand All @@ -37,7 +37,7 @@ public OnNPCGiveDamage(npcid, damagedid, Float:damage, WEAPON:weaponid, bodypart
if (PlayerNPC[playerid] == npcid)
{
SendClientMessage(playerid, 0xFF8800FF, "NPC %d 对玩家 %d 造成了 %.1f 点伤害(武器:%d,身体部位:%d)",
npcid, damage, damagedid, _:weaponid, bodypart);
npcid, amount, damagedid, _:weaponid, bodypart);
}
}
return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ tags: ["npc", "伤害"]

当 NPC 受到来自玩家或其他 NPC 的伤害时调用此回调。

| 参数 | 说明 |
| -------- | ------------------------------------------ |
| npcid | 受到伤害的 NPC 的 ID |
| issuerid | 造成伤害的玩家/NPC 的 ID |
| damage | 受到的伤害数量 |
| weaponid | 用于造成伤害的武器 ID |
| bodypart | 被击中的[身体部位](../resources/bodyparts) |
| 参数 | 说明 |
| --------------- | ------------------------------------------ |
| npcid | 受到伤害的 NPC 的 ID |
| issuerid | 造成伤害的玩家/NPC 的 ID |
| Float:amount | 受到的伤害数量 |
| WEAPON:weaponid | 用于造成伤害的武器 ID |
| bodypart | 被击中的[身体部位](../resources/bodyparts) |

## 返回值

Expand All @@ -26,7 +26,7 @@ tags: ["npc", "伤害"]
## 示例

```c
public OnNPCTakeDamage(npcid, issuerid, Float:damage, WEAPON:weaponid, bodypart)
public OnNPCTakeDamage(npcid, issuerid, Float:amount, WEAPON:weaponid, bodypart)
{
// 仅通知追踪此 NPC 的玩家
for (new playerid = 0; playerid < MAX_PLAYERS; playerid++)
Expand All @@ -39,12 +39,12 @@ public OnNPCTakeDamage(npcid, issuerid, Float:damage, WEAPON:weaponid, bodypart)
if (issuerid == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, 0xFF8800FF, "NPC %d 受到 %.1f 点伤害(武器:%d,身体部位:%d)",
npcid, damage, _:weaponid, bodypart);
npcid, amount, _:weaponid, bodypart);
}
else
{
SendClientMessage(playerid, 0xFF8800FF, "NPC %d 受到玩家 %d 造成的 %.1f 点伤害(武器:%d,身体部位:%d)",
npcid, damage, issuerid, _:weaponid, bodypart);
npcid, amount, issuerid, _:weaponid, bodypart);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ tags: ["npc", "武器", "射击"]

当 NPC 开火时调用此回调。

| 参数 | 说明 |
| -------- | ------------------------ |
| npcid | 开火的 NPC 的 ID |
| weaponid | 开火的武器 ID |
| hittype | 命中的实体类型(如果有) |
| hitid | 命中的实体 ID(如果有) |
| fX | 子弹击中的 X 坐标 |
| fY | 子弹击中的 Y 坐标 |
| fZ | 子弹击中的 Z 坐标 |
| 参数 | 说明 |
| ----------------------- | ------------------------ |
| npcid | 开火的 NPC 的 ID |
| WEAPON:weaponid | 开火的武器 ID |
| BULLET_HIT_TYPE:hittype | 命中的实体类型(如果有) |
| hitid | 命中的实体 ID(如果有) |
| Float:fX | 子弹击中的 X 坐标 |
| Float:fY | 子弹击中的 Y 坐标 |
| Float:fZ | 子弹击中的 Z 坐标 |

## 返回值

Expand Down