Kartik Scripts

Metal Detectors

To secure police stations, courtrooms, and search checkpoints, this module handles scanning individuals for metal objects, weapons, and blades.

1. Handheld Metal Detector

  • Search Tool: Officers can use the handheld_detector item to perform a quick sweep over a suspect.
  • Beeping Alarm: Emits an audible scanner sound. If the suspect carries any item configured in Config.MetalDetector.Weapons (firearms, knives, ammunition, etc.), the wand emits a loud alarm.

2. Checkpoint Metal Detectors

  • Static Security Gates: Placing a checkpoint gate object at an entrance (like Mission Row lobby) automatically scans any citizen passing through the frame.
  • Alert Notifications: If a citizen walks through carrying metallic weapons, the gate flashes red and sounds an alarm. Officers inside the station receive a dispatch alert.

How to Use In-Game

Scanning a Suspect with the Handheld Detector:

  1. Ensure you have the handheld_detector item in your inventory.
  2. Stand close to the suspect, drag the item to your use slot, or use the target interaction menu and select "Scan with Metal Detector".
  3. An animation will play sweeping the wand over the player.
  4. Outcome: A success tone plays if clean. A warning alarm triggers if they have a weapon in their pockets.

Placing a Checkpoint Gate:

  • Admins can place a static metal detector prop (ch_prop_ch_metal_detector_01a) via the world builder. It will instantly monitor the passage area.

3. Sound Customization

You can choose to use the native GTA V frontend sounds, completely disable them, or play custom sound files through a sound resource (interact-sound or xsound).

Configuration Options

These settings are defined under Config.MetalDetector.Sound in shared/config_detection.lua:

  • UseGTASound: Set to false if you want to completely disable the built-in GTA V frontend sound effects.
  • UseExternalSound: Set to true to play custom external sound files using the sound bridge.

Adding Custom Sounds for interact-sound

  1. Save your custom sound files in .ogg format (e.g., metal_alarm.ogg and metal_clean.ogg).
  2. Place the files in your interact-sound resource directory: interact-sound/client/html/sounds/
  3. Make sure the files are registered in interact-sound/fxmanifest.lua under the files array (usually matched via 'client/html/sounds/*.ogg').
  4. Set the sound names and desired volume in shared/config_detection.lua:
    ExternalSoundAlarm = 'metal_alarm', -- filename without extension
    ExternalSoundClean = 'metal_clean', -- filename without extension
    ExternalSoundVolume = 0.25, -- Adjust volume between 0.0 and 1.0

Adding Custom Sounds for xsound

  1. Save your custom sound files in .ogg or .mp3 format (e.g., metal_alarm.ogg and metal_clean.ogg).
  2. Place the files in your xsound resource directory: xsound/html/sounds/
  3. Make sure the files are registered in xsound/fxmanifest.lua under the files array (usually matched via 'html/sounds/*' or similar).
  4. Set the sound names and desired volume in shared/config_detection.lua:
    ExternalSoundAlarm = 'metal_alarm', -- filename without extension
    ExternalSoundClean = 'metal_clean', -- filename without extension
    ExternalSoundVolume = 0.25, -- Adjust volume between 0.0 and 1.0

On this page