- Documentation
- Weapons
Category
Weapons
All Lua functions and events in the Weapons category, on the server and the client.

Server functions 23
createCreates a scripted weapon that stands in the world and belongs to no ped. You control it withWeapon setWeaponTarget,fireWeaponandsetWeaponState.fireFires one shot from a scripted weapon at its current target. Uses one round from the clip.Weapon getReturns a weapon's factory property. The factory data lives in the game files, so it always returnsOriginal Weapon Property false. UsegetWeaponPropertyfor properties set on the server.getReturns a scripted weapon's reserve ammo (outside the clip).Weapon Ammo getReturns the number of rounds in a scripted weapon's clip.Weapon Clip Ammo getReturns a scripted weapon's fire rate multiplier (Weapon Firing Rate 1is the factory rate).getReturns a scripted weapon's flags: the whole table, or one flag when you pass its name.Weapon Flags getReturns a weapon property (e.g. damage, range) set on this server withWeapon Property setWeaponProperty.getReturns a scripted weapon's state.Weapon State getReturns a scripted weapon's target.Weapon Target giveGives a ped a weapon with ammo. If the ped already has a weapon in that slot, it is replaced.Weapon isChecks whether scripted weapons are drawn.Weapon Render Enabled resetRestores a scripted weapon's factory fire rate (multiplierWeapon Firing Rate 1).setSets ammo. For a ped it sets the ammo of a given weapon; for a scripted weapon it sets its reserve.Weapon Ammo setSets the number of rounds in a scripted weapon's clip.Weapon Clip Ammo setSets a scripted weapon's fire rate multiplier.Weapon Firing Rate setSets a scripted weapon flag (name and value) or several flags at once from a table.Weapon Flags setSets a weapon property (damage, range, accuracy and so on) for the whole server.Weapon Property setTurns drawing of scripted weapons on or off.Weapon Render Enabled setSets a scripted weapon's state.Weapon State setAims a scripted weapon at an element or a point. With no target (Weapon Target nil) it stops aiming.takeTakes every weapon from a ped.All Weapons takeTakes one weapon from a ped together with all its ammo.Weapon
Client functions 2
isChecks whether the weapon wheel is enabled.Weapon Wheel Enabled setCompletely disables or restores the game's weapon wheel. A disabled wheel never opens: no menu, no slow motion and no grey background. Switching weapons with the mouse wheel still works. The wheel is enabled by default. The setting applies to this game only; if the wheel was open, it closes right away.Weapon Wheel Enabled
Shared functions 7
getReturns the inventory slot (0-12) a weapon ID goes into.Slot From Weapon getReturns a weapon ID from its name. Case does not matter, and a numeric string (Weapon IDFrom Name "30") works too.getReturns a sorted list of every weapon ID used in the game.Weapon IDs getReturns the model ID a ped holds in hand for a weapon.Weapon Model From ID getReturns the GTA San Andreas weapon name for an ID (0-46).Weapon Name From ID getReturns the weapon IDs that belong to an inventory slot.Weapons In Slot isChecks whether an ID is a weapon used in the game (0-46, skipping unused numbers).Valid Weapon ID
Server events 2
onA player fired a firearm. It arrives once per bullet, with the point the shot came from and the point it hit (a wall, the ground, a ped or the end of the range). The game reports shots only while some resource listens to this event, so it costs nothing without a listener.Player Weapon Fire onA script weapon (Weapon Fire createWeapon) fired withfireWeapon.