Skip to content
Permalink
Browse files
Refuse to spawn trains using the /v feature
  • Loading branch information
RussellLVP committed Jul 23, 2020
1 parent 50cdb4f commit 3521d2afca1fd743c4335df1608d79bcf2589286
Showing 3 changed files with 9 additions and 0 deletions.
@@ -603,6 +603,7 @@
"VEHICLE_SEIZED": "@success You've seized the vehicle, on you go.",
"VEHICLE_SPAWN_CREATED": "@success Your %s has been created!",
"VEHICLE_SPAWN_NOT_ALLOWED": "@error You are not allowed to spawn vehicles right now.",
"VEHICLE_SPAWN_NOT_ALLOWED_TRAIN": "@error You are unable to create trains using this feature.",
"VEHICLE_SPAWN_NOT_FOUND": "@error We're not sure what vehicle {FF8282}%s{FFFFFF} is...",
"VEHICLE_SPAWN_REJECTED": "@error Sorry, you can't spawn vehicles right now because %s.",
"VEHICLE_UNLOCK_PASSENGER": "@error You can only unlock a vehicle when you're the driver!",
@@ -28,6 +28,9 @@ export class StreamableVehicleInfo {
if (typeof modelId !== 'number' || modelId < 400 || modelId > 611)
throw new Error(`Invalid vehicle model Id given: ${modelId}`);

if ([ 537, 538 ].includes(modelId))
throw new Error(`Illegal to dynamically create trains through this system.`);

if (!(position instanceof Vector))
throw new Error(`Invalid vehicle position given: ${position}`);

@@ -227,6 +227,11 @@ class VehicleCommands {
return;
}

if ([ 537, 538 ].includes(vehicleModel.id)) {
player.sendMessage(Message.VEHICLE_SPAWN_NOT_ALLOWED_TRAIN);
return;
}

const streamableVehicle = this.manager_.createVehicle(player, vehicleModel.id);
if (!streamableVehicle) {
player.sendMessage(Message.VEHICLE_SPAWN_NOT_ALLOWED);

0 comments on commit 3521d2a

Please sign in to comment.