Weapons: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
*For death reasons, especially in event handlers for onPlayerWasted or similar, also have a look at the [[Damage Types]]. | *For death reasons, especially in event handlers for onPlayerWasted or similar, also have a look at the [[Damage Types]]. | ||
*'''Name''' is compatible with functions [[getWeaponNameFromID]], [[getWeaponIDFromName]]. | *'''Name''' is compatible with functions [[getWeaponNameFromID]], [[getWeaponIDFromName]]. | ||
*'''Bullet Sync''' refers to whether they are triggered by the [[OnPlayerWeaponFire]] event. | |||
}} | }} | ||
{|class="wikitable sortable" style="text-align:center; margin: 1em auto 1em auto; border:1px solid black" | {|class="wikitable sortable" style="text-align:center; margin: 1em auto 1em auto; border:1px solid black" | ||
|- | |- | ||
! Slot || class="unsortable" | Type || class="unsortable" | Image || Name || ID || class="unsortable" | Model ID || class="unsortable" | Clip || class="unsortable" | Sharing slot ammo | ! Slot || class="unsortable" | Type || class="unsortable" | Image || Name || ID || class="unsortable" | Model ID || class="unsortable" | Clip || class="unsortable" | Sharing slot ammo || class="unsortable" | Bullet Sync | ||
|- | |- | ||
! rowspan="2" | 0 | ! rowspan="2" | 0 | ||
Line 14: | Line 15: | ||
| [[Image:Fist.png]] || align="left" | Fist || 0 || - || - | | [[Image:Fist.png]] || align="left" | Fist || 0 || - || - | ||
| rowspan="2" | - | | rowspan="2" | - | ||
| rowspan="2" | No | |||
|- | |- | ||
| [[Image:Knuckle.png]] || align="left" | Brassknuckle || 1 || 331 || - | | [[Image:Knuckle.png]] || align="left" | Brassknuckle || 1 || 331 || - | ||
Line 21: | Line 23: | ||
| [[Image:Golfclub.png]] || align="left" | Golfclub || 2 || 333 || - | | [[Image:Golfclub.png]] || align="left" | Golfclub || 2 || 333 || - | ||
| rowspan="8" | - | | rowspan="8" | - | ||
| rowspan="8" | No | |||
|- | |- | ||
| [[Image:Nitestik.png]] || align="left" | Nightstick || 3 || 334 || - | | [[Image:Nitestik.png]] || align="left" | Nightstick || 3 || 334 || - | ||
Line 40: | Line 43: | ||
| [[Image:Colt45.png]] || align="left" | Colt 45 || 22 || 346 || 17 (34) | | [[Image:Colt45.png]] || align="left" | Colt 45 || 22 || 346 || 17 (34) | ||
| rowspan="3" | '''No'''<br/>''Replacing handgun resets slot 2 ammo'' | | rowspan="3" | '''No'''<br/>''Replacing handgun resets slot 2 ammo'' | ||
| rowspan="3" | Yes | |||
|- | |- | ||
| [[Image:Silenced.png]] || align="left" | Silenced || 23 || 347 || 17 | | [[Image:Silenced.png]] || align="left" | Silenced || 23 || 347 || 17 | ||
Line 48: | Line 52: | ||
! rowspan="3" | Shotguns | ! rowspan="3" | Shotguns | ||
| [[Image:Shotgun.png]] || align="left" | Shotgun || 25 || 349 || 1 | | [[Image:Shotgun.png]] || align="left" | Shotgun || 25 || 349 || 1 | ||
| rowspan="3" | Yes | |||
| rowspan="3" | Yes | | rowspan="3" | Yes | ||
|- | |- | ||
Line 57: | Line 62: | ||
! rowspan="3" | Sub-Machine Guns | ! rowspan="3" | Sub-Machine Guns | ||
| [[Image:Mac10.png]] || align="left" | Uzi || 28 || 352 || 50 (100) | | [[Image:Mac10.png]] || align="left" | Uzi || 28 || 352 || 50 (100) | ||
| rowspan="3" | Yes | |||
| rowspan="3" | Yes | | rowspan="3" | Yes | ||
|- | |- | ||
Line 66: | Line 72: | ||
! rowspan="2" | Assault Rifles | ! rowspan="2" | Assault Rifles | ||
| [[Image:Ak47.png]] || align="left" | AK-47 || 30 || 355 || 30 | | [[Image:Ak47.png]] || align="left" | AK-47 || 30 || 355 || 30 | ||
| rowspan="2" | Yes | |||
| rowspan="2" | Yes | | rowspan="2" | Yes | ||
|- | |- | ||
Line 74: | Line 81: | ||
| [[Image:Rifle.png]] || align="left" | Rifle || 33 || 357 || 1 | | [[Image:Rifle.png]] || align="left" | Rifle || 33 || 357 || 1 | ||
| rowspan="2" | '''No'''<br/>''Replacing rifle resets slot 6 ammo'' | | rowspan="2" | '''No'''<br/>''Replacing rifle resets slot 6 ammo'' | ||
| rowspan="2" | Yes | |||
|- | |- | ||
| [[Image:Sniper.png]] || align="left" | Sniper || 34 || 358 || 1 | | [[Image:Sniper.png]] || align="left" | Sniper || 34 || 358 || 1 | ||
Line 81: | Line 89: | ||
| [[Image:Rocketla.png]] || align="left" | Rocket Launcher || 35 || 359 || 1 | | [[Image:Rocketla.png]] || align="left" | Rocket Launcher || 35 || 359 || 1 | ||
| rowspan="4" | '''No'''<br/>''Replacing heavy weapon resets slot 7 ammo'' | | rowspan="4" | '''No'''<br/>''Replacing heavy weapon resets slot 7 ammo'' | ||
| rowspan="4" | No | |||
|- | |- | ||
| [[Image:Heatseek.png]] || align="left" | Rocket Launcher HS || 36 || 360 || 1 | | [[Image:Heatseek.png]] || align="left" | Rocket Launcher HS || 36 || 360 || 1 | ||
Line 92: | Line 101: | ||
| [[Image:Grenade.png]] || align="left" | Grenade || 16 || 342 || 1 | | [[Image:Grenade.png]] || align="left" | Grenade || 16 || 342 || 1 | ||
| rowspan="4" | '''No'''<br/>''Replacing projectile resets slot 8 ammo'' | | rowspan="4" | '''No'''<br/>''Replacing projectile resets slot 8 ammo'' | ||
| rowspan="4" | No | |||
|- | |- | ||
| [[Image:Teargas.png]] || align="left" | Teargas || 17 || 343 || 1 | | [[Image:Teargas.png]] || align="left" | Teargas || 17 || 343 || 1 | ||
Line 103: | Line 113: | ||
| [[Image:Spraycan.png]] || align="left" | Spraycan || 41 || 365 || 500 | | [[Image:Spraycan.png]] || align="left" | Spraycan || 41 || 365 || 500 | ||
| rowspan="3" | '''No'''<br/>''Replacing slot 9 weapon resets slot 9 ammo'' | | rowspan="3" | '''No'''<br/>''Replacing slot 9 weapon resets slot 9 ammo'' | ||
| rowspan="3" | No | |||
|- | |- | ||
| [[Image:Fire_ex.png]] || align="left" | Fire Extinguisher || 42 || 366 || 500 | | [[Image:Fire_ex.png]] || align="left" | Fire Extinguisher || 42 || 366 || 500 | ||
Line 112: | Line 123: | ||
| [[Image:Dildo1.png]] || align="left" | Dildo || 10 || 321 || - | | [[Image:Dildo1.png]] || align="left" | Dildo || 10 || 321 || - | ||
| rowspan="5" | - | | rowspan="5" | - | ||
| rowspan="5" | No | |||
|- | |- | ||
| [[Image:Dildo2.png]] || align="left" | Dildo || 11 || 322 || - | | [[Image:Dildo2.png]] || align="left" | Dildo || 11 || 322 || - | ||
Line 125: | Line 137: | ||
| [[Image:Irgoggle.png]] || align="left" | Nightvision || 44 || 368 || - | | [[Image:Irgoggle.png]] || align="left" | Nightvision || 44 || 368 || - | ||
| rowspan="3" | - | | rowspan="3" | - | ||
| rowspan="3" | No | |||
|- | |- | ||
| [[Image:Irgoggle.png]] || align="left" | Infrared || 45 || 369 || - | | [[Image:Irgoggle.png]] || align="left" | Infrared || 45 || 369 || - | ||
Line 134: | Line 147: | ||
| [[Image:Bomb.png]] || align="left" | Bomb || 40 || 364 || - | | [[Image:Bomb.png]] || align="left" | Bomb || 40 || 364 || - | ||
| rowspan="1" | - | | rowspan="1" | - | ||
| rowspan="1" | No | |||
|} | |} | ||
Lua table of all weapon IDs. | Lua table of all weapon IDs. | ||
Line 158: | Line 172: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | ==Functions== | ||
{{Weapon functions|server}}== See Also == | |||
{{Weapon functions}}== See Also == | |||
* [[Id|Ids]] | * [[Id|Ids]] | ||
Latest revision as of 21:00, 17 November 2024
Scripting functions that ask for a weapon ID need an integer that refers to the GTASA weapon ID list. They are listed below.
Lua table of all weapon IDs.
local weaponsID = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 22, 23, 24, 25, 26, 27, 28, 29, 32, 30, 31, 33, 34, 35, 36, 37, 38, 16, 17, 18, 39, 41, 42, 43, 10, 11, 12, 14, 15, 44, 45, 46, 40}
Lua table of all weapon IDs grouped by slot.
local weaponsBySlot = { [0] = {0, 1}, -- Hand [1] = {2, 3, 4, 5, 6, 7, 8, 9}, -- Melee [2] = {22, 23, 24}, -- Handguns [3] = {25, 26, 27}, -- Shotguns [4] = {28, 29, 32}, -- Sub-Machine Guns [5] = {30, 31}, -- Assault Rifles [6] = {33, 34}, -- Rifles [7] = {35, 36, 37, 38}, -- Heavy Weapons [8] = {16, 17, 18, 39}, -- Projectiles [9] = {41, 42, 43}, -- Special 1 [10] = {10, 11, 12, 14, 15}, -- Gifts [11] = {44, 45, 46}, -- Special 2 [12] = {40}, -- Satchel Detonator }
Functions
- giveWeapon
- takeAllWeapons
- takeWeapon
- Shared
- getWeaponProperty
- getPickupWeapon
- getOriginalWeaponProperty
- getSlotFromWeapon
- getWeaponIDFromName
- getWeaponNameFromID
- setWeaponAmmo
- setWeaponProperty