Skip to content

Commit

Permalink
Verify that there's actually a vehicle for /v respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellLVP committed Jul 2, 2020
1 parent ca9bc28 commit d773a65
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@
"VEHICLE_QUICK_COLLECTABLES": "@error Keep tagging Spray Tags and shooting Red Barrels to enable this command!",
"VEHICLE_RESET": "@success The vehicle layout has been reset.",
"VEHICLE_RESPAWNED": "@success The %s has been respawned.",
"VEHICLE_RESPAWN_NOT_IN_VEHICLE": "@error %s is not in a vehicle, which can thus not be respawned.",
"VEHICLE_SAVE_TOO_BUSY": "@error Sorry, this area is too busy! There already are %d vehicles (max: %d) and %d models (max: %d).",
"VEHICLE_SAVED": "@success The %s has been %s in the database.",
"VEHICLE_SEIZE_DRIVER": "@error %s is already driving your vehicle!",
Expand Down
4 changes: 4 additions & 0 deletions javascript/features/vehicles/vehicle_commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,10 @@ class VehicleCommands {
// wish to reset the vehicle's position to its original spot.
onVehicleRespawnCommand(player, subject) {
const vehicle = subject.vehicle;
if (!vehicle) {
player.sendMessage(Message.VEHICLE_RESPAWN_NOT_IN_VEHICLE, subject.name);
return;
}

// Bail out if the |subject| is not driving a vehicle, or it's not managed by this system.
if (!this.manager_.isManagedVehicle(vehicle)) {
Expand Down

0 comments on commit d773a65

Please sign in to comment.