Allows players to claim ownership of unowned vehicles

Supported Games

Features

  • Allows players to claim ownership of unowned vehicles
  • Allows players to relinquish ownership of a vehicle they own, so that another player can claim it

How it works

By itself, "owning" a vehicle does nothing. However, various plugins enable special features for owned vehicles based on the permissions of the owner. Some examples:

A vehicle is considered owned if its OwnerID property is set to a player's Steam ID. A vehicle is considered unowned if its OwnerID is 0. Many plugins that spawn vehicles for a player will set ownership, so this plugin is mostly useful for allowing players to claim vehicles that spawned randomly in the world or at NPC vendors.

Note: If you just want vehicles spawned at NPC vendors to be owned by the player that purchased them, you can accomplish that with the Vehicle Vendor Options plugin.

Permissions

  • claimvehicle.claim.allvehicles -- Allows the player to claim unowned vehicles of all supported types.
  • claimvehicle.unclaim -- Allows the player to relinquish ownership of a vehicle using the vunclaim command, so that someone else can claim it. This does not reset their cooldown.
  • claimvehicle.nocooldown -- Allows the player to claim vehicles with no cooldown.

Alternatively, you can grant permissions to claim vehicles by type:

  • claimvehicle.claim.chinook
  • claimvehicle.claim.duosub
  • claimvehicle.claim.hotairballoon
  • claimvehicle.claim.minicopter
  • claimvehicle.claim.modularcar
  • claimvehicle.claim.rhib
  • claimvehicle.claim.ridablehorse
  • claimvehicle.claim.rowboat
  • claimvehicle.claim.scraptransporthelicopter
  • claimvehicle.claim.sedan
  • claimvehicle.claim.solosub
  • claimvehicle.claim.workcart

Commands

  • vclaim -- Claim ownership of the vehicle you are aiming at. It must be unowned, unmounted, and not have a lock deployed to it by another player. You must also not be building blocked.
  • vunclaim -- Relinquish ownership of the vehicle you are aiming at. You must already own it.

Configuration

Default configuration:

{
  "ClaimCooldownSeconds": 3600.0
}
  • ClaimCooldownSeconds -- Determines how long a player must wait after claiming a vehicle before they can claim another.
    • Caution: Before reducing this value, consider other plugins you are running and whether this will allow for griefing potential. For example, a low cooldown may enable players to go around the map and lock or pick up every vehicle they find.
    • Note: Cooldowns are lost on plugin reload (or server restart). Cooldown persistence can be implemented on request.

Localization

{
  "Generic.Error.NoPermission": "You don't have permission to do that.",
  "Generic.Error.BuildingBlocked": "Error: Cannot do that while building blocked.",
  "Generic.Error.NoSupportedVehicleFound": "Error: No supported vehicle found.",
  "Generic.Error.VehicleDead": "Error: That vehicle is dead.",
  "Generic.Error.Cooldown": "Please wait <color=red>{0}</color> and try again.",
  "Claim.Error.AlreadyOwnedByYou": "You already own that vehicle.",
  "Claim.Error.DifferentOwner": "Error: Someone else already owns that vehicle.",
  "Claim.Error.LockedByAnother": "Error: Someone else placed a lock on that vehicle.",
  "Claim.Error.Mounted": "Error: That vehicle is currently occupied.",
  "Claim.Success": "You now own that vehicle.",
  "Unclaim.Error.NotOwned": "Error: You do not own that vehicle.",
  "Unclaim.Success": "You no longer own that vehicle."
}

Developer Hooks

OnVehicleClaim

  • Called when a player tries to claim a vehicle.
  • Returning false will prevent the default behavior.
  • Returning null will result in the default behavior.
bool? OnVehicleClaim(BasePlayer player, BaseCombatEntity vehicle)

OnVehicleUnclaim

  • Called when a player tries to relinquish ownership of a vehicle.
  • Returning false will prevent the default behavior.
  • Returning null will result in the default behavior.
bool? OnVehicleUnclaim(BasePlayer player, BaseCombatEntity vehicle)

OnVehicleOwnershipChanged

This hook is called when a player successfully claims or unclaims a vehicle. This allows other plugins to do things like update vehicle storage capacity based on the new owner.

void OnVehicleOwnershipChanged(BaseCombatEntity vehicle)
MIT License

Copyright (c) 2021 WhiteThunder

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.