Add respawnveh cmd for single vehicle respawn
This commit is contained in:
@@ -506,6 +506,7 @@ function loadCommands() {
|
||||
commandData("vehrespawnpublic", respawnPublicVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true),
|
||||
commandData("vehrespawnbiz", respawnBusinessVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true),
|
||||
commandData("vehreloadall", reloadAllVehiclesCommand, "", getStaffFlagValue("ManageVehicles"), true, true),
|
||||
commandData("vehreload", respawnVehicleCommand, "", getStaffFlagValue("ManageVehicles"), true, true),
|
||||
|
||||
commandData("vehrent", rentVehicleCommand, "", getStaffFlagValue("None"), true, true),
|
||||
commandData("vehrentprice", setVehicleRentPriceCommand, "", getStaffFlagValue("None"), true, true),
|
||||
|
||||
@@ -1076,6 +1076,20 @@ function reloadAllVehiclesCommand(command, params, client) {
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function respawnVehicleCommand(command, params, client) {
|
||||
if(isPlayerInAnyVehicle(client)) {
|
||||
removeAllOccupantsFromVehicle(getPlayerVehicle(client));
|
||||
respawnVehicle(getPlayerVehicle(client));
|
||||
}
|
||||
|
||||
setAllVehicleIndexes();
|
||||
|
||||
messagePlayerSuccess(client, `Your vehicle has been respawned`);
|
||||
}
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function respawnAllVehiclesCommand(command, params, client) {
|
||||
@@ -1396,7 +1410,12 @@ function createPermanentVehicle(modelIndex, position, heading, interior = 0, dim
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkVehicleBuying(client) {
|
||||
function processVehiclePurchasing() {
|
||||
if(!getGlobalConfig().useServerSideVehiclePurchaseCheck) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getClients().forEach((client) => {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
@@ -1449,16 +1468,19 @@ function checkVehicleBuying(client) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkVehicleBurning() {
|
||||
function processVehicleBurning() {
|
||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||
for(let i in vehicles) {
|
||||
|
||||
if(vehicles[i].health <= 250) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1496,17 +1518,19 @@ function setAllVehicleIndexes() {
|
||||
// ===========================================================================
|
||||
|
||||
function doesVehicleHaveMegaphone(vehicle) {
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).job)) == VRR_JOB_POLICE) {
|
||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_POLICE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).job)) == VRR_JOB_FIRE) {
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_FIRE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).job)) == VRR_JOB_MEDICAL) {
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_MEDICAL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1549,3 +1573,13 @@ function getVehicleTrunkPosition(vehicle) {
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removeAllOccupantsFromVehicle(vehicle) {
|
||||
for(let i = 0 ; i <= 16 ; i++) {
|
||||
if(vehicle.getOccupant(i) != null) {
|
||||
removePlayerFromVehicle(vehicle.getOccupant(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user