How a car is chopped#
- A player parks a car next to the bay, gets out and picks "Drop off a car" on the yard boss. The server refuses owned cars, occupied cars, blacklisted models, cars in another routing bucket, a busy or blocked bay, and police cars when too few officers are on duty. The car is moved into the bay and frozen, and the player's cooldown starts.
- Anyone near the car can target a part. The server locks the part, checks the time it took and the distance when the progress ends, and the client runs the skill check.
- A clean cut puts the part in the player's hands. A failed check ruins the part. At the boss, "Hand over the part" rolls the loot on the server and adds it to the inventory.
- "Finish up" or the bay timer crushes the car. If at least
ServerConfig.Tablet.minPartsparts were handed in, every helper gets XP and the tablet is credited. - The parts are sold to the boss ("Sell parts") or to the Fence.
Add a third yard#
Config.Yards[#Config.Yards + 1] = {
id = 'paleto', label = 'Paleto Scrapyard',
bossModel = 's_m_y_construct_01',
boss = vec4(0.0, 0.0, 0.0, 0.0), -- where the boss stands
bay = vec4(0.0, 0.0, 0.0, 0.0), -- where the car is parked and frozen
dropRadius = 25.0,
blip = { enabled = false, sprite = 380, color = 47, scale = 0.7 },
}
Fill in your own coordinates. Leave out bossOutfit to use the model's default look.
Pay clean cash instead of dirty money#
ServerConfig.Selling.dirty = false
Only take cheap cars#
ServerConfig.ModelWhitelist = { 'asea', 'emperor', 'ingot', 'primo', 'stanier' }
ServerConfig.AllowPoliceCars = false
Send the police alert from the server#
ServerConfig.Dispatch.serverAlert runs on the server instead of the dropping player's client, so a modified client cannot skip it. Use it when your dispatch script takes server-side alerts. Replace the call with your dispatch script's own export:
ServerConfig.Dispatch.serverAlert = function(coords, plate, police, title, src)
exports['my-dispatch']:SendAlert({
coords = coords,
title = title,
message = ('Plate %s'):format(plate),
priority = police and 1 or 2,
})
end
Leave it nil to use Config.DispatchAlert on the client. ps-dispatch needs the client version because it reads the street and gender there.
Use your own dispatch script on the client#
Config.DispatchAlert = function(coords, plate, police, title)
exports['my-dispatch']:Alert({ coords = coords, title = title, plate = plate, jobs = { 'police' } })
end
The function gets the bay coords, the plate, whether the car is an emergency vehicle and the alert title. It returns nothing.
Read a bay from another resource#
Each yard publishes GlobalState['chop:<yardId>'] while a car is in its bay, and the car carries an entity state bag glitch_chop.
-- client or server
local bay = GlobalState['chop:eastls']
if bay then
print(('owner %s, crushed at %s, car netId %s'):format(bay.owner, bay.expires, bay.netId))
end
-- client: which parts are already off this car
local st = Entity(vehicle).state.glitch_chop
if st then
for partId in pairs(st.removed) do print(partId) end
end
List the yards for a map#
-- server
local places = exports['glitch-chopShop']:GetTabletPlaces()
for _, p in ipairs(places) do
print(p.id, p.label, p.coords, p.radius)
end
Stuck on a step?Ask in the Discord →