New universal lock command

This commit is contained in:
Vortrex
2022-04-18 20:58:23 -05:00
parent 55b2c9e22c
commit c1d27f7fb6
4 changed files with 154 additions and 77 deletions

View File

@@ -622,41 +622,6 @@ function removeBusinessOwnerCommand(command, params, client) {
// ===========================================================================
/**
* This is a command handler function.
*
* @param {string} command - The command name used by the player
* @param {string} params - The parameters/args string used with the command by the player
* @param {Client} client - The client/player that used the command
* @return {bool} Whether or not the command was successful
*
*/
function lockUnlockBusinessCommand(command, params, client) {
let businessId = getPlayerBusiness(client);
if(!areParamsEmpty(params)) {
businessId = getBusinessFromParams(params);
}
if(!getBusinessData(businessId)) {
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
return false;
}
if(!canPlayerManageBusiness(client, businessId)) {
messagePlayerError(client, getLocaleString(client, "CantModifyBusiness"));
return false;
}
getBusinessData(businessId).locked = !getBusinessData(businessId).locked;
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true);
getBusinessData(businessId).needsSaved = true;
messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}${getLockedUnlockedFromBool((getBusinessData(businessId).locked))}!`);
}
// ===========================================================================
/**
* This is a command handler function.
*