Use confirmation prompt for buying business

This commit is contained in:
Vortrex
2022-05-03 12:03:28 -05:00
parent 47c6d32990
commit 39badd1106

View File

@@ -402,16 +402,22 @@ function setBusinessClanCommand(command, params, client) {
return false; return false;
} }
if(!canPlayerManageBusiness(client, businessId)) { if(getBusinessData(business).ownerType != VRR_VEHOWNER_PLAYER) {
messagePlayerError(client, getLocaleString(client, "CantModifyBusiness")); messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
return false; return false;
} }
getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN; if(getBusinessData(business).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
getBusinessData(businessId).ownerId = getClanData(clanId).databaseId; messagePlayerError(client, getLocaleString(client, "MustOwnBusiness"));
getBusinessData(businessId).needsSaved = true; return false;
}
messagePlayerSuccess(client, `{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}to the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan!`); showPlayerPrompt(client, getLocaleString(client, "SetBusinessClanConfirmMessage"), getLocaleString(client, "SetBusinessClanConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = VRR_PROMPT_GIVEBIZTOCLAN;
//getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN;
//getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
//getBusinessData(businessId).needsSaved = true;
} }
// =========================================================================== // ===========================================================================
@@ -1343,14 +1349,8 @@ function buyBusinessCommand(command, params, client) {
return false; return false;
} }
getBusinessData(businessId).ownerType = VRR_BIZOWNER_PLAYER; showPlayerPrompt(client, getLocaleString(client, "BuyBusinessConfirmMessage"), getLocaleString(client, "BuyBusinessConfirmTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(client).databaseId; getPlayerData(client).promptType = VRR_PROMPT_BUYBIZ;
getBusinessData(businessId).buyPrice = 0;
updateBusinessPickupLabelData(businessId);
getBusinessData(businessId).needsSaved = true;
messagePlayerSuccess(client, `You are now the owner of {businessBlue}${getBusinessData(businessId).name}`);
} }
// =========================================================================== // ===========================================================================