Skip to content

CityRide

CityRide

Uber-style ride-hailing app. Players register as drivers, riders request pickups with destination, drivers accept and complete rides with fare calculated by distance.

Database Tables

TablePurpose
phone_cityride_driversRegistered drivers -- identifier, phone_number, display_name, vehicle_model, vehicle_color, plate, is_available, rating_avg, rating_count
phone_cityride_ridesRide history -- rider/driver identifiers, pickup/destination coords, status (requested/accepted/in_progress/completed/cancelled), fare, distance, timestamps
phone_cityride_ratingsDriver ratings -- ride_id, rater_identifier, score, comment

Server Callbacks

CallbackPurpose
gcphone:cityride:registerDriverRegisters as a driver
gcphone:cityride:getDriverProfileReturns the caller's driver profile
gcphone:cityride:updateDriverUpdates vehicle info
gcphone:cityride:setDriverAvailabilityToggle available/offline
gcphone:cityride:requestRideRider requests a ride (pickup + destination coords)
gcphone:cityride:getAvailableRidesDriver gets pending ride requests
gcphone:cityride:acceptRideDriver accepts a ride request
gcphone:cityride:confirmPickupDriver confirms rider pickup
gcphone:cityride:completeRideDriver marks ride as completed, fare charged
gcphone:cityride:cancelRideEither party cancels the ride
gcphone:cityride:getActiveRideGets current active ride for the caller
gcphone:cityride:getRideHistoryRide history for the caller
gcphone:cityride:rateDriverRider rates a completed ride
gcphone:cityride:estimatePriceCalculates estimated fare from distance
gcphone:cityride:getAvailableDriverCountReturns number of online drivers

Config Options

lua
Config.Features.CityRide = true

Config.CityRide = {
    PricePerUnit = 12,
    MinPrice = 50,
    MaxPrice = 50000,
    RequestTimeoutSeconds = 120,
}

Notes

  • Fare formula: max(MinPrice, min(distance * PricePerUnit, MaxPrice))
  • Ride request expires after RequestTimeoutSeconds if no driver accepts
  • Payment is handled via framework money (RemoveMoney/AddMoney through the bridge)

Released under GPL-3.0 License