Change use of get client to get player from param

This commit is contained in:
Vortrex
2020-12-28 01:25:04 -06:00
parent 564a9f3548
commit e778720ea6
5 changed files with 25 additions and 25 deletions

View File

@@ -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!");

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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) {

View File

@@ -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!");