Add job list command

This commit is contained in:
Vortrex
2022-05-15 04:19:38 -05:00
parent 5242233841
commit 57c60e1ff6
2 changed files with 22 additions and 0 deletions

View File

@@ -298,6 +298,10 @@ function loadCommands() {
new CommandData("uniform", jobUniformCommand, "[uniform]", getStaffFlagValue("None"), true, false, "Use a job uniform"),
new CommandData("equip", jobEquipmentCommand, "[equipment]", getStaffFlagValue("None"), true, false, "Get equipment for your job"),
new CommandData("jobs", jobListCommand, "", getStaffFlagValue("None"), true, false, "Shows a list of all jobs"),
new CommandData("joblist", jobListCommand, "", getStaffFlagValue("None"), true, false, "Shows a list of all jobs"),
new CommandData("alljobs", jobListCommand, "", getStaffFlagValue("None"), true, false, "Shows a list of all jobs"),
// Emergency Services (Police, Fire, EMS, etc)
new CommandData("department", jobDepartmentRadioCommand, "", getStaffFlagValue("None"), true, false, "Communicate with all emergency services (radio must be on and able to transmit)"),
new CommandData("d", jobDepartmentRadioCommand, "", getStaffFlagValue("None"), true, false, "Communicate with all emergency services (radio must be on and able to transmit)"),

View File

@@ -394,6 +394,24 @@ function showJobInformationToPlayer(client, jobType) {
// ===========================================================================
function jobListCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use any jobs!");
return false;
}
let jobList = getServerData().jobs.map(function(x) { return `${x.name}`});
let chunkedList = splitArrayIntoChunks(jobList, 4);
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderJobList")));
for(let i in chunkedList) {
messagePlayerInfo(client, chunkedList[i].join(", "));
}
return true;
}
// ===========================================================================
function takeJobCommand(command, params, client) {
if(!canPlayerUseJobs(client)) {
messagePlayerError(client, "You are not allowed to use any jobs!");