Check for gun ban + show proper cost difference
This commit is contained in:
@@ -2619,6 +2619,14 @@ function buyFromBusinessCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let useType = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).useType;
|
||||||
|
if (useType == V_ITEM_USE_TYPE_WEAPON || V_ITEM_USE_TYPE_TAZER || useType == V_ITEM_USE_TYPE_AMMO_CLIP) {
|
||||||
|
if (isPlayerWeaponBanned(client) && !isPlayerExemptFromAntiCheat(client)) {
|
||||||
|
messagePlayerError(client, getLocaleString(client, "WeaponBanned"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let amount = 1;
|
let amount = 1;
|
||||||
if (areThereEnoughParams(params, 2, " ")) {
|
if (areThereEnoughParams(params, 2, " ")) {
|
||||||
amount = toInteger(getParam(params, " ", 2)) || 1;
|
amount = toInteger(getParam(params, " ", 2)) || 1;
|
||||||
@@ -2643,7 +2651,7 @@ function buyFromBusinessCommand(command, params, client) {
|
|||||||
let itemName = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name;
|
let itemName = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).name;
|
||||||
|
|
||||||
if (getPlayerCurrentSubAccount(client).cash < totalCost) {
|
if (getPlayerCurrentSubAccount(client).cash < totalCost) {
|
||||||
messagePlayerError(client, getLocaleString(client, "NotEnoughCashNeedAmountMore", `{ALTCOLOUR}${getBusinessData(businessId).floorItemCache[itemSlot - 1].buyPrice * amount - getPlayerCurrentSubAccount(client).cash}{MAINCOLOUR}`));
|
messagePlayerError(client, getLocaleString(client, "NotEnoughCashNeedAmountMore", `{ALTCOLOUR}${totalCost - getPlayerCurrentSubAccount(client).cash}{MAINCOLOUR}`));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2657,14 +2665,6 @@ function buyFromBusinessCommand(command, params, client) {
|
|||||||
deleteItem(getBusinessData(businessId).floorItemCache[itemSlot - 1]);
|
deleteItem(getBusinessData(businessId).floorItemCache[itemSlot - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let useType = getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot - 1]).itemTypeIndex).useType;
|
|
||||||
if (useType == V_ITEM_USE_TYPE_WEAPON || V_ITEM_USE_TYPE_TAZER || useType == V_ITEM_USE_TYPE_AMMO_CLIP) {
|
|
||||||
if (isPlayerWeaponBanned(client) && !isPlayerExemptFromAntiCheat(client)) {
|
|
||||||
messagePlayerError(client, getLocaleString(client, "WeaponBanned"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//messagePlayerSuccess(client, `You bought ${amount} {ALTCOLOUR}${itemName} {MAINCOLOUR}for ${totalCost} ${priceEach}`);
|
//messagePlayerSuccess(client, `You bought ${amount} {ALTCOLOUR}${itemName} {MAINCOLOUR}for ${totalCost} ${priceEach}`);
|
||||||
meActionToNearbyPlayers(client, `buys a ${itemName}`);
|
meActionToNearbyPlayers(client, `buys a ${itemName}`);
|
||||||
|
|
||||||
@@ -2879,9 +2879,9 @@ function updateBusinessPickupLabelData(businessId, deleted = false) {
|
|||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
if (businessData == false) {
|
if (businessData == false) {
|
||||||
sendBusinessToPlayer(null, businessId, true, "", false, -1, -1, 0, 0, false, false, false);
|
sendBusinessToPlayer(null, businessId, true, "", false, -1, -1, 0, 0, false, false, false, 0);
|
||||||
} else {
|
} else {
|
||||||
sendBusinessToPlayer(null, businessId, false, businessData.name, businessData.entrancePosition, getBusinessEntranceBlipModelForNetworkEvent(businessId), getBusinessEntrancePickupModelForNetworkEvent(businessId), businessData.buyPrice, businessData.rentPrice, businessData.hasInterior, businessData.locked, doesBusinessHaveAnyItemsToBuy(businessId));
|
sendBusinessToPlayer(null, businessId, false, businessData.name, businessData.entrancePosition, getBusinessEntranceBlipModelForNetworkEvent(businessId), getBusinessEntrancePickupModelForNetworkEvent(businessId), businessData.buyPrice, businessData.rentPrice, businessData.hasInterior, businessData.locked, doesBusinessHaveAnyItemsToBuy(businessId), businessData.entranceFee);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user