-
Notifications
You must be signed in to change notification settings - Fork 36
Example Plugins
Death68093 edited this page Apr 27, 2026
·
2 revisions
const dc = window.DeathClient;
// Slider setting for delay
let speed = dc.createSetting("Slider", "Delay", 0, 0, 100);
// Create a mode setting for what message to send
let mode = dc.createSetting("Mode", "Message Mode", "Cycle", ["Cycle", "Random", "Message1", "Message2", "Message3"]);
// Create String settings for what messages to send
let text1 = dc.createSetting("String", "Message1", "Hello!");
let text2 = dc.createSetting("String", "Message2", "Hello!");
let text3 = dc.createSetting("String", "Message3", "Hello!");
// Some more variables for keeping track of the delay or what message to send
let last = 0;
let cycleIndex = 1;
// Create a mod
dc.createMod({
// Mod name (This is what will appear in the menu)
name: "Spammer+",
// Use the defined settings
settings: [speed, mode, text1, text2, text3],
// Runs every tick (20 times/sec)
onUpdate: function(settings) {
last++;
// Check if our "last" variable is greater than or equal to the delay setting
if (last >= settings["Delay"].value) {
last = 0;
// Get the message mode setting
const currentMode = settings["Message Mode"].value;
// Get all messages
const messages = [settings["Message1"].value, settings["Message2"].value, settings["Message3"].value];
let msgToSend = "";
// Check which mode is selected
if (currentMode === "Cycle") {
// Get the message from the list
msgToSend = messages[cycleIndex - 1];
cycleIndex = (cycleIndex % 3) + 1;
} else if (currentMode === "Random") {
// Get a random message
msgToSend = messages[Math.floor(Math.random() * messages.length)];
} else {
// If a specific message is selected (e.g., "Message1") Get that message
msgToSend = settings[currentMode].value;
}
// Send the chat Note that "dc.sendChat()" sends the chat to the server while "dc.chat()" will only send it to the client
dc.sendChat(msgToSend);
}
}
});// Make the deathclient object easier to access
const dc = window.DeathClient;
// Create a mod
dc.createMod({
name: "EasyHome", // The name that will appear in the mod menu.
description: "Instantly type /home (you might set a keybind 😉)",
// When the mod is enabled
onEnable: function() {
dc.sendCommand("home"); // Send the server command "/home"
dc.disableMod("EasyHome"); // Disable the mod so it can easily be used again
}
});