Garry's Mod Wiki

Garry's Mod Wiki

  number Weapon:GetSlot()

Description

Returns the slot of the weapon.

The slot numbers start from 0.

Returns

1 number
The slot of the weapon.

Example

How you could use this function to check if a weapon slot was empty or not.

function IsSlotEmpty( ply, slot ) slot = slot - 1 -- take away 1 from the slot number you want since it starts from 0 for _, v in ipairs( ply:GetWeapons() ) do -- get all the weapons the player has and loop through them if v:GetSlot() == slot then return false end -- check if the slot is the slot you wanted to check, if it is, return false end return true -- otherwise return true end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...