playerTookPickup
Tells your gamemode that a player took one of your gamemode’s pickups. This is where you give the pickup’s goods.
Renamed in 0.28 from pickupTaken; see renamed names.
Signature
Section titled “Signature”server.on("playerTookPickup", ({ player, pickup }) => void)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
player |
PlayerSnapshot |
The player. |
pickup |
Pickup |
The pickup they took. |
Example
Section titled “Example”import { players, server } from "nativemp";
server.on("playerTookPickup", async ({ player, pickup }) => { if (pickup.pickupType === 8) await players.giveMoney(player, pickup.ammoOrMoney);});Pickup
Section titled “Pickup”| Field | Type | Description |
|---|---|---|
id |
number |
The pickup’s ID. |
model |
number |
Its model. |
type |
number |
The game’s pickup type. |
amount |
number |
Ammo or money. |
interior |
number |
0 outside, 1 to 18 an interior’s, 13 every interior. |
position |
Vector3 |
Where it is. |
Related
Section titled “Related”playerTakePickupRequest: refuse the takepickups.create: make a pickup