Skip to main content
This page is for mod makers who write garage, storage or trader mods. Server owners don’t need to do anything: if your garage mod doesn’t use these calls, Core still works and the data of stored vehicles simply expires (see What happens without the hook).

Why it exists

Vehicles Core keeps a few things for each vehicle in profiles/CZAutoz/Cars/Data, keyed by the vehicle’s persistent ID: Many garage mods delete a vehicle when a player stores it and spawn a new one when they take it out. The new vehicle gets a new persistent ID, so without help its odometer starts at zero, its keys stop fitting and the old entries wait in the files for the clean-up.

The four calls

All are static, server-only and safe to call more than once.

Example

Guard the calls so your mod still loads on servers without Vehicles Core:
Call czam_Restored after the new vehicle exists and has its persistent ID (after it is created on the server; if your mod spawns it and sets it up in the same frame, a CallLater of a few hundred milliseconds is enough).

Rules and limits

  • false means not done and nothing changed. Call it again (for example a moment later): a call can be refused when more than 100 arrive in one second, such as a restore-all after a restart.
  • Server only. On a player’s game the calls do nothing and write one warning line.
  • The key is what czam_KeyOf returns: four whole numbers joined by _. Anything else is refused (false, one warning line at most every 10 seconds).
  • A vehicle in the world is never overwritten. czam_Restored refuses a key that belongs to a vehicle still in the world, so it can’t copy a lock or keys onto another vehicle.
  • The new vehicle’s own data wins where it is newer: a last driver already recorded for it stays, and a key already paired to it stays. Its odometer reading is added to the stored one.
  • No file is written inside a call. Each file is saved by Core’s own schedule (within 5 minutes, and at server shutdown).
  • Limits: at most 2,000 parked vehicles (the oldest drop first), each kept for ParkedKeepDays; at most 100 calls a second. Core writes a log line at most once a minute when vehicles come back with a new ID.
  • Cost: each call is a few map lookups. Checking that a key is not a vehicle in the world uses a list of the world’s vehicles rebuilt at most once a second, so a burst of take-outs stays cheap.
  • If the garage keeps the vehicle’s persistent ID, czam_Restored just clears the parked mark.

What happens without the hook

Nothing breaks. A stored vehicle’s entries stay until the clean-up removes them: after DataKeepDays (default 30) days out of the world, or when a file holds more than DataKeepMax (default 1000) vehicles that are not in the world (newest kept). Odometer entries of vehicles that were never driven go after a day. On servers whose garage mod makes a new ID for every take-out, set DataKeepDays low (1 to 3) in the admin panel (Records).