Add get player in house/biz cmds

This commit is contained in:
Vortrex
2022-05-19 18:56:23 -05:00
parent 1c5ae513a8
commit 080e2616bb

View File

@@ -1751,4 +1751,66 @@ function forceFightStyleCommand(command, params, client) {
return true;
}
// ===========================================================================
/**
* 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 getPlayerCurrentHouseCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
let houseId = getPlayerHouse(targetClient);
if(!houseId) {
messagePlayerAlert(client, `${getPlayerName(targetClient)} isn't in or at a house!`);
return false;
}
let houseData = getHouseData(houseId);
messagePlayerInfo(client, `${getPlayerName(targetClient)}'s is at/in house '${houseData.description}' (ID ${houseId}/${houseData.databaseId})`);
return true;
}
// ===========================================================================
/**
* 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 getPlayerCurrentBusinessCommand(command, params, client) {
if(areParamsEmpty(params)) {
messagePlayerSyntax(client, getCommandSyntaxText(command));
return false;
}
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
let businessId = getPlayerBusiness(targetClient);
if(!businessId) {
messagePlayerAlert(client, `${getPlayerName(targetClient)} isn't in or at a house!`);
return false;
}
let businessData = getBusinessData(houseId);
messagePlayerInfo(client, `${getPlayerName(targetClient)}'s is at/in business '${businessData.name}' (ID ${businessId}/${businessData.databaseId})`);
return true;
}
// ===========================================================================