ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server functions
  3. takeWeapon

Function

takeWeapon

Takes one weapon from a ped together with all its ammo.

Syntax

bool takeWeapon(ped ped, int weapon)

Arguments

pedped
A player or ped.
weaponint
Weapon ID.

Differences from MTA:SA

  • These MTA:SA arguments are not here: int ammo

In MTA:SA

takeWeapon(player thePlayer, int weaponId, int ammo)

Returns

true on success.

Example

addEventHandler("onColShapeHit", safeZone, function(el)
    if getElementType(el) == "player" then
        takeWeapon(el, 35)
        takeWeapon(el, 36)
    end
end)