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 inprofiles/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: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
falsemeans 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_KeyOfreturns: 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_Restoredrefuses 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_Restoredjust clears the parked mark.