> For the complete documentation index, see [llms.txt](https://oliver1308pro.gitbook.io/docs.codestormstudios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oliver1308pro.gitbook.io/docs.codestormstudios/free-assets/redm-assets/css-overwatch/commands.md).

# Commands

## Included Commands

`/additems [id] [item] [count]` - mod+\
`/addjob [id] [job] [lable]`  - mod+\
`/addmoney [id] [type] [amount]` - mod+\
`/addweapon [id] [weapon]`  - mod+\
`/heal [id]` - mod+\
`/identifiers [id]` - mod+\
`/kick[id] [message]` - mod+\
`/kill [id]` - mod+\
`/players (list of players in the server)` - mod+\
`/removeitems [id] [item] [count]` - mod+\
`/removejob [id]` - mod+\
`/removemoney [id] [type] [amount]` - mod+\
`/respawn [id]` - mod+\
`/revive [id]` - mod+\
`/tp city [id] [location] (locations is in code)` - mod+\
`/tp coords [id] [X] [Y] [Z]` - mod+

***

## Change Permissions

There’s currently only 4 permission tiers (mod, admin, god, god+). Permissions are granted by a hierarchy so “mod” will also mean “admin” and “god” can access them but a command with “god” will only be usable by someone with the “god” role. if you want to ad permission tiers you can do it in the code

1. Go to the `/commands/command-name.js` you want to modify and open it in a text/code editor.
2. Fine the line that looks like `role: "mod",` near the top (usually around line 26)
3. Change what is in the quotes `" "` to the permission you want to access the command. ie. `role: "admin",`
4. save and restart the resource or server.

*Please note that permissions are synced across whole base commands so if you wanted `/money inspect` to be mod+ and `/money add` to be admin+ you’d need to separate them into separate commands to achieve that.*

***

## Add Commands

{% stepper %}
{% step %}

### Add command

add the command under the folder commands in the serverside /server/commands/newcommand.js
{% endstep %}

{% step %}

### Add The command under /commands

```javascript
// EXAMPEL CODE FOR ADDING ITEMS
const logEvent = require('../addons/log');
const css = {};
css.root = GetResourcePath(GetCurrentResourceName());
css.config = require(`${css.root}/config`);
css.locale = require(`${css.root}/locales/${css.config.LanguageLocaleCode}`);

module.exports = {
    name: "additems",
    description: css.locale.additemsdesc1,
    role: "mod",

    options: [
        {
            name: "id",
            description: css.locale.playeriddesc,
            required: true,
            type: "INTEGER",
        },
        {
            name: "item",
            description: css.locale.additemsdesc2,
            required: true,
            type: "STRING",
        },
        {
            name: "count",
            description: css.locale.additemsdesc3,
            required: false,
            type: "INTEGER",
        },
    
    ],
 
    run: async (client, interaction, args) => {
        try {

            const playerId = interaction.options.getInteger("id");
            const item = interaction.options.getString("item");
            const count = interaction.options.getInteger("count") || 1;
            const playerName = GetPlayerName(args.id);
            const gave = css.locale.gave;
            const to = css.locale.to
            const spawned = css.locale.spawned
            const into = css.locale.into

            if (!GetPlayerName(playerId)) {
                return interaction.reply({ content: css.locale.invalidid, ephemeral: true });
            }

            emit("CSS_Overwatch:additem", playerId, item, count);
            interaction.reply({ content: `${gave} ${count}x ${item} ${to} ${playerId}.`, ephemeral: false });

            logEvent("additems", `${interaction.member.displayName} ${spawned} ${count}x ${item} ${into} ${playerName} (${playerId}).`, {
                color: "#00FF00",
            });

        } catch (error) {
            console.error(css.locale.catcherrorcommand, error);
            interaction.reply({ content: css.locale.catcherrorfail, ephemeral: true });
        }
    },
};

```

{% endstep %}

{% step %}

### Hook up a ServerEvent to the command

```lua
-- Example in Server.lua
local frameworkPath = GetResourcePath(GetCurrentResourceName()) .. "/server/framework.lua"
local f = assert(load(io.open(frameworkPath, "r"):read("*a"), frameworkPath))()

RegisterNetEvent("CSS_Overwatch:additem")
AddEventHandler("CSS_Overwatch:additem", function(playerId, item, count)
    Framework.AddItem(playerId, item, count)
end)
```

{% endstep %}

{% step %}

### Write the accual framework function

```lua
-- Example in Framework.lua

local frameworkName = GetConvar('CSS_Framework', 'VORP') -- default VORP
Framework = {}

print("^2[CSS Overwatch]^7 Using framework: "..frameworkName)

if frameworkName == "VORP" then
    local Core = exports.vorp_core:GetCore()

    Framework.GetUser = function(playerId)
        return Core.getUser(playerId)
    end

    Framework.GetCharacter = function(playerId)
        local user = Framework.GetUser(playerId)
        if not user then return nil end
        return user.getUsedCharacter
    end

    Framework.AddItem = function(playerId, item, count)
        local char = Framework.GetCharacter(playerId)
        if char then
            exports.vorp_inventory:addItem(playerId, item, count)
            Core.NotifyRightTip(playerId, "You received "..count.."x "..item, 5000)
            Core.NotifyRightTip(playerId, "from a staff member", 5000)
        end
    end
    
elseif frameworkName == "RSG" then
-- INPUT THE RSG VERSION IF YOU USE RSG
    local RSGCore = exports['rsg-core']:GetCoreObject()

    Framework.GetUser = function(playerId)
        local Player = RSGCore.Functions.GetPlayer(playerId)
        if not Player then return end

        return Player
    end
    
    Framework.GetCharacter = function(playerId)
        return Framework.GetUser(playerId)
    end

    Framework.AddItem = function(playerId, item, count)
        local Player = Framework.GetUser(playerId)
        if not Player then return end
    
        -- Check if the item can be added
        local canAdd, reason = exports['rsg-inventory']:CanAddItem(playerId, item, count)
        if canAdd then
            exports['rsg-inventory']:AddItem(playerId, item, count)
        end
    end
    
else
    print("^1[CSS Overwatch]^7 ERROR: Unsupported framework "..frameworkName)
end


exports('GetFramework', function()
    return Framework
end)
```

{% endstep %}

{% step %}

### ensure the function works

make sure you test the script before publishing it on your server
{% endstep %}
{% endstepper %}
