Skip to content

Commit

Permalink
Fixed vehicle removal
Browse files Browse the repository at this point in the history
  • Loading branch information
zziger committed Oct 1, 2023
1 parent 91cf5dc commit 2e9d42f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions freeroam-extended/server/freeroam-extended/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ public void SpawnVeh(IAltPlayer player, params string[] args)
return;
}

if (player.IsInVehicle)
{
player.SendChatMessage(ChatConstants.ErrorPrefix + "You are already in a vehicle!");
return;
}

if (player.Vehicles.Count >= 3)
{
var target = player.Vehicles.OrderBy(veh => veh.SpawnTime).First();
Expand All @@ -70,13 +76,6 @@ public void SpawnVeh(IAltPlayer player, params string[] args)
player.SendChatMessage(ChatConstants.ErrorPrefix + "You can't have more than 3 vehicles. We removed your oldest one!");
}

if (player.IsInVehicle)
{
player.SendChatMessage(ChatConstants.ErrorPrefix + "You are already in a vehicle we replaced it for you!");
player.Vehicle.Destroy();
return;
}

lock (StatsController.StatsData)
{
StatsController.StatsData.VehiclesSpawned++;
Expand Down

0 comments on commit 2e9d42f

Please sign in to comment.