CPMStaffCommands

  • community
  • administration
  • by Mad
  • Takaro v0.0.21
  • all
Version
View export JSON

MAD_CPMStaffCommands Module

Configuration 1

Settings you fill in when installing the module on a server.

SettingTypeDefaultDescription
discordChannel discordChannel string Sends to discord
Raw config schema
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": [],
  "additionalProperties": false,
  "properties": {
    "discordChannel": {
      "title": "discordChannel",
      "description": "Sends to discord",
      "type": "string"
    }
  }
}
Raw UI schema
{}

Commands 9

Chat commands players trigger in game.

  • avisit

    Teleport to a friend

    ArgumentTypeDefaultHelp
    playerTarget string Player teleporting to
    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    
    async function main() {
        const { player, gameServerId, pog, arguments: args } = data;
        const playerTarget = args.playerTarget;
    
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commmands.');
        }
    
        const response = (await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
            command: `teleportplayer "${player.name}" "${playerTarget}"`,
        })).data.data.rawResult;
    
        if (response.includes('Targetplayer is offline')) {
            throw new TakaroUserError(`[02FEDC]${playerTarget}[-] is not online`);
        }
    
        // Send success message to the player
        await player.pm(`Successfully teleported to [02FEDC]${playerTarget}[-]`);
    }
    
    await main();
  • mute

    Mute (players name, use quotes when there's aspace) (reason in quotes)

    ArgumentTypeDefaultHelp
    person string Person to be muted
    reasoning string No reason given Reason they were muted
    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    
    async function main() {
        const { player, gameServerId, pog, arguments: args } = data;
        const { person, reasoning } = args;
        const discordChannel = data.module.userConfig.discordChannel;
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commmands.');
        }
    
        const response = (await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
            command: `mcp "${person}" true`,
        })).data.data.rawResult;
    
        if (response.includes('is not a valid entity id, player name or user id')) {
            throw new TakaroUserError(`[02FEDC]${person}[-]'s name wasn't spelled correctly!`);
        }
    
        //Confirmation
        await player.pm(`[02FEDC]${person}[-] was muted.`);
    
        await takaro.discord.discordControllerSendMessage(discordChannel, {
            message: `🤐 ${player.name} muted ${person} for ${reasoning}.`,
        });
    }
    
    await main();
  • unmute

    unmute (players name, use quotes for names with spaces)

    ArgumentTypeDefaultHelp
    person string player to be unmuted
    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    
    async function main() {
        const { player, gameServerId, pog, arguments: args } = data;
        const { person, reasoning } = args;
        const discordChannel = data.module.userConfig.discordChannel;
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commmands.');
        }
    
        const response = (await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
            command: `mcp "${person}" false`,
        })).data.data.rawResult;
    
        if (response.includes('is not a valid entity id, player name or user id')) {
            throw new TakaroUserError(`[02FEDC]${person}[-]'s name wasn't spelled correctly!`);
        }
    
        //Confirmation
        await player.pm(`[02FEDC]${person}[-] was unmuted.`);
    
        await takaro.discord.discordControllerSendMessage(discordChannel, {
            message: `🤐 ${player.name} unmuted ${person}.`,
        });
    }
    
    await main();
  • ban

    ban (name, use quotes if there's a space) (reason in quotes)

    ArgumentTypeDefaultHelp
    reasoning string No reason given Reason they are banned
    person string Person being banned
    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    
    async function main() {
        const { player, gameServerId, pog, arguments: args } = data;
        const { person, reasoning } = args;
        const discordChannel = data.module.userConfig.discordChannel;
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commmands.');
        }
    
        const response = (await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
            command: `ban add "${person}" 1 year "${reasoning}" "${person}"`,
        })).data.data.rawResult;
    
        if (response.includes('is not a valid entity id, player name or user id')) {
            throw new TakaroUserError(`[02FEDC]${person}[-]'s name wasn't spelled correctly!`);
        }
    
        //Confirmation
        await player.pm(`[02FEDC]${person}[-] was banned.`);
    
        await takaro.discord.discordControllerSendMessage(discordChannel, {
            message: `🔨 ${player.name} banned ${person} for ${reasoning}.`,
        });
    }
    
    await main();
  • arrest

    No help text available

    ArgumentTypeDefaultHelp
    playerTarget string Other player's name
    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    async function main() {
        const { gameServerId, player } = data;
        const { arguments: args } = data;
    
        //Check Permissions
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commmands.');
        }
    
        //Execute Command arrest
        await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
            command: `arrest "${args.playerTarget}"`,
        });
    
        if (response.includes('is not a valid entity id, player name or user id')) {
            throw new TakaroUserError(`[02FEDC]${args.playerTarget}[-]'s name wasn't spelled correctly!`);
        }
    
        //Send global message in game to shame the offender
        await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
            message: `${args.playerTarget} was arrested for ${args.reasoning}`,
        });
    };
    await main();
    //# sourceMappingURL=visit.js.map
  • kick

    type kick (name, in quotes is they have a space) (reason in quotes). Example kick "El Linón" "Too cool"

    ArgumentTypeDefaultHelp
    person string Player getting kicked
    reasoning string Contact a moderator for a kick reason Reason for being kicked
    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    
    async function main() {
        const { player, gameServerId, pog, arguments: args } = data;
        const { person, reasoning } = args;
        const discordChannel = data.module.userConfig.discordChannel;
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commmands.');
        }
    
        const response = (await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
            command: `kick "${person}" "${reasoning}"`,
        })).data.data.rawResult;
    
        if (response.includes('is not a valid entity id, player name or user id')) {
            throw new TakaroUserError(`[02FEDC]${person}[-]'s name wasn't spelled correctly!`);
        }
    
        //Confirmation
        await player.pm(`[02FEDC]${person}[-] was kicked.`);
    
        await takaro.discord.discordControllerSendMessage(discordChannel, {
            message: `🥾 ${player.name} kicked ${person} for ${reasoning}`,
        });
    }
    
    await main();
  • release

    No help text available

    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    async function main() {
        const { gameServerId, player } = data;
        const { arguments: args } = data;
    
        //Check Permissions
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commmands.');
        }
    
        //Execute Command arrest
        await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
            command: `release "${args.playerTarget}"`,
        });
    
        if (response.includes('is not a valid entity id, player name or user id')) {
            throw new TakaroUserError(`[02FEDC]${args.playerTarget}[-]'s name wasn't spelled correctly! Use quotes if their name has spaces!`)
        };
    
        //Send global message in game to shame the offender
        await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, {
            message: `${args.playerTarget} has been released. Please follow the rules!`,
        });
    };
    await main();
    //# sourceMappingURL=visit.js.map
  • kill

    kill (players name), use quotes for names with spaces

    ArgumentTypeDefaultHelp
    playerTarget string The player you want to kill
    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    
    async function main() {
        const { player, gameServerId, pog, module: mod, arguments: args } = data;
        const playerTarget = args.playerTarget;
    
        // Check permissions first
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commands.');
        }
    
        // Check if there's an existing confirmation variable
        const confirmationKey = `kill_confirmation_${playerTarget}`;
        const existingConfirmation = await takaro.variable.variableControllerSearch({
            filters: {
                key: [confirmationKey],
                gameServerId: [gameServerId],
                playerId: [pog.playerId],
                moduleId: [mod.moduleId]
            }
        });
    
        // If confirmation variable exists, proceed with kill
        if (existingConfirmation.data.data.length > 0) {
            // Delete the confirmation variable first
            await takaro.variable.variableControllerDelete(existingConfirmation.data.data[0].id);
    
            // Execute the kill command
            const response = (await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
                command: `kill "${playerTarget}"`,
            })).data.data.rawResult;
    
            if (response.includes('Targetplayer is offline')) {
                throw new TakaroUserError(`[02FEDC]${playerTarget}[-] is not online`);
            }
    
            await player.pm(`You have killed [02FEDC]${playerTarget}[-].`);
        } else {
            // Create confirmation variable with 30 second expiry
            const now = new Date();
            const expiry = new Date(now.getTime() + 30 * 1000); // 30 seconds from now
    
            await takaro.variable.variableControllerCreate({
                key: confirmationKey,
                value: JSON.stringify({ expiry: expiry.toISOString() }),
                gameServerId,
                moduleId: mod.moduleId,
                playerId: pog.playerId
            });
    
            // Send confirmation message
            await player.pm(`Are you sure you want to kill [02FEDC]${playerTarget}[-]? Run the command again within 30 seconds to confirm.`);
        }
    }
    
    await main();
  • rdd

    No help text available

    ArgumentTypeDefaultHelp
    playerTarget string Person drone data is being reset for
    Command source
    import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers';
    
    async function main() {
        const { player, gameServerId, pog, arguments: args } = data;
        const playerTarget = args.playerTarget;
    
        if (!checkPermission(pog, 'STAFF_COMMANDS')) {
            throw new TakaroUserError('You do not have permission to use [02FEDC]Moderator[-] commmands.');
        }
    
        const response = (await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, {
            command: `rdd "${playerTarget}"`,
        })).data.data.rawResult;
    
        if (response.includes('Targetplayer is offline')) {
            throw new TakaroUserError(`[02FEDC]${playerTarget}[-] is not online`);
        }
    }
    
    await main();

Permissions 1

Roles you can grant to decide who may use what.

  • Staff Commands

    Commands for staff to use without using Currency