Weapons: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 158: Line 158:
</syntaxhighlight>
</syntaxhighlight>


==Client Functions==
==Functions==
{{Client_weapon_functions}}==Server Function==
{{Weapon functions|server}}== See Also ==
{{Weapon functions}}== See Also ==
* [[Id|Ids]]
* [[Id|Ids]]



Revision as of 15:38, 11 September 2024

Scripting functions that ask for a weapon ID need an integer that refers to the GTASA weapon ID list. They are listed below.

[[{{{image}}}|link=|]] Note:
  • Clip size () denotes clip size when the weapon is dual wielded. Weapons without this specification are not dual wield weapons.
  • GTASA weapon stats will affect movement, accuracy, damage, and dual wield capability. See setPedStat to change these stats. The default MTA server package comes with a resource called "defaultStats" that sets GTASA weapon stats to 999. See the weapon stats link for more info.
  • 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.
Slot Type Image Name ID Model ID Clip Sharing slot ammo
0 Hand Fist.png Fist 0 - - -
Knuckle.png Brassknuckle 1 331 -
1 Melee Golfclub.png Golfclub 2 333 - -
Nitestik.png Nightstick 3 334 -
Knife.png Knife 4 335 -
Bat.png Bat 5 336 -
Shovel.png Shovel 6 337 -
Poolcue.png Poolstick 7 338 -
Katana.png Katana 8 339 -
Saw.png Chainsaw 9 341 -
2 Handguns Colt45.png Colt 45 22 346 17 (34) No
Replacing handgun resets slot 2 ammo
Silenced.png Silenced 23 347 17
Deagle.png Deagle 24 348 7
3 Shotguns Shotgun.png Shotgun 25 349 1 Yes
Sawnoff.png Sawed-off 26 350 2 (4)
Spas12.png Combat Shotgun 27 351 7
4 Sub-Machine Guns Mac10.png Uzi 28 352 50 (100) Yes
Mp5.png MP5 29 353 30
Tec9.png Tec-9 32 372 50 (100)
5 Assault Rifles Ak47.png AK-47 30 355 30 Yes
M4.png M4 31 356 50
6 Rifles Rifle.png Rifle 33 357 1 No
Replacing rifle resets slot 6 ammo
Sniper.png Sniper 34 358 1
7 Heavy Weapons Rocketla.png Rocket Launcher 35 359 1 No
Replacing heavy weapon resets slot 7 ammo
Heatseek.png Rocket Launcher HS 36 360 1
Flame.png Flamethrower 37 361 50
Minigun.png Minigun 38 362 500
8 Projectiles Grenade.png Grenade 16 342 1 No
Replacing projectile resets slot 8 ammo
Teargas.png Teargas 17 343 1
Molotov.png Molotov 18 344 1
Satchel.png Satchel 39 363 1
9 Special 1 Spraycan.png Spraycan 41 365 500 No
Replacing slot 9 weapon resets slot 9 ammo
Fire ex.png Fire Extinguisher 42 366 500
Camera.png Camera 43 367 36
10 Gifts Dildo1.png Dildo 10 321 - -
Dildo2.png Dildo 11 322 -
Vibe1.png Vibrator 12 323 -
Flowers.png Flower 14 325 -
Cane.png Cane 15 326 -
11 Special 2 Irgoggle.png Nightvision 44 368 - -
Irgoggle.png Infrared 45 369 -
Paracute.png Parachute 46 371 -
12 Satchel Detonator Bomb.png Bomb 40 364 - -

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


See Also