cato-a / CoDaM_MiscMod

Official MiscMod for CoDaM in Call of Duty 1.1
BSD 3-Clause "New" or "Revised" License
15 stars 5 forks source link

Only the first custom command appears #6

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello

Adding custom commands to MiscMod using CoDaM_MiscMod_CustomCommands_v0.23

3 commands added, only the first one from code works, and appears after entering !help as default group user.

Here is the part of the code :

    commands(level.prefix + "crosshair", ::cmd_crosshair, "Enable crosshair. ["+ level.prefix + "crosshair <on|off>]");
    commands(level.prefix + "lagometer", ::cmd_lagometer, "Enable lagometer. ["+ level.prefix + "lagometer <on|off>]");
    commands(level.prefix + "drawfps", ::cmd_drawfps, "Draw FPS. ["+ level.prefix + "drawfps <on|off>]");
}

commands(cmd, func, desc, id)
{
    if(!isDefined(id))
        id = level.commands.size;

    level.commands[cmd]["func"] = func;
    level.commands[cmd]["desc"] = desc;
    level.commands[cmd]["id"]   = id;

    level.help[level.commands[cmd]["id"]]["cmd"] = cmd;
}

MM version is 3.1.1

The 3 commands appears and works when logged as Staff group user.

(please help)

cato-a commented 1 year ago

Hi, did you update the scr_mm_perms_default with the permissions for the new commands added? You need to add them to the default group if you want everyone to access them.

You can see how it's done in the MiscMod guide on cod.pm.

EDIT: also in the mod there is this line:

level.perms["default"][level.perms["default"].size] = "" + level.commands.size;

You can add this line before every commands() function and that command will automatically be added to the "default" group.

ghost commented 1 year ago

@cato-a

Thank you Cato it works now, without the need to manually add the permissions ids in MM cfg.