Skip to content

players.giveWeapon

Gives a player a weapon, or more ammunition for one they already have. The game loads its model before the result is applied.

players.giveWeapon(player: PlayerTarget, weaponId: number, ammo: number): Promise<ActionResult>
Name Type Description
player PlayerTarget The player, or their ID.
weaponId number GTA:SA’s weapon ID, 0 to 46 (24 is the Desert Eagle, 31 the M4); all of them on Weapons.
ammo number Rounds, 0 to 1,000,000.

A promise of an ActionResult: applied once the player’s game has carried it out, rejected with a code, or timeout after five seconds without an answer.

Arm every player when they spawn.

gamemodes/my-mode.ts
import { players, server } from "nativemp";
server.on("playerSpawned", async ({ player }) => {
await players.giveWeapon(player, 24, 50); // Desert Eagle
await players.giveWeapon(player, 31, 200); // M4
});

A captured Player keeps this effect bound to its connection across awaits; see Async handlers.