Use cmd arg/param util
This commit is contained in:
@@ -230,9 +230,8 @@ function changeAccountPasswordCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let oldPassword = splitParams[0];
|
||||
let newPassword = splitParams[1];
|
||||
let oldPassword = getParam(params, " ", 1);
|
||||
let newPassword = getParam(params, " ", 2);
|
||||
|
||||
if(isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), oldPassword))) {
|
||||
messagePlayerError(client, `The old password is invalid!`);
|
||||
@@ -282,8 +281,7 @@ function setAccountEmailCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let emailAddress = splitParams[0];
|
||||
let emailAddress = getParam(params, " ", 1);
|
||||
|
||||
if(!isValidEmailAddress(emailAddress)) {
|
||||
messagePlayerError(client, `The email '${emailAddress} is not valid!`);
|
||||
@@ -320,8 +318,7 @@ function verifyAccountEmailCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let verificationCode = splitParams[0];
|
||||
let verificationCode = getParam(params, " ", 1);
|
||||
|
||||
if(isAccountEmailVerified(getPlayerData(client).accountData)) {
|
||||
messagePlayerError(client, `You already verified your email!`);
|
||||
@@ -353,8 +350,7 @@ function resetAccountPasswordCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let verificationCode = splitParams[0] || "";
|
||||
let verificationCode = getParam(params, " ", 1) || "";
|
||||
|
||||
if(!isAccountEmailVerified(getPlayerData(client).accountData)) {
|
||||
messagePlayerError(client, `Your email is not verified. Your password will not be reset!`);
|
||||
@@ -386,8 +382,7 @@ function setAccountDiscordCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let discordName = splitParams[0];
|
||||
let discordName = getParam(params, " ", 1);
|
||||
|
||||
if(!isValidEmailAddress(emailAddress)) {
|
||||
messagePlayerError(client, `The discord '${discordName} is not valid!`);
|
||||
|
||||
@@ -20,8 +20,7 @@ function playPlayerAnimationCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let animationSlot = getAnimationFromParams(splitParams[0]);
|
||||
let animationSlot = getAnimationFromParams(getParam(params, " ", 1));
|
||||
let animationPositionOffset = 1;
|
||||
|
||||
if(!animationSlot) {
|
||||
|
||||
@@ -23,7 +23,7 @@ function accountBanCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
@@ -53,7 +53,7 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
@@ -84,7 +84,7 @@ function ipBanCommand(command, params, client, fromDiscord) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
@@ -114,8 +114,8 @@ function subNetBanCommand(command, params, client, fromDiscord) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let octetAmount = Number(splitParams[1]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let octetAmount = Number(getParam(params, " ", 2));
|
||||
let reason = splitParams.slice(2).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
|
||||
@@ -166,8 +166,8 @@ function createBusinessLocationCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let locationType = toString(splitParams[0]);
|
||||
let businessId = (isPlayerInAnyBusiness(splitParams[1])) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let locationType = toString(getParam(params, " ", 1));
|
||||
let businessId = (isPlayerInAnyBusiness(getParam(params, " ", 2))) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -228,7 +228,7 @@ function deleteBusinessCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessLocationCommand(command, params, client) {
|
||||
//let businessId = toInteger(splitParams[1]);
|
||||
//let businessId = toInteger(getParam(params, " ", 2));
|
||||
//deleteBusinessLocation(businessId);
|
||||
//messagePlayerSuccess(client, `Business '${tempBusinessData.name} deleted!`);
|
||||
}
|
||||
@@ -554,8 +554,7 @@ function lockUnlockBusinessCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessEntranceFeeCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let entranceFee = toInteger(splitParams[0]) || 0;
|
||||
let entranceFee = toInteger(getParam(params, " ", 1)) || 0;
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -651,8 +650,7 @@ function getBusinessStorageItemsCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessPickupCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let typeParam = splitParams[0] || "business";
|
||||
let typeParam = getParam(params, " ", 1) || "business";
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -682,8 +680,7 @@ function setBusinessPickupCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessInteriorTypeCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let typeParam = splitParams[0] || "business";
|
||||
let typeParam = getParam(params, " ", 1) || "business";
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -738,7 +735,7 @@ function setBusinessInteriorTypeCommand(command, params, client) {
|
||||
function setBusinessBlipCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let typeParam = splitParams[0] || "business";
|
||||
let typeParam = getParam(params, " ", 1) || "business";
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -769,7 +766,7 @@ function setBusinessBlipCommand(command, params, client) {
|
||||
function giveDefaultItemsToBusinessCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let typeParam = splitParams[0] || "business";
|
||||
let typeParam = getParam(params, " ", 1) || "business";
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -867,7 +864,7 @@ function withdrawFromBusinessCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let amount = toInteger(splitParams[0]) || 0;
|
||||
let amount = toInteger(getParam(params, " ", 1)) || 0;
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -903,7 +900,7 @@ function setBusinessBuyPriceCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let amount = toInteger(splitParams[0]) || 0;
|
||||
let amount = toInteger(getParam(params, " ", 1)) || 0;
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -938,7 +935,7 @@ function depositIntoBusinessCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let amount = toInteger(splitParams[0]) || 0;
|
||||
let amount = toInteger(getParam(params, " ", 1)) || 0;
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -978,7 +975,6 @@ function orderItemForBusinessCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let itemType = getItemTypeFromParams(splitParams.slice(0,-2).join(" "));
|
||||
|
||||
if(!getItemTypeData(itemType)) {
|
||||
@@ -1638,7 +1634,7 @@ function buyFromBusinessCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
let itemSlot = toInteger(splitParams[0]) || 1;
|
||||
let itemSlot = toInteger(getParam(params, " ", 1)) || 1;
|
||||
|
||||
if(typeof getBusinessData(businessId).floorItemCache[itemSlot-1] == "undefined") {
|
||||
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
|
||||
@@ -1652,7 +1648,7 @@ function buyFromBusinessCommand(command, params, client) {
|
||||
|
||||
let amount = 1;
|
||||
if(areThereEnoughParams(params, 2, " ")) {
|
||||
amount = toInteger(splitParams[1]) || 1;
|
||||
amount = toInteger(getParam(params, " ", 2)) || 1;
|
||||
if(amount <= 0) {
|
||||
messagePlayerError(client, "The amount must be more than 0!");
|
||||
return false;
|
||||
@@ -1712,15 +1708,14 @@ function buyFromBusinessCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessItemSellPriceCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let businessId = getBusinessFromParams(splitParams[2]) || getPlayerBusiness(client);
|
||||
let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let itemSlot = toInteger(splitParams[0]) || 0;
|
||||
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
|
||||
|
||||
if(typeof getBusinessData(businessId).floorItemCache[itemSlot-1] == "undefined") {
|
||||
messagePlayerError(client, `Item slot ${itemSlot-1} doesn't exist!`);
|
||||
@@ -1733,7 +1728,7 @@ function setBusinessItemSellPriceCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let oldPrice = getBusinessData(businessId).floorItemCache[itemSlot-1].buyPrice;
|
||||
let newPrice = toInteger(splitParams[1]) || oldPrice;
|
||||
let newPrice = toInteger(getParam(params, " ", 2)) || oldPrice;
|
||||
if(newPrice < 0) {
|
||||
messagePlayerError(client, "The price can't be negative!");
|
||||
return false;
|
||||
@@ -1747,15 +1742,14 @@ function setBusinessItemSellPriceCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function storeItemInBusinessStorageCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let businessId = getBusinessFromParams(splitParams[2]) || getPlayerBusiness(client);
|
||||
let businessId = getBusinessFromParams(getParam(params, " ", 3)) || getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let itemSlot = toInteger(splitParams[0]) || 0;
|
||||
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
|
||||
|
||||
if(typeof getBusinessData(businessId).floorItemCache[itemSlot-1] == "undefined") {
|
||||
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
|
||||
@@ -1783,7 +1777,6 @@ function storeItemInBusinessStorageCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function stockItemOnBusinessFloorCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
@@ -1791,7 +1784,7 @@ function stockItemOnBusinessFloorCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let itemSlot = toInteger(splitParams[0]) || 0;
|
||||
let itemSlot = toInteger(getParam(params, " ", 1)) || 0;
|
||||
|
||||
if(typeof getBusinessData(businessId).storageItemCache[itemSlot-1] == "undefined") {
|
||||
messagePlayerError(client, `Item slot ${itemSlot} doesn't exist!`);
|
||||
|
||||
@@ -228,9 +228,8 @@ function setClanOwnerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let clanId = getClanFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(splitParams[1]);
|
||||
let clanId = getClanFromParams(getParam(params, " ", 1));
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 2));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
@@ -319,9 +318,8 @@ function createClanRankCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let rankId = toInteger(splitParams[0]);
|
||||
let rankName = splitParams[1];
|
||||
let rankId = toInteger(getParam(params, " ", 1));
|
||||
let rankName = getParam(params, " ", 2);
|
||||
|
||||
let rankIndex = createClanRank(clanId, rankId, rankName);
|
||||
|
||||
@@ -375,8 +373,7 @@ function setClanMemberTagCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
@@ -402,10 +399,10 @@ function setClanMemberTagCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
getPlayerCurrentSubAccount(targetClient).ClanTag = splitParams[1];
|
||||
getPlayerCurrentSubAccount(targetClient).ClanTag = getParam(params, " ", 2);
|
||||
|
||||
messagePlayerSuccess(client, `You set {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}clan tag to {ALTCOLOUR}${splitParams[1]}`);
|
||||
messagePlayerAlert(client, `{ALTCOLOUR}${getCharacterFullName(targetClient)} {MAINCOLOUR}set your clan tag to {ALTCOLOUR}${splitParams[1]}`);
|
||||
messagePlayerSuccess(client, `You set {ALTCOLOUR}${getCharacterFullName(targetClient)}'s {MAINCOLOUR}clan tag to {ALTCOLOUR}${getParam(params, " ", 2)}`);
|
||||
messagePlayerAlert(client, `{ALTCOLOUR}${getCharacterFullName(targetClient)} {MAINCOLOUR}set your clan tag to {ALTCOLOUR}${getParam(params, " ", 2)}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -452,8 +449,7 @@ function setClanRankLevelCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let clanId = getPlayerClan(client);
|
||||
let clanId = getPlayerClan(client);
|
||||
|
||||
if(!getClanData(clanId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidClan"));
|
||||
@@ -508,8 +504,7 @@ function addClanMemberFlagCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
@@ -535,9 +530,9 @@ function addClanMemberFlagCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
let flagValue = getClanFlagValue(splitParams[1]);
|
||||
let flagValue = getClanFlagValue(getParam(params, " ", 2));
|
||||
getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags | flagValue;
|
||||
messagePlayerSuccess(client, `You added the {ALTCOLOUR}${splitParams[1]} {MAINCOLOUR}clan flag to {ALTCOLOUR}${getCharacterFullName(client)}`);
|
||||
messagePlayerSuccess(client, `You added the {ALTCOLOUR}${getParam(params, " ", 2)} {MAINCOLOUR}clan flag to {ALTCOLOUR}${getCharacterFullName(client)}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -560,8 +555,7 @@ function removeClanMemberFlagCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
@@ -587,9 +581,9 @@ function removeClanMemberFlagCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
let flagValue = getClanFlagValue(splitParams[1]);
|
||||
let flagValue = getClanFlagValue(getParam(params, " ", 2));
|
||||
getPlayerCurrentSubAccount(client).clanFlags = getPlayerCurrentSubAccount(client).clanFlags & ~flagValue;
|
||||
messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${splitParams[1]} {MAINCOLOUR}clan flag from {ALTCOLOUR}${getCharacterFullName(client)}`);
|
||||
messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${getParam(params, " ", 2)} {MAINCOLOUR}clan flag from {ALTCOLOUR}${getCharacterFullName(client)}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -612,23 +606,22 @@ function addClanRankFlagCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let rankId = getClanRankFromParams(clanId, splitParams[0]);
|
||||
let rankId = getClanRankFromParams(clanId, getParam(params, " ", 1));
|
||||
|
||||
if(!getClanRankData(clanId, rankId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "ClanRankInvalid"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getClanFlagValue(splitParams[1])) {
|
||||
if(!getClanFlagValue(getParam(params, " ", 2))) {
|
||||
messagePlayerError(client, "Clan flag not found!");
|
||||
return false;
|
||||
}
|
||||
|
||||
let flagValue = getClanFlagValue(splitParams[1]);
|
||||
let flagValue = getClanFlagValue(getParam(params, " ", 2));
|
||||
|
||||
addBitFlag(getClanRankData(clanId, rankId).flags, flagValue);
|
||||
messagePlayerSuccess(client, `You added the {ALTCOLOUR}${splitParams[1]} {MAINCOLOUR}clan flag to rank {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`);
|
||||
messagePlayerSuccess(client, `You added the {ALTCOLOUR}${getParam(params, " ", 2)} {MAINCOLOUR}clan flag to rank {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -651,23 +644,22 @@ function removeClanRankFlagCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let rankId = getClanRankFromParams(clanId, splitParams[0]);
|
||||
let rankId = getClanRankFromParams(clanId, getParam(params, " ", 1));
|
||||
|
||||
if(!getClanRankData(clanId, rankId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "ClanRankInvalid"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getClanFlagValue(splitParams[1])) {
|
||||
if(!getClanFlagValue(getParam(params, " ", 2))) {
|
||||
messagePlayerError(client, "Clan flag not found!");
|
||||
return false;
|
||||
}
|
||||
|
||||
let flagValue = getClanFlagValue(splitParams[1]);
|
||||
let flagValue = getClanFlagValue(getParam(params, " ", 2));
|
||||
|
||||
removeBitFlag(getClanRankData(clanId, rankId).flags, flagValue);
|
||||
messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${splitParams[1]} {MAINCOLOUR}clan flag from rank {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`);
|
||||
messagePlayerSuccess(client, `You removed the {ALTCOLOUR}${getParam(params, " ", 2)} {MAINCOLOUR}clan flag from rank {ALTCOLOUR}${getClanRankData(clanId, rankId).name}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -690,8 +682,7 @@ function showClanRankFlagsCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let rankId = getClanRankFromParams(clanId, splitParams[0]);
|
||||
let rankId = getClanRankFromParams(clanId, getParam(params, " ", 1));
|
||||
|
||||
if(!getClanRankData(clanId, rankId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "ClanRankInvalid"));
|
||||
@@ -738,8 +729,7 @@ function setClanMemberTitleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
@@ -761,7 +751,7 @@ function setClanMemberTitleCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let oldMemberTitle = getPlayerCurrentSubAccount(client).clanTitle;
|
||||
getPlayerCurrentSubAccount(client).clanTitle = splitParams[1];
|
||||
getPlayerCurrentSubAccount(client).clanTitle = getParam(params, " ", 2);
|
||||
messagePlayerSuccess(client, `You changed the name of {ALTCOLOUR}${getCharacterFullName(client)} {MAINCOLOUR}from {ALTCOLOUR}${oldMemberTitle} {MAINCOLOUR}to {ALTCOLOUR}${params}`);
|
||||
}
|
||||
|
||||
@@ -785,8 +775,7 @@ function setClanRankTitleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let rankId = getClanRankFromParams(clanId, splitParams[0]);
|
||||
let rankId = getClanRankFromParams(clanId, getParam(params, " ", 1));
|
||||
|
||||
if(!getClanRankData(clanId, rankId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "ClanRankInvalid"));
|
||||
@@ -794,7 +783,7 @@ function setClanRankTitleCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let oldRankName = getClanRankData(clanId, rankId).name;
|
||||
getClanRankData(clanId, rankId).name = splitParams[1];
|
||||
getClanRankData(clanId, rankId).name = getParam(params, " ", 2);
|
||||
messagePlayerSuccess(client, `You changed the name of rank ${rankId} from {ALTCOLOUR}${oldRankName} {MAINCOLOUR}to {ALTCOLOUR}${params}`);
|
||||
}
|
||||
|
||||
@@ -818,9 +807,8 @@ function setClanMemberRankCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let rankId = getClanRankFromParams(clanId, splitParams[1]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let rankId = getClanRankFromParams(clanId, getParam(params, " ", 2));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
@@ -1193,8 +1181,7 @@ function showClanFlagListCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let rankId = getClanRankFromParams(clanId, splitParams[0]);
|
||||
let rankId = getClanRankFromParams(clanId, getParam(params, " ", 1));
|
||||
|
||||
if(!getClanRankData(clanId, rankId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "ClanRankInvalid"));
|
||||
|
||||
@@ -711,7 +711,7 @@ addCommandHandler("cmd", function(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let newCommand = splitParams[0];
|
||||
let newCommand = getParam(params, " ", 1);
|
||||
let newParams = splitParams.slice(1).join(" ");
|
||||
|
||||
getCommand(newCommand).handlerFunction(newCommand, newParams, client);
|
||||
@@ -790,7 +790,7 @@ function areThereEnoughParams(params, requiredAmount, delimiter = " ") {
|
||||
// ===========================================================================
|
||||
|
||||
function getParam(params, delimiter, index) {
|
||||
return params.split(delimiter)[index];
|
||||
return params.split(delimiter)[index-1];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -304,9 +304,8 @@ function setTimeCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let hour = toInteger(splitParams[0]);
|
||||
let minute = toInteger(splitParams[1]) || 0;
|
||||
let hour = toInteger(getParam(params, " ", 1));
|
||||
let minute = toInteger(getParam(params, " ", 2)) || 0;
|
||||
|
||||
if(hour > 23 || hour < 0) {
|
||||
messagePlayerError(client, "The hour must be between 0 and 23!");
|
||||
@@ -377,8 +376,7 @@ function setWeatherCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let weatherId = getWeatherFromParams(splitParams[0]);
|
||||
let weatherId = getWeatherFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!weatherId) {
|
||||
messagePlayerError(client, `That weather ID or name is invalid!`);
|
||||
@@ -413,8 +411,8 @@ function setSnowingCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let falling = toInteger(splitParams[0]);
|
||||
let ground = toInteger(splitParams[1]);
|
||||
let falling = toInteger(getParam(params, " ", 1));
|
||||
let ground = toInteger(getParam(params, " ", 2));
|
||||
|
||||
getServerConfig().fallingSnow = intToBool(falling);
|
||||
getServerConfig().groundSnow = intToBool(ground);
|
||||
@@ -446,9 +444,9 @@ function setServerGUIColoursCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let colourRed = toInteger(splitParams[0]) || 255;
|
||||
let colourGreen = toInteger(splitParams[1]) || 255;
|
||||
let colourBlue = toInteger(splitParams[2]) || 255;
|
||||
let colourRed = toInteger(getParam(params, " ", 1)) || 255;
|
||||
let colourGreen = toInteger(getParam(params, " ", 2)) || 255;
|
||||
let colourBlue = toInteger(getParam(params, " ", 3)) || 255;
|
||||
|
||||
getServerConfig().guiColour = [colourRed, colourGreen, colourBlue];
|
||||
|
||||
|
||||
@@ -243,9 +243,8 @@ function simulateCommandForPlayerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let tempCommand = splitParams[1];
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let tempCommand = getParam(params, " ", 2);
|
||||
tempCommand.replace("/", "");
|
||||
let tempParams = splitParams.slice(2).join(" ");
|
||||
|
||||
@@ -284,8 +283,7 @@ function simulateCommandForAllPlayersCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let tempCommand = splitParams[0];
|
||||
let tempCommand = getParam(params, " ", 1);
|
||||
tempCommand.replace("/", "");
|
||||
let tempParams = splitParams.slice(1).join(" ");
|
||||
|
||||
@@ -335,8 +333,7 @@ function executeClientCodeCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let targetCode = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
@@ -521,9 +518,8 @@ function streamAudioURLToAllPlayersCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let url = splitParams[0];
|
||||
let volume = splitParams[1];
|
||||
let url = getParam(params, " ", 1);
|
||||
let volume = getParam(params, " ", 2);
|
||||
|
||||
playRadioStreamForPlayer(null, url, false, volume);
|
||||
}
|
||||
@@ -536,9 +532,8 @@ function streamAudioNameToAllPlayersCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let name = splitParams[0];
|
||||
let volume = splitParams[1];
|
||||
let name = getParam(params, " ", 1);
|
||||
let volume = getParam(params, " ", 2);
|
||||
|
||||
playAudioFileForPlayer(null, name, false, volume);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ function helpCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
switch(toLowerCase(splitParams[0])) {
|
||||
switch(toLowerCase(getParam(params, " ", 1))) {
|
||||
case "account":
|
||||
showAccountHelpMessage(client);
|
||||
break;
|
||||
@@ -127,7 +127,7 @@ function helpCommand(command, params, client) {
|
||||
|
||||
case "command":
|
||||
case "cmd":
|
||||
showCommandHelpMessage(client, splitParams[1]);
|
||||
showCommandHelpMessage(client, getParam(params, " ", 2));
|
||||
break;
|
||||
|
||||
case "clan":
|
||||
|
||||
@@ -110,7 +110,7 @@ function lockUnlockHouseCommand(command, params, client) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
messagePlayerError("House not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidHouse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ function lockUnlockHouseCommand(command, params, client) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
messagePlayerError("House not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidHouse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ function setHouseDescriptionCommand(command, params, client) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
messagePlayerError("House not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidHouse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -208,12 +208,12 @@ function setHouseOwnerCommand(command, params, client) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!newHouseOwner) {
|
||||
messagePlayerError("Player not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
messagePlayerError("House not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidHouse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ function setHouseClanCommand(command, params, client) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
messagePlayerError("House not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidHouse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ function setHouseClanCommand(command, params, client) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
messagePlayerError("House not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidHouse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ function setHousePickupCommand(command, params, client) {
|
||||
} else {
|
||||
if(isNull(getGameConfig().pickupModels[getServerGame()][typeParam])) {
|
||||
messagePlayerError(client, "Invalid house type! Use a house type name or a pickup model ID or 'none'");
|
||||
messagePlayerInfo(client, `Pickup Types: [#AAAAAA]${Object.keys(getGameConfig().pickupModels[getServerGame()]).join(", ")}`)
|
||||
messagePlayerInfo(client, `Pickup Types: {ALTCOLOUR}${Object.keys(getGameConfig().pickupModels[getServerGame()]).join(", ")}`)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ function setHousePickupCommand(command, params, client) {
|
||||
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]pickup display to [#AAAAAA]${toLowerCase(typeParam)}`);
|
||||
messageAdmins(`{ALTCOLOUR}${client.name} {MAINCOLOUR}set house {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}pickup display to {ALTCOLOUR}${toLowerCase(typeParam)}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -375,8 +375,7 @@ function setHousePickupCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function setHouseInteriorTypeCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let typeParam = splitParams[0] || "None";
|
||||
let typeParam = getParam(params, " ", 1) || "None";
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
@@ -400,7 +399,7 @@ function setHouseInteriorTypeCommand(command, params, client) {
|
||||
let interiorTypesList = Object.keys(getGameConfig().interiorTemplates[getServerGame()]);
|
||||
let chunkedList = splitArrayIntoChunks(interiorTypesList, 10);
|
||||
|
||||
messagePlayerNormal(client, `{clanOrange}== {jobYellow}Interior Types {clanOrange}=======================`);
|
||||
messagePlayerNormal(client, makeChatBoxSectionHeader("InteriorTypes"));
|
||||
for(let i in chunkedList) {
|
||||
messagePlayerInfo(client, chunkedList[i].join(", "));
|
||||
}
|
||||
@@ -420,7 +419,7 @@ function setHouseInteriorTypeCommand(command, params, client) {
|
||||
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]interior type to [#AAAAAA]${toLowerCase(typeParam)}`);
|
||||
messageAdmins(`{ALTCOLOUR}${client.name} {MAINCOLOUR}set house {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}interior type to {ALTCOLOUR}${toLowerCase(typeParam)}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -449,7 +448,7 @@ function setHouseBlipCommand(command, params, client) {
|
||||
} else {
|
||||
if(isNull(getGameConfig().blipSprites[getServerGame()][typeParam])) {
|
||||
messagePlayerError(client, "Invalid house type! Use a house type name or a blip image ID");
|
||||
messagePlayerInfo(client, `Pickup Types: [#AAAAAA]${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`)
|
||||
messagePlayerInfo(client, `Pickup Types: {ALTCOLOUR}${Object.keys(getGameConfig().blipSprites[getServerGame()]).join(", ")}`)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -466,7 +465,7 @@ function setHouseBlipCommand(command, params, client) {
|
||||
resetHouseBlips(houseId);
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]blip display to [#AAAAAA]${toLowerCase(typeParam)}`);
|
||||
messageAdmins(`{ALTCOLOUR}${client.name} {MAINCOLOUR}set house {houseGreen}${getHouseData(houseId).description} {MAINCOLOUR}blip display to {ALTCOLOUR}${toLowerCase(typeParam)}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -560,7 +559,7 @@ function deleteHouseCommand(command, params, client) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
messagePlayerError("House not found!");
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidHouse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1031,7 +1030,7 @@ function setHouseBuyPriceCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let amount = toInteger(splitParams[0]) || 0;
|
||||
let amount = toInteger(getParam(params, " ", 1)) || 0;
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
@@ -1059,7 +1058,7 @@ function setHouseRentPriceCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let amount = toInteger(splitParams[0]) || 0;
|
||||
let amount = toInteger(getParam(params, " ", 1)) || 0;
|
||||
let houseId = getPlayerHouse(client);
|
||||
|
||||
if(!getHouseData(houseId)) {
|
||||
|
||||
@@ -133,7 +133,6 @@ function deleteGroundItemObject(itemId) {
|
||||
// ===========================================================================
|
||||
|
||||
function createGroundItemCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let itemType = getItemTypeFromParams(splitParams.slice(0, -1).join(" "));
|
||||
let value = splitParams.slice(-1) || 1;
|
||||
|
||||
@@ -155,7 +154,6 @@ function createGroundItemCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function createItemCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let itemType = getItemTypeFromParams(splitParams.slice(0, -1).join(" "));
|
||||
let value = splitParams.slice(-1) || 1;
|
||||
|
||||
@@ -476,7 +474,6 @@ function setItemTypeDropModelCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let itemTypeIndex = getItemTypeFromParams(splitParams.slice(0,-1).join(" "));
|
||||
let modelId = splitParams[splitParams.length-1];
|
||||
|
||||
@@ -497,7 +494,6 @@ function setItemTypeOrderPriceCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let itemTypeIndex = getItemTypeFromParams(splitParams.slice(0,-1).join(" "));
|
||||
let orderPrice = splitParams[splitParams.length-1];
|
||||
|
||||
@@ -518,7 +514,6 @@ function setItemTypeRiskMultiplierCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let itemTypeIndex = getItemTypeFromParams(splitParams.slice(0,-1).join(" "));
|
||||
let riskMultiplier = splitParams[splitParams.length-1];
|
||||
|
||||
@@ -558,7 +553,6 @@ function setItemTypeUseTypeCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let itemTypeIndex = getItemTypeFromParams(splitParams.slice(0,-1).join(" "));
|
||||
let useType = splitParams[splitParams.length-1];
|
||||
|
||||
@@ -579,7 +573,6 @@ function setItemTypeUseValueCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let itemTypeIndex = getItemTypeFromParams(splitParams.slice(0,-1).join(" "));
|
||||
let useValue = splitParams[splitParams.length-1];
|
||||
|
||||
@@ -1736,9 +1729,8 @@ function deleteItemInPlayerInventoryCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let hotBarSlot = splitParams[1];
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let hotBarSlot = getParam(params, " ", 2);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, `Player not found!`);
|
||||
@@ -1778,9 +1770,8 @@ function deleteAllItemsInPlayerInventoryCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let hotBarSlot = splitParams[1];
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let hotBarSlot = getParam(params, " ", 2);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, `Player not found!`);
|
||||
|
||||
@@ -1013,8 +1013,8 @@ function addPlayerToJobBlackListCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let jobId = getJobFromParams(splitParams[1]) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let jobId = getJobFromParams(getParam(params, " ", 2)) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, `That player was not found!`);
|
||||
@@ -1043,8 +1043,8 @@ function removePlayerFromJobBlackListCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let jobId = getJobFromParams(splitParams[1]) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let jobId = getJobFromParams(getParam(params, " ", 2)) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, `That player was not found!`);
|
||||
@@ -1073,8 +1073,8 @@ function addPlayerToJobWhiteListCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let jobId = getJobFromParams(splitParams[1]) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let jobId = getJobFromParams(getParam(params, " ", 2)) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, `That player was not found!`);
|
||||
@@ -1103,8 +1103,8 @@ function removePlayerFromJobWhiteListCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let jobId = getJobFromParams(splitParams[1]) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let jobId = getJobFromParams(getParam(params, " ", 2)) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, `That player was not found!`);
|
||||
|
||||
@@ -19,8 +19,8 @@ function initKeyBindScript() {
|
||||
function addKeyBindCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let keyId = getKeyIdFromParams(splitParams[0]);
|
||||
let tempCommand = splitParams[1];
|
||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||
let tempCommand = getParam(params, " ", 2);
|
||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||
|
||||
if(!keyId) {
|
||||
@@ -49,7 +49,7 @@ function addKeyBindCommand(command, params, client) {
|
||||
function removeKeyBindCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let keyId = getKeyIdFromParams(splitParams[0]);
|
||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
@@ -210,7 +210,7 @@ function showKeyBindListCommand(command, params, client) {
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(keybindList, 6);
|
||||
|
||||
messagePlayerInfo(client, `{clanOrange}== {jobYellow}Your Key Binds {clanOrange}===========================`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderKeyBindsList")));
|
||||
|
||||
for(let i in chunkedList) {
|
||||
messagePlayerInfo(client, chunkedList[i].join(", "));
|
||||
|
||||
@@ -59,8 +59,7 @@ function setNewCharacterMoneyCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let amount = toInteger(splitParams[0]) || 1000;
|
||||
let amount = toInteger(getParam(params, " ", 1)) || 1000;
|
||||
|
||||
getServerConfig().newCharacter.cash = amount;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
@@ -46,8 +46,7 @@ function setClientStaffTitleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let staffTitle = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
@@ -383,14 +382,14 @@ function gotoJobLocationCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let jobId = getJobFromParams(splitParams[0]) || getClosestJobLocation(getPlayerPosition(client)).job;
|
||||
let jobId = getJobFromParams(getParam(params, " ", 1)) || getClosestJobLocation(getPlayerPosition(client)).job;
|
||||
|
||||
if(!getJobData(jobId)) {
|
||||
messagePlayerError(client, `That job does not exist!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
let jobLocationId = splitParams[1] || 0;
|
||||
let jobLocationId = getParam(params, " ", 2) || 0;
|
||||
|
||||
if(typeof getJobData(jobId).locations[jobLocationId] == "undefined") {
|
||||
messagePlayerError(client, `That location ID does not exist!`);
|
||||
@@ -427,12 +426,11 @@ function gotoPositionCommand(command, params, client) {
|
||||
}
|
||||
|
||||
params = params.replace(",", "");
|
||||
let splitParams = params.split(" ");
|
||||
let x = splitParams[0];
|
||||
let y = splitParams[1];
|
||||
let z = splitParams[2];
|
||||
let int = splitParams[3];
|
||||
let vw = splitParams[4];
|
||||
let x = getParam(params, " ", 1);
|
||||
let y = getParam(params, " ", 2);
|
||||
let z = getParam(params, " ", 3);
|
||||
let int = getParam(params, " ", 4);
|
||||
let vw = getParam(params, " ", 5);
|
||||
|
||||
client.player.velocity = toVector3(0.0, 0.0, 0.0);
|
||||
setPlayerInterior(client, toInteger(int));
|
||||
@@ -541,8 +539,7 @@ function playerInteriorCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
@@ -553,7 +550,7 @@ function playerInteriorCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let interiorId = splitParams[1];
|
||||
let interiorId = getParam(params, " ", 2);
|
||||
setPlayerInterior(targetClient, Number(interiorId));
|
||||
messageAdmins(`${client.name} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s interior to {ALTCOLOUR}${interiorId}`);
|
||||
}
|
||||
@@ -566,8 +563,7 @@ function playerVirtualWorldCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
@@ -578,7 +574,7 @@ function playerVirtualWorldCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let dimensionId = splitParams[1];
|
||||
let dimensionId = getParam(params, " ", 2);
|
||||
setPlayerDimension(targetClient, Number(dimensionId));
|
||||
messageAdmins(`${client.name} {MAINCOLOUR}set {ALTCOLOUR}${getPlayerName(targetClient)}'s {MAINCOLOUR}virtual world to {ALTCOLOUR}${dimensionId}`);
|
||||
}
|
||||
@@ -670,8 +666,8 @@ function addStaffFlagCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split("");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let flagName = splitParams[1] || "None";
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let flagName = getParam(params, " ", 2) || "None";
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -704,8 +700,8 @@ function takeStaffFlagCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split("");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let flagName = splitParams[1] || "None";
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let flagName = getParam(params, " ", 2) || "None";
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -738,7 +734,7 @@ function clearStaffFlagsCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split("");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -778,7 +774,7 @@ function getStaffFlagsCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split("");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -821,8 +817,8 @@ function allStaffFlagsCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split("");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let flagName = splitParams[1] || "None";
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let flagName = getParam(params, " ", 2) || "None";
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -840,9 +836,8 @@ function givePlayerMoneyCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let amount = toInteger(splitParams[1]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let amount = toInteger(getParam(params, " ", 2));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -864,9 +859,8 @@ function forcePlayerAccentCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let newAccent = splitParams[1] || "None";
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let newAccent = getParam(params, " ", 2) || "None";
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -898,8 +892,7 @@ function forceCharacterNameChangeCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -925,10 +918,9 @@ function forceCharacterNameCommand(command, params, client) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let firstName = splitParams[1];
|
||||
let lastName = splitParams[2];
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let firstName = getParam(params, " ", 2);
|
||||
let lastName = getParam(params, " ", 3);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
@@ -961,8 +953,7 @@ function forcePlayerSkinCommand(command, params, client) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "));
|
||||
|
||||
if(!targetClient) {
|
||||
@@ -989,9 +980,8 @@ function forcePlayerWantedLevelCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let wantedLevel = splitParams[1];
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let wantedLevel = getParam(params, " ", 2);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!");
|
||||
|
||||
@@ -416,9 +416,8 @@ function newCharacterCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let firstName = splitParams[0];
|
||||
let lastName = splitParams[1];
|
||||
let firstName = getParam(params, " ", 1);
|
||||
let lastName = getParam(params, " ", 2);
|
||||
|
||||
checkNewCharacter(client, firstName, lastName);
|
||||
}
|
||||
@@ -541,9 +540,8 @@ function forceFightStyleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let fightStyleId = getFightStyleFromParams(splitParams[1]);
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let fightStyleId = getFightStyleFromParams(getParam(params, " ", 2));
|
||||
|
||||
//if(!targetClient) {
|
||||
// messagePlayerError(client, `Player not found!`);
|
||||
|
||||
@@ -464,9 +464,8 @@ function vehicleAdminColourCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let colour1 = toInteger(splitParams[0]) || 0;
|
||||
let colour2 = toInteger(splitParams[1]) || 0;
|
||||
let colour1 = toInteger(getParam(params, " ", 1)) || 0;
|
||||
let colour2 = toInteger(getParam(params, " ", 2)) || 0;
|
||||
|
||||
takePlayerCash(client, getGlobalConfig().resprayVehicleCost);
|
||||
updatePlayerCash(client);
|
||||
@@ -542,7 +541,6 @@ function vehicleAdminLiveryCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let livery = toInteger(params) || 3;
|
||||
|
||||
takePlayerCash(client, getGlobalConfig().resprayVehicleCost);
|
||||
|
||||
Reference in New Issue
Block a user