From e778720ea6b806435a405f4535454a63e129aa9a Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 28 Dec 2020 01:25:04 -0600 Subject: [PATCH] Change use of get client to get player from param --- scripts/server/clan.js | 4 ++-- scripts/server/developer.js | 6 +++--- scripts/server/house.js | 8 ++++---- scripts/server/moderation.js | 28 ++++++++++++++-------------- scripts/server/vehicle.js | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/scripts/server/clan.js b/scripts/server/clan.js index 1a9ecc82..365aff2a 100644 --- a/scripts/server/clan.js +++ b/scripts/server/clan.js @@ -188,7 +188,7 @@ function addClanMemberFlagCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); if(!targetClient) { messageClientError(client, "Clan member not found!"); @@ -225,7 +225,7 @@ function removeClanMemberFlagCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); if(!targetClient) { messageClientError(client, "Clan member not found!"); diff --git a/scripts/server/developer.js b/scripts/server/developer.js index af2cc4e9..f6cef36c 100644 --- a/scripts/server/developer.js +++ b/scripts/server/developer.js @@ -107,7 +107,7 @@ function executeClientCodeCommand(command, params, client) { } let splitParams = params.split(" "); - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); let targetCode = splitParams.slice(1).join(" "); if(!targetClient) { @@ -151,7 +151,7 @@ function restartGameModeCommand(command, params, client) { // --------------------------------------------------------------------------- addNetworkHandler("ag.runCodeFail", function(client, returnTo, code) { - let returnClient = getClientFromParams(returnTo); + let returnClient = getPlayerFromParams(returnTo); if(!returnClient) { return false; } @@ -163,7 +163,7 @@ addNetworkHandler("ag.runCodeFail", function(client, returnTo, code) { // --------------------------------------------------------------------------- addNetworkHandler("ag.runCodeSuccess", function(client, returnTo, returnVal, code) { - let returnClient = getClientFromParams(returnTo); + let returnClient = getPlayerFromParams(returnTo); if(!returnClient) { return false; } diff --git a/scripts/server/house.js b/scripts/server/house.js index bde27491..d0c066e0 100644 --- a/scripts/server/house.js +++ b/scripts/server/house.js @@ -88,7 +88,7 @@ function setHouseDescriptionCommand(command, params, client) { // --------------------------------------------------------------------------- function setHouseOwnerCommand(command, params, client) { - let newHouseOwner = getClientFromParams(params); + let newHouseOwner = getPlayerFromParams(params); let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client))); if(!newHouseOwner) { @@ -243,20 +243,20 @@ function deleteHouseCommand(command, params, client) { } tempHouseData = getHouseData(houseId); - deleteHouse(houseId); messageClientSuccess(client, `House '${tempHouseData.description}' deleted!`); + deleteHouse(houseId, getPlayerData(client).accountData.databaseId); } // --------------------------------------------------------------------------- -function deleteHouse(houseId) { +function deleteHouse(houseId, whoDeleted = 0) { let tempHouseData = getServerData().houses[houseId]; let dbConnection = connectToDatabase(); let dbQuery = null; if(dbConnection) { - dbQuery = queryDatabase(dbConnection, `UPDATE house_main SET house_deleted = 1 AND house_who_deleted = ${getPlayerData(client).accountData.databaseId} AND house_when_deleted = UNIX_TIMESTAMP() WHERE house_id = ${tempHouseData.databaseId} LIMIT 1`); + dbQuery = queryDatabase(dbConnection, `UPDATE house_main SET house_deleted = 1 AND house_who_deleted = ${whoDeleted} AND house_when_deleted = UNIX_TIMESTAMP() WHERE house_id = ${tempHouseData.databaseId} LIMIT 1`); if(dbQuery) { freeDatabaseQuery(dbQuery); } diff --git a/scripts/server/moderation.js b/scripts/server/moderation.js index 5b43a524..51108016 100644 --- a/scripts/server/moderation.js +++ b/scripts/server/moderation.js @@ -19,7 +19,7 @@ function kickClientCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is not connected!"); return false; @@ -46,7 +46,7 @@ function setClientStaffTitleCommand(command, params, client) { } let splitParams = params.split(" "); - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); let staffTitle = splitParams.slice(1).join(" "); if(!targetClient) { @@ -76,7 +76,7 @@ function muteClientCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is not connected!"); return false; @@ -103,7 +103,7 @@ function unMuteClientCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is not connected!"); return false; @@ -129,7 +129,7 @@ function freezeClientCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is not connected!"); return false; @@ -155,7 +155,7 @@ function unFreezeClientCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is not connected!"); return false; @@ -181,7 +181,7 @@ function gotoPlayerCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is not connected!"); return false; @@ -370,7 +370,7 @@ function getPlayerCommand(command, params, client) { return false; } - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is not connected!"); return false; @@ -407,7 +407,7 @@ function addStaffFlagCommand(command, params, client) { } let splitParams = params.split(""); - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); let flagName = splitParams[1] || "none"; if(!targetClient) { @@ -441,7 +441,7 @@ function takeStaffFlagCommand(command, params, client) { } let splitParams = params.split(""); - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); let flagName = splitParams[1] || "none"; if(!targetClient) { @@ -475,7 +475,7 @@ function clearStaffFlagsCommand(command, params, client) { } let splitParams = params.split(""); - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); let flagName = splitParams[1] || "none"; if(!targetClient) { @@ -521,7 +521,7 @@ function getStaffFlagsCommand(command, params, client) { } let splitParams = params.split(""); - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); let flagName = splitParams[1] || "none"; if(!targetClient) { @@ -550,7 +550,7 @@ function allStaffFlagsCommand(command, params, client) { } let splitParams = params.split(""); - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); let flagName = splitParams[1] || "none"; if(!targetClient) { @@ -570,7 +570,7 @@ function givePlayerMoneyCommand(command, params, client) { } let splitParams = params.split(" "); - let targetClient = getClientFromParams(splitParams[0]); + let targetClient = getPlayerFromParams(splitParams[0]); let amount = toInteger(splitParams[1]); if(!targetClient) { diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js index a4df8cd6..c2b4a1c5 100644 --- a/scripts/server/vehicle.js +++ b/scripts/server/vehicle.js @@ -606,7 +606,7 @@ function setVehicleOwnerCommand(command, params, client) { } let vehicle = getPlayerVehicle(client); - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is invalid or isn't connected!"); @@ -674,7 +674,7 @@ function removeVehicleOwnerCommand(command, params, client) { } let vehicle = getPlayerVehicle(client); - let targetClient = getClientFromParams(params); + let targetClient = getPlayerFromParams(params); if(!targetClient) { messageClientError(client, "That player is invalid or isn't connected!");