getSlotFromWeapon | Multi Theft Auto: Wiki Skip to content

getSlotFromWeapon

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.


This function allows you to identify the weapon slot that a weapon belongs to.

Syntax

getSlotFromWeapon ( )

Code Examples

server

This will output to the chatbox what weapon slot a given weapon number belongs to when entered into the console (i.e. 'getWeaponSlot 10').

function outputWeaponSlot ( source, commandName, weaponID )
local weaponSlot = getSlotFromWeapon ( weaponID )
if (weaponSlot) then
outputChatBox ( "Weapon ID " .. weaponID .. " is in weapon slot " .. weaponSlot)
else
outputChatBox ( "Invalid weapon ID" )
end
end
addCommandHandler ( "getWeaponSlot", outputWeaponSlot )