Skip to content

pickups.create

Creates a pickup of your gamemode’s own. The server keeps it, every player’s game shows it, and the first player to touch it takes it.

pickups.create(settings: PickupSettings): Promise<ActionResult>
Name Type Description
settings.model number The object model, 1 to 19999. A weapon’s pickup model is on Weapons.
settings.position Vector3 Where, [x, y, z]. x and y within ±6000, z from -500 to 2000.
settings.pickupType number Optional. The game’s pickup type: 1, 2, 3, 4, 5, 8, 15, 19 or 22. The default 2 comes back 30 seconds after it is taken, 3 is taken once, 8 is money.
settings.ammoOrMoney number Optional. Ammo or money, 0 to 1,000,000.
settings.interior number Optional. 0 outside (the default), 1 to 18 an interior’s, 13 every interior.
settings.virtualWorld number Optional. The virtual world it is in, or virtualWorlds.every for every one. Defaults to 0.

A promise of an ActionResult: applied with createdId, the new pickup’s ID. Bad settings are invalid-pickup or invalid-position; full when the server has no room for more.

A health pickup at Grove Street that gives 100 health.

gamemodes/my-mode.ts
import { pickups, players, server } from "nativemp";
const result = await pickups.create({ model: 1240, position: [2490.0, -1680.0, 13.3] }); // 1240: health
const healthId = result.status === "applied" ? result.createdId : undefined;
server.on("playerTookPickup", async ({ player, pickup }) => {
if (pickup.id === healthId) await players.setHealth(player, 100);
});