setWeaponFlags
Client-side
Server-side
Shared
Pair: getWeaponFlags
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 sets a custom weapon flags, used to change how it behaves or finds a possible target to shoot.
Note
Do not confuse this function with setWeaponProperty . Although setWeaponProperty works with player-held weapons and custom weapons (in a limited extent), this function does not work with player-held weapons.
Syntax
setWeaponFlags ( )Code Examples
client
This example creates a minigun that will kill any player who approaches the center of the map, no matter if he takes cover or not.
local function setupDeadlyWeapon() local weapon = createWeapon("minigun", 0, 0, 10) -- Create the minigun setWeaponTarget(weapon, localPlayer) -- Set the weapon target to the local player setWeaponFlags(weapon, "flags", false, false, false, false, false, false, false, false) -- Allow the weapon to shoot through everythingendaddEventHandler("onClientResourceStart", resourceRoot, setupDeadlyWeapon)Issues
| ID | Description |
|---|---|
| 8686 | setWeaponFlags(weapon, "flags") always returns false, but getWeaponFlags(weapon, "flags") works correctly |