Skip to content

Social & services apps ​

Chirp, Yellow Pages, Maps, Calendar, Stocks, Transit, Weather (home screen) and News (App Store). Config: shared/config/social.lua (Config.Social). Tables: sql/social.sql (created automatically). Server: server/apps/{social,chirp,yp,maps,calendar,stocks,transit,news}.lua (social.lua holds shared helpers Phone.Social.*: charge/pay with wallet fallback, admin/job checks, URL validation, per-key money locks). Client: client/apps/maps.lua (client RPC maps.distances), client/apps/weather.lua (client RPC weather.get). Web: web/src/apps/<id>/.

Admin actions (deleting other people's chirps / ads) need the np_admin node np_phone.admin, granted to a group or player in np_admin; without np_admin: the console, np_admin_fallback identifiers and, on ESX, np_admin_fallback_groups (see Installation → Permissions). Deleting someone else's chirp or ad and /chirpverify are logged to np_admin (category np_phone).

Money goes through Phone.Wallet.charge (city team, logs a transaction) when present, otherwise Phone.fw('removeMoney', src, 'bank', …). Payouts (stock sales) use Phone.fw('addMoney', …) plus Phone.Wallet.log.

Chirp (chirp.*, accent #e0423b) ​

An account is created from the character name on first open. The handle can be changed once.

Multiple accounts. A character can create more accounts (maxAccounts, owner = identifier) and stay logged into several at once (maxSessions, table phone_chirp_sessions); one is active, every RPC acts as it. Tapping the avatar on Home (or the people icon on the Profile tab) opens the account switcher: switch with one tap, log back into own accounts without a password, log into another account with handle + password, or create one. The owner can set a password (bcrypt, GetPasswordHash) to share an account, e.g. a business account; only the owner can change it. Logging out of the last account shows a welcome screen. Notifications reach everyone logged into the account (prefixed @handle · when it isn't their active one; tapping switches to it). The job badge (verifiedJobs) is only applied while the owner uses the account. Existing installs are upgraded on start (unique owner index dropped, every character logged into its account). Posts starting with #tip are shown as "Anonymous Tip" (Config.Social.chirp.anonymousTips); the author still sees and can delete them, admins see the real author. Verified badge: off by default. Admins (np_phone.admin, or the server console) set it with /chirpverify <handle> [on|off] (toggles without on/off; command name Config.Social.chirp.verifyCommand), the np_admin staff tool Chirp verification, or the setChirpVerified export. Optionally the player's job is in Config.Social.verifiedJobs (empty by default; refreshed whenever the player uses Chirp).

RPC params → result
chirp.me → { account, stats, handleLocked, notify, unread, admin, owner, hasPassword, accounts (logged in, with unread/active), owned (own, logged out), canCreate, maxSessions, maxLength, maxImages } or { loggedOut: true, owned, canCreate, name }
chirp.switch { id } → true (an account the character is logged into)
chirp.login { handle, password } or { id } (own account) → true; 5 failed attempts per minute
chirp.create { handle, displayName, password? } → true (logged in and active)
chirp.logout { id? } (default: active) → true; the newest other session becomes active
chirp.updateProfile { displayName?, avatar? ('' clears), bio?, handle? (once), notify?, password? (owner only, '' removes) } → { account, handleLocked, notify, hasPassword }
chirp.profile { id } or { handle } → { account, stats, following, me }
chirp.follow { id, follow } → { following, followers }
chirp.feed { tab: 'foryou'|'following'|'trending', cursor? } → { posts, cursor } (cursor = last id; trending uses an offset)
chirp.userPosts { id, tab: 'posts'|'replies'|'likes', cursor? } → { posts, cursor }
chirp.thread { id } → { post, parent?, replies }
chirp.hashtag { tag, cursor? } → { posts, cursor, count }
chirp.trends → { tag, count }[] (last trendingHours)
chirp.search { q } → { accounts, posts }
chirp.activity → { items } (likes, replies, mentions, follows, reposts; marks them read)
chirp.post { text ≤ 280, images?: url[] ≤ 4, replyTo? } → post
chirp.delete { id } → true (own posts, or admin)
chirp.like / chirp.repost { id, value } → { value, count }

Push: chirp:new (post, sent to every player except the author; the NUI shows a "new Chirps" pill), chirp:deleted { id }, chirp:activity { type, postId, accountId }. Notifications (mentions, replies, likes, reposts, follows) via Phone.notify, only when the account's notify setting is on. NUI deep links: openApp('chirp', { postId } | { handle } | { compose } | { attachImage }) (attachImage: Photos share sheet → composer with the image attached). Notification taps carry { postId, handle, accountId } and open the post (switching account first). Images are picked from rpc('photos.list') (media team) or pasted as a URL. Every image URL in Chirp (images, avatar), Yellow Pages (photo) and News (cover) must be https on a Config.Media.allowedHosts host (no IP grabbers in the public feed). Search input longer than 40 bytes is cut, not rejected.

Yellow Pages (yp.*, accent #e1b52f) ​

RPC params → result
yp.list { category?, q?, mine? } → { listings, fee, expireHours, categories }
yp.create { category, title, price?, description?, photo?, location? } → listing (charges ypPostFee)
yp.delete { id } → true (own, or admin; no refund)
yp.businesses → { job, label, icon, number, count, open }[] (on-duty players per Config.Social.businesses, cached 15 s)

Ads expire after ypExpireHours (filtered in queries, expired rows deleted at most every 5 min). Max active ads per player: ypMaxActivePerPlayer. Push: yp:new, yp:deleted. Call / Message open phone / messages with { number }.

Maps (maps.*) ​

RPC params → result
maps.data → { places, shared, pois, icons }
maps.config → { style, cayoPerico, tiles, layers } (Config.Maps, enabled layers only; cached by the UI)
maps.savePlace { name, icon, x, y, z?, street? } → place (max maxPlaces)
maps.updatePlace { id, name?, icon? } → true
maps.deletePlace / maps.deleteShared { id } → true
maps.share { number, label, x, y, z? } → true (notifies + pushes maps:shared to the receiver; tapping the notification { sharedId } opens the Shared tab with that location's actions)
maps.distances (client) { points: {x,y}[] } → { me: {x,y,z,street,zone,heading}, distances: number[] } (the app polls it with no points every 2.5 s for the live position)

Waypoints use the core client RPC gps.setWaypoint.

The map ​

web/src/apps/maps/MapCard.tsx (also used by Transit) draws the real GTA V map from tiles: drag to pan, scroll / double-click / ± to zoom, a button switches road atlas ↔ satellite (remembered per client), another one follows the player again. Pins can be tapped (place / shared / POI actions).

  • Tiles ship in web/public/maps/tiles/{atlas,satellite}/{z}/{x}-{y}.webp (256px, atlas z0–5, satellite z0–4, ≈15 MB) from VIRUXE/gtav-map-tiles. World → map units uses the usual Leaflet livemap calibration of the 8192px renders (geo.ts toMap: x·0.02072 + 117.3, −y·0.0205 + 172.8).
  • Cayo Perico is a built-in image layer (web/public/maps/overlays/cayo-perico/, from fivenet-app/livemap-tiles, bounds x 3666.78..5723.78, y −6144.05..−4144.05). Config.Maps.cayoPerico = false hides it.
  • Map mods (Roxwood, …): Config.Maps.layers = images over a world rectangle. Paths @resource/file (any resource's files {}; np_phone/maps/ is already shipped), https://…, or relative to the UI. Minimap tiles sit on a 4500-unit grid from x −4140, y 8400 (top-left), so an exported minimap texture lines up 1:1 — see maps/README.md. Roxwood entries are in the config, disabled until you export its tiles.
  • Config.Maps.tiles replaces the base tile set (same layout and calibration), e.g. a full render that already contains your map mods.
  • Coordinates accepted by places / shares / waypoints are ±16000 so expansions far outside the base map work.

Calendar (calendar.*, accent #e98a52) ​

Times are epoch milliseconds. Reminders: one server thread checks every calendarReminderCheck seconds (single indexed query, skipped when nobody is online) and notifies the owner and accepted invitees.

RPC params → result
calendar.list { from, to } → events (own + accepted invites; own events include invitees)
calendar.create { title, startsAt, endsAt?, allDay?, location?, notes?, color?, reminder? (minutes), invite?: numbers[] } → event
calendar.update { id, …partial, invite? } → event (owner; false clears optional fields)
calendar.delete { id } → true (owner deletes; an invitee leaves)
calendar.invites → pending invites { id, status, event, from }
calendar.respond { id, accept } → true
calendar.next → { title, startsAt, endsAt, time, date, location, allDay } | null (home / lock widget, next 7 days)

Push: calendar:update { id }, calendar:invite { id, eventId }. Notification taps: { inviteId } opens Invitations, { eventId, startsAt? } (reminders, accepted / declined invites) selects the day and opens the event once loaded. Server API: Phone.Calendar.add(identifier, { title, startsAt, endsAt?, location?, notes?, allDay?, color?, reminder? }) → eventId. Export: exports.np_phone:addCalendarEvent(serverIdOrIdentifier, event).

Stocks (stocks.*) ​

Prices follow a random walk with mild mean reversion towards base, ticking every stockTickMinutes on the server (latest price + stockHistory points persisted in phone_stocks). Crypto symbols allow 4 decimals.

RPC params → result
stocks.list → { stocks: { symbol, name, crypto, price, change, changePct, history }[], tickMinutes }
stocks.portfolio → { holdings: { symbol, shares, cost, value, avgPrice }[], value, cost, bank }
stocks.buy { symbol, shares } → { shares, cost, price, portfolio } (cost rounded up, charged from bank)
stocks.sell { symbol, shares } → { shares, proceeds, price, portfolio } (rounded down, paid to bank)

Push: stocks:tick (summary for every symbol, broadcast).

Transit (transit.*, accent #da4d1e) ​

Lines come from Config.Social.transit.lines. Departures are computed in the NUI from the in-game clock: trains leave the first stop every headway in-game minutes between firstDeparture and lastDeparture and need travel minutes per stop. The nearest stop uses maps.distances.

RPC params → result
transit.lines → { lines, ticketPrice, ticketHours, tickets }
transit.buy → { item = true } (when ticketItem is set and Phone.fw('addItem') succeeds) or { ticket } (digital)

Weather (weather.*, accent #64d2ff) ​

Client-only, no server or database. The current / next GTA weather type maps to a label and °C through Config.Weather (same table as the lock / home widget, city name Config.WeatherCity); wind, rain and snow come from the game natives. The NUI derives the 24 h in-game forecast (diurnal curve between low and high, the next type taking over once the transition is underway), UV, humidity and visibility per weather type and sunrise / sunset (06:00 / 21:00). It reloads on every phone:weather push and falls back to the push data if the RPC fails. Tapping the weather widget opens the app.

RPC params → result
weather.get (client) → { city, zone, type, condition, temp, high, low, next?: { type, condition, temp }, transition (0-1), wind (km/h), windDir (deg it blows from), rain (0-1), snow (0-1) }

News (news.*, App Store app) ​

Players with a job in Config.Social.newsJobs (or the np_phone.admin node) can publish and delete any article. Body format: # / ## headings, - lists, > quotes, **bold**, *italic*, blank-line paragraphs.

RPC params → result
news.list { cursor? } → { articles (with excerpt), cursor, canPublish }
news.get { id } → article with body
news.publish { title, body, cover? } → article
news.delete { id } → true

Push: news:new, news:deleted (broadcast with Phone.pushAll). With newsNotifyAll = true every player with a loaded phone gets a "Breaking News" notification (Phone.notifyAll, data = { articleId } opens the article).

Browser dev ​

Every app has a mock.ts. Screenshot helpers (dev only, ignored in FiveM): ?app=chirp&view=compose|profile|search|activity|thread|accounts|welcome, ?app=yp&view=detail|post, ?app=calendar&view=new, ?app=stocks&view=detail, ?app=transit&view=line, ?app=news&view=reader. Weather follows the in-game clock, so ?app=weather&time=23:10 shows the night sky.