Jump to content

Metal Detectors 1.1.0

   (6 reviews)

1 Screenshot

About This File

This resource lets you add metal detectors that go off when a player with a not allowed weapon goes through them.

 

Installing

  • Put the files you downloaded in their respective places
  • Add require('metaldetectors') to client_packages/index.js
  • Set up some metal detectors (read below)
  • All done

 

JSON Files

Most of the changes are done by editing JSON files located in packages/metaldetectors/json/.

Remember to validate your changes here: https://jsonlint.com/

 

config.json

colshapeSize: Size of the metal detector colshape, I think the default value is pretty much perfect and doesn't need any editing.

soundRange: Maximum range/distance of the players who should hear metal detector alarms, default value is 15.0.

cooldownMs: Milliseconds that need to pass before a metal detector goes off again, default value is 2000.

allowedWeapons: Array of weapons that are ignored by metal detectors. This list is pretty much empty and you probably should fill it, WEAPON_UNARMED and WEAPON_CERAMICPISTOL are ignored by default.

smallWeaponGroups: Array of weapon groups that are considered small. Weapons of this group will play the small weapon alarm sound and everything else will play the big weapon alarm sound. GROUP_MELEE, GROUP_PISTOL, GROUP_SMG, GROUP_STUNGUN and GROUP_THROWN are considered small by default.

 

detectors.json

This file contains the metal detectors in array of objects format. A metal detector has x, y, z, heading, dimension and createProp properties.

x, y, z: Coordinates of the metal detector.

heading: Rotation (yaw) of the metal detector.

dimension: Dimension of the metal detector.

Default value: 0

createProp: Whether this metal detector should create a prop when it is loaded or not, useful if you want to use existing metal detectors. (like in the IAA facility interior)

Default value: true

// Example: Metal detector used in the making of video above
{
  "x": 2059.037109375,
  "y": 2980.64208984375,
  "z": -62.90178298950195,
  "heading": 325.0,
  "dimension": 0
}

 

 

weaponData.json

Used for weapon groups, just make sure it is updated after every DLC.

 

For Developers

This resource triggers an event named playerTriggerMetalDetector with args player, position, isSmallWeapon when players trigger a metal detector.

player: The player who triggered a metal detector.

position: Coordinates of the metal detector.

isSmallWeapon: Whether the player's weapon was a small weapon or not.

(another arg that contains weapon hash might be added in the future)

 

Example

mp.events.add("playerTriggerMetalDetector", (player, position, isSmallWeapon) => {
    player.outputChatBox(`You triggered a metal detector with a ${isSmallWeapon ? "small" : "big"} weapon!`);
});

 

Notes

  1. Right now, this resource checks only the current weapon of a player due to issues with player.weapons. If player.weapons get fixed, I'll update the resource to check for all weapons of a player.

 

Source code is available on GitHub in case you don't want to download: https://github.com/root-cause/ragemp-metal-detectors


What's New in Version 1.1.0   See changelog

Released

* This version needs RAGE Multiplayer 1.1.0 and above to work.

- All weapons of the player will be checked now instead of the current.

- Added detectedWeapon last argument to both clientside and serverside events. It contains the weapon hash that triggered the metal detector.

  • Like 7
  • Mask 1

User Feedback

Create an account or sign in to leave a review

You need to be a member in order to leave a review

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

JamesBeast

   3 of 3 members found this review helpful 3 / 3 members

tnx so much, gonna using this in post brexit Britain to stopping guns and knives to coming into

 

regards Her Royal Highness' Government of the United Kingdom of Great Britain and Northern Ireland

 

Flag: United Kingdom on Twitter Twemoji 12.1.4 Flag: United Kingdom on Twitter Twemoji 12.1.4 Flag: United Kingdom on Twitter Twemoji 12.1.4 Flag: United Kingdom on Twitter Twemoji 12.1.4 Flag: United Kingdom on Twitter Twemoji 12.1.4 

  • Like 2
Link to review
ragempdev

   3 of 3 members found this review helpful 3 / 3 members

bonus triggered a metal detector with a big weapon!

  • Like 2
  • Confused 1
Link to review
hubba

   1 of 1 member found this review helpful 1 / 1 member

ok

Link to review
n0minal

   0 of 1 member found this review helpful 0 / 1 member

Awesome as always, good job! 

Link to review
Wolves

  

Swears at these lines

const {colshapeSize, soundRange, cooldownMs, allowedWeapons, smallWeaponGroups} = require("./json/config.json");
const metalDetectors = require("./json/detectors.json");
const weaponData = require("./json/weaponData.json");

 

Link to review
×
×
  • Create New...