addCommandHandler("bootveh", bootVehicle)
function bootVehicle(player, command, vinOrPlate)
-- retrieve the VIN or plate of the vehicle from the command arguments
local vinOrPlate = vinOrPlate
-- retrieve the element of the vehicle using the VIN or plate
local vehicle = getVehicleFromVinOrPlate(vinOrPlate)
-- check if the vehicle was found
if not vehicle then
outputChatBox("Invalid VIN or plate.", player)
return
end
-- freeze the vehicle
setElementFrozen(vehicle, true)
outputChatBox("Vehicle frozen.", player)
end
function getVehicleFromVinOrPlate(vinOrPlate)
-- query the database for the VIN or plate
local result = dbQuery(...)
-- check if the result is valid
if not result then return end
-- retrieve the first row from the result
local row = dbPoll(result, -1)[1]
-- check if a row was found
if not row then return end
-- return the element of the vehicle
return row.vehicle
end
addCommandHandler("unbootveh", unbootVehicle)
function unbootVehicle(player, command, vinOrPlate)
-- retrieve the VIN or plate of the vehicle from the command arguments
local vinOrPlate = vinOrPlate
-- retrieve the element of the vehicle using the VIN or plate
local vehicle = getVehicleFromVinOrPlate(vinOrPlate)
-- check if the vehicle was found
if not vehicle then
outputChatBox("Invalid VIN or plate.", player)
return
end
-- unfreeze the vehicle
setElementFrozen(vehicle, false)
outputChatBox("Vehicle unfrozen.", player)
end
You will need to create a function to retrieve the element of the vehicle from the VIN or plate. You can do this by querying the database for the VIN or plate and returning the element of the vehicle.
You can create a similar command and function for /unbootveh to unfreeze the vehicle.