Home delivery
Home delivery in Eleven Comercios for FiveM: NPC orders sent to on-duty staff, delivery zones, a pedestrian customer, a time limit and payment to the business.
City NPCs order food from businesses for home delivery. An on-duty employee grabs the products, drives to the delivery zone and hands them over to a pedestrian. The full payment goes to the business account.
Important
Delivery is scheduled by eleven-npc-events, an Eleven resource that is not part of this package. See Requirements.
Which businesses get orders
- Businesses whose type is in
Config.Delivery.businessTypes(onlyRESTAURACIONby default). Withuntyped = true, businesses with no type yet are included too. - With at least one product flagged for delivery on the menu.
- With at least one employee on duty online.
Each business gets one order at a time. The pace is irregular on purpose: there are rushes of back-to-back orders and long quiet spells.
What an order looks like
- The order comes in: every on-duty employee gets an alert with a sound (and a phone notification if you run
eleven-phone). - The order holds 1 to 3 different menu products, up to 3 units each, and a delivery zone marked on the map, 250 to 2,200 meters from the premises.
- The employee picks up the products (from the storage, the kitchen…) and heads to the zone.
- On arrival the customer appears: a pedestrian from the street who stands still and waits. If nobody is around, one is created on the pavement.
- The employee gets within 5 meters and uses Deliver order. They must carry all the products.
- The products are taken and the business gets paid.
If nobody delivers within maxLifetime seconds (10 minutes by default), the order is cancelled.
Payment
The NPC pays each product's menu price, capped per unit at Config.Delivery.maxUnitPrice ($500 by default) so nobody can inflate prices. The money goes to the business account; the courier isn't paid directly.
Delivery zones
Zones are the center of the customer search, not an exact spot: any street with people will do.
- On first start, the points in
Config.Delivery.seedPointsare saved to the database. From then on, the database is the source of truth. Config.Delivery.extraZonesadds fixed zones on top of the database ones.- To manage the database zones from another resource there are exports:
GetDeliveryPoints,CreateDeliveryPoint,UpdateDeliveryPoint,DeleteDeliveryPointandResetDeliveryPoint(see Exports).
Every pace, zone and customer option is in Delivery, fuel and NPC.
Switching it off
Set Config.Delivery.enabled = false to turn delivery off server-wide.