Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // .all and .others
- // regex for spaces
- // vanish
- // join team
- const SUPER_ADMIN = [127118, 127121, 127096, 127092, 2760, 4561] // Commands like kick, mute, unmute, etc.
- // integral, cosine, wumbo, philly
- const request = require('request')
- const DONATORS = [] // 127118, 58
- const BANNED = [104394, 128855]
- const PLAYER_DATA = [];
- const SPEED_CAP = 100 // Fastest you can go without being unable to walk
- const JUMP_CAP = 50 // Highest you can go without spending a while in the air
- const SCALE_HIGH_CAP = 5 // Biggest you can get (limited for lag purposes)
- const SCALE_LOW_CAP = 0.1 // The lowest scale you can get. < 0 makes you become invisible
- const ALLOWED_KILLS = 5 // Amount of kills before said player gets kicked
- const ADMIN_BLOCK = Game.findBrickByName("adminblock")
- const DISCO_COLORS = [
- red = "#FF0000",
- orange = "#eb8034",
- yellow = "#fff200",
- green = "#00ff04",
- light_blue = "#00ffee",
- blue = "#0000FF",
- purple = "#7700ff",
- pink = "#ff00bb"
- ]
- let active = true; // debounce for disco
- const COLORS = [
- blue = "#0066ff",
- red = "#ff0000",
- yellow = "#ffff00",
- purple = "#6f00ff",
- pink = "#ff00d0",
- orange = "#ff8800",
- green = "#22ff00"
- ] // Colors for team purposes
- const HELP_DIALOG = {
- DONOR: {
- ambient: "/ambient (num); Changes the ambient color of the game",
- sky: "/sky (num); Changes the sky color of the game",
- freeze: "/freeze (player); Freezes said player",
- thaw: "/thaw (player); Thaws said player (if frozen)"
- },
- REG: {
- kill: "/kill (player); Kills player",
- tp: "/tp (player); Teleports you to said player",
- jump: "/jump (number); How high you can jump",
- speed: "/speed (number); How fast you can go",
- scale: "/scale (number); Changes the size of your character",
- av: "/av (id); Changes you to a different player via their ID",
- id: "/id (player); Gives you said player's ID",
- team: "/team (name); Makes a new team with a custom name",
- disco: "/disco; Changes the ambient color in rainbow order [epilepsy warning]"
- }
- }
- let adminIds = new Set() // Admins first to join. Players who touch brick will be added here.
- ADMIN_BLOCK.touching((plr) => {
- if (adminIds.has(plr.userId)) return
- if (!plr.alive) return
- adminIds.add(plr.userId)
- console.log(`[----------------------${plr.username} just became an admin----------------------]`)
- plr.centerPrint("You became an admin! Type [#FF0000]/cmds[#FF0000] for valid commands", 7)
- change("You became an admin! Type [#FF0000]/cmds[#FFFFFF] for valid commands", null, plr);
- })
- function change(msg, val, plr) { // Messaging function
- if (!val) val = ""
- const serverMsg = `\\h09ff00[CHANGE]: \\hffffff${msg} ${val}`
- plr.message(serverMsg);
- }
- function isAdmin(userId) { // Checking if an admin
- return adminIds.has(userId);
- }
- function isSuperAdmin(userId) { // Checking if a super admin
- return SUPER_ADMIN.includes(userId);
- }
- function isDonator(userId) {
- return DONATORS.includes(userId);
- }
- function isBanned(userId) {
- return BANNED.includes(userId);
- }
- function getPlayer(name) {
- const username = name.toLowerCase()
- if (name)
- if (username == ".all") { // Getting all players
- for (let player of Game.players) {
- const victim = Game.findPlayerByUsername(player.username)
- return victim
- }
- } else {
- for (let player of Game.players) { // Gets specific player
- if (player.username.toLowerCase().indexOf(username) == 0) {
- const victim = Game.findPlayerByUsername(player.username)
- return victim
- }
- }
- }
- }
- Game.on('speedCmd', (plr, msg) => {
- if (!isAdmin(plr.userId)) return
- if (isNaN(msg)) return
- if (Number(msg) > SPEED_CAP) {
- plr.speed = SPEED_CAP;
- } else {
- plr.speed = Number(msg)
- }
- change("you changed your speed to", plr.speed, plr)
- })
- Game.on('killCmd', (plr, msg) => {
- if (!isAdmin(plr.userId)) return
- if (plr.score >= ALLOWED_KILLS - 1) {
- return plr.kick("you killed too many players");
- }
- const victim = getPlayer(msg)
- if (victim) {
- victim.respawn()
- plr.score++
- plr.message(`[#ffa500][WARN]:[#FFFFFF] if you kill ${ALLOWED_KILLS - plr.score} more players, you WILL BE kicked`)
- Game.messageAll(`[#FF0000][ALERT]: [#FFFFFF]${victim.username} has been killed by ${plr.username}`)
- }
- })
- Game.on('jumpCmd', (plr, msg) => {
- if (!isAdmin(plr.userId)) return
- if (isNaN(msg)) return
- if (msg > JUMP_CAP)
- plr.jumpPower = JUMP_CAP
- else
- plr.jumpPower = msg
- change("you changed your jump height to", plr.jumpPower, plr)
- })
- Game.on('plrCmd', () => {
- console.log(Game.players)
- })
- Game.on('tpCmd', (plr, msg) => {
- if (!isAdmin(plr.userId)) return
- let player = getPlayer(msg)
- if (player) {
- plr.position = player.position
- }
- })
- Game.on('teamCmd', (plr, msg) => {
- if (!isAdmin(plr.userId)) return
- const randomColor = COLORS[Math.floor(Math.random() * COLORS.length)]
- const team = new Team(msg, randomColor)
- plr.team = team
- Game.messageAll(`[#00eeff][TEAM]: [#FFFFFF]${plr.username} created [#00eeff]${team.name}`)
- console.log(`${plr.username} created ${team.name}`)
- })
- // Could be improved
- Game.on('scaleCmd', (plr, msg) => {
- if (!isAdmin(plr.userId)) return
- if (isNaN(msg)) return
- if (Number(msg) > SCALE_HIGH_CAP) {
- plr.scale = {
- x: SCALE_HIGH_CAP,
- y: SCALE_HIGH_CAP,
- z: SCALE_HIGH_CAP
- }
- change(`you set your scale to (${SCALE_HIGH_CAP}, ${SCALE_HIGH_CAP}, ${SCALE_HIGH_CAP})`, null, plr)
- } else if (Number(msg) <= 0.1) {
- plr.scale = {
- x: SCALE_LOW_CAP,
- y: SCALE_LOW_CAP,
- z: SCALE_LOW_CAP
- };
- change(`you set your scale to (${SCALE_LOW_CAP}, ${SCALE_LOW_CAP}, ${SCALE_LOW_CAP})`, null, plr)
- } else {
- plr.scale = {
- x: msg,
- y: msg,
- z: msg
- }
- change(`you set your scale to (${msg}, ${msg}, ${msg})`, null, plr)
- }
- })
- Game.on('idCmd', (plr, msg) => {
- if (!isAdmin(plr.userId)) return
- let player = getPlayer(msg);
- if (player) {
- plr.message(`[#ffa500][REQUEST]: [#FFFFFF]${player.username}'s id is [#ffa500]${player.userId}`);
- }
- })
- Game.on('cmdsCmd', (plr) => {
- if (!isAdmin(plr.userId)) return
- Object.keys(HELP_DIALOG.REG).map((key) => {
- plr.message(`[#ffa500][REQUEST]: \\hffffff${HELP_DIALOG.REG[key]}`)
- })
- })
- Game.on('discoCmd', (plr) => {
- if (!isAdmin(plr.userId)) return
- if (!active) return
- let index = 0;
- Game.centerPrintAll(`[#FF0000][WARNING]: [#FFFFFF]disco was initated and contains flashing colors!`, 3)
- setTimeout(() => { // waiting for warning
- discoActive = setInterval(() => {
- active = false
- for (let players of Game.players) {
- try {
- players.setEnvironment({
- ambient: DISCO_COLORS[index++ % DISCO_COLORS.length]
- })
- } catch {}
- }
- }, 1000); // interval between each color
- }, 3000); // how long the warning is
- setTimeout(() => {
- clearInterval(discoActive)
- for (let players of Game.players) {
- try {
- players.setEnvironment({
- ambient: 1
- })
- active = true;
- index = 0; // reset the index
- } catch {}
- }
- }, DISCO_COLORS.length * 2000); // how many times you should do it --> doing it twice
- })
- // ------------------------------------ Super Admin commands ------------------------------------ \\
- Game.on('configCmd', (plr) => {
- if (!isSuperAdmin(plr.userId)) return
- plr.speed = 10
- plr.jumpPower = 10
- plr.scale = {
- x: 1.5,
- y: 1.5,
- z: 1.5
- }
- })
- Game.on('kickCmd', (plr, msg) => {
- if (!isSuperAdmin(plr.userId)) return
- const victim = getPlayer(msg)
- if (victim) {
- victim.kick(`You were kicked by ${plr.username}`)
- Game.messageAll(`[#FF0000][ALERT]: ${victim.username}[#FFFFFF] was kicked by [#FF0000]${plr.username}`)
- console.log(`////////////////////////////////${victim.username} was kicked by ${plr.username}////////////////////////////////`)
- }
- })
- Game.on('serverCmd', (plr, msg) => {
- if (!isSuperAdmin(plr.userId)) return
- Game.messageAll(`[#FF0000][SERVER]: [#FFFFFF]${msg}`)
- })
- // Toggle mute, it's cleaner
- Game.on('muteCmd', (plr, msg) => {
- if (!isSuperAdmin(plr.userId)) return
- const player = getPlayer(msg)
- if (player) {
- player.muted = !player.muted
- if (player.muted) {
- change("You have been muted!", null, player)
- } else change("You have been unmuted!", null, player)
- }
- })
- Game.on('isadminCmd', (plr, msg) => {
- if (!isSuperAdmin(plr.userId)) return
- const player = getPlayer(msg)
- if (player) {
- if (isAdmin(player.userId))
- plr.message(`[#ffa500][REQUEST]: [#FFFFFF]${player.username} is an admin`)
- else
- plr.message(`[#ffa500][REQUEST]: [#FFFFFF]${player.username} is NOT an admin`)
- }
- })
- Game.on('tpmeCmd', (plr, msg) => {
- if (!isSuperAdmin(plr.userId)) return
- const victim = getPlayer(msg)
- if (victim) {
- victim.position = plr.position
- }
- })
- Game.on('statsCmd', (plr, msg) => {
- if (!isSuperAdmin(plr.userId)) return
- const victim = getPlayer(msg)
- if (victim) {
- for (let data of PLAYER_DATA) {
- if (data.id === victim.userId) {
- console.log(data)
- }
- }
- }
- })
- Game.on('adminCmd', (plr, msg) => {
- if (!isSuperAdmin(plr.userId)) return;
- const victim = getPlayer(msg);
- if (victim) {
- if (isAdmin(victim.userId)) {
- adminIds.delete(victim.userId);
- victim.centerPrint(`[#ffa500]Your admin has been taken away by [#FF0000]${plr.username}`, 5)
- change(`Your admin has been taken away by [#FF0000]`, plr.username, victim);
- } else {
- adminIds.add(victim.userId);
- victim.centerPrint(`[#ffa500]you became an admin! Check the desc of the game for valid commands`, 5)
- change("you became an admin! Check the desc of the game for valid commands", null, victim);
- }
- }
- })
- Game.on('vCmd', (plr, msg) => {
- if (!isSuperAdmin(plr.userId)) return
- const team = new Team(" ", "#ffffff") // make platform
- })
- // ------------------------------------ Removing admin when player leaves ------------------------------------ \\
- Game.on('playerLeave', (plr) => {
- if (isAdmin(plr.userId) && !isSuperAdmin(plr.userId)) {
- adminIds.delete(plr.userId)
- }
- })
- Game.on('avCmd', async (plr, msg) => {
- if (!isAdmin(plr.userId)) return
- if (isNaN(msg)) return
- await plr.setAvatar(msg).then(() => {
- change("you changed your id to", msg, plr)
- }).catch(() => {
- change("failure setting avatar id", null, plr)
- })
- })
- Game.on('playerJoin', async (plr) => {
- if (isBanned(plr.userId)) {
- return plr.kick("You are banned from this server.")
- }
- const PLR_DATA = {
- id: plr.userId,
- name: plr.username,
- superadmin: isSuperAdmin(plr.userId),
- frozen: false
- }
- await request("https://api.brick-hill.com/v1/shop/owners?id=65663", async (err, res, data) => {
- const json = await JSON.parse(data);
- for (let index of json) {
- const id = await index.owner;
- if (id) {
- if (!DONATORS.includes(id)) {
- DONATORS.push(id)
- }
- }
- }
- })
- PLAYER_DATA.push(PLR_DATA)
- plr.centerPrint("Enter the house and step on the white brick for admin!", 7)
- })
- // ------------------------------------ Donator commands ------------------------------------ \\
- Game.on('ambientCmd', (plr, num) => {
- if (!isDonator(plr.userId)) return
- if (isNaN(num)) return
- for (let player of Game.players) { // Setting ambient for each player since it's local
- try {
- player.setEnvironment({
- ambient: Number(num)
- })
- console.log(num)
- } catch (err) {}
- }
- })
- Game.on('skyCmd', (plr, num) => {
- if (!isDonator(plr.userId)) return
- if (isNaN(num)) return
- try {
- Game.setEnvironment({
- skyColor: Number(num)
- })
- } catch (err) {}
- })
- Game.on('dcmdsCmd', (plr) => {
- if (!isDonator(plr.userId)) return
- Object.keys(HELP_DIALOG.DONOR).map((key) => {
- plr.message(`[#ffa500][REQUEST]: [#FFFFFF]${HELP_DIALOG.DONOR[key]}`)
- })
- })
- Game.on('freezeCmd', (plr, msg) => {
- if (!isDonator(plr.userId)) return
- const victim = getPlayer(msg);
- if (victim) {
- victim.speed = 0;
- victim.jumpPower = 0;
- victim.centerPrint(`[#009dff][FROZEN]: [#FFFFFF]You have been frozen by [#009dff]${plr.username}`, 5)
- }
- }) // integral
- Game.on('thawCmd', (plr, msg) => {
- if (!isDonator(plr.userId)) return
- const victim = getPlayer(msg);
- if (victim) {
- victim.speed = 4;
- victim.jumpPower = 5;
- victim.centerPrint(`[#009dff][THAWED]: [#FFFFFF]You have been thawed by [#009dff]${plr.username}`, 5)
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement