Merge branch 'location-overhaul' into nightly
This commit is contained in:
@@ -132,7 +132,7 @@ function createBusinessLocationCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let locationType = toString(splitParams[0]);
|
||||
let businessId = (isPlayerInAnyBusiness(splitParams[1])) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(splitParams[1])) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -175,7 +175,7 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -203,7 +203,7 @@ function deleteBusinessLocationCommand(command, params, client) {
|
||||
function setBusinessNameCommand(command, params, client) {
|
||||
let newBusinessName = toString(params);
|
||||
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
messagePlayerError(client, "Business not found!");
|
||||
@@ -220,7 +220,7 @@ function setBusinessNameCommand(command, params, client) {
|
||||
|
||||
function setBusinessOwnerCommand(command, params, client) {
|
||||
let newBusinessOwner = getPlayerFromParams(params);
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!newBusinessOwner) {
|
||||
messagePlayerError(client, "Player not found!");
|
||||
@@ -241,7 +241,7 @@ function setBusinessOwnerCommand(command, params, client) {
|
||||
|
||||
function setBusinessClanCommand(command, params, client) {
|
||||
let clanId = getClanFromParams(params);
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!getBusinessData(businessId)) {
|
||||
messagePlayerError(client, "Business not found!");
|
||||
@@ -261,7 +261,7 @@ function setBusinessClanCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessJobCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -292,7 +292,7 @@ function setBusinessJobCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessPublicCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -311,7 +311,7 @@ function setBusinessPublicCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function lockBusinessCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -490,10 +490,10 @@ function setBusinessBlipCommand(command, params, client) {
|
||||
getBusinessData(businessId).entranceBlipModel = toInteger(typeParam);
|
||||
}
|
||||
|
||||
deleteBusinessEntranceBlip(businessId);
|
||||
deleteBusinessExitBlip(businessId);
|
||||
createBusinessEntranceBlip(businessId);
|
||||
createBusinessExitBlip(businessId);
|
||||
deleteBusinessLocationEntranceBlip(businessId, closestEntrance.index);
|
||||
deleteBusinessLocationExitBlip(businessId, closestEntrance.index);
|
||||
createBusinessLocationEntranceBlip(businessId, closestEntrance.index);
|
||||
createBusinessLocationExitBlip(businessId, closestEntrance.index);
|
||||
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]blip display to [#AAAAAA]${toLowerCase(typeParam)}`);
|
||||
}
|
||||
@@ -727,7 +727,7 @@ function orderItemForBusiness(businessId, itemType, amount) {
|
||||
// ===========================================================================
|
||||
|
||||
function viewBusinessTillAmountCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -773,7 +773,7 @@ function buyBusinessCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function moveBusinessEntranceCommand(command, params, client) {
|
||||
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -800,7 +800,7 @@ function moveBusinessEntranceCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function moveBusinessExitCommand(command, params, client) {
|
||||
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)).business;
|
||||
|
||||
if(!areParamsEmpty(params)) {
|
||||
businessId = getBusinessFromParams(params);
|
||||
@@ -837,10 +837,12 @@ function getBusinessDataFromDatabaseId(databaseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestBusinessEntrance(position) {
|
||||
let closest = 0;
|
||||
for(let i in getServerData().businesses) {
|
||||
if(getDistance(position, getServerData().businesses[i].entrancePosition) <= getDistance(position, getServerData().businesses[closest].entrancePosition)) {
|
||||
closest = i;
|
||||
let closest = getServerData().businesses[0].locations[0];
|
||||
for(let i in businesses) {
|
||||
for(let j in getServerData().businesses[i].locations) {
|
||||
if(getDistance(position, businesses[i].locations[j].entrancePosition) <= getDistance(position, closest.entrancePosition)) {
|
||||
closest = getServerData().businesses[i].locations[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
return closest;
|
||||
@@ -984,8 +986,10 @@ function saveBusinessToDatabase(businessId) {
|
||||
|
||||
function createAllBusinessPickups() {
|
||||
for(let i in getServerData().businesses) {
|
||||
createBusinessEntrancePickup(i);
|
||||
createBusinessExitPickup(i);
|
||||
for(let j in getServerData().businesses[i].locations) {
|
||||
createBusinessLocationEntrancePickup(i, j);
|
||||
createBusinessLocationExitPickup(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -993,87 +997,86 @@ function createAllBusinessPickups() {
|
||||
|
||||
function createAllBusinessBlips() {
|
||||
for(let i in getServerData().businesses) {
|
||||
createBusinessEntranceBlip(i);
|
||||
createBusinessExitBlip(i);
|
||||
for(let j in getServerData().businesses[i].locations) {
|
||||
createBusinessLocationEntranceBlip(i, j);
|
||||
createBusinessLocationExitBlip(i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
if(getBusinessData(businessId).entrancePickupModel != -1) {
|
||||
function createBusinessLocationEntrancePickup(businessId, locationId) {
|
||||
if(getBusinessData(businessId).locations[locationId].entrancePickupModel != -1) {
|
||||
let pickupModelId = getGameConfig().pickupModels[getServerGame()].business;
|
||||
|
||||
if(getServerData().businesses[businessId].entrancePickupModel != 0) {
|
||||
pickupModelId = getBusinessData(businessId).entrancePickupModel;
|
||||
if(getServerData().businesses[businessId].locations[locationId].entrancePickupModel != 0) {
|
||||
pickupModelId = getBusinessData(businessId).locations[locationId].entrancePickupModel;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).entrancePickup = gta.createPickup(pickupModelId, getBusinessData(businessId).entrancePosition);
|
||||
getBusinessData(businessId).entrancePickup.onAllDimensions = false;
|
||||
getBusinessData(businessId).entrancePickup.dimension = getBusinessData(businessId).entranceDimension;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).entrancePickup);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntranceBlip(businessId) {
|
||||
if(getBusinessData(businessId).entranceBlipModel != -1) {
|
||||
function createBusinessLocationEntranceBlip(businessId, locationId) {
|
||||
if(getBusinessData(businessId).locations[locationId].entranceBlipModel != -1) {
|
||||
let blipModelId = getGameConfig().blipSprites[getServerGame()].business;
|
||||
|
||||
if(getServerData().businesses[businessId].entranceBlipModel != 0) {
|
||||
blipModelId = getBusinessData(businessId).entranceBlipModel;
|
||||
blipModelId = getBusinessData(businessId).locations[locationId].entranceBlipModel;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).entranceBlip = gta.createBlip(blipModelId, getBusinessData(businessId).entrancePosition, 1, getColourByName("businessBlue"));
|
||||
getBusinessData(businessId).entranceBlip.onAllDimensions = false;
|
||||
getBusinessData(businessId).entranceBlip.dimension = getBusinessData(businessId).entranceDimension;
|
||||
//getBusinessData(businessId).entranceBlip.interior = getBusinessData(businessId).entranceInterior;
|
||||
setEntityData(getBusinessData(businessId).entranceBlip, "ag.owner.type", AG_BLIP_BUSINESS_ENTRANCE, false);
|
||||
setEntityData(getBusinessData(businessId).entranceBlip, "ag.owner.id", businessId, false);
|
||||
addToWorld(getBusinessData(businessId).entranceBlip);
|
||||
getBusinessData(businessId).locations[locationId].entranceBlip = gta.createBlip(getBusinessData(businessId).locations[locationId].entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
getBusinessData(businessId).locations[locationId].entranceBlip.onAllDimensions = false;
|
||||
getBusinessData(businessId).locations[locationId].entranceBlip.dimension = getBusinessData(businessId).locations[locationId].entranceDimension;
|
||||
getBusinessData(businessId).locations[locationId].entranceBlip.setData("ag.owner.type", AG_BLIP_BUSINESS_ENTRANCE, false);
|
||||
getBusinessData(businessId).locations[locationId].entranceBlip.setData("ag.owner.id", businessId, false);
|
||||
addToWorld(getBusinessData(businessId).locations[locationId].entranceBlip);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessExitPickup(businessId) {
|
||||
function createBusinessLocationExitPickup(businessId, locationId) {
|
||||
if(getBusinessData(businessId).hasInterior) {
|
||||
if(getBusinessData(businessId).exitPickupModel != -1) {
|
||||
if(getBusinessData(businessId).locations[locationId].exitPickupModel != -1) {
|
||||
let pickupModelId = getGameConfig().pickupModels[getServerGame()].exit;
|
||||
|
||||
if(getServerData().businesses[businessId].exitPickupModel != 0) {
|
||||
pickupModelId = getBusinessData(businessId).exitPickupModel;
|
||||
if(getServerData().businesses[businessId].locations[locationId].exitPickupModel != 0) {
|
||||
pickupModelId = getBusinessData(businessId).locations[locationId].exitPickupModel;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).exitPickup = gta.createPickup(pickupModelId, getBusinessData(businessId).exitPosition);
|
||||
getBusinessData(businessId).exitPickup.onAllDimensions = false;
|
||||
getBusinessData(businessId).exitPickup.dimension = getBusinessData(businessId).exitDimension;
|
||||
//getBusinessData(businessId).exitPickup.interior = getBusinessData(businessId).exitInterior;
|
||||
addToWorld(getBusinessData(businessId).exitPickup);
|
||||
getBusinessData(businessId).locations[locationId].exitPickup = gta.createPickup(pickupModelId, getBusinessData(businessId).locations[locationId].exitPosition);
|
||||
getBusinessData(businessId).locations[locationId].exitPickup.onAllDimensions = false;
|
||||
getBusinessData(businessId).locations[locationId].exitPickup.dimension = getBusinessData(businessId).locations[locationId].exitDimension;
|
||||
getBusinessData(businessId).locations[locationId].exitPickup.setData("ag.owner.type", AG_PICKUP_BUSINESS_EXIT, false);
|
||||
getBusinessData(businessId).locations[locationId].exitPickup.setData("ag.owner.id", businessId, false);
|
||||
getBusinessData(businessId).locations[locationId].exitPickup.setData("ag.label.type", AG_LABEL_EXIT, true);
|
||||
addToWorld(getBusinessData(businessId).locations[locationId].exitPickup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessExitBlip(businessId) {
|
||||
function createBusinessLocationExitBlip(businessId, locationId) {
|
||||
if(getBusinessData(businessId).hasInterior) {
|
||||
if(getBusinessData(businessId).exitBlipModel != -1) {
|
||||
if(getBusinessData(businessId).locations[locationId].exitBlipModel != -1) {
|
||||
let blipModelId = getGameConfig().blipSprites[getServerGame()].business;
|
||||
|
||||
if(getServerData().businesses[businessId].exitBlipModel != 0) {
|
||||
blipModelId = getBusinessData(businessId).exitBlipModel;
|
||||
if(getServerData().businesses[businessId].locations[locationId].exitBlipModel != 0) {
|
||||
blipModelId = getBusinessData(businessId).locations[locationId].exitBlipModel;
|
||||
}
|
||||
|
||||
getBusinessData(businessId).exitBlip = gta.createBlip(blipModelId, getBusinessData(businessId).exitPosition, 1, getColourByName("businessBlue"));
|
||||
getBusinessData(businessId).exitBlip.onAllDimensions = false;
|
||||
getBusinessData(businessId).exitBlip.dimension = getBusinessData(businessId).entranceDimension;
|
||||
getBusinessData(businessId).locations[locationId].exitBlip = gta.createBlip(getBusinessData(businessId).locations[locationId].exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
getBusinessData(businessId).locations[locationId].exitBlip.onAllDimensions = false;
|
||||
getBusinessData(businessId).locations[locationId].exitBlip.dimension = getBusinessData(businessId).locations[locationId].entranceDimension;
|
||||
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
|
||||
setEntityData(getBusinessData(businessId).exitBlip, "ag.owner.type", AG_BLIP_BUSINESS_EXIT, false);
|
||||
setEntityData(getBusinessData(businessId).exitBlip, "ag.owner.id", businessId, false);
|
||||
addToWorld(getBusinessData(businessId).exitBlip);
|
||||
getBusinessData(businessId).locations[locationId].exitBlip.setData("ag.owner.type", AG_BLIP_BUSINESS_EXIT, false);
|
||||
getBusinessData(businessId).locations[locationId].exitBlip.setData("ag.owner.id", businessId, false);
|
||||
addToWorld(getBusinessData(businessId).locations[locationId].exitBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1091,14 +1094,19 @@ function deleteBusiness(businessId, deletedBy = 0) {
|
||||
if(dbQuery) {
|
||||
freeDatabaseQuery(dbQuery);
|
||||
}
|
||||
|
||||
dbQuery = queryDatabase(dbConnection, `DELETE FROM biz_loc WHERE biz_loc_biz = ${tempBusinessData.databaseId}`);
|
||||
if(dbQuery) {
|
||||
freeDatabaseQuery(dbQuery);
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
deleteBusinessEntrancePickup(businessId);
|
||||
deleteBusinessExitPickup(businessId);
|
||||
deleteBusinessEntrancePickups(businessId);
|
||||
deleteBusinessExitPickups(businessId);
|
||||
|
||||
deleteBusinessEntranceBlip(businessId);
|
||||
deleteBusinessExitBlip(businessId);
|
||||
deleteBusinessEntranceBlips(businessId);
|
||||
deleteBusinessExitBlips(businessId);
|
||||
|
||||
removePlayersFromBusiness(businessId);
|
||||
|
||||
@@ -1176,43 +1184,69 @@ function doesBusinessHaveInterior(businessId) {
|
||||
return getBusinessData(businessId).hasInterior;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessEntrancePickup(businessId) {
|
||||
if(getBusinessData(businessId).entrancePickup != null) {
|
||||
//removeFromWorld(getBusinessData(businessId).entrancePickup);
|
||||
deleteGameElement(getBusinessData(businessId).entrancePickup);
|
||||
getBusinessData(businessId).entrancePickup = null;
|
||||
function deleteBusinessEntrancePickups(businessId) {
|
||||
for(let i in getServerData().businesses[businessId].locations) {
|
||||
deleteBusinessLocationEntrancePickup(businessId, i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessExitPickup(businessId) {
|
||||
if(getBusinessData(businessId).exitPickup != null) {
|
||||
//removeFromWorld(getBusinessData(businessId).exitPickup);
|
||||
deleteGameElement(getBusinessData(businessId).exitPickup);
|
||||
getBusinessData(businessId).exitPickup = null;
|
||||
function deleteBusinessEntranceBlips(businessId) {
|
||||
for(let i in getServerData().businesses[businessId].locations) {
|
||||
deleteBusinessLocationEntranceBlip(businessId, i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessEntranceBlip(businessId) {
|
||||
if(getBusinessData(businessId).entranceBlip != null) {
|
||||
//removeFromWorld(getBusinessData(businessId).entranceBlip);
|
||||
deleteGameElement(getBusinessData(businessId).entranceBlip);
|
||||
getBusinessData(businessId).entranceBlip = null;
|
||||
function deleteBusinessExitPickups(businessId) {
|
||||
for(let i in getServerData().businesses[businessId].locations) {
|
||||
deleteBusinessLocationExitPickup(businessId, i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessExitBlip(businessId) {
|
||||
if(getBusinessData(businessId).exitBlip != null) {
|
||||
//removeFromWorld(getBusinessData(businessId).exitBlip);
|
||||
deleteGameElement(getBusinessData(businessId).exitBlip);
|
||||
getBusinessData(businessId).exitBlip = null;
|
||||
function deleteBusinessExitBlips(businessId) {
|
||||
for(let i in getServerData().businesses[businessId].locations) {
|
||||
deleteBusinessLocationExitBlip(businessId, i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessLocationEntrancePickup(businessId, locationId) {
|
||||
if(getBusinessData(businessId).locations[locationId].entrancePickup) {
|
||||
destroyElement(getBusinessData(businessId).locations[locationId].entrancePickup);
|
||||
getBusinessData(businessId).locations[locationId].entrancePickup = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessLocationExitPickup(businessId, locationId) {
|
||||
if(getBusinessData(businessId).locations[locationId].exitPickup) {
|
||||
destroyElement(getBusinessData(businessId).locations[locationId].exitPickup);
|
||||
getBusinessData(businessId).locations[locationId].exitPickup = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessLocationEntranceBlip(businessId, locationId) {
|
||||
if(getBusinessData(businessId).locations[locationId].entranceBlip) {
|
||||
destroyElement(getBusinessData(businessId).locations[locationId].entranceBlip);
|
||||
getBusinessData(businessId).locations[locationId].entranceBlip = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessLocationExitBlip(businessId, locationId) {
|
||||
if(getBusinessData(businessId).locations[locationId].exitBlip) {
|
||||
destroyElement(getBusinessData(businessId).locations[locationId].exitBlip);
|
||||
getBusinessData(businessId).locations[locationId].exitBlip = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user