Prompt confirm giving veh to clan

This commit is contained in:
Vortrex
2022-04-16 21:46:58 -05:00
parent 2722d2498c
commit 3a32326b66
3 changed files with 41 additions and 5 deletions

View File

@@ -11,6 +11,7 @@
const VRR_PROMPT_NONE = 0;
const VRR_PROMPT_CREATEFIRSTCHAR = 1;
const VRR_PROMPT_BIZORDER = 2;
const VRR_PROMPT_GIVEVEHTOCLAN = 3;
// Job Types
const VRR_JOB_NONE = 0;

View File

@@ -85,10 +85,37 @@ function playerPromptAnswerYes(client) {
}
} else {
showPlayerErrorGUI(client, `You aren't ordering anything for a business!`, `Business Order Canceled`);
showPlayerErrorGUI(client, ``, `Business Order Canceled`);
}
break;
case VRR_PROMPT_GIVEVEHTOCLAN:
if(!isPlayerInAnyVehicle(client)) {
messagePlayerError(client, getLocaleString(client, "MustBeInVehicle"));
return false;
}
if(!getVehicleData(getPlayerVehicle(client))) {
messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled"));
return false;
}
if(getVehicleData(getPlayerVehicle(client)).ownerType != VRR_VEHOWNER_PLAYER) {
messagePlayerError(client, getLocaleString(client, "MustOwnVehicle"));
return false;
}
if(getVehicleData(getPlayerVehicle(client)).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
messagePlayerError(client, getLocaleString(client, "MustOwnVehicle"));
return false;
}
getVehicleData(getPlayerVehicle(client)).ownerType = VRR_VEHOWNER_CLAN;
getVehicleData(getPlayerVehicle(client)).ownerId = getPlayerCurrentSubAccount(client).clan;
messagePlayerSuccess(client, getLocaleString(client, "GaveVehicleToClan"));
//messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}owner to the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan`);
break;
default:
break;
}

View File

@@ -797,17 +797,25 @@ function setVehicleClanCommand(command, params, client) {
}
let vehicle = getPlayerVehicle(client);
let clanId = getClanFromParams(params);
let clanId = getPlayerClan(client);
if(!getClanData(clanId)) {
messagePlayerError(client, "That clan is invalid or doesn't exist!");
return false;
}
getVehicleData(vehicle).ownerType = VRR_VEHOWNER_CLAN;
getVehicleData(vehicle).ownerId = getClanData(clanId).databaseId;
if(getVehicleData(vehicle).ownerType != VRR_VEHOWNER_PLAYER) {
messagePlayerError(client, getLocaleString(client, "MustOwnVehicle"));
return false;
}
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}set their {vehiclePurple}${getVehicleName(vehicle)} {MAINCOLOUR}owner to the {clanOrange}${getClanData(clanId).name} {MAINCOLOUR}clan`);
if(getVehicleData(vehicle).ownerId != getPlayerCurrentSubAccount(client).databaseId) {
messagePlayerError(client, getLocaleString(client, "MustOwnVehicle"));
return false;
}
showPlayerPromptGUI(client, getLocaleString(client, "SetVehicleClanConfirmMessage"), getLocaleString(client, "SetVehicleClanConfirm"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
getPlayerData(client).promptType = VRR_PROMPT_GIVEVEHTOCLAN;
getVehicleData(vehicle).needsSaved = true;
}