This is a base alarm script with discord notification, when raided you will receive a discord notification and the alarm will sound.
you can whitelist players by business name, organization name and steamid.
Installation
login into your maxnet account.
create a file then copy the code below and save it,
modify the code to your preference and then execute it,
Required Tools (open Q menu then go to Tools)
Maxnet Device Hub - spawn one device hub and connect it to your terminal.
Maxnet Metal Detector - spawn a metal detector near your base entrance.
Maxnet Motion Detector - spawn a motion detector where you wish to detect intruders. (optional)
Maxnet Text Screen - spawn a text screen, select "models/hunter/plates/plate1x3.mdl" model.
Maxnet Sound Emitter - spawn as many sound emitters you wish inside your base. (should have atleast 3 of these.)
Maxnet Multi-Purpose Tool - use it to connect all devices to the Device Hub and then name the Text Screen you placed as "screen1" or "screen2" and the sound emitters as "alarm1" , "alarm2", "alarm3".
Unfortunately there isn't a way to sync multiple alarms, just place it apart of each other.
Discord notification - you must be an admin of a discord channel, then right click on the channel > "Edit Channel" > "Integrations" > "Create Webhook" > "Copy Webhook Url".
you will get a url like this:
string webhook will be: string webhook = "1161991748520451584/umY6F-fjDzjxopcZAJ-s8xIWa6CBthB9Rb3m41-curqyjUZvejhRbUCy0I2ZzgP-KkRD";
https://pastebin.com/U92kfEJL
you can whitelist players by business name, organization name and steamid.
Installation
login into your maxnet account.
create a file then copy the code below and save it,
file create BaseAlarm.msc
then file open BaseAlarm.msc
modify the code to your preference and then execute it,
mnscript cexec BaseAlarm.msc
Required Tools (open Q menu then go to Tools)
Maxnet Device Hub - spawn one device hub and connect it to your terminal.
Maxnet Metal Detector - spawn a metal detector near your base entrance.
Maxnet Motion Detector - spawn a motion detector where you wish to detect intruders. (optional)
Maxnet Text Screen - spawn a text screen, select "models/hunter/plates/plate1x3.mdl" model.
Maxnet Sound Emitter - spawn as many sound emitters you wish inside your base. (should have atleast 3 of these.)
Maxnet Multi-Purpose Tool - use it to connect all devices to the Device Hub and then name the Text Screen you placed as "screen1" or "screen2" and the sound emitters as "alarm1" , "alarm2", "alarm3".
Unfortunately there isn't a way to sync multiple alarms, just place it apart of each other.
Discord notification - you must be an admin of a discord channel, then right click on the channel > "Edit Channel" > "Integrations" > "Create Webhook" > "Copy Webhook Url".
you will get a url like this:
string webhook will be: string webhook = "1161991748520451584/umY6F-fjDzjxopcZAJ-s8xIWa6CBthB9Rb3m41-curqyjUZvejhRbUCy0I2ZzgP-KkRD";
https://pastebin.com/U92kfEJL
C#:
using Application;
using Array;
using Business;
using Console;
using Device;
using Discord;
using Event;
using Orgs;
using Player;
using String;
using System;
using Util;
Application.RequestAdminPrivilege();
// Example webhook, find your own Webhook from your discord channel which you are admin of and replace it with that.
string webhook = "";
number AlarmDuration = 15; // in seconds.
number alarmTime = System.Time() + AlarmDuration;
bool WhitelistByBusiness = false;
string[] Business = new string[1]; // chars are case sensitive. Supports only a single business.
if (WhitelistByBusiness) { // or add Business.IsEmployeeOf(Business[2], player) == false
Business[1] = "Hive Bank";
//Business[2] = "Umbrella Bank";
//Business[3] = "WOLF CO";
}
bool WhitelistByOrg = true;
string[] Org = new string[2]; // all chars must be lowercase.
if (WhitelistByOrg) {
Org[1] = "the crim cult";
Org[2] = "omega";
}
bool WhitelistByPlayer = true;
string[] Player = new string[10]; // whitelist players by their steamid.
if (WhitelistByPlayer) {
Player[1] = "STEAM_0:0:55406482"; // Ellie :)
//Player[2] = "";
//Player[3] = "";
}
SoundEmitterDevice alarm1 = Device.FindSoundEmitter("alarm1");
SoundEmitterDevice alarm2 = Device.FindSoundEmitter("alarm2");
SoundEmitterDevice alarm3 = Device.FindSoundEmitter("alarm3");
TextScreenDevice screen1 = Device.FindTextScreen("screen1");
screen1.SetFontSize(70);
TextScreenDevice screen2 = Device.FindTextScreen("screen2");
screen2.SetFontSize(70);
function OnMetalDetectorTriggered(MetalDetectorDevice detector, Player player){
screen1.SetText("Name: " .. player.GetName() .. "\n" .. "Job: " .. player.GetJob() .. "\n" .. "Health: " .. player.GetHealth() .. " || Armor: " .. player.GetArmor() .. "\n" .. "License: " .. player.HasGunlicense() .. "\n" .. "Wanted: " .. player.IsWanted() .. " || Reason: " .. player.GetWantedReason());
screen2.SetText("Name: " .. player.GetName() .. "\n" .. "Job: " .. player.GetJob() .. "\n" .. "Health: " .. player.GetHealth() .. " || Armor: " .. player.GetArmor() .. "\n" .. "License: " .. player.HasGunlicense() .. "\n" .. "Wanted: " .. player.IsWanted() .. " || Reason: " .. player.GetWantedReason());
if(Array.Contains(Player, player.GetSteamID()) == false && Array.Contains(Org, Orgs.GetOrgName(player)) == false && Business.IsEmployeeOf(Business[1], player) == false) {
DiscordEmbed embed = new DiscordEmbed();
embed.SetTitle("Player Past Detector");
embed.AddField(player.GetName(), player.GetJob(), true);
embed.AddField(Util.ToString(player.GetHealth()), Util.ToString(player.GetArmor()), true);
embed.AddField(player.GetSteamID(), "Base Alarm", false);
embed.Post(webhook);
alarm1.PlaySound();
alarm2.PlaySound();
alarm3.PlaySound();
alarmTime = System.Time() + AlarmDuration;
}
}
Event.AddListener("Device_MetalDetectorTriggered", "metal detectors", "OnMetalDetectorTriggered");
function OnMotionDetectorTriggered(MotionDetectorDevice detector, Player player){
screen1.SetText("Name: " .. player.GetName() .. "\n" .. "Job: " .. player.GetJob() .. "\n" .. "Health: " .. player.GetHealth() .. " || Armor: " .. player.GetArmor() .. "\n" .. "License: " .. player.HasGunlicense() .. "\n" .. "Wanted: " .. player.IsWanted() .. " || Reason: " .. player.GetWantedReason());
screen2.SetText("Name: " .. player.GetName() .. "\n" .. "Job: " .. player.GetJob() .. "\n" .. "Health: " .. player.GetHealth() .. " || Armor: " .. player.GetArmor() .. "\n" .. "License: " .. player.HasGunlicense() .. "\n" .. "Wanted: " .. player.IsWanted() .. " || Reason: " .. player.GetWantedReason());
if(Array.Contains(Player, player.GetSteamID()) == false && Array.Contains(Org, Orgs.GetOrgName(player)) == false && Business.IsEmployeeOf(Business[1], player) == false) {
DiscordEmbed embed = new DiscordEmbed();
embed.SetTitle("Player Past Detector");
embed.AddField(player.GetName(), player.GetJob(), true);
embed.AddField(Util.ToString(player.GetHealth()), Util.ToString(player.GetArmor()), true);
embed.AddField(player.GetSteamID(), "Base Alarm", false);
embed.Post(webhook);
alarm1.PlaySound();
alarm2.PlaySound();
alarm3.PlaySound();
alarmTime = System.Time() + AlarmDuration;
}
}
Event.AddListener("Device_MotionDetectorTriggered", "motion detectors", "OnMotionDetectorTriggered");
while(true) {
if (alarm1.IsPlaying() && alarmTime < System.Time()) {
alarm1.StopSound();
alarm2.StopSound();
alarm3.StopSound();
}
Event.Process();
}
Last edited: