TranslateCap returned the result of gsub directly, and gsub returns the string
plus the number of substitutions. Whenever TranslateCap is the last argument of
a call, that count is passed along as an extra argument.
The common case is showNotification(msg, notifyType, ...), which is called with
just the message in about 49 places in the core. Those all pass notifyType = 1
instead of nil, so the notification is rendered with a numeric type rather than
the intended default. 71 call sites in total have TranslateCap in trailing
position.
Wrapping the call in parentheses truncates it to one value. The string itself is
unchanged, and nothing reads the second value.
xLib.name was "xLib", which is not a resource, so the import metatable fed it to LoadResourceFile and resolved nothing. It failed silently on Legacy and hard-errored on Enhanced (Resource 'xLib' not found). Point it at the real resource name.
Adds xLib.pubsub for server-driven topic multicast: a producer resource
subscribes players to a topic server-side and publishes data that is pushed
only to the subscribed players. Clients listen with xLib.pubsub.on and never
subscribe or publish themselves.
The subscription registry is a single shared instance in the esx_lib server VM,
reached cross-resource through exports; the client side is a per-VM listener
over one net event. Subscriptions are cleaned up on playerDropped, so a reused
serverId never inherits them, and on the owning resource stopping.
Also adds xLib.triggerClientEvent, which packs the payload once when sending to
many players; publish uses it so a broadcast to N subscribers serialises once.
Adds a generic xLib.cache (ped, vehicle, seat, weapon, coords) modelled on
ox_lib cache and framework agnostic, and rewires es_extended to source ped and
weapon from it which removes the per-frame ped poll. The vehicle enter/exit
state machine and every esx: event are kept unchanged through a thin glue.
Moved getPlayersInArea / getClosestPlayer / getPedsInArea / getObjectsInArea /
getVehiclesInArea / getClosestPed / getClosestObject / getClosestVehicle to
xLib; es_extended re-exposes them through server compat shims.
Flagged: getNearbyPlayers iterates ESX.Players (es_extended server state),
which is not portable across the lib boundary - the lib relies on that global
being present at call time.
Integrated fix during the move:
- spawnVehicle uses the computed isNetworked for the network-id/migrate guard,
fixing the original that branched on the raw networked argument
modSmokeEnabled preserved as-is in get/setVehicleProperties (flagged: the set
path toggles mod 20 without applying a smoke color, matching legacy behavior).
Non-portable substitution documented:
- ESX.PlayerData.ped -> PlayerPedId() (ESX.PlayerData is not available in the lib VM)
Integrated fixes during the move:
- monotonic handle counter (handleCount) instead of count+1; no handle
collision after a point is removed
- unified single proximity loop: per-frame inside() plus a 500ms enter/leave
scan, adaptive Wait(next(insidePoints) and 0 or 500), replacing the previous
two separate loops
- emptiness detected via next() instead of # on a sparse-keyed table
Non-portable substitutions documented:
- ESX.PlayerData.ped -> PlayerPedId() (ESX.PlayerData is not available in the
lib VM)
- GetGameTimer() used to gate the 500ms scan within the single loop