giveWeapon | Multi Theft Auto: Wiki Skip to content

giveWeapon

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


giveWeapon gives a specified weapon to a certain player or ped. There is an optional argument to specify ammunition. For example, a melee weapon doesn't need an ammo argument.

Note

When setting ammo for weapons in slot 0,1,10,11 or 12, the ammo max is 1 When setting ammo for weapons in slot 3,4,5, the ammo is added When setting ammo for weapons in slot 2,6,7,8,9 and the slot weapon is changing, the ammo is replaced

Syntax

giveWeapon ( )

Code Examples

server

Example 1:This example gives a player an M4 with 200 ammo whenever they spawn.

function giveWeaponsOnSpawn ( theSpawnpont, theTeam )
giveWeapon ( source, 31, 200 ) -- Gives the M4 weapon with 200 ammo
end
addEventHandler ( "onPlayerSpawn", root, giveWeaponsOnSpawn ) -- attach the event handler