Compatibility
Store and notices
The FXShop functions the notebook store uses for money and items, and the short game notice, with what to change for another inventory or notify script.
Both live in the open file framework/frameworks.lua.
#FXShop
The notebook store (config_shops.lua: the shop NPC that sells colour notebooks and, while fx-radio is started, the back radio, batteries and the charger) takes money and gives items only through FXShop. It is written for VORP and RSG. To use another inventory or money script, change these functions.
Amounts are dollars (or gold) as numbers, not cents.
| Function | Returns | What it does |
|---|---|---|
GetPlayerMoney(src, type) |
number | Money of type 'cash' or 'gold' |
RemovePlayerMoney(src, amount, type) |
true or false |
Takes money; false when there is not enough and nothing was taken |
AddPlayerMoney(src, amount, type) |
nothing | Gives money (sell-back) |
GetItemCount(src, item) |
number | Count of an item over every stack, with or without metadata |
CanCarryItem(src, item, count) |
true or false |
Whether the item fits |
AddItem(src, item, count) |
true or false |
Gives an item |
RemoveItem(src, item, count) |
true or false |
Takes items stack by stack (some items, such as radio batteries, carry metadata) |
GetPlayerJob(src) |
string | Job name, '' when none |
Notify(src, text) |
nothing | Message to the player; calls FXFramework.Notify |
What the shipped code calls:
| Function | VORP | RSG |
|---|---|---|
| Money | character money / gold, addCurrency, removeCurrency |
PlayerData.money.cash / gold, Functions.AddMoney, Functions.RemoveMoney |
| Items | vorp_inventory getUserInventoryItems, canCarryItem, addItem, subItem |
PlayerData.items, Functions.CanAddItem, Functions.AddItem, Functions.RemoveItem |
| Job | character job |
PlayerData.job.name |
Price, distance and job are checked on the server before these functions run.
#FXFramework.Notify
A short game notice: the store's messages, the Catalogue hand-over and the Official Ledger's doctor and fine messages. It is not the notebook's notification box (for that, use the [Notify](/phone/docs/pocketbook/exports/server/notifications-and-signal) export).
lua-- server
FXFramework.Notify(src, text, time)
-- client
FXFramework.Notify(nil, text, time)
| Framework | Event |
|---|---|
| VORP | vorp:TipBottom |
| RSG | RSGCore:Notify with type 'primary' |
time is in milliseconds, default 4000. On VORP the text goes through PocketText.Native first: the game's own font has no Turkish ş, ğ, ı and İ, so they are written as s, g, i and I. RSG's notify is drawn by its own interface and keeps every letter.
To use your own notify script, replace the body of this function. If your script draws with the game's font, keep PocketText.Native(text); if it is a web interface, pass text as it is.
luafunction FXFramework.Notify(src, text, time)
time = time or 4000
if IsDuplicityVersion() then
TriggerClientEvent('my-notify:show', src, text, time)
else
TriggerEvent('my-notify:show', text, time)
end
end
my-notify:show stands for your own script's event.