getPedWeaponSlot | Multi Theft Auto: Wiki Skip to content

getPedWeaponSlot

Client-side
Server-side
Shared

Pair: setPedWeaponSlot

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function gets a ped's selected weapon slot.

OOP Syntax Help! I don't understand this!

  • Method:ped:getWeaponSlot(...)
  • Variable: .weaponSlot

Syntax

int getPedWeaponSlot ( ped thePed )
Required Arguments
  • thePed: the ped to get the current weapon slot of.

Returns

  • int: value

Returns the selected weapon slot ID on success, false otherwise.

Code Examples

shared
function doesPlayerHaveWeapon(source)
local pedSlot = getPedWeaponSlot ( source )
if (pedSlot == 0) then
outputChatBox("Your weapon is not in your hands ;)", source)
end
end
addCommandHandler("weapon", doesPlayerHaveWeapon)

See Also