Skip to content

Commit d773a65

Browse files
committed
Verify that there's actually a vehicle for /v respawn
1 parent ca9bc28 commit d773a65

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

data/messages.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@
549549
"VEHICLE_QUICK_COLLECTABLES": "@error Keep tagging Spray Tags and shooting Red Barrels to enable this command!",
550550
"VEHICLE_RESET": "@success The vehicle layout has been reset.",
551551
"VEHICLE_RESPAWNED": "@success The %s has been respawned.",
552+
"VEHICLE_RESPAWN_NOT_IN_VEHICLE": "@error %s is not in a vehicle, which can thus not be respawned.",
552553
"VEHICLE_SAVE_TOO_BUSY": "@error Sorry, this area is too busy! There already are %d vehicles (max: %d) and %d models (max: %d).",
553554
"VEHICLE_SAVED": "@success The %s has been %s in the database.",
554555
"VEHICLE_SEIZE_DRIVER": "@error %s is already driving your vehicle!",

javascript/features/vehicles/vehicle_commands.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,10 @@ class VehicleCommands {
379379
// wish to reset the vehicle's position to its original spot.
380380
onVehicleRespawnCommand(player, subject) {
381381
const vehicle = subject.vehicle;
382+
if (!vehicle) {
383+
player.sendMessage(Message.VEHICLE_RESPAWN_NOT_IN_VEHICLE, subject.name);
384+
return;
385+
}
382386

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

0 commit comments

Comments
 (0)