From 51b6cc6f4cfcda0fe67017c7f0c417b309bba1ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 26 May 2022 18:53:56 +0000 Subject: [PATCH] deploy: 0184049183e35c8619921449f04b31d0a8610d24 --- 404.html | 4 ++-- assets/js/2ff920a5.87233856.js | 1 - assets/js/2ff920a5.b12519f7.js | 1 + .../{runtime~main.d334ab4e.js => runtime~main.8606ed8e.js} | 2 +- docs/index.html | 4 ++-- .../Functions/Client/Inventory/Search/index.html | 4 ++-- docs/ox_inventory/Functions/Client/Items/index.html | 4 ++-- .../Functions/Client/Utils/weaponWheel/index.html | 4 ++-- .../Functions/Client/displayMetadata/index.html | 4 ++-- docs/ox_inventory/Functions/Client/openInventory/index.html | 4 ++-- .../Functions/Client/openNearbyInventory/index.html | 4 ++-- .../ox_inventory/Functions/Client/setStashTarget/index.html | 4 ++-- docs/ox_inventory/Functions/Client/useItem/index.html | 4 ++-- docs/ox_inventory/Functions/Client/useSlot/index.html | 4 ++-- .../Functions/Server/Inventory/AddItem/index.html | 4 ++-- .../Functions/Server/Inventory/CanCarryAmount/index.html | 4 ++-- .../Functions/Server/Inventory/CanCarryItem/index.html | 4 ++-- .../Functions/Server/Inventory/CanSwapItem/index.html | 4 ++-- .../Functions/Server/Inventory/ClearInventory/index.html | 4 ++-- .../Server/Inventory/ConfiscateInventory/index.html | 4 ++-- .../Functions/Server/Inventory/ConvertItems/index.html | 4 ++-- .../Functions/Server/Inventory/CustomDrop/index.html | 4 ++-- .../Functions/Server/Inventory/GetCurrentWeapon/index.html | 4 ++-- .../Functions/Server/Inventory/GetItem/index.html | 4 ++-- .../Functions/Server/Inventory/GetItemSlots/index.html | 4 ++-- .../Functions/Server/Inventory/GetSlot/index.html | 4 ++-- .../Functions/Server/Inventory/RegisterStash/index.html | 4 ++-- .../Functions/Server/Inventory/RemoveItem/index.html | 4 ++-- .../Functions/Server/Inventory/ReturnInventory/index.html | 4 ++-- .../Functions/Server/Inventory/Search/index.html | 4 ++-- .../Functions/Server/Inventory/SetDurability/index.html | 4 ++-- .../Functions/Server/Inventory/SetMetadata/index.html | 4 ++-- .../Functions/Server/Inventory/SwapSlots/index.html | 4 ++-- docs/ox_inventory/Functions/Server/Items/index.html | 4 ++-- .../Functions/Server/setPlayerInventory/index.html | 4 ++-- docs/ox_inventory/Guides/creatingItems/index.html | 4 ++-- docs/ox_inventory/Guides/index.html | 4 ++-- docs/ox_inventory/Guides/inventory_ui/index.html | 4 ++-- docs/ox_inventory/Guides/stashes/index.html | 4 ++-- docs/ox_inventory/config/index.html | 4 ++-- docs/ox_inventory/index.html | 6 +++--- docs/ox_lib/ACL/Server/index.html | 4 ++-- docs/ox_lib/AddCommand/Server/index.html | 4 ++-- docs/ox_lib/Cache/Client/index.html | 4 ++-- docs/ox_lib/Callback/Client/index.html | 4 ++-- docs/ox_lib/Callback/Server/index.html | 4 ++-- docs/ox_lib/DisableControls/Client/index.html | 4 ++-- docs/ox_lib/Interface/Client/clipboard/index.html | 4 ++-- docs/ox_lib/Interface/Client/context/index.html | 4 ++-- docs/ox_lib/Interface/Client/input/index.html | 4 ++-- docs/ox_lib/Interface/Client/notify/index.html | 4 ++-- docs/ox_lib/Interface/Client/progress/index.html | 4 ++-- docs/ox_lib/Interface/Client/textui/index.html | 4 ++-- docs/ox_lib/Locale/Shared/index.html | 4 ++-- docs/ox_lib/Logger/Server/index.html | 4 ++-- docs/ox_lib/Points/Client/index.html | 4 ++-- docs/ox_lib/Streaming/Client/index.html | 4 ++-- docs/ox_lib/VehicleProperties/Client/index.html | 4 ++-- docs/ox_lib/Version/Server/index.html | 4 ++-- docs/ox_lib/Version/Shared/index.html | 4 ++-- docs/ox_lib/Zones/Client/index.html | 4 ++-- docs/ox_lib/index.html | 4 ++-- docs/oxmysql/Getting Started/benchmark/index.html | 4 ++-- docs/oxmysql/Getting Started/issues/index.html | 4 ++-- docs/oxmysql/Getting Started/placeholders/index.html | 4 ++-- docs/oxmysql/Usage/index.html | 4 ++-- docs/oxmysql/Usage/insert/index.html | 4 ++-- docs/oxmysql/Usage/prepare/index.html | 4 ++-- docs/oxmysql/Usage/query/index.html | 4 ++-- docs/oxmysql/Usage/scalar/index.html | 4 ++-- docs/oxmysql/Usage/single/index.html | 4 ++-- docs/oxmysql/Usage/transaction/index.html | 4 ++-- docs/oxmysql/Usage/update/index.html | 4 ++-- docs/oxmysql/index.html | 4 ++-- index.html | 4 ++-- markdown-page/index.html | 4 ++-- search/index.html | 4 ++-- 77 files changed, 151 insertions(+), 151 deletions(-) delete mode 100644 assets/js/2ff920a5.87233856.js create mode 100644 assets/js/2ff920a5.b12519f7.js rename assets/js/{runtime~main.d334ab4e.js => runtime~main.8606ed8e.js} (99%) diff --git a/404.html b/404.html index 61a0f174..4bc33b05 100644 --- a/404.html +++ b/404.html @@ -5,13 +5,13 @@ Page Not Found | Overextended - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/assets/js/2ff920a5.87233856.js b/assets/js/2ff920a5.87233856.js deleted file mode 100644 index 24ceffc3..00000000 --- a/assets/js/2ff920a5.87233856.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3128],{2360:function(e,t,n){n.d(t,{Z:function(){return i}});var a=n(7294),o=n(6010),r="tabItem_OmH5";function i(e){var t=e.children,n=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",className:(0,o.Z)(r,i),hidden:n},t)}},9877:function(e,t,n){n.d(t,{Z:function(){return c}});var a=n(3117),o=n(7294),r=n(2389),i=n(7392),l=n(7094),s=n(2466),d=n(6010),u="tabList_uSqn",p="tabItem_LplD";function m(e){var t,n,r,m=e.lazy,c=e.block,h=e.defaultValue,v=e.values,f=e.groupId,k=e.className,y=o.Children.map(e.children,(function(e){if((0,o.isValidElement)(e)&&void 0!==e.props.value)return e;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})),b=null!=v?v:y.map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes}})),g=(0,i.l)(b,(function(e,t){return e.value===t.value}));if(g.length>0)throw new Error('Docusaurus error: Duplicate values "'+g.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.');var x=null===h?h:null!=(t=null!=h?h:null==(n=y.find((function(e){return e.props.default})))?void 0:n.props.value)?t:null==(r=y[0])?void 0:r.props.value;if(null!==x&&!b.some((function(e){return e.value===x})))throw new Error('Docusaurus error: The has a defaultValue "'+x+'" but none of its children has the corresponding value. Available values are: '+b.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");var w=(0,l.U)(),N=w.tabGroupChoices,I=w.setTabGroupChoices,T=(0,o.useState)(x),_=T[0],q=T[1],S=[],E=(0,s.o5)().blockElementScrollPositionUntilNextRender;if(null!=f){var R=N[f];null!=R&&R!==_&&b.some((function(e){return e.value===R}))&&q(R)}var Z=function(e){var t=e.currentTarget,n=S.indexOf(t),a=b[n].value;a!==_&&(E(t),q(a),null!=f&&I(f,a))},B=function(e){var t,n=null;switch(e.key){case"ArrowRight":var a=S.indexOf(e.currentTarget)+1;n=S[a]||S[0];break;case"ArrowLeft":var o=S.indexOf(e.currentTarget)-1;n=S[o]||S[S.length-1]}null==(t=n)||t.focus()};return o.createElement("div",{className:(0,d.Z)("tabs-container",u)},o.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,d.Z)("tabs",{"tabs--block":c},k)},b.map((function(e){var t=e.value,n=e.label,r=e.attributes;return o.createElement("li",(0,a.Z)({role:"tab",tabIndex:_===t?0:-1,"aria-selected":_===t,key:t,ref:function(e){return S.push(e)},onKeyDown:B,onFocus:Z,onClick:Z},r,{className:(0,d.Z)("tabs__item",p,null==r?void 0:r.className,{"tabs__item--active":_===t})}),null!=n?n:t)}))),m?(0,o.cloneElement)(y.filter((function(e){return e.props.value===_}))[0],{className:"margin-top--md"}):o.createElement("div",{className:"margin-top--md"},y.map((function(e,t){return(0,o.cloneElement)(e,{key:t,hidden:e.props.value!==_})}))))}function c(e){var t=(0,r.Z)();return o.createElement(m,(0,a.Z)({key:String(t)},e))}},1280:function(e,t,n){var a=n(7294);t.Z=function(e){var t={fontSize:"1.7rem",paddingRight:"left"===e.side&&"0.6rem",paddingLeft:"right"===e.side&&"0.6rem",verticalAlign:"center",display:"flex"};return a.createElement("div",{style:Object.assign({width:"fit-content",height:"3rem",padding:"0.8rem",borderRadius:"0.2rem",verticalAlign:"baseline",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:"white"},e.style),className:"icon-button"},"left"===e.side&&a.createElement("div",{style:t},e.icon),a.createElement("div",null,e.children),"right"===e.side&&a.createElement("div",{style:t},e.icon))}},1246:function(e,t,n){n.r(t),n.d(t,{assets:function(){return h},contentTitle:function(){return m},default:function(){return k},frontMatter:function(){return p},metadata:function(){return c},toc:function(){return v}});var a=n(3117),o=n(102),r=(n(7294),n(3905)),i=n(1280),l=n(3750),s=n(9877),d=n(2360),u=["components"],p={title:"Getting Started"},m=void 0,c={unversionedId:"ox_inventory/index",id:"ox_inventory/index",title:"Getting Started",description:"This resource is being designed with the intention of providing advanced functionality while remaining easy to use,",source:"@site/docs/ox_inventory/index.md",sourceDirName:"ox_inventory",slug:"/ox_inventory/",permalink:"/docs/ox_inventory/",draft:!1,editUrl:"https://github.com/overextended/overextended.github.io/tree/main/docs/ox_inventory/index.md",tags:[],version:"current",frontMatter:{title:"Getting Started"},sidebar:"docs",previous:{title:"Configuration",permalink:"/docs/ox_inventory/config"}},h={},v=[{value:"Dependencies",id:"dependencies",level:2},{value:"OxMySQL",id:"oxmysql",level:3},{value:"Ox Lib",id:"ox-lib",level:3},{value:"Production Build",id:"production-build",level:3},{value:"Optional resources",id:"optional-resources",level:2},{value:"qtarget",id:"qtarget",level:3},{value:"NPWD",id:"npwd",level:3},{value:"Installation",id:"installation",level:3},{value:"Upgrading ESX",id:"upgrading-esx",level:2},{value:"Optional optimisation",id:"optional-optimisation",level:3},{value:"Common Issues",id:"common-issues",level:2},{value:"UI has not been built",id:"ui-has-not-been-built",level:3},{value:"Stashes / trunks are not saved at server restart",id:"stashes--trunks-are-not-saved-at-server-restart",level:3}],f={toc:v};function k(e){var t=e.components,n=(0,o.Z)(e,u);return(0,r.kt)("wrapper",(0,a.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"This resource is being designed with the intention of providing advanced functionality while remaining easy to use,\nhowever it is not recommended for beginners. You must possess a basic understanding of coding and the ability to read;\notherwise you ",(0,r.kt)("strong",{parentName:"p"},"should not")," install this resource."))),(0,r.kt)("h2",{id:"dependencies"},"Dependencies"),(0,r.kt)("h3",{id:"oxmysql"},"OxMySQL"),(0,r.kt)("p",null,"We utilise our own resource to communicate with MySQL databases via the node-mysql2 package.\nThe backend is actively maintained and updated unlike the package used by mysql-async, providing improved performance, security, and features.\nWe provide full backwards compatibility with mysql-async and build for the current Cfx architecture."),(0,r.kt)("div",{style:{display:"flex"}},(0,r.kt)("a",{href:"https://www.github.com/overextended/oxmysql",style:{marginRight:"0.6rem"}},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub")),(0,r.kt)("a",{href:"https://overextended.github.io/docs/oxmysql/Installation/"},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.DRM,{mdxType:"BsBookHalf"}),mdxType:"IconButton"},"Documentation"))),(0,r.kt)("h3",{id:"ox-lib"},"Ox Lib"),(0,r.kt)("p",null,"Provides easily reusable functions that can be imported into your resource or called with exports."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Used in the inventory for")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"SetInterval"),(0,r.kt)("li",{parentName:"ul"},"Server Callbacks"),(0,r.kt)("li",{parentName:"ul"},"Requesting models, animations, etc."),(0,r.kt)("li",{parentName:"ul"},"Marker management"),(0,r.kt)("li",{parentName:"ul"},"Notifications and progress bar")),(0,r.kt)("div",{style:{width:"fit-content"}},(0,r.kt)("a",{href:"https://www.github.com/overextended/ox_lib"},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub"))),(0,r.kt)("h3",{id:"production-build"},"Production Build"),(0,r.kt)("p",null,"The interface is written in TypeScript using the React library, so the code included in the repository will not work.\nYou either need to build the package yourself (more information in ",(0,r.kt)("a",{parentName:"p",href:"./Guides"},"guides")," section), or download a release."),(0,r.kt)("div",{style:{width:"fit-content"}},(0,r.kt)("a",{href:"https://www.github.com/overextended/ox_inventory/releases/latest",style:{marginRight:"0.6rem"}},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub"))),(0,r.kt)("h2",{id:"optional-resources"},"Optional resources"),(0,r.kt)("p",null,"The resources listed under here ",(0,r.kt)("strong",{parentName:"p"},"aren't")," necessary for the inventory to work but still have full support."),(0,r.kt)("h3",{id:"qtarget"},"qtarget"),(0,r.kt)("p",null,"A high performance targeting solution based on bt-target, and the basis for qb-target.\nIt is being updated alongside Ox Inventory to improve support as well as add compatibility when using QBCore or migrating from bt-target.\nAll stashes and shops will utilise PolyZone's instead of markers to interact with them."),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"If you wish to use it first you must ensure that qtarget is enabled in the resource convars.\nYou will need to enable compatibility manually by adjusting your config - more information provided below."),(0,r.kt)("p",{parentName:"div"},"You must start qtarget before the inventory and after your framework."))),(0,r.kt)("div",{style:{display:"flex"}},(0,r.kt)("a",{href:"https://www.github.com/overextended/qtarget",style:{marginRight:"0.6rem"}},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub")),(0,r.kt)("a",{href:"https://overextended.github.io/qtarget/"},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.DRM,{mdxType:"BsBookHalf"}),mdxType:"IconButton"},"Documentation"))),(0,r.kt)("h3",{id:"npwd"},"NPWD"),(0,r.kt)("p",null,"A standalone and feature-rich phone created by Project Error."),(0,r.kt)("p",null,"The inventory will handle disabling the phone when the player has no item, and supports toggling the phone through item use."),(0,r.kt)("div",{style:{display:"flex"}},(0,r.kt)("a",{href:"https://www.github.com/project-error/npwd",style:{marginRight:"0.6rem"}},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub")),(0,r.kt)("a",{href:"https://projecterror.dev/docs"},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.DRM,{mdxType:"BsBookHalf"}),mdxType:"IconButton"},"Documentation"))),(0,r.kt)("h3",{id:"installation"},"Installation"),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(d.Z,{value:"fresh_esx",label:"Fresh ESX",default:!0,mdxType:"TabItem"},(0,r.kt)("p",null,"Use a compatible version of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/esx-framework/esx-legacy"},"ESX Legacy")," (1.6.0+)",(0,r.kt)("br",{parentName:"p"}),"\n","Execute the query inside ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/install.sql"},"install.sql")," and ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql"},"vehicle.sql")," "),(0,r.kt)("p",null," Start order should look like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"start oxmysql\nstart es_extended\nstart ox_lib\nstart ox_inventory\n...\n"))),(0,r.kt)(d.Z,{value:"convert_esx",label:"Convert ESX",mdxType:"TabItem"},(0,r.kt)("p",null,"Use a compatible version of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/esx-framework/esx-legacy"},"ESX Legacy")," (1.6.0+)",(0,r.kt)("br",{parentName:"p"}),"\n","Execute the query inside ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/install.sql"},"install.sql"),"\nand ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql"},"vehicle.sql"),(0,r.kt)("br",{parentName:"p"}),"\n","Open ",(0,r.kt)("inlineCode",{parentName:"p"},"fxmanifest.lua")," and uncomment ",(0,r.kt)("inlineCode",{parentName:"p"},"server_script 'setup/convert.lua'"),(0,r.kt)("br",{parentName:"p"}),"\n","Start the server and execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"convertinventory")," command from the console",(0,r.kt)("br",{parentName:"p"}),"\n","Remove the conversion file "),(0,r.kt)("p",null," Start order should look like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"start oxmysql\nstart es_extended\nstart ox_lib\nstart ox_inventory\neverything else\n...\n"))),(0,r.kt)(d.Z,{value:"convert_linden",label:"Upgrade from Linden Inventory",mdxType:"TabItem"},(0,r.kt)("p",null,"Execute the query inside ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/upgrade.sql"},"upgrade.sql"),"\nand ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql"},"vehicle.sql"),(0,r.kt)("br",{parentName:"p"}),"\n","Open ",(0,r.kt)("inlineCode",{parentName:"p"},"fxmanifest.lua")," and uncomment ",(0,r.kt)("inlineCode",{parentName:"p"},"server_script 'setup/convert.lua'"),(0,r.kt)("br",{parentName:"p"}),"\n","Start the server and execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"convertinventory")," linden command from the console",(0,r.kt)("br",{parentName:"p"}),"\n","Remove the conversion file")),(0,r.kt)(d.Z,{value:"standalone",label:"Standalone",mdxType:"TabItem"},(0,r.kt)("p",null,"Work in progress."),(0,r.kt)("p",null,'Refer to the "bridge" module to get an idea of how you setup support for any framework.',(0,r.kt)("br",{parentName:"p"}),"\n","Modifications will need to be made for licenses, owned vehicles, and jobs."))),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"You should restart your server after the first startup to ensure everything has been correctly setup"))),(0,r.kt)("h2",{id:"upgrading-esx"},"Upgrading ESX"),(0,r.kt)("p",null,"Ox Inventory provides a complete suite of tools to replace the built-in items and inventory system from ESX, and is not intended to be used with resources designed around it."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"ESX loadouts do not exist - resources that use them need to remove references or be modified to look for the weapon as an item"),(0,r.kt)("li",{parentName:"ul"},"Stashes from resources such as esx_policejob, esx_ambulancejob, etc. should be removed"),(0,r.kt)("li",{parentName:"ul"},"Shops from esx_shops or the armoury from esx_policejob should be removed"),(0,r.kt)("li",{parentName:"ul"},"Resources like esx_inventoryhud, esx_trunkinventory, esx_addoninventory, etc. should be removed")),(0,r.kt)("h3",{id:"optional-optimisation"},"Optional optimisation"),(0,r.kt)("p",null,"All item related functions from xPlayer, such as ",(0,r.kt)("inlineCode",{parentName:"p"},"xPlayer.getInventoryItem"),", have been modified for compatibility purposes; however they are considered deprecated."),(0,r.kt)("p",null,"The reasoning is fairly simple - there's now additional function references and overhead to consider. Fortunately, the new Inventory functions can be used directly and offer a great deal of improvements over the old ones."),(0,r.kt)("p",null,"You should read through the functions section for further information, but the following should give you a decent idea."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(d.Z,{value:"esx",label:"ESX",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-lua"},"if xPlayer.getInventoryItem('acetone').count > 2 and xPlayer.getInventoryItem('antifreeze').count > 4 and xPlayer.getInventoryItem('sudo').count > 9 then\n xPlayer.removeInventoryItem(\"acetone\", 3)\n xPlayer.removeInventoryItem(\"antifreeze\", 5)\n xPlayer.removeInventoryItem(\"sudo\", 10)\nend\n"))),(0,r.kt)(d.Z,{value:"inventory",label:"Inventory",mdxType:"TabItem"},(0,r.kt)("p",null,"Add the following code somewhere in your resource to cache the exports metatable."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-lua"},"local ox_inventory = exports.ox_inventory\n")),(0,r.kt)("p",null,"You will be able to reference any functions exposed through the export."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-lua"},"local items = ox_inventory:Search(source, 'count', {'acetone', 'antifreeze', 'sudo'})\nif items and items.acetone > 2 and items.antifreeze > 4 and items.sudo > 9 then\n ox_inventory:RemoveItem(source, 'acetone', 3)\n ox_inventory:RemoveItem(source, 'antifreeze', 5)\n ox_inventory:RemoveItem(source, 'sudo', 10)\nend\n")))),(0,r.kt)("h2",{id:"common-issues"},"Common Issues"),(0,r.kt)("h3",{id:"ui-has-not-been-built"},"UI has not been built"),(0,r.kt)("p",null,"Because the UI for inventory is written in React it can't run natively under FiveM so it must first be bundled into html/css/js."),(0,r.kt)("p",null,"We provide an easy way for you to do this by downloading a pre-bundled release, which you can get from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/releases/latest"},"here"),".",(0,r.kt)("br",{parentName:"p"}),"\n","Make sure you download the ",(0,r.kt)("inlineCode",{parentName:"p"},"ox_inventory.zip")," file as that one contains the bundled files and others are raw source code."),(0,r.kt)("p",null,"If in case you wanted to edit the inventory UI you would have to build these files yourself.",(0,r.kt)("br",{parentName:"p"}),"\n","To do so please read our ",(0,r.kt)("a",{parentName:"p",href:"/docs/ox_inventory/Guides/inventory_ui"},(0,r.kt)("em",{parentName:"a"},"Building inventory UI"))," guide."),(0,r.kt)("h3",{id:"stashes--trunks-are-not-saved-at-server-restart"},"Stashes / trunks are not saved at server restart"),(0,r.kt)("p",null,"The only supported way of doing a restart is ",(0,r.kt)("strong",{parentName:"p"},"txAdmin scheduled restart"),".",(0,r.kt)("br",{parentName:"p"}),"\n","txAdmin scheduled restart should be your only way of restarting a server in production."),(0,r.kt)("p",null,"If you need to do a manual restart, you must use ",(0,r.kt)("inlineCode",{parentName:"p"},"/saveinv")," before restarting the server.",(0,r.kt)("br",{parentName:"p"}),"\n","If you don't do this, all inventory except players inventory will not be saved."))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2ff920a5.b12519f7.js b/assets/js/2ff920a5.b12519f7.js new file mode 100644 index 00000000..e7ea44ba --- /dev/null +++ b/assets/js/2ff920a5.b12519f7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3128],{2360:function(e,t,n){n.d(t,{Z:function(){return i}});var a=n(7294),o=n(6010),r="tabItem_OmH5";function i(e){var t=e.children,n=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",className:(0,o.Z)(r,i),hidden:n},t)}},9877:function(e,t,n){n.d(t,{Z:function(){return c}});var a=n(3117),o=n(7294),r=n(2389),i=n(7392),l=n(7094),s=n(2466),d=n(6010),u="tabList_uSqn",p="tabItem_LplD";function m(e){var t,n,r,m=e.lazy,c=e.block,h=e.defaultValue,v=e.values,f=e.groupId,k=e.className,y=o.Children.map(e.children,(function(e){if((0,o.isValidElement)(e)&&void 0!==e.props.value)return e;throw new Error("Docusaurus error: Bad child <"+("string"==typeof e.type?e.type:e.type.name)+'>: all children of the component should be , and every should have a unique "value" prop.')})),b=null!=v?v:y.map((function(e){var t=e.props;return{value:t.value,label:t.label,attributes:t.attributes}})),g=(0,i.l)(b,(function(e,t){return e.value===t.value}));if(g.length>0)throw new Error('Docusaurus error: Duplicate values "'+g.map((function(e){return e.value})).join(", ")+'" found in . Every value needs to be unique.');var x=null===h?h:null!=(t=null!=h?h:null==(n=y.find((function(e){return e.props.default})))?void 0:n.props.value)?t:null==(r=y[0])?void 0:r.props.value;if(null!==x&&!b.some((function(e){return e.value===x})))throw new Error('Docusaurus error: The has a defaultValue "'+x+'" but none of its children has the corresponding value. Available values are: '+b.map((function(e){return e.value})).join(", ")+". If you intend to show no default tab, use defaultValue={null} instead.");var w=(0,l.U)(),N=w.tabGroupChoices,I=w.setTabGroupChoices,T=(0,o.useState)(x),_=T[0],q=T[1],S=[],E=(0,s.o5)().blockElementScrollPositionUntilNextRender;if(null!=f){var R=N[f];null!=R&&R!==_&&b.some((function(e){return e.value===R}))&&q(R)}var Z=function(e){var t=e.currentTarget,n=S.indexOf(t),a=b[n].value;a!==_&&(E(t),q(a),null!=f&&I(f,a))},B=function(e){var t,n=null;switch(e.key){case"ArrowRight":var a=S.indexOf(e.currentTarget)+1;n=S[a]||S[0];break;case"ArrowLeft":var o=S.indexOf(e.currentTarget)-1;n=S[o]||S[S.length-1]}null==(t=n)||t.focus()};return o.createElement("div",{className:(0,d.Z)("tabs-container",u)},o.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,d.Z)("tabs",{"tabs--block":c},k)},b.map((function(e){var t=e.value,n=e.label,r=e.attributes;return o.createElement("li",(0,a.Z)({role:"tab",tabIndex:_===t?0:-1,"aria-selected":_===t,key:t,ref:function(e){return S.push(e)},onKeyDown:B,onFocus:Z,onClick:Z},r,{className:(0,d.Z)("tabs__item",p,null==r?void 0:r.className,{"tabs__item--active":_===t})}),null!=n?n:t)}))),m?(0,o.cloneElement)(y.filter((function(e){return e.props.value===_}))[0],{className:"margin-top--md"}):o.createElement("div",{className:"margin-top--md"},y.map((function(e,t){return(0,o.cloneElement)(e,{key:t,hidden:e.props.value!==_})}))))}function c(e){var t=(0,r.Z)();return o.createElement(m,(0,a.Z)({key:String(t)},e))}},1280:function(e,t,n){var a=n(7294);t.Z=function(e){var t={fontSize:"1.7rem",paddingRight:"left"===e.side&&"0.6rem",paddingLeft:"right"===e.side&&"0.6rem",verticalAlign:"center",display:"flex"};return a.createElement("div",{style:Object.assign({width:"fit-content",height:"3rem",padding:"0.8rem",borderRadius:"0.2rem",verticalAlign:"baseline",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:"white"},e.style),className:"icon-button"},"left"===e.side&&a.createElement("div",{style:t},e.icon),a.createElement("div",null,e.children),"right"===e.side&&a.createElement("div",{style:t},e.icon))}},1246:function(e,t,n){n.r(t),n.d(t,{assets:function(){return h},contentTitle:function(){return m},default:function(){return k},frontMatter:function(){return p},metadata:function(){return c},toc:function(){return v}});var a=n(3117),o=n(102),r=(n(7294),n(3905)),i=n(1280),l=n(3750),s=n(9877),d=n(2360),u=["components"],p={title:"Getting Started"},m=void 0,c={unversionedId:"ox_inventory/index",id:"ox_inventory/index",title:"Getting Started",description:"This resource is being designed with the intention of providing advanced functionality while remaining easy to use,",source:"@site/docs/ox_inventory/index.md",sourceDirName:"ox_inventory",slug:"/ox_inventory/",permalink:"/docs/ox_inventory/",draft:!1,editUrl:"https://github.com/overextended/overextended.github.io/tree/main/docs/ox_inventory/index.md",tags:[],version:"current",frontMatter:{title:"Getting Started"},sidebar:"docs",previous:{title:"Configuration",permalink:"/docs/ox_inventory/config"}},h={},v=[{value:"Dependencies",id:"dependencies",level:2},{value:"OxMySQL",id:"oxmysql",level:3},{value:"Ox Lib",id:"ox-lib",level:3},{value:"Production Build",id:"production-build",level:3},{value:"Optional resources",id:"optional-resources",level:2},{value:"qtarget",id:"qtarget",level:3},{value:"NPWD",id:"npwd",level:3},{value:"Installation",id:"installation",level:3},{value:"Upgrading ESX",id:"upgrading-esx",level:2},{value:"Optional optimisation",id:"optional-optimisation",level:3},{value:"Common Issues",id:"common-issues",level:2},{value:"UI has not been built",id:"ui-has-not-been-built",level:3},{value:"Stashes / trunks are not saved at server restart",id:"stashes--trunks-are-not-saved-at-server-restart",level:3}],f={toc:v};function k(e){var t=e.components,n=(0,o.Z)(e,u);return(0,r.kt)("wrapper",(0,a.Z)({},f,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"This resource is being designed with the intention of providing advanced functionality while remaining easy to use,\nhowever it is not recommended for beginners. You must possess a basic understanding of coding and the ability to read;\notherwise you ",(0,r.kt)("strong",{parentName:"p"},"should not")," install this resource."))),(0,r.kt)("h2",{id:"dependencies"},"Dependencies"),(0,r.kt)("h3",{id:"oxmysql"},"OxMySQL"),(0,r.kt)("p",null,"We utilise our own resource to communicate with MySQL databases via the node-mysql2 package.\nThe backend is actively maintained and updated unlike the package used by mysql-async, providing improved performance, security, and features.\nWe provide full backwards compatibility with mysql-async and build for the current Cfx architecture."),(0,r.kt)("div",{style:{display:"flex"}},(0,r.kt)("a",{href:"https://www.github.com/overextended/oxmysql",style:{marginRight:"0.6rem"}},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub")),(0,r.kt)("a",{href:"https://overextended.github.io/docs/oxmysql/Installation/"},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.DRM,{mdxType:"BsBookHalf"}),mdxType:"IconButton"},"Documentation"))),(0,r.kt)("h3",{id:"ox-lib"},"Ox Lib"),(0,r.kt)("p",null,"Provides easily reusable functions that can be imported into your resource or called with exports."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Used in the inventory for")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"SetInterval"),(0,r.kt)("li",{parentName:"ul"},"Server Callbacks"),(0,r.kt)("li",{parentName:"ul"},"Requesting models, animations, etc."),(0,r.kt)("li",{parentName:"ul"},"Marker management"),(0,r.kt)("li",{parentName:"ul"},"Notifications and progress bar")),(0,r.kt)("div",{style:{width:"fit-content"}},(0,r.kt)("a",{href:"https://www.github.com/overextended/ox_lib/releases/latest"},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub"))),(0,r.kt)("h3",{id:"production-build"},"Production Build"),(0,r.kt)("p",null,"The interface is written in TypeScript using the React library, so the code included in the repository will not work.\nYou either need to build the package yourself (more information in ",(0,r.kt)("a",{parentName:"p",href:"./Guides"},"guides")," section), or download a release."),(0,r.kt)("div",{style:{width:"fit-content"}},(0,r.kt)("a",{href:"https://www.github.com/overextended/ox_inventory/releases/latest",style:{marginRight:"0.6rem"}},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub"))),(0,r.kt)("h2",{id:"optional-resources"},"Optional resources"),(0,r.kt)("p",null,"The resources listed under here ",(0,r.kt)("strong",{parentName:"p"},"aren't")," necessary for the inventory to work but still have full support."),(0,r.kt)("h3",{id:"qtarget"},"qtarget"),(0,r.kt)("p",null,"A high performance targeting solution based on bt-target, and the basis for qb-target.\nIt is being updated alongside Ox Inventory to improve support as well as add compatibility when using QBCore or migrating from bt-target.\nAll stashes and shops will utilise PolyZone's instead of markers to interact with them."),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"If you wish to use it first you must ensure that qtarget is enabled in the resource convars.\nYou will need to enable compatibility manually by adjusting your config - more information provided below."),(0,r.kt)("p",{parentName:"div"},"You must start qtarget before the inventory and after your framework."))),(0,r.kt)("div",{style:{display:"flex"}},(0,r.kt)("a",{href:"https://www.github.com/overextended/qtarget",style:{marginRight:"0.6rem"}},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub")),(0,r.kt)("a",{href:"https://overextended.github.io/qtarget/"},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.DRM,{mdxType:"BsBookHalf"}),mdxType:"IconButton"},"Documentation"))),(0,r.kt)("h3",{id:"npwd"},"NPWD"),(0,r.kt)("p",null,"A standalone and feature-rich phone created by Project Error."),(0,r.kt)("p",null,"The inventory will handle disabling the phone when the player has no item, and supports toggling the phone through item use."),(0,r.kt)("div",{style:{display:"flex"}},(0,r.kt)("a",{href:"https://www.github.com/project-error/npwd",style:{marginRight:"0.6rem"}},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.rFR,{mdxType:"BsGithub"}),mdxType:"IconButton"},"GitHub")),(0,r.kt)("a",{href:"https://projecterror.dev/docs"},(0,r.kt)(i.Z,{side:"left",icon:(0,r.kt)(l.DRM,{mdxType:"BsBookHalf"}),mdxType:"IconButton"},"Documentation"))),(0,r.kt)("h3",{id:"installation"},"Installation"),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(d.Z,{value:"fresh_esx",label:"Fresh ESX",default:!0,mdxType:"TabItem"},(0,r.kt)("p",null,"Use a compatible version of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/esx-framework/esx-legacy"},"ESX Legacy")," (1.6.0+)",(0,r.kt)("br",{parentName:"p"}),"\n","Execute the query inside ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/install.sql"},"install.sql")," and ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql"},"vehicle.sql")," "),(0,r.kt)("p",null," Start order should look like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"start oxmysql\nstart es_extended\nstart ox_lib\nstart ox_inventory\n...\n"))),(0,r.kt)(d.Z,{value:"convert_esx",label:"Convert ESX",mdxType:"TabItem"},(0,r.kt)("p",null,"Use a compatible version of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/esx-framework/esx-legacy"},"ESX Legacy")," (1.6.0+)",(0,r.kt)("br",{parentName:"p"}),"\n","Execute the query inside ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/install.sql"},"install.sql"),"\nand ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql"},"vehicle.sql"),(0,r.kt)("br",{parentName:"p"}),"\n","Open ",(0,r.kt)("inlineCode",{parentName:"p"},"fxmanifest.lua")," and uncomment ",(0,r.kt)("inlineCode",{parentName:"p"},"server_script 'setup/convert.lua'"),(0,r.kt)("br",{parentName:"p"}),"\n","Start the server and execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"convertinventory")," command from the console",(0,r.kt)("br",{parentName:"p"}),"\n","Remove the conversion file "),(0,r.kt)("p",null," Start order should look like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"start oxmysql\nstart es_extended\nstart ox_lib\nstart ox_inventory\neverything else\n...\n"))),(0,r.kt)(d.Z,{value:"convert_linden",label:"Upgrade from Linden Inventory",mdxType:"TabItem"},(0,r.kt)("p",null,"Execute the query inside ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/upgrade.sql"},"upgrade.sql"),"\nand ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/blob/main/setup/vehicle.sql"},"vehicle.sql"),(0,r.kt)("br",{parentName:"p"}),"\n","Open ",(0,r.kt)("inlineCode",{parentName:"p"},"fxmanifest.lua")," and uncomment ",(0,r.kt)("inlineCode",{parentName:"p"},"server_script 'setup/convert.lua'"),(0,r.kt)("br",{parentName:"p"}),"\n","Start the server and execute the ",(0,r.kt)("inlineCode",{parentName:"p"},"convertinventory")," linden command from the console",(0,r.kt)("br",{parentName:"p"}),"\n","Remove the conversion file")),(0,r.kt)(d.Z,{value:"standalone",label:"Standalone",mdxType:"TabItem"},(0,r.kt)("p",null,"Work in progress."),(0,r.kt)("p",null,'Refer to the "bridge" module to get an idea of how you setup support for any framework.',(0,r.kt)("br",{parentName:"p"}),"\n","Modifications will need to be made for licenses, owned vehicles, and jobs."))),(0,r.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"caution")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"You should restart your server after the first startup to ensure everything has been correctly setup"))),(0,r.kt)("h2",{id:"upgrading-esx"},"Upgrading ESX"),(0,r.kt)("p",null,"Ox Inventory provides a complete suite of tools to replace the built-in items and inventory system from ESX, and is not intended to be used with resources designed around it."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"ESX loadouts do not exist - resources that use them need to remove references or be modified to look for the weapon as an item"),(0,r.kt)("li",{parentName:"ul"},"Stashes from resources such as esx_policejob, esx_ambulancejob, etc. should be removed"),(0,r.kt)("li",{parentName:"ul"},"Shops from esx_shops or the armoury from esx_policejob should be removed"),(0,r.kt)("li",{parentName:"ul"},"Resources like esx_inventoryhud, esx_trunkinventory, esx_addoninventory, etc. should be removed")),(0,r.kt)("h3",{id:"optional-optimisation"},"Optional optimisation"),(0,r.kt)("p",null,"All item related functions from xPlayer, such as ",(0,r.kt)("inlineCode",{parentName:"p"},"xPlayer.getInventoryItem"),", have been modified for compatibility purposes; however they are considered deprecated."),(0,r.kt)("p",null,"The reasoning is fairly simple - there's now additional function references and overhead to consider. Fortunately, the new Inventory functions can be used directly and offer a great deal of improvements over the old ones."),(0,r.kt)("p",null,"You should read through the functions section for further information, but the following should give you a decent idea."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(d.Z,{value:"esx",label:"ESX",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-lua"},"if xPlayer.getInventoryItem('acetone').count > 2 and xPlayer.getInventoryItem('antifreeze').count > 4 and xPlayer.getInventoryItem('sudo').count > 9 then\n xPlayer.removeInventoryItem(\"acetone\", 3)\n xPlayer.removeInventoryItem(\"antifreeze\", 5)\n xPlayer.removeInventoryItem(\"sudo\", 10)\nend\n"))),(0,r.kt)(d.Z,{value:"inventory",label:"Inventory",mdxType:"TabItem"},(0,r.kt)("p",null,"Add the following code somewhere in your resource to cache the exports metatable."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-lua"},"local ox_inventory = exports.ox_inventory\n")),(0,r.kt)("p",null,"You will be able to reference any functions exposed through the export."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-lua"},"local items = ox_inventory:Search(source, 'count', {'acetone', 'antifreeze', 'sudo'})\nif items and items.acetone > 2 and items.antifreeze > 4 and items.sudo > 9 then\n ox_inventory:RemoveItem(source, 'acetone', 3)\n ox_inventory:RemoveItem(source, 'antifreeze', 5)\n ox_inventory:RemoveItem(source, 'sudo', 10)\nend\n")))),(0,r.kt)("h2",{id:"common-issues"},"Common Issues"),(0,r.kt)("h3",{id:"ui-has-not-been-built"},"UI has not been built"),(0,r.kt)("p",null,"Because the UI for inventory is written in React it can't run natively under FiveM so it must first be bundled into html/css/js."),(0,r.kt)("p",null,"We provide an easy way for you to do this by downloading a pre-bundled release, which you can get from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/overextended/ox_inventory/releases/latest"},"here"),".",(0,r.kt)("br",{parentName:"p"}),"\n","Make sure you download the ",(0,r.kt)("inlineCode",{parentName:"p"},"ox_inventory.zip")," file as that one contains the bundled files and others are raw source code."),(0,r.kt)("p",null,"If in case you wanted to edit the inventory UI you would have to build these files yourself.",(0,r.kt)("br",{parentName:"p"}),"\n","To do so please read our ",(0,r.kt)("a",{parentName:"p",href:"/docs/ox_inventory/Guides/inventory_ui"},(0,r.kt)("em",{parentName:"a"},"Building inventory UI"))," guide."),(0,r.kt)("h3",{id:"stashes--trunks-are-not-saved-at-server-restart"},"Stashes / trunks are not saved at server restart"),(0,r.kt)("p",null,"The only supported way of doing a restart is ",(0,r.kt)("strong",{parentName:"p"},"txAdmin scheduled restart"),".",(0,r.kt)("br",{parentName:"p"}),"\n","txAdmin scheduled restart should be your only way of restarting a server in production."),(0,r.kt)("p",null,"If you need to do a manual restart, you must use ",(0,r.kt)("inlineCode",{parentName:"p"},"/saveinv")," before restarting the server.",(0,r.kt)("br",{parentName:"p"}),"\n","If you don't do this, all inventory except players inventory will not be saved."))}k.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.d334ab4e.js b/assets/js/runtime~main.8606ed8e.js similarity index 99% rename from assets/js/runtime~main.d334ab4e.js rename to assets/js/runtime~main.8606ed8e.js index 4b280ca3..013cac22 100644 --- a/assets/js/runtime~main.d334ab4e.js +++ b/assets/js/runtime~main.8606ed8e.js @@ -1 +1 @@ -!function(){"use strict";var e,a,f,d,t,c={},b={};function n(e){var a=b[e];if(void 0!==a)return a.exports;var f=b[e]={exports:{}};return c[e].call(f.exports,f,f.exports,n),f.exports}n.m=c,e=[],n.O=function(a,f,d,t){if(!f){var c=1/0;for(u=0;u=t)&&Object.keys(n.O).every((function(e){return n.O[e](f[r])}))?f.splice(r--,1):(b=!1,t0&&e[u-1][2]>t;u--)e[u]=e[u-1];e[u]=[f,d,t]},n.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(a,{a:a}),a},f=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},n.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var t=Object.create(null);n.r(t);var c={};a=a||[null,f({}),f([]),f(f)];for(var b=2&d&&e;"object"==typeof b&&!~a.indexOf(b);b=f(b))Object.getOwnPropertyNames(b).forEach((function(a){c[a]=function(){return e[a]}}));return c.default=function(){return e},n.d(t,c),t},n.d=function(e,a){for(var f in a)n.o(a,f)&&!n.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:a[f]})},n.f={},n.e=function(e){return Promise.all(Object.keys(n.f).reduce((function(a,f){return n.f[f](e,a),a}),[]))},n.u=function(e){return"assets/js/"+({53:"935f2afb",212:"2fb76b0a",219:"461f728c",336:"e836e7f0",361:"7d2d738e",488:"603a3945",623:"efe28d55",711:"e836461c",763:"8c52c42d",992:"d65f8ccc",1660:"94dab9da",1884:"c8b7a7b8",2017:"081aa3d8",2115:"99ade4d8",2145:"81089b86",2202:"34a267b8",2446:"831ab327",2597:"384e58e1",3085:"1f391b9e",3128:"2ff920a5",3218:"01e0aabd",3237:"1df93b7f",3287:"5fabe7ef",3405:"54c31db2",3412:"ed6cb704",3537:"ec013d60",3792:"fb92962e",4044:"93e28271",4270:"3a94ab6a",4428:"09e6f732",4434:"c2e48a87",4467:"a301658a",4571:"ddb2ec41",4677:"fe5eec09",4764:"9d661e0a",4772:"871b43d2",4960:"a0cc59ae",5102:"bd024966",5199:"3517af41",5633:"b1e73860",6124:"3bed0d25",6169:"03b72f95",6193:"d4a6286b",6227:"49744a1f",6231:"1edd048e",6508:"7bd87f6f",6533:"0419c24a",6971:"c377a04b",6995:"56163916",7008:"fd4717da",7150:"a484ef80",7330:"011f4266",7414:"393be207",7438:"036a6f83",7653:"27ba855c",7690:"8cbd576d",7799:"8d5488b4",7835:"23a5733a",7918:"17896441",7920:"1a4e3797",7995:"fa305394",8048:"704448ba",8299:"b81c2ea8",8431:"2e6924e9",8506:"1abfdec1",8552:"c038339d",8592:"3e61bb29",8729:"022a8a8a",8910:"6cc2c735",9008:"ea722c4f",9081:"475acb0d",9155:"d6b25613",9278:"75f8f779",9341:"72d326dc",9414:"5d7eb90d",9491:"adbed512",9514:"1be78505",9586:"85ef8f6b",9730:"daa8642d",9945:"e36123ca"}[e]||e)+"."+{53:"116c4023",138:"8c2f12a0",212:"6a9fb86e",219:"a0c3e7d5",336:"c0764910",361:"81803d5d",488:"3d50232d",623:"8d38ff15",711:"81d9241f",763:"498c27ff",992:"8b3941a1",1660:"ee048aea",1884:"3eeed0e4",2017:"04cb537d",2115:"72e8773c",2145:"2d547b46",2202:"9042f207",2446:"875440d5",2597:"7826a3c1",2724:"e89e543c",3085:"651ca0b2",3128:"87233856",3218:"27a6e3cd",3237:"81206a3e",3287:"020143bc",3405:"8c709deb",3412:"145ee9d7",3537:"23fd2af7",3792:"aff6d42c",4044:"009b4c1f",4270:"7873f880",4428:"f6bb7303",4434:"80350e6f",4467:"ab988d89",4571:"0e29169e",4608:"db604c16",4677:"1bd73148",4764:"59562574",4772:"6a864fc7",4960:"3b08cf1b",5102:"2d92cc87",5199:"3511a351",5633:"4e03d916",6124:"fe068f14",6169:"276f0a47",6193:"f5a3352d",6227:"dee093d5",6231:"07d8da79",6385:"4701e2d8",6508:"46a2a1e6",6533:"f315b748",6815:"1514b2f1",6945:"87ff0226",6971:"ed8a6a68",6995:"32d3f0f2",7008:"66c13a41",7150:"09e36f00",7330:"2807e7a4",7414:"67887543",7438:"a9508c7f",7653:"f87267ab",7690:"65e0e22e",7799:"7ff7256d",7835:"42c42266",7918:"108cc97b",7920:"3250a158",7995:"4511369c",8048:"faa6ca18",8299:"8f836b7d",8431:"210b42aa",8506:"c417ce2c",8552:"9740d7fc",8592:"cd9cbb72",8729:"fe34168b",8894:"ef41ad74",8910:"a7c63ecb",9008:"3cfdf8ab",9081:"93e3bba3",9155:"5041b665",9278:"267e2c0b",9341:"984b4680",9414:"401dc31b",9491:"2d4dfafe",9514:"67fa4e48",9586:"3a86a44e",9730:"913464c3",9945:"8d4ac2f3"}[e]+".js"},n.miniCssF=function(e){},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},d={},t="website:",n.l=function(e,a,f,c){if(d[e])d[e].push(a);else{var b,r;if(void 0!==f)for(var o=document.getElementsByTagName("script"),u=0;u=t)&&Object.keys(n.O).every((function(e){return n.O[e](f[r])}))?f.splice(r--,1):(b=!1,t0&&e[u-1][2]>t;u--)e[u]=e[u-1];e[u]=[f,d,t]},n.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(a,{a:a}),a},f=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},n.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var t=Object.create(null);n.r(t);var c={};a=a||[null,f({}),f([]),f(f)];for(var b=2&d&&e;"object"==typeof b&&!~a.indexOf(b);b=f(b))Object.getOwnPropertyNames(b).forEach((function(a){c[a]=function(){return e[a]}}));return c.default=function(){return e},n.d(t,c),t},n.d=function(e,a){for(var f in a)n.o(a,f)&&!n.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:a[f]})},n.f={},n.e=function(e){return Promise.all(Object.keys(n.f).reduce((function(a,f){return n.f[f](e,a),a}),[]))},n.u=function(e){return"assets/js/"+({53:"935f2afb",212:"2fb76b0a",219:"461f728c",336:"e836e7f0",361:"7d2d738e",488:"603a3945",623:"efe28d55",711:"e836461c",763:"8c52c42d",992:"d65f8ccc",1660:"94dab9da",1884:"c8b7a7b8",2017:"081aa3d8",2115:"99ade4d8",2145:"81089b86",2202:"34a267b8",2446:"831ab327",2597:"384e58e1",3085:"1f391b9e",3128:"2ff920a5",3218:"01e0aabd",3237:"1df93b7f",3287:"5fabe7ef",3405:"54c31db2",3412:"ed6cb704",3537:"ec013d60",3792:"fb92962e",4044:"93e28271",4270:"3a94ab6a",4428:"09e6f732",4434:"c2e48a87",4467:"a301658a",4571:"ddb2ec41",4677:"fe5eec09",4764:"9d661e0a",4772:"871b43d2",4960:"a0cc59ae",5102:"bd024966",5199:"3517af41",5633:"b1e73860",6124:"3bed0d25",6169:"03b72f95",6193:"d4a6286b",6227:"49744a1f",6231:"1edd048e",6508:"7bd87f6f",6533:"0419c24a",6971:"c377a04b",6995:"56163916",7008:"fd4717da",7150:"a484ef80",7330:"011f4266",7414:"393be207",7438:"036a6f83",7653:"27ba855c",7690:"8cbd576d",7799:"8d5488b4",7835:"23a5733a",7918:"17896441",7920:"1a4e3797",7995:"fa305394",8048:"704448ba",8299:"b81c2ea8",8431:"2e6924e9",8506:"1abfdec1",8552:"c038339d",8592:"3e61bb29",8729:"022a8a8a",8910:"6cc2c735",9008:"ea722c4f",9081:"475acb0d",9155:"d6b25613",9278:"75f8f779",9341:"72d326dc",9414:"5d7eb90d",9491:"adbed512",9514:"1be78505",9586:"85ef8f6b",9730:"daa8642d",9945:"e36123ca"}[e]||e)+"."+{53:"116c4023",138:"8c2f12a0",212:"6a9fb86e",219:"a0c3e7d5",336:"c0764910",361:"81803d5d",488:"3d50232d",623:"8d38ff15",711:"81d9241f",763:"498c27ff",992:"8b3941a1",1660:"ee048aea",1884:"3eeed0e4",2017:"04cb537d",2115:"72e8773c",2145:"2d547b46",2202:"9042f207",2446:"875440d5",2597:"7826a3c1",2724:"e89e543c",3085:"651ca0b2",3128:"b12519f7",3218:"27a6e3cd",3237:"81206a3e",3287:"020143bc",3405:"8c709deb",3412:"145ee9d7",3537:"23fd2af7",3792:"aff6d42c",4044:"009b4c1f",4270:"7873f880",4428:"f6bb7303",4434:"80350e6f",4467:"ab988d89",4571:"0e29169e",4608:"db604c16",4677:"1bd73148",4764:"59562574",4772:"6a864fc7",4960:"3b08cf1b",5102:"2d92cc87",5199:"3511a351",5633:"4e03d916",6124:"fe068f14",6169:"276f0a47",6193:"f5a3352d",6227:"dee093d5",6231:"07d8da79",6385:"4701e2d8",6508:"46a2a1e6",6533:"f315b748",6815:"1514b2f1",6945:"87ff0226",6971:"ed8a6a68",6995:"32d3f0f2",7008:"66c13a41",7150:"09e36f00",7330:"2807e7a4",7414:"67887543",7438:"a9508c7f",7653:"f87267ab",7690:"65e0e22e",7799:"7ff7256d",7835:"42c42266",7918:"108cc97b",7920:"3250a158",7995:"4511369c",8048:"faa6ca18",8299:"8f836b7d",8431:"210b42aa",8506:"c417ce2c",8552:"9740d7fc",8592:"cd9cbb72",8729:"fe34168b",8894:"ef41ad74",8910:"a7c63ecb",9008:"3cfdf8ab",9081:"93e3bba3",9155:"5041b665",9278:"267e2c0b",9341:"984b4680",9414:"401dc31b",9491:"2d4dfafe",9514:"67fa4e48",9586:"3a86a44e",9730:"913464c3",9945:"8d4ac2f3"}[e]+".js"},n.miniCssF=function(e){},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},d={},t="website:",n.l=function(e,a,f,c){if(d[e])d[e].push(a);else{var b,r;if(void 0!==f)for(var o=document.getElementsByTagName("script"),u=0;u Documentation | Overextended - +

Documentation

Here you can find all of the official documentation for resoruces developed by the Overextended team

If you feel like the documentation is lacking in some department then feel free to go onto that page and click the "Edit this page" at the bottom and submit a Pull Request.

- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/Inventory/Search/index.html b/docs/ox_inventory/Functions/Client/Inventory/Search/index.html index b78682d5..e9ac4dc5 100644 --- a/docs/ox_inventory/Functions/Client/Inventory/Search/index.html +++ b/docs/ox_inventory/Functions/Client/Inventory/Search/index.html @@ -5,7 +5,7 @@ Search | Overextended - + @@ -13,7 +13,7 @@

Search

Searches the inventory for an item, or list of items, with the result varying based on the first argument.

-- search: string
-- item: table or string
-- metadata: table or string (optional)
exports.ox_inventory:Search(search, item, metadata)

If the search argument is defined as 'slots' the return will be a table of slots where the item was found at.

Otherwise if the search argument is defined as 'count' the return value will be the amount of the specified item in player's inventory.

Count​

local count = exports.ox_inventory:Search('count', 'water')
print('You have '..count.. ' water')

Slots​

local water = exports.ox_inventory:Search('slots', 'water')
local count = 0
for _, v in pairs(water) do
print(v.slot..' contains '..v.count..' water '..json.encode(v.metadata))
count = count + v.count
end
print('You have '..count..' water')
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/Items/index.html b/docs/ox_inventory/Functions/Client/Items/index.html index c05c5cd4..c74f23a2 100644 --- a/docs/ox_inventory/Functions/Client/Items/index.html +++ b/docs/ox_inventory/Functions/Client/Items/index.html @@ -5,13 +5,13 @@ Items | Overextended - +

Items

Returns a table of all registered items. The format is as defined in data/items.lua.

exports.ox_inventory:Items()

The following snippet can be used in crafting resources such as okokCrafting or core_crafting, rather than retrieving information from the server.

local itemNames = {}

for item, data in pairs(exports.ox_inventory:Items()) do
itemNames[item] = data.label
end
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/Utils/weaponWheel/index.html b/docs/ox_inventory/Functions/Client/Utils/weaponWheel/index.html index 82c943af..37c2aa19 100644 --- a/docs/ox_inventory/Functions/Client/Utils/weaponWheel/index.html +++ b/docs/ox_inventory/Functions/Client/Utils/weaponWheel/index.html @@ -5,13 +5,13 @@ weaponWheel | Overextended - +

weaponWheel

Enables the weapon wheel, but disables the use of inventory items.

Mostly used for weaponised vehicles, though could be called for "minigames"

-- state: boolean
local exports.ox_inventory:weaponWheel(state)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/displayMetadata/index.html b/docs/ox_inventory/Functions/Client/displayMetadata/index.html index 41a3bd3c..1b54c162 100644 --- a/docs/ox_inventory/Functions/Client/displayMetadata/index.html +++ b/docs/ox_inventory/Functions/Client/displayMetadata/index.html @@ -5,7 +5,7 @@ displayMetadata | Overextended - + @@ -13,7 +13,7 @@

displayMetadata

Sets a metadata property to display in the tooltip.

-- metadata: table or string
-- value: string (optional)
exports.ox_inventory:displayMetadata(metadata, value)

metadata can either be table or string, if it's a string it's the metadata property that you want to display, value is not optional then.

value represents the label for the property you want to display.

Otherwise metadata can be a table of key value pairs, key being the metadata property and value being the label for that metadata.

Example:

exports.ox_inventory:displayMetadata('mustard', 'Mustard')
exports.ox_inventory:displayMetadata({
mustard = 'Mustard',
ketchup = 'Ketchup'
})
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/openInventory/index.html b/docs/ox_inventory/Functions/Client/openInventory/index.html index 55484edc..8b2cfd60 100644 --- a/docs/ox_inventory/Functions/Client/openInventory/index.html +++ b/docs/ox_inventory/Functions/Client/openInventory/index.html @@ -5,13 +5,13 @@ openInventory | Overextended - +

openInventory

Opens an inventory using on the passed data.

-- invType: string
-- data: number | string | table
exports.ox_inventory:openInventory(invType, data)

Open the target player's inventory.

exports.ox_inventory:openInventory('player', 3)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/openNearbyInventory/index.html b/docs/ox_inventory/Functions/Client/openNearbyInventory/index.html index 5604cbf9..1cba1bc1 100644 --- a/docs/ox_inventory/Functions/Client/openNearbyInventory/index.html +++ b/docs/ox_inventory/Functions/Client/openNearbyInventory/index.html @@ -5,7 +5,7 @@ openNearbyInventory | Overextended - + @@ -13,7 +13,7 @@

openNearbyInventory

If possible opens the nearby player's inventory.

The player trying to open the inventory must be able to open their own and if the player does not have a police job, the target player must be fatally injured or playing one of the death anims.

exports.ox_inventory:openNearbyInventory()
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/setStashTarget/index.html b/docs/ox_inventory/Functions/Client/setStashTarget/index.html index df7e9b7f..32dc68b1 100644 --- a/docs/ox_inventory/Functions/Client/setStashTarget/index.html +++ b/docs/ox_inventory/Functions/Client/setStashTarget/index.html @@ -5,13 +5,13 @@ setStashTarget | Overextended - +

setStashTarget

Forces the secondary-inventory key to open the passed inventory. Can be useful to enable inventory access while standing inside a marker.

-- id: string or number
-- owner: string or number (optional)
exports.ox_inventory:setStashTarget(id, owner)

exports.ox_inventory:setStashTarget('motel5', 'bobsmith')
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/useItem/index.html b/docs/ox_inventory/Functions/Client/useItem/index.html index 2a86df71..bae9f400 100644 --- a/docs/ox_inventory/Functions/Client/useItem/index.html +++ b/docs/ox_inventory/Functions/Client/useItem/index.html @@ -5,14 +5,14 @@ useItem | Overextended - +

useItem

Uses the passed item, then triggers the callback function.
Should be calling during item callbacks to utilise the builtin methods (server checks, progress bar, etc.).

-- data: table
-- cb: function (optional)
exports.ox_inventory:useItem(data, cb)
exports('bandage', function(data, slot)
local playerPed = PlayerPedId()
local maxHealth = GetEntityMaxHealth(playerPed)
local health = GetEntityHealth(playerPed)

-- Does the ped need to heal?
if health < maxHealth then
-- Use the bandage
exports.ox_inventory:useItem(data, function(data)
-- The item has been used, so trigger the effects
if data then
SetEntityHealth(playerPed, math.min(maxHealth, math.floor(health + maxHealth / 16)))
exports.ox_inventory:notify({text = 'You feel better already'})
end
end)
else
-- Don't use the item
exports.ox_inventory:notify({type = 'error', text = 'You don\'t need a bandage right now'})
end
end)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Client/useSlot/index.html b/docs/ox_inventory/Functions/Client/useSlot/index.html index 5e298c66..5d8b6cca 100644 --- a/docs/ox_inventory/Functions/Client/useSlot/index.html +++ b/docs/ox_inventory/Functions/Client/useSlot/index.html @@ -5,13 +5,13 @@ useSlot | Overextended - + - + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/AddItem/index.html b/docs/ox_inventory/Functions/Server/Inventory/AddItem/index.html index 6343392b..4b05bb6c 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/AddItem/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/AddItem/index.html @@ -5,13 +5,13 @@ AddItem | Overextended - +

AddItem

Adds an item into the specified inventory.

Should be used alongside CanCarryItem otherwise, the maximum weight may be exceeded.

-- inv: string or number
-- item: table or string
-- count: number
-- metadata: table or string (optional)
-- slot: number (optional)
-- cb: function (optional)
exports.ox_inventory:AddItem(inv, item, count, metadata, slot, cb)

Example:

exports.ox_inventory:AddItem(1, 'bread', 4, nil, nil, function(success, reason)
if success then
print(json.encode(reason, {indent=true}))
--[[
{
"metadata": [],
"label": "Bread",
"slot": 1,
"stack": true,
"close": true,
"name": "bread",
"count": 1,
"weight": 150
}
]]
else
print(success)
-- nil

print(reason)
-- for example if all slots are taken it will give us "inventory_full"
end
end)

Possible value of the "reason" argument for the callback function:

  • "invalid_item": the item doesn't exist
  • "invalid_inventory": the inventory doesn't exist
  • "inventory_full": no free slots
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/CanCarryAmount/index.html b/docs/ox_inventory/Functions/Server/Inventory/CanCarryAmount/index.html index 9a1b98e2..6d5b81bc 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/CanCarryAmount/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/CanCarryAmount/index.html @@ -5,13 +5,13 @@ CanCarryAmount | Overextended - +

CanCarryAmount

Returns the amount a player can hold based on available weight.

---@param inv string | number
---@param item table | string
exports.ox_inventory:CanCarryAmount(inv, item)

Example:

-- Checks how much you can carry
amountToAdd = exports.ox_inventory:CanCarryAmount(inv, 'stone')
-- Adds the amount
exports.ox_inventory:AddItem(inv, 'stone', amountToAdd)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/CanCarryItem/index.html b/docs/ox_inventory/Functions/Server/Inventory/CanCarryItem/index.html index 2892c5ed..bcb2cb6f 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/CanCarryItem/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/CanCarryItem/index.html @@ -5,13 +5,13 @@ CanCarryItem | Overextended - +

CanCarryItem

Returns true or false depending if the inventory can carry the specified item.

The function checks for inventory weight and available slots.

-- inv: string or number
-- item: table or string
-- count: number
-- metadata: table or string (optional)
exports.ox_inventory:CanCarryItem(inv, item, count, metadata)

Example:

-- Checks if the player calling the event can carry 3 water items
if exports.ox_inventory:CanCarryItem(source, 'water', 3) then
-- Do stuff if can carry
else
-- Do stuff if can't carry
end
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/CanSwapItem/index.html b/docs/ox_inventory/Functions/Server/Inventory/CanSwapItem/index.html index 8afcac93..d19def41 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/CanSwapItem/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/CanSwapItem/index.html @@ -5,13 +5,13 @@ CanSwapItem | Overextended - +

CanSwapItem

Returns true if the item swap is possible based on inventory weight.

-- inv: string or number
-- firstItem: string
-- firstItemCount: number
-- testItem: string
-- testItemCount: number
exports.ox_inventory:CanSwapItem(inv, firstItem, firstItemCount, testItem, testItemCount)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/ClearInventory/index.html b/docs/ox_inventory/Functions/Server/Inventory/ClearInventory/index.html index 4919660f..99bd347d 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/ClearInventory/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/ClearInventory/index.html @@ -5,13 +5,13 @@ ClearInventory | Overextended - + - + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/ConfiscateInventory/index.html b/docs/ox_inventory/Functions/Server/Inventory/ConfiscateInventory/index.html index 49ee0124..2430f3cf 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/ConfiscateInventory/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/ConfiscateInventory/index.html @@ -5,14 +5,14 @@ ConfiscateInventory | Overextended - + - + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/ConvertItems/index.html b/docs/ox_inventory/Functions/Server/Inventory/ConvertItems/index.html index e33582da..82ac0698 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/ConvertItems/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/ConvertItems/index.html @@ -5,13 +5,13 @@ ConvertItems | Overextended - +

ConvertItems

Takes traditional item data and updates it to support ox_inventory.

-- playerId: number
-- items: table
exports.ox_inventory:ConvertItems(playerId, items)

Data conversion example:

Old: [{"cola":1, "bread":3}]
New: [{"slot":1,"name":"cola","count":1}, {"slot":2,"name":"bread","count":3}]
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/CustomDrop/index.html b/docs/ox_inventory/Functions/Server/Inventory/CustomDrop/index.html index 011be7a6..11f4bc40 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/CustomDrop/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/CustomDrop/index.html @@ -5,13 +5,13 @@ CustomDrop | Overextended - +

CustomDrop

Drops can be created from other resources, containing a variety of items and utilising a custom label (instead of 'Drop 32648').

-- prefix: string
-- items: table
-- name: string
-- count: number
-- metadata: table (optional)
-- coords: vector3
-- slots: number (optional)
-- maxWeight: number (optional)
-- instance: string | number (optional)
exports.ox_inventory:CustomDrop(prefix, items, coords, slots, maxWeight, instance)
exports.ox_inventory:CustomDrop('Carcass', {
{'meat', 5, { grade = 2, type = 'deer' }},
{'hide', 5, { grade = 2, type = 'deer' }}
}, coords)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetCurrentWeapon/index.html b/docs/ox_inventory/Functions/Server/Inventory/GetCurrentWeapon/index.html index 0d5cd78b..893b427a 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/GetCurrentWeapon/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/GetCurrentWeapon/index.html @@ -5,13 +5,13 @@ GetCurrentWeapon | Overextended - + - + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetItem/index.html b/docs/ox_inventory/Functions/Server/Inventory/GetItem/index.html index 695f2e98..1dfd2146 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/GetItem/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/GetItem/index.html @@ -5,14 +5,14 @@ GetItem | Overextended - +

GetItem

Returns the item from the specified inventory.

-- inv: string or number
-- item: table or string
-- metadata: any (optional)
-- returnsCount: boolean (optional)
exports.ox_inventory:GetItem(inv, item, metadata, returnsCount)

If returnsCount is set to true, the returned value will be the count based on how many times the item was found.

Otherwise returns the data related to the item and it's total count found in the inventory.

Example:

local item = ox_inventory:GetItem(source, 'water', nil, false)

print(json.encode(item, {indent=true}))
--[[
{
"consume": 1,
"count": 15,
"stack": true,
"name": "water",
"weight": 500,
"label": "Water",
"close": true
}
]]
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetItemSlots/index.html b/docs/ox_inventory/Functions/Server/Inventory/GetItemSlots/index.html index 2734139e..96186611 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/GetItemSlots/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/GetItemSlots/index.html @@ -5,13 +5,13 @@ GetItemSlots | Overextended - +

GetItemSlots

Returns the number of slots the specified item is in, the item's total count and the remaining empty slots.

-- inv: string or number
-- item: table or string
-- metadata: table (optional)
exports.ox_inventory:GetItemSlots(inv, item, metadata)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/GetSlot/index.html b/docs/ox_inventory/Functions/Server/Inventory/GetSlot/index.html index fc95625b..b312621d 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/GetSlot/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/GetSlot/index.html @@ -5,13 +5,13 @@ GetSlot | Overextended - +

GetSlot

Returns the specified slot data as a table.

-- inv: string or number
-- slot: number
exports.ox_inventory:GetSlot(inv, slot)

Example:

local slot = exports.ox_inventory:GetSlot(source, 1)

print(json.encode(slot, {indent=true}))
--[[
{
"weight": 2000,
"name": "water",
"metadata": [],
"slot": 1,
"label": "Water",
"close": true,
"stack": true,
"count: 4
}
]]
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/RegisterStash/index.html b/docs/ox_inventory/Functions/Server/Inventory/RegisterStash/index.html index 1a2187a5..b8ee716b 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/RegisterStash/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/RegisterStash/index.html @@ -5,13 +5,13 @@ RegisterStash | Overextended - +

RegisterStash

Creates a new custom stash.

-- id: string or number
-- label: string
-- slots: number
-- maxWeight: number
-- owner: string or boolean or nil
-- groups: table
-- coords: vector3
exports.ox_inventory:RegisterStash(id, label, slots, maxWeight, owner, groups, coords)
  • id - Stash identifier when loading from the database.
  • label - Display name when inventory is open.
  • owner - Defines stash permissions.
    • string: Can only access the stash linked to the owner.
    • true: Each player has a unique stash but can request other player's stashes.
    • nil: Always shared.
  • groups - Player groups (jobs) able to access the stash.
    • Table of group names where the numeric value is the minimum grade required.
    • {['police'] = 0, ['ambulance'] = 2}
caution

This function needs to be triggered before a player can open the stash.

Example:

For a use case example on this function check out the written Guide for it.

- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/RemoveItem/index.html b/docs/ox_inventory/Functions/Server/Inventory/RemoveItem/index.html index fdfd91a3..0fbde98f 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/RemoveItem/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/RemoveItem/index.html @@ -5,13 +5,13 @@ RemoveItem | Overextended - +

RemoveItem

Removes the specified item from the specified inventory.

-- inv: string or table
-- item: table or string
-- count: number
-- metadata: table or string (optional)
-- slot: number (optional)
exports.ox_inventory:RemoveItem(inv, item, count, metadata, slot)

Example:

-- Removes 1 water from the inventory
exports.ox_inventory:RemoveItem(source, 'water', 1)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/ReturnInventory/index.html b/docs/ox_inventory/Functions/Server/Inventory/ReturnInventory/index.html index 790d3c68..f2961ad8 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/ReturnInventory/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/ReturnInventory/index.html @@ -5,13 +5,13 @@ ReturnInventory | Overextended - + - + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/Search/index.html b/docs/ox_inventory/Functions/Server/Inventory/Search/index.html index 7f886986..72242735 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/Search/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/Search/index.html @@ -5,14 +5,14 @@ Search | Overextended - +

Search

Searches an inventory for a specified item.

-- inv: string or number
-- search: string
-- item: table or string
-- metadata: table or string (optional)
exports.ox_inventory:Search(inv, search, item, metadata)

search can be either 'slots' or 'count', where slots will return a table of data and count will return the found amount of the specified item.

- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/SetDurability/index.html b/docs/ox_inventory/Functions/Server/Inventory/SetDurability/index.html index 1676c8fc..fdda8722 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/SetDurability/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/SetDurability/index.html @@ -5,13 +5,13 @@ SetDurability | Overextended - +

SetDurability

Sets durability onto the specified slot.

Can be used for repairing weapons.

-- inv: string or number
-- slot: number
-- durability: number
exports.ox_inventory:SetDurability(inv, slot, durability)

Example:

local ox_inventory = exports.ox_inventory

-- Set the durability of the item in slot 3 of source player's inventory to 100
ox_inventory:SetDurability(source, 3, 100)

-- Set the durability of the source player's current weapon to 100
local weapon = ox_inventory:GetCurrentWeapon(source)

if weapon then
ox_inventory:SetDurability(source, weapon.slot, 100)
end
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/SetMetadata/index.html b/docs/ox_inventory/Functions/Server/Inventory/SetMetadata/index.html index 368fc8cb..2e18e1a6 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/SetMetadata/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/SetMetadata/index.html @@ -5,13 +5,13 @@ SetMetadata | Overextended - +

SetMetadata

Sets metadata on the specified slot.

-- inv: string or number
-- slot: number
-- metadata: table
ox_inventory:SetMetadata(inv, slot, metadata)

Example:

local ox_inventory = exports.ox_inventory

local water = ox_inventory:Search(source, 1, 'water')
for k, v in pairs(water) do
print('\n______________'..'\n- index '..k)
print(v.name, 'slot: '..v.slot, 'metadata: '..json.encode(v.metadata))
water = v
break
end
water.metadata.type = 'clean'
ox_inventory:SetMetadata(source, water.slot, water.metadata)
print(('modified %sx water in slot %s with new metadata'):format(water.count, water.slot))
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Inventory/SwapSlots/index.html b/docs/ox_inventory/Functions/Server/Inventory/SwapSlots/index.html index f4e75f49..f4bf3341 100644 --- a/docs/ox_inventory/Functions/Server/Inventory/SwapSlots/index.html +++ b/docs/ox_inventory/Functions/Server/Inventory/SwapSlots/index.html @@ -5,13 +5,13 @@ SwapSlots | Overextended - + - + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/Items/index.html b/docs/ox_inventory/Functions/Server/Items/index.html index 5165ba54..5e84e6a1 100644 --- a/docs/ox_inventory/Functions/Server/Items/index.html +++ b/docs/ox_inventory/Functions/Server/Items/index.html @@ -5,13 +5,13 @@ Items | Overextended - +

Items

Returns a table of all registered items. The format is as defined in data/items.lua.

exports.ox_inventory:Items()

The following snippet can be used in crafting resources such as okokCrafting or core_crafting, rather than querying the database.

local itemNames
ESX.RegisterServerCallback('crafting:itemNames', function(source, cb)
if not itemNames then
itemNames = {}
for item, data in pairs(exports.ox_inventory:Items()) do
itemNames[item] = data.label
end
end
cb(itemNames)
end)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Functions/Server/setPlayerInventory/index.html b/docs/ox_inventory/Functions/Server/setPlayerInventory/index.html index 7f060023..d67f9713 100644 --- a/docs/ox_inventory/Functions/Server/setPlayerInventory/index.html +++ b/docs/ox_inventory/Functions/Server/setPlayerInventory/index.html @@ -5,13 +5,13 @@ setPlayerInventory | Overextended - +

setPlayerInventory

Creates and sets the player's inventory.

-- player: table
-- source: number
-- identifier: string
-- name: string
-- groups: table (optional)
-- sex: string (optional)
-- dateofbirth: string (optional)
-- data: table
exports.ox_inventory:setPlayerInventory(player, data)
- + \ No newline at end of file diff --git a/docs/ox_inventory/Guides/creatingItems/index.html b/docs/ox_inventory/Guides/creatingItems/index.html index 304449cd..5e3e3d27 100644 --- a/docs/ox_inventory/Guides/creatingItems/index.html +++ b/docs/ox_inventory/Guides/creatingItems/index.html @@ -5,7 +5,7 @@ Creating items | Overextended - + @@ -18,7 +18,7 @@ options for the item.

Item options:

items/server.lua.

exports('bandage', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local playerPed = GetPlayerPed(inventory.id)
local maxHealth = GetEntityMaxHealth(playerPed)
local health = GetEntityHealth(playerPed)

if health >= maxHealth then
TriggerClientEvent('ox_inventory:notify', inventory.id, {type = 'error', text = 'You don\'t need a bandage right now'})

-- Returning 'false' will prevent the item from being used
return false
end

return
elseif event == 'usedItem' then
return TriggerClientEvent('ox_inventory:notify', inventory.id, {text = 'You feel better already'})

elseif event == 'buying' then
return TriggerClientEvent('ox_inventory:notify', inventory.id, {type = 'success', text = 'You bought a bandage'})
end
end)

Creating container items​

Like with other items the item must first be registered.

Example:

['paperbag'] = {
label = 'Paper Bag',
weight = 1,
stack = false,
close = false,
consume = 0
},

When registered you can define the item as a container under the Items.containers table in /modules/items/sever.lua
The key for the container is the name you gave it when registering the item.
You can also define the number of slots, the maximum weight, blacklist and whitelist items.

['name'] = {
-- size: {slots, maxWeight}
-- slots: number
-- maxWeight: number
-- blacklist: table (optional)
-- ['itemName'] = true
-- whitelist: table (optional)
-- ['itemName'] = true
}

Example:

['paperbag'] = {
size = {5, 1000},
blacklist = {
['testburger'] = true -- No burgers!
}
},
- + \ No newline at end of file diff --git a/docs/ox_inventory/Guides/index.html b/docs/ox_inventory/Guides/index.html index 55c05b95..cf10d4a2 100644 --- a/docs/ox_inventory/Guides/index.html +++ b/docs/ox_inventory/Guides/index.html @@ -5,13 +5,13 @@ Overview | Overextended - +

Overview

Providing examples and explaining certain inventory API into more detail.

If you have trouble understanding how some of the API works check out our example resource.

- + \ No newline at end of file diff --git a/docs/ox_inventory/Guides/inventory_ui/index.html b/docs/ox_inventory/Guides/inventory_ui/index.html index a1d8e862..7688b211 100644 --- a/docs/ox_inventory/Guides/inventory_ui/index.html +++ b/docs/ox_inventory/Guides/inventory_ui/index.html @@ -5,7 +5,7 @@ Building inventory UI | Overextended - + @@ -13,7 +13,7 @@

Building inventory UI

Requirements to build:​

  • Node.js
  • Yarn

Installing Node.js:​

  • Download the LTS version of Node.js.
  • Go through the install and make sure you install all of the features.
  • Run node --version in cmd and make sure that it gives you the version number. If it doesn't then you didn't install it correctly.

Installing Yarn:​

  • Now that you've installed Node.js you can install Yarn by running npm install --global yarn in cmd.

Building the UI:​

  • cd into the web directory of ox_inventory
  • In your cmd type yarn and in will start downloading the node modules.
  • After it's done downloading node modules you can run yarn build to build the UI.
Hot reloads

When working in the browser you can run yarn start, which supports hot reloads meaning that you will see your changes after saving your file.

If you want to work in game you can run yarn start:game which writes changes to disk, so the only thing you have to do is restart the resource for it take affect.

- + \ No newline at end of file diff --git a/docs/ox_inventory/Guides/stashes/index.html b/docs/ox_inventory/Guides/stashes/index.html index ca9b9205..d644af0f 100644 --- a/docs/ox_inventory/Guides/stashes/index.html +++ b/docs/ox_inventory/Guides/stashes/index.html @@ -5,13 +5,13 @@ Creating custom stashes | Overextended - +

Creating custom stashes

We can set up custom stashes from outside the resource utilising the exported RegisterStash function. Firstly, we need to define the stashes properties.

-- id: string
-- label: string
-- slots: number
-- weight: number
-- owner: string or boolean (optional)
-- groups: table (optional)
-- name: string
-- grade: number
-- coords: vector or table (optional)
  • id - A unique name to identify the stash in the database
  • label - Display name when viewing the stash
  • slots - Number of slots that the stash will have
  • weight - Maximum stash weight
  • owner - See below
  • groups - Key-value pairs of job name and minimum grade to access
  • coords - Vector or table containing coordinates

The owner field will set permissions for stash access, with stashes registering to specific identifiers.

  • true: Each player has their own unique stash, but can request to open the stash of another player
  • false: Only a single stash exists and is shared between all players
  • string: The stash explicitly belongs to the given owner, usually a player identifier

You can set the stash coordinates to prevent the stash from being opened if the player isn't close enough.

Example​

Below the value is hardset, but it could be loaded from the database (especially if there are unknown fields, i.e. owner)

-- Server
local stash = {
id = '42wallabyway',
label = '42 Wallaby Way',
slots = 50,
weight = 100000,
owner = 'char1:license'
}

AddEventHandler('onServerResourceStart', function(resourceName)
if resourceName == 'ox_inventory' or resourceName == GetCurrentResourceName() then
exports.ox_inventory:RegisterStash(stash.id, stash.label, stash.slots, stash.weight, stash.owner)
end
end)

-- Client
exports.ox_inventory:openInventory('stash', {id='42wallabyway', owner=property.owner})

The following sample is based on esx_property's db data.

-- Server
local properties

MySQL.query('SELECT * FROM `properties`', {}, function(result)
properties = result
end

RegisterNetEvent('ox:loadStashes', function(id)
local stash = properties[id]
if stash then
-- id: 1, name: WhispymoundDrive, label: 2677 Whispymound Drive, coords: {"x":118.748,"y":566.573,"z":175.697}
ox_inventory:RegisterStash(stash.name, stash.label, 50, 100000, true, false, json.encode(stash.room_menu))
end
end)

-- Client
local ox_inventory = exports.ox_inventory

if ox_inventory:openInventory('stash', property.id) == false then
TriggerServerEvent('ox:loadStashes')
ox_inventory:openInventory('stash', property.id)
end

Example resource​

We put together an example resource showcasing how to properly utilise the stash API:

- + \ No newline at end of file diff --git a/docs/ox_inventory/config/index.html b/docs/ox_inventory/config/index.html index 729767e3..f05c5a29 100644 --- a/docs/ox_inventory/config/index.html +++ b/docs/ox_inventory/config/index.html @@ -5,13 +5,13 @@ Configuration | Overextended - +

Configuration

You can add these settings directly to your 'server.cfg', or add them to a separate file (i.e. inventory.cfg) and call it with exec.

caution

Convars must be set before starting ox_inventory.

The values below are defaults and should not be explicitly set unless changing the value.

# Activate specific event handlers and functions (supported: ox, esx)
setr inventory:framework "esx"

# Load specific language file from data/locales
setr inventory:locale "en"

# Number of slots for player inventories
setr inventory:slots 50

# Maximum carry capacity for players, in kilograms
setr inventory:weight 30000

# Weapons will reload after reaching 0 ammo
setr inventory:autoreload false

# Weapons must be aimed before shooting
setr aimedfiring false

# Blur the screen while accessing the inventory
setr inventory:screenblur true

# Trim whitespace from vehicle plates when checking owned vehicles
setr inventory:trimplate true

# Integrated support for qtarget stashes, shops, etc
setr inventory:qtarget false

# Default hotkeys to access primary and secondary inventories, and hotbar
setr inventory:keys ["F2", "K", "TAB"]

# Enable control action when inventory is open
setr inventory:enablekeys [249]

# Jobs with access to police armoury, evidence lockers, etc
setr inventory:police ["police", "sheriff"]

# Item prices fluctuate in shops
set inventory:randomprices true

# Compare current version to latest release on GitHub
set inventory:versioncheck true

# Loot will randomly generate inside unowned vehicles and dumpsters
set inventory:randomloot true

# Minimum job grade to remove items from evidence lockers
set inventory:evidencegrade 2

# Stashes will be wiped after remaining unchanged for the given time
set inventory:clearstashes "6 MONTH"

# Set the contents of randomly generated inventories
# [item name, minimum, maximum, loot chance]
set inventory:vehicleloot [
["cola", 1, 1],
["water", 1, 1],
["garbage", 1, 2, 50],
["panties", 1, 1, 5],
["money", 1, 50],
["money", 200, 400, 5],
["bandage", 1, 1]
]

set inventory:dumpsterloot [
["mustard", 1, 1],
["garbage", 1, 3],
["money", 1, 10],
["burger", 1, 1]
]

# Set datadog API key for inventory logging (https://app.datadoghq.com/organization-settings/api-keys)
set datadog:key ""

# Set server intake (https://docs.datadoghq.com/api/latest/logs/#send-logs)
set datadog:site "datadoghq.com"

# Set server hostname
set datadog:hostname "FXServer"
- + \ No newline at end of file diff --git a/docs/ox_inventory/index.html b/docs/ox_inventory/index.html index b72fcb0c..df01c1b4 100644 --- a/docs/ox_inventory/index.html +++ b/docs/ox_inventory/index.html @@ -5,7 +5,7 @@ Getting Started | Overextended - + @@ -14,7 +14,7 @@ however it is not recommended for beginners. You must possess a basic understanding of coding and the ability to read; otherwise you should not install this resource.

Dependencies​

OxMySQL​

We utilise our own resource to communicate with MySQL databases via the node-mysql2 package. The backend is actively maintained and updated unlike the package used by mysql-async, providing improved performance, security, and features. -We provide full backwards compatibility with mysql-async and build for the current Cfx architecture.

Ox Lib​

Provides easily reusable functions that can be imported into your resource or called with exports.

Used in the inventory for

  • SetInterval
  • Server Callbacks
  • Requesting models, animations, etc.
  • Marker management
  • Notifications and progress bar

Production Build​

The interface is written in TypeScript using the React library, so the code included in the repository will not work. +We provide full backwards compatibility with mysql-async and build for the current Cfx architecture.

Ox Lib​

Provides easily reusable functions that can be imported into your resource or called with exports.

Used in the inventory for

  • SetInterval
  • Server Callbacks
  • Requesting models, animations, etc.
  • Marker management
  • Notifications and progress bar

Production Build​

The interface is written in TypeScript using the React library, so the code included in the repository will not work. You either need to build the package yourself (more information in guides section), or download a release.

Optional resources​

The resources listed under here aren't necessary for the inventory to work but still have full support.

qtarget​

A high performance targeting solution based on bt-target, and the basis for qb-target. It is being updated alongside Ox Inventory to improve support as well as add compatibility when using QBCore or migrating from bt-target. All stashes and shops will utilise PolyZone's instead of markers to interact with them.

caution

If you wish to use it first you must ensure that qtarget is enabled in the resource convars. @@ -34,7 +34,7 @@ and Building inventory UI guide.

Stashes / trunks are not saved at server restart​

The only supported way of doing a restart is txAdmin scheduled restart.
txAdmin scheduled restart should be your only way of restarting a server in production.

If you need to do a manual restart, you must use /saveinv before restarting the server.
If you don't do this, all inventory except players inventory will not be saved.

- + \ No newline at end of file diff --git a/docs/ox_lib/ACL/Server/index.html b/docs/ox_lib/ACL/Server/index.html index 6637ea29..0ab24e5d 100644 --- a/docs/ox_lib/ACL/Server/index.html +++ b/docs/ox_lib/ACL/Server/index.html @@ -5,14 +5,14 @@ Server | Overextended - +

Server

Wrapper around the built-in ACL system. Handles lib.addCommand and ox_groups permissions.
Refer to Basic Aces & Principals overview/guide for more information.

lib.addAce​

Assigns the ace permission to a principal. Third parameter defaults to 'allow', while false sets the permission to 'deny'.

-- principal: string
-- ace: string
-- allow: boolean
lib.addAce(principal, ace, allow)

lib.addAce('group.admin', 'command.say')

lib.removeAce​

Removes the ace permission from a principal. Third parameter defaults to 'allow', while false sets the permission to 'deny'.

-- principal: string
-- ace: string
-- allow: boolean
lib.removeAce(principal, ace, allow)

lib.removeAce('group.admin', 'command.say')

lib.addPrincipal​

Assigns a principal to a parent principal. Children inherit permissions from the parent.

-- child: string
-- parent: string
lib.addPrincipal(child, parent)

lib.addPrincipal('player.1', 'group.moderator')

lib.removePrincipal​

Removes a principal from a parent principal.

-- child: string
-- parent: string
lib.removePrincipal(child, parent)

lib.removePrincipal('player.1', 'group.moderator')
- + \ No newline at end of file diff --git a/docs/ox_lib/AddCommand/Server/index.html b/docs/ox_lib/AddCommand/Server/index.html index 3f72bfeb..07c2f2d8 100644 --- a/docs/ox_lib/AddCommand/Server/index.html +++ b/docs/ox_lib/AddCommand/Server/index.html @@ -5,13 +5,13 @@ Server | Overextended - +

Server

-- principal: string or false
-- command: string
-- callback: function
-- parameters: table (optional)
-- help: string (optional)
lib.addCommand(principal, command, callback, parameters, help)

lib.addCommand('group.admin', {'additem', 'giveitem'}, function(source, args)
args.item = Items(args.item)
if args.item and args.count > 0 then
Inventory.AddItem(args.target, args.item.name, args.count, args.metatype)
end
end, {'target:number', 'item:string', 'count:number', 'metatype:?string'})
- + \ No newline at end of file diff --git a/docs/ox_lib/Cache/Client/index.html b/docs/ox_lib/Cache/Client/index.html index 4829f4c1..c7579d7a 100644 --- a/docs/ox_lib/Cache/Client/index.html +++ b/docs/ox_lib/Cache/Client/index.html @@ -5,14 +5,14 @@ Client | Overextended - +

Client

Caches data related to the player and handling some events or statebags.
An interval runs every 100ms to update data that cannot be checked via handlers.

https://github.com/overextended/ox_lib/blob/master/resource/cache/client.lua

States​

cache.ped        -- player entity id
cache.vehicle -- vehicle entity id
cache.seat -- vehicle seat index

lib.onCache​

Register a callback function when the value is changed.

lib.onCache('vehicle', function(value)
print('vehicle', value)
end)

lib.onCache('seat', function(value)
print('seat', value)
end)
- + \ No newline at end of file diff --git a/docs/ox_lib/Callback/Client/index.html b/docs/ox_lib/Callback/Client/index.html index d5a45cf5..e14ff8e3 100644 --- a/docs/ox_lib/Callback/Client/index.html +++ b/docs/ox_lib/Callback/Client/index.html @@ -5,13 +5,13 @@ Client | Overextended - +

Client

Triggers a registered server callback and registers an event handler for the response.

lib.callback​

The response is handled in a separate coroutine.

-- name: string
-- delay: number or false
-- cb: function
lib.callback(name, delay, cb, ...)

lib.callback('ox_inventory:getItemCount', false, function(count)
print(count)
end, 'water', {type = 'fresh'})

lib.callback.await​

The current coroutine is yielded until a response is received.

-- name: string
-- delay: number or false
lib.callback.await(name, delay, ...)

local count = lib.callback.await('ox_inventory:getItemCount', false, 'water', {type = 'fresh'})
print(count)
- + \ No newline at end of file diff --git a/docs/ox_lib/Callback/Server/index.html b/docs/ox_lib/Callback/Server/index.html index da186ea7..1617b19d 100644 --- a/docs/ox_lib/Callback/Server/index.html +++ b/docs/ox_lib/Callback/Server/index.html @@ -5,13 +5,13 @@ Server | Overextended - +

Server

lib.callback.register​

-- name: string
-- cb: function
lib.callback.register(name, cb)

lib.callback.register('ox_inventory:getItemCount', function(source, item, metadata, target)
local inventory = target and Inventory(target) or Inventory(source)
return (inventory and Inventory.GetItem(inventory, item, metadata, true)) or 0
end)
- + \ No newline at end of file diff --git a/docs/ox_lib/DisableControls/Client/index.html b/docs/ox_lib/DisableControls/Client/index.html index 67a6414a..8772a587 100644 --- a/docs/ox_lib/DisableControls/Client/index.html +++ b/docs/ox_lib/DisableControls/Client/index.html @@ -5,13 +5,13 @@ Client | Overextended - +

Client

lib.disableControls​

-- Call on frame to disable all stored keys.
lib.disableControls()

lib.disableControls:Add​

-- vararg: number
lib.disableControls:Add(...)

lib.disableControls:Remove​

-- vararg: number
lib.disableControls:Remove(...)

lib.disableControls:Clear​

-- vararg: number
lib.disableControls:Clear(...)
- + \ No newline at end of file diff --git a/docs/ox_lib/Interface/Client/clipboard/index.html b/docs/ox_lib/Interface/Client/clipboard/index.html index b6e3eec1..76e7d56c 100644 --- a/docs/ox_lib/Interface/Client/clipboard/index.html +++ b/docs/ox_lib/Interface/Client/clipboard/index.html @@ -5,13 +5,13 @@ Clipboard | Overextended - + - + \ No newline at end of file diff --git a/docs/ox_lib/Interface/Client/context/index.html b/docs/ox_lib/Interface/Client/context/index.html index db3cc1e2..1b47a541 100644 --- a/docs/ox_lib/Interface/Client/context/index.html +++ b/docs/ox_lib/Interface/Client/context/index.html @@ -5,7 +5,7 @@ Context Menu | Overextended - + @@ -39,7 +39,7 @@ the button will do nothing upon being clicked.

Of course just registering with the lib.showContext function, passing in the menu's id.

menu_example
metadata
event_menu

- + \ No newline at end of file diff --git a/docs/ox_lib/Interface/Client/input/index.html b/docs/ox_lib/Interface/Client/input/index.html index ec0b01cb..cef4fdd3 100644 --- a/docs/ox_lib/Interface/Client/input/index.html +++ b/docs/ox_lib/Interface/Client/input/index.html @@ -5,7 +5,7 @@ Input Dialog | Overextended - + @@ -21,7 +21,7 @@ number data type, you can use the tonumber function to convert it t a number instead.

If a user left an input field empty it will return nil.

You can also add checkboxes that will return true if checked and nil if unchecked.
Look at the Advanced example for it's usage.

caution

When using the advanced method you can define icon and password ONLY with type "input" and you can define options ONLY with type "select".

Doing so otherwise will result in errors.

Example:

local input = lib.inputDialog('Police locker', {'Locker number', 'Locker passcode'})

if input then
local lockerNumber = tonumber(input[1])
local lockerPasscode = input[2]

print(lockerNumber, lockerPasscode)
end

Example image

- + \ No newline at end of file diff --git a/docs/ox_lib/Interface/Client/notify/index.html b/docs/ox_lib/Interface/Client/notify/index.html index 4ccd28fc..dcb8ce4c 100644 --- a/docs/ox_lib/Interface/Client/notify/index.html +++ b/docs/ox_lib/Interface/Client/notify/index.html @@ -5,7 +5,7 @@ Notifications | Overextended - + @@ -18,7 +18,7 @@ style - React CSS styling, works the same as in TextUI
icon - Font Awesome 6 icon, works the same as in TextUI
iconColor - Set a different color for the provided icon

Example:

lib.notify({
title = 'Notification title',
description = 'Notification description',
type = 'success'
})

notification

lib.defaultNotify​

Default notifications provided by Chakra UI.

-- title: string (if description then optional)
-- description: string (if title then optional)
-- duration: number (optional)
-- position: ToastPositionWithLogical (optional)
-- status: "info" | "warning" | "success" | "error" (optional)
-- id: number (optional)

lib.defaultNotify(data)

Example:

lib.defaultNotify({
title = 'Notification title',
description = 'Notification description',
status = 'success'
})

default_notification

- + \ No newline at end of file diff --git a/docs/ox_lib/Interface/Client/progress/index.html b/docs/ox_lib/Interface/Client/progress/index.html index 86784931..5ffbc32e 100644 --- a/docs/ox_lib/Interface/Client/progress/index.html +++ b/docs/ox_lib/Interface/Client/progress/index.html @@ -5,7 +5,7 @@ Progress | Overextended - + @@ -14,7 +14,7 @@ as individual tables in the prop table.

Example:

if lib.progressBar({
duration = 2000,
label = 'Drinking water',
useWhileDead = false,
canCancel = true,
disable = {
car = true,
},
anim = {
dict = 'mp_player_intdrink',
clip = 'loop_bottle'
},
prop = {
model = `prop_ld_flow_bottle`,
pos = vec3(0.03, 0.03, 0.02),
rot = vec3(0.0, 0.0, -1.5)
},
}) then print('Do stuff when complete') else print('Do stuff when cancelled') end

progress_bar

lib.progressCircle​

Similar to lib.progressBar except it displays a circle and has no label and you can define a position.

-- duration: number
-- position: "middle" or "bottom" (optional - default is "middle")
-- useWhileDead: boolean (optional)
-- canCancel: boolean (optional)
-- anim: table (optional)
-- dict: string (optional - either scenario or dict)
-- clip: string
-- flag: number (optional - default is 49)
-- blendIn: float (optional - default is 3.0)
-- blendOut: float (optional - default is 1.0)
-- duration: number (optional - default is -1)
-- flag: number (optional - default is 49)
-- playbackRate: number (optional - default is 0)
-- lockX: boolean (optional)
-- lockY: boolean (optional)
-- lockZ: boolean (optional)

-- scenario: string (optional - either scenario or dict)
-- playEnter: boolean (optional - default is true)
-- prop: table (optional)
-- model: hash
-- x: number
-- y: number
-- z: number
-- bone: number (optional - default is 60309)
-- pos: table
-- x: number
-- y: number
-- z: number
-- rot: table
-- x: number
-- y: number
-- z: number
-- disable: table (optional)
-- move: boolean (optional)
-- car: boolean (optional)
-- comabt: boolean (optional)
-- mouse: boolean (optional)
--- ...: number (optional - Keys to disable, can have unlimted)

lib.progressCircle(data)

Example:

if lib.progressCircle({
duration = 2000,
position = 'bottom',
useWhileDead = false,
canCancel = true,
disable = {
car = true,
},
anim = {
dict = 'mp_player_intdrink',
clip = 'loop_bottle'
},
prop = {
model = `prop_ld_flow_bottle`,
pos = vec3(0.03, 0.03, 0.02),
rot = vec3(0.0, 0.0, -1.5)
},
}) then print('Do stuff when complete') else print('Do stuff when cancelled') end

progress_circle

lib.progressActive​

Returns true if a progress bar is currently active.

lib.progressActive()

lib.cancelProgress​

If there is a progress bar active and the progress bar can be cancelled then it cancels it.

lib.cancelProgress()
- + \ No newline at end of file diff --git a/docs/ox_lib/Interface/Client/textui/index.html b/docs/ox_lib/Interface/Client/textui/index.html index fdb4a173..467ab1b1 100644 --- a/docs/ox_lib/Interface/Client/textui/index.html +++ b/docs/ox_lib/Interface/Client/textui/index.html @@ -5,7 +5,7 @@ TextUI | Overextended - + @@ -15,7 +15,7 @@ the default icon type will be solid.
If you want to use a different icon type, i.e apple as a brand, you need to define icon as a table with the first value being the icon type as a string, and the second being the icon name.

icon = {'fab', 'apple'}

lib.hideTextUI​

Hides the currently visible TextUI window

lib.hideTextUI()
- + \ No newline at end of file diff --git a/docs/ox_lib/Locale/Shared/index.html b/docs/ox_lib/Locale/Shared/index.html index 01a23853..8eaf6df6 100644 --- a/docs/ox_lib/Locale/Shared/index.html +++ b/docs/ox_lib/Locale/Shared/index.html @@ -5,14 +5,14 @@ Shared | Overextended - +

Shared

Allows players to set a preferred language and attempt to load locale files in any resources using the module.
Locale files should use the ISO Language Code and be saved as ./locales/langcode.json

Players can use setlocale [langcode], and admins can use serverlocale [langcode] to change the loaded file.

-- str: string
-- ...: string | number
locale(str, ...)

Additional arguments can be sent to format the locale output.

-- Load the locale module
lib.locale()

SetInterval(function()
print(locale('grand_theft_auto'))
print(locale('suspect_sex', locale('male')))
end, 5000)
locales/en-US.json
{
"grand_theft_auto": "grand theft auto",
"male": "male",
"female": "female",
"suspect_sex": "suspect is %s",
}
locales/fr-FR.json
{
"grand_theft_auto": "vol de voiture",
"male": "homme",
"female": "femme",
"suspect_sex": "le suspect est %s",
}
fxmanifest.lua
files {
'locales/*.json'
}
- + \ No newline at end of file diff --git a/docs/ox_lib/Logger/Server/index.html b/docs/ox_lib/Logger/Server/index.html index 222e4a6b..55556c27 100644 --- a/docs/ox_lib/Logger/Server/index.html +++ b/docs/ox_lib/Logger/Server/index.html @@ -5,7 +5,7 @@ Server | Overextended - + @@ -14,7 +14,7 @@ Modify your server.cfg with the newly generated API key and intake server.

  • datadoghq.com
  • us3.datadoghq.com
  • us5.datadoghq.com
  • datadoghq.eu
set datadog:key "yourapikey"
set datadog:site "datadoghq.com"
-- source: string | number
-- event: string
-- message: string
-- ...: string
lib.logger(source, event, message, ...)

Source is passed to ddsource and creates a tag. Could be playerId, identifier, -1, or server.
Event is passed to ddservice and displays in the logs list.
Additional arguments are converted into tags for additional filtering and search options.

local vehicle = Ox.CreateVehicle(false, `sultanrs`, vec(-56.479122, -1116.870362, 26.432250, 0.000030517578))
lib.logger(-1, 'CreateVehicle', json.encode(vehicle))

image

image

- + \ No newline at end of file diff --git a/docs/ox_lib/Points/Client/index.html b/docs/ox_lib/Points/Client/index.html index 3769c584..576c89a0 100644 --- a/docs/ox_lib/Points/Client/index.html +++ b/docs/ox_lib/Points/Client/index.html @@ -5,13 +5,13 @@ Points | Overextended - +

Points

Simple and centralised distance checking, supporting callbacks when entering, leaving, and standing in-range of set coordinates.

-- coords: vector3
-- distance: number
-- data: table
lib.points.new(coords, distance, data)

local point = lib.points.new(playerCoords, 5, {
dunak = 'nerd',
})

function point:onEnter()
print('entered range of point', self.id)
end

function point:onExit()
print('left range of point', self.id)
end

function point:nearby()
DrawMarker(2, self.coords.x, self.coords.y, self.coords.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 200, 20, 20, 50, false, true, 2, nil, nil, false)

if self.currentDistance < 1 and IsControlJustReleased(0, 38) then
print('inside marker', self.id)
print(self.dunak)
end
end

Points can be deleted by using the remove method.

point:remove()
- + \ No newline at end of file diff --git a/docs/ox_lib/Streaming/Client/index.html b/docs/ox_lib/Streaming/Client/index.html index 7847bb00..5f2ef915 100644 --- a/docs/ox_lib/Streaming/Client/index.html +++ b/docs/ox_lib/Streaming/Client/index.html @@ -5,14 +5,14 @@ Client | Overextended - +

Client

Check if assets exist, such as models, and loads them into memory.
Throws errors for invalid assets and returns true if the asset is loaded.

lib.requestAnimDict​

-- dict: string
-- timeout: number [default: 100]
lib.requestAnimDict(dict, timeout)

lib.requestAnimSet​

-- set: string
-- timeout: number [default: 100]
lib.requestAnimSet(set, timeout)

lib.requestModel​

-- model: string
-- timeout: number [default: 100]
lib.requestModel(model, timeout)

lib.requestStreamedTextureDict​

-- dict: string
-- timeout: number [default: 100]
lib.requestStreamedTextureDict(dict, timeout)

lib.requestNamedPtfxAsset​

-- fxName: string
-- timeout: number [default: 100]
lib.requestNamedPtfxAsset(fxName, timeout)
- + \ No newline at end of file diff --git a/docs/ox_lib/VehicleProperties/Client/index.html b/docs/ox_lib/VehicleProperties/Client/index.html index 9318d1b9..df0bda47 100644 --- a/docs/ox_lib/VehicleProperties/Client/index.html +++ b/docs/ox_lib/VehicleProperties/Client/index.html @@ -5,14 +5,14 @@ Client | Overextended - +

Client

Mostly follows the format used by ESX and QBCore, with extra data such as damaged/missing props.
https://github.com/overextended/ox_lib/blob/master/resource/vehicleProperties/client.lua#L5

lib.getVehicleProperties​

-- vehicle: entity
lib.getVehicleProperties(vehicle)

lib.getVehicleProperties(GetVehiclePedIsUsing(PlayerPedId()))

lib.setVehicleProperties​

Requires the vehicle to belong to the client. Do not use NetworkRequestControlOfEntity.

-- vehicle: entity
-- props: table
lib.setVehicleProperties(vehicle, props)

RegisterNetEvent('lualib:setVehicleProperties', function(netid, data)
lib.setVehicleProperties(NetToVeh(netid), data)
end)

The server should tell the owner of the entity to set properties, using the following trigger.

TriggerClientEvent('lualib:setVehicleProperties', entityOwner, vehNetId, data)
- + \ No newline at end of file diff --git a/docs/ox_lib/Version/Server/index.html b/docs/ox_lib/Version/Server/index.html index a650c137..23cf4d63 100644 --- a/docs/ox_lib/Version/Server/index.html +++ b/docs/ox_lib/Version/Server/index.html @@ -5,13 +5,13 @@ Server | Overextended - +

Server

lib.versionCheck​

Compares the resource version to the latest published release on GitHub.

-- repository: string
lib.versionCheck(repository)

lib.versionCheck('overextended/ox_lib')

Utilises GitHub's release API

- + \ No newline at end of file diff --git a/docs/ox_lib/Version/Shared/index.html b/docs/ox_lib/Version/Shared/index.html index f844c38b..da4a0241 100644 --- a/docs/ox_lib/Version/Shared/index.html +++ b/docs/ox_lib/Version/Shared/index.html @@ -5,13 +5,13 @@ Shared | Overextended - +

Shared

lib.checkDependency​

Check if a resource is using a specified version or higher, allowing for compatibility checks or throwing errors.

-- resource: string
-- version: string
lib.checkDependency(resource, version)

if not lib.checkDependency('ox_lib', '1.5.0') then error() end
- + \ No newline at end of file diff --git a/docs/ox_lib/Zones/Client/index.html b/docs/ox_lib/Zones/Client/index.html index 5686222d..1675a31b 100644 --- a/docs/ox_lib/Zones/Client/index.html +++ b/docs/ox_lib/Zones/Client/index.html @@ -5,13 +5,13 @@ Client | Overextended - +

Client

An alternative to PolyZone utilising glm.polygon.

-- data: table
-- points: vector3[] all z values must match
-- thickness: number (optional), default 4
-- debug: bool (optional)
lib.zones.poly(data)

-- data: table
-- coords: vector3
-- size: vector3 (optional), default is vec3(4, 4, 4)
-- rotation: number (optional), angle in degrees
-- debug: bool (optional)
lib.zones.box(data)

-- data: table
-- coords: vector3
-- radius: number (optional), default is 2
-- debug: bool (optional)
lib.zones.sphere(data)
function onEnter(self)
print('entered zone', self.id)
end

function onExit(self)
print('exited zone', self.id)
end

function inside(self)
print('you are inside zone ' .. self.id)
end

local poly = lib.zones.poly({
points = {
vec(413.8, -1026.1, 29),
vec(411.6, -1023.1, 29),
vec(412.2, -1018.0, 29),
vec(417.2, -1016.3, 29),
vec(422.3, -1020.0, 29),
vec(426.8, -1015.9, 29),
vec(431.8, -1013.0, 29),
vec(437.3, -1018.4, 29),
vec(432.4, -1027.2, 29),
vec(424.7, -1023.5, 29),
vec(420.0, -1030.2, 29),
vec(409.8, -1028.4, 29),
},
thickness = 2,
debug = true,
inside = inside,
onEnter = onEnter,
onExit = onExit
})

local sphere = lib.zones.sphere({
coords = vec3(442.5363, -1017.666, 28.65637),
radius = 1,
debug = true,
inside = inside,
onEnter = onEnter,
onExit = onExit
})

local box = lib.zones.box({
coords = vec3(442.5363, -1017.666, 28.65637),
size = vec3(1, 1, 1),
rotation = 45,
debug = true,
inside = insideZone,
onEnter = onEnter,
onExit = onExit
})

Zones can be deleted by using the remove method.

poly:remove()
sphere:remove()
box:remove()
- + \ No newline at end of file diff --git a/docs/ox_lib/index.html b/docs/ox_lib/index.html index 04d2e3c2..3ca92af6 100644 --- a/docs/ox_lib/index.html +++ b/docs/ox_lib/index.html @@ -5,7 +5,7 @@ Getting Started | Overextended - + @@ -15,7 +15,7 @@ a shared_script in your fxmanifest.lua file.

shared_scripts {
'@ox_lib/init.lua'
}

Or if the library is the only shared script you use you can do:

shared_script '@ox_lib/init.lua'

That's it!
You can now use the library functions inside of your resource, check the rest of the documentation to see how to utilise them.

- + \ No newline at end of file diff --git a/docs/oxmysql/Getting Started/benchmark/index.html b/docs/oxmysql/Getting Started/benchmark/index.html index 84cef69f..e7c34afb 100644 --- a/docs/oxmysql/Getting Started/benchmark/index.html +++ b/docs/oxmysql/Getting Started/benchmark/index.html @@ -5,13 +5,13 @@ Benchmark | Overextended - +

Benchmark

Internal benchmark

Low: 0.1222ms | Avg: 0.14188357ms | Total: 1418.8357ms (10000 queries)

Round-trip-time for exports

Low: 0.1997ms | Avg: 0.25898800ms | Total: 2589.8800ms (10000 queries)

Lua (5.4)​

local val = 10000
RegisterCommand('luasync', function()
local queryTimesLocal = {}
local result
MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'})

for i=1, val do
local time = os.nanotime()
local r = MySQL.prepare.await('SELECT identifier from users WHERE lastname = ?', {'Linden'})
queryTimesLocal[#queryTimesLocal+1] = (os.nanotime() - time) / 1000000
if i==1 then result = r end
end

local queryMsLow, queryMsSum = 1000, 0

for _, v in pairs(queryTimesLocal) do queryMsSum = queryMsSum + v end
for _, v in pairs(queryTimesLocal) do
if v < queryMsLow then queryMsLow = v end
end

local averageQueryTime = queryMsSum / #queryTimesLocal
print(json.encode(result))
print('Low: '.. queryMsLow ..'ms | Avg: '..averageQueryTime..'ms | Total: '..queryMsSum..'ms ('..#queryTimesLocal..' queries)')
end)

JavaScript​

const val = 10000
RegisterCommand('jssync', async() => {
const queryTimesLocal = [];
let result
await exports.oxmysql.prepare_async('SELECT identifier from users WHERE lastname = ?', ['Linden'])

for(let i=0; i < val; i++) {
const startTime = process.hrtime()
const r = await exports.oxmysql.prepare_async('SELECT identifier from users WHERE lastname = ?', ['Linden'])
queryTimesLocal.push(process.hrtime(startTime)[1] / 1000000)
if (i === 0) result = r
}

const queryMsSum = queryTimesLocal.reduce((a, b) => a + b, 0)
const queryMsLow = queryTimesLocal.sort((a, b) => a - b)[0]
const averageQueryTime = queryMsSum / queryTimesLocal.length

console.log(result)
console.log('Low: '+ queryMsLow +'ms | Avg: '+averageQueryTime+'ms | Total: '+queryMsSum+'ms ('+queryTimesLocal.length+' queries)')
})
- + \ No newline at end of file diff --git a/docs/oxmysql/Getting Started/issues/index.html b/docs/oxmysql/Getting Started/issues/index.html index 65b22c8f..eb8b4d09 100644 --- a/docs/oxmysql/Getting Started/issues/index.html +++ b/docs/oxmysql/Getting Started/issues/index.html @@ -5,14 +5,14 @@ Common Issues | Overextended - +

Common Issues

Unable to establish a connection​

This is usually the result of incorrect database settings or your password containing reserved characters (; , / ? : @ & = + $ #).

Solution

Ensure you have entered the correct database settings in the mysql_connection_string convar.
You can try using the semicolon-separated format if your password contains reserved characters.

No such export ... in resource oxmysql​

Typically the result of failing to follow instructions.

Solution

Download the latest release build (not source) of oxmysql, and ensure it is starting before any resources that require it.

- + \ No newline at end of file diff --git a/docs/oxmysql/Getting Started/placeholders/index.html b/docs/oxmysql/Getting Started/placeholders/index.html index 9ee19831..6ff15efc 100644 --- a/docs/oxmysql/Getting Started/placeholders/index.html +++ b/docs/oxmysql/Getting Started/placeholders/index.html @@ -5,13 +5,13 @@ Placeholders | Overextended - +

Placeholders

This allows queries to be properly prepared and escaped; the following lines are equivalent.

"SELECT group FROM users WHERE identifier = ?", {identifier}
"SELECT group FROM users WHERE identifier = :identifier", {identifier = identifier}
"SELECT group FROM users WHERE identifier = @identifier", {['@identifier'] = identifier}

Named placeholders are deprecated and should be avoided as much as possible.

- + \ No newline at end of file diff --git a/docs/oxmysql/Usage/index.html b/docs/oxmysql/Usage/index.html index b66104e3..dfc8f083 100644 --- a/docs/oxmysql/Usage/index.html +++ b/docs/oxmysql/Usage/index.html @@ -5,13 +5,13 @@ Usage | Overextended - +

Usage

-- Lua
MySQL.query('SELECT * from users WHERE identifier = ?', {identifier}, function(result)
-- callback response
-- same as MySQL.Async.fetchAll
end)
CreateThread(function()
local result = MySQL.query.await('SELECT * from users WHERE identifier = ?', {identifier})
-- await a promise to resolve
-- same as MySQL.Sync.fetchAll
end)
// JS
exports.oxmysql.query('SELECT * from users WHERE identifier = ?', [identifier], (result) => {
// callback response
})(async () => {
const result = await exports.oxmysql.query_async('SELECT * from users WHERE identifier = ?', [identifier]);
// await a promise to resolve
})();
exports.oxmysql.query_async('SELECT * from users WHERE identifier = ?', [identifier]).then((result) => {
// utilise .then to resolve a promise like a callback
});
- + \ No newline at end of file diff --git a/docs/oxmysql/Usage/insert/index.html b/docs/oxmysql/Usage/insert/index.html index e07d1916..6b7f5a2b 100644 --- a/docs/oxmysql/Usage/insert/index.html +++ b/docs/oxmysql/Usage/insert/index.html @@ -5,13 +5,13 @@ Insert | Overextended - +

Insert

Inserts a new entry into the database and returns the insert id for the row, if valid.

Lua​

Callback​

-- Alias: exports.oxmysql:insert
-- Alias: MySQL.Async.insert
MySQL.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName}, function(id)
print(id)
end)

Promise​

-- Alias: exports.oxmysql:insert_async
-- Alias: MySQL.Sync.insert
CreateThread(function()
local id = MySQL.insert.await('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', {playerIdentifier, firstName, lastName})
print(id)
end)

JavaScript​

Callback​

exports.oxmysql.insert('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)', [playerIdentifier, firstName, lastName], function(id) {
console.log(id)
})

Promise​

(async () => {
const id = exports.oxmysql.insert_async('INSERT INTO users (identifier, firstname, lastname) VALUES (?, ?, ?)',
[playerIdentifier, firstName, lastName]) {
console.log(id)
})()
- + \ No newline at end of file diff --git a/docs/oxmysql/Usage/prepare/index.html b/docs/oxmysql/Usage/prepare/index.html index da51226f..259ec3fc 100644 --- a/docs/oxmysql/Usage/prepare/index.html +++ b/docs/oxmysql/Usage/prepare/index.html @@ -5,14 +5,14 @@ Prepare | Overextended - +

Prepare

The only function that provides true prepared statements, granting native protection and query planning by MySQL.
Prepare can be used to execute frequently called queries faster and accepts multiple sets of parameters to be used with a single query.

  • Date will not return the datestring commonly used in FiveM
  • TINYINT 1 and BIT will not return a boolean
  • You can only use ? value placeholders, ?? column placeholders and named placeholders will throw an error

When using SELECT, the return value will match query, single, or scalar depending on the number of columns and rows selected.

Lua​

Callback​

-- Alias: exports.oxmysql:prepare
-- Alias: MySQL.Async.prepare

MySQL.prepare('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then
for _, v in pairs(result) do
print(v.identifier, v.firstname, v.lastname)
end
end
end)

Promise​

-- Alias: exports.oxmysql:prepare_async
-- Alias: MySQL.Sync.prepare

CreateThread(function()
local result = MySQL.prepare.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then
for _, v in pairs(result) do
print(v.identifier, v.firstname, v.lastname)
end
end
end)

JavaScript​

Callback​

exports.oxmysql.prepare('SELECT * FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
if (result) {
result.forEach((v) => {
console.log(v.identifier, v.firstname, v.lastname)
})
}
})

Promise​

(async () => {
const result = await exports.oxmysql.prepare_async('SELECT * FROM users WHERE identifier = ?', [playerIdentifier]) {
if (result) {
result.forEach((v) => {
console.log(v.identifier, v.firstname, v.lastname)
})
}
})()
- + \ No newline at end of file diff --git a/docs/oxmysql/Usage/query/index.html b/docs/oxmysql/Usage/query/index.html index d73db8e2..d57b06ce 100644 --- a/docs/oxmysql/Usage/query/index.html +++ b/docs/oxmysql/Usage/query/index.html @@ -5,14 +5,14 @@ Query | Overextended - +

Query

Generic function that can be utilised for any query.
When selecting data it will return all matching rows and columns, otherwise it will return field data such as insertid, affectedRows, etc.

Lua​

Callback​

-- Alias: exports.oxmysql:query
-- Alias: MySQL.Async.query

MySQL.query('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then
for _, v in pairs(result) do
print(v.identifier, v.firstname, v.lastname)
end
end
end)

Promise​

-- Alias: exports.oxmysql:query_async
-- Alias: MySQL.Sync.query

CreateThread(function()
local result = MySQL.query.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then
for _, v in pairs(result) do
print(v.identifier, v.firstname, v.lastname)
end
end
end)

JavaScript​

Callback​

exports.oxmysql.query('SELECT * FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
if (result) {
result.forEach((v) => {
console.log(v.identifier, v.firstname, v.lastname)
})
}
})

Promise​

(async () => {
const result = await exports.oxmysql.query_async('SELECT * FROM users WHERE identifier = ?', [playerIdentifier]) {
if (result) {
result.forEach((v) => {
console.log(v.identifier, v.firstname, v.lastname)
})
}
})()
- + \ No newline at end of file diff --git a/docs/oxmysql/Usage/scalar/index.html b/docs/oxmysql/Usage/scalar/index.html index ac580556..10579c27 100644 --- a/docs/oxmysql/Usage/scalar/index.html +++ b/docs/oxmysql/Usage/scalar/index.html @@ -5,13 +5,13 @@ Scalar | Overextended - +

Scalar

Returns the first column for a single row.

Lua​

Callback​

-- Alias: exports.oxmysql:scalar
-- Alias: MySQL.Async.fetchScalar

MySQL.scalar('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier}, function(firstname)
print(firstname)
end)

Promise​

-- Alias: exports.oxmysql:scalar_async
-- Alias: MySQL.Sync.fetchScalar

CreateThread(function()
local firstname = MySQL.scalar.await('SELECT firstname FROM users WHERE identifier = ?', {playerIdentifier})
print(firstname)
end)

JavaScript​

Callback​

exports.oxmysql.scalar('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier], function(firstname) {
console.log(firstname)
})

Promise​

(async () => {
const firstname = await exports.oxmysql.scalar_async('SELECT firstname FROM users WHERE identifier = ?', [playerIdentifier]) {
console.log(firstname)
})()
- + \ No newline at end of file diff --git a/docs/oxmysql/Usage/single/index.html b/docs/oxmysql/Usage/single/index.html index d58882d6..d61292ec 100644 --- a/docs/oxmysql/Usage/single/index.html +++ b/docs/oxmysql/Usage/single/index.html @@ -5,13 +5,13 @@ Single | Overextended - +

Single

Returns the columns for a single row.

Lua​

Callback​

-- Alias: exports.oxmysql:single
-- Alias: MySQL.Async.fetchSingle

MySQL.single('SELECT * FROM users WHERE identifier = ?', {playerIdentifier}, function(result)
if result then
print(result.identifier, result.firstname, result.lastname)
end
end)

Promise​

-- Alias: exports.oxmysql:single_async
-- Alias: MySQL.Sync.fetchSingle

CreateThread(function()
local result = MySQL.single.await('SELECT * FROM users WHERE identifier = ?', {playerIdentifier})
if result then
print(result.identifier, result.firstname, result.lastname)
end
end)

JavaScript​

Callback​

exports.oxmysql.single('SELECT * FROM users WHERE identifier = ?', [playerIdentifier], function(result) {
if (result)
console.log(result.identifier, result.firstname, result.lastname)
})

Promise​

setImmediate(async () => {
const result = await exports.oxmysql.single_async('SELECT * FROM users WHERE identifier = ?', [playerIdentifier]) {
if (result)
console.log(result.identifier, result.firstname, result.lastname)
})
- + \ No newline at end of file diff --git a/docs/oxmysql/Usage/transaction/index.html b/docs/oxmysql/Usage/transaction/index.html index f03da84d..fc5109a6 100644 --- a/docs/oxmysql/Usage/transaction/index.html +++ b/docs/oxmysql/Usage/transaction/index.html @@ -5,14 +5,14 @@ Transaction | Overextended - +

Transaction

Transactions​

A transaction executes multiple queries and commits them only if all succeed. If one fails, none of the queries are committed. The return value is a boolean, which is the result of the transaction.

Specific Format​

When using the Specific format you must pass one parameter to the oxmysql export. In this case, the queries parameter contains your queries and the SQL variables unique to each query.

This is useful for transactions where the queries do not share many SQL variables.

Usage​

Lua​

local queries = {
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { ['someid'] = 1 } },
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { ['someid'] = 2 } }
} -- NOTE, the 'values' tables can be named 'parameters' here for MySQL-Async compatibility.

-- Async
-- Alias: exports.oxmysql:transaction
-- Alias: MySQL.Async.transaction
MySQL.transaction(queries, function(result)
print(result)
end)

-- Sync
-- Alias: exports.oxmysql:transaction_async
-- Alias: MySQL.Sync.transaction
local result = MySQL.transaction.await(queries)
print(result)

JavaScript​

const queries = [
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { someid = 1 } },
{ query = 'INSERT INTO `test` (id) VALUES (:someid)', values = { someid = 2 } }
] // NOTE, the 'values' objects can be named 'parameters' here for MySQL-Async compatibility.

// Async
exports.oxmysql.transaction(queries, (result) => {
console.log(result)
})

// Sync
const result = await exports.oxmysql.transactionSync(queries)
console.log(result)

Shared Format​

When using the Shared format you must pass two parameters to the oxmysql export. The queries and the parameters those queries will use.
This is useful if your queries use the same SQL variables.

Lua​

local queries = {
'INSERT INTO `test` (id, name) VALUES (:someid, :somename)',
'SET `name` = :newname IN `test` WHERE `id` = :someid'
}

local parameters = { ['someid'] = 2, ['somename'] = 'John Doe', ['newname'] = 'John Notdoe' }

-- Async
-- Alias: exports.oxmysql:transaction
-- Alias: MySQL.Async.transaction
MySQL.transaction(queries, parameters, function(result)
print(result)
end)

-- Sync
-- Alias: exports.oxmysql:transaction_async
-- Alias: MySQL.Sync.transaction
local result = MySQL.transaction.await(queries, parameters)
print(result)

JavaScript​

const queries = [
'INSERT INTO `test` (id, name) VALUES (:someid, :somename)',
'SET `name` = :newname IN `test` WHERE `id` = :someid'
]

const parameters = { someid = 2, somename = 'John Doe', newname = 'John Notdoe' }

// Async
exports.oxmysql.transaction(queries, parameters, (result) => {
console.log(result)
})

// Sync
const result = await exports.oxmysql.transactionSync(queries, parameters)
console.log(result)

Transaction Isolation Level​

This can be set through the convar mysql_transaction_isolation_level which should be an integer ranging from 1-4. The default convar value set by oxmysql is 2.

Convar ValueResult
1Repeatable Read
2Read Committed
3Read Uncommitted
4Serializable
- + \ No newline at end of file diff --git a/docs/oxmysql/Usage/update/index.html b/docs/oxmysql/Usage/update/index.html index d745ccbe..2f5e9b18 100644 --- a/docs/oxmysql/Usage/update/index.html +++ b/docs/oxmysql/Usage/update/index.html @@ -5,13 +5,13 @@ Update | Overextended - +

Update

Returns the number of affected rows by the query.

Lua​

Callback​

-- Alias: exports.oxmysql:update
-- Alias: MySQL.Async.execute

MySQL.update('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier}, function(affectedRows)
if affectedRows then
print(affectedRows)
end
end)

Promise​

-- Alias: exports.oxmysql:update_async
-- Alias: MySQL.Sync.execute

CreateThread(function()
local affectedRows = MySQL.update.await('UPDATE users SET firstname = ? WHERE identifier = ?', {newName, playerIdentifier})
if affectedRows then
print(affectedRows)
end
end)

JavaScript​

Callback​

exports.oxmysql.update('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier], function(affectedRows) {
if (affectedRows)
console.log(affectedRows)
})

Promise​

setImmediate(async () => {
const id = exports.oxmysql.update_async('UPDATE users SET firstname = ? WHERE identifier = ? ', [newName, playerIdentifier]) {
if (affectedRows)
console.log(affectedRows)
})
- + \ No newline at end of file diff --git a/docs/oxmysql/index.html b/docs/oxmysql/index.html index 4c426cb8..ab2dd1c4 100644 --- a/docs/oxmysql/index.html +++ b/docs/oxmysql/index.html @@ -5,7 +5,7 @@ Getting Started | Overextended - + @@ -15,7 +15,7 @@ Reference the following for an idea of how to set your connection options. You must include one of the following lines, adjusted for your connection and database settings.

set mysql_connection_string "mysql://root:12345@localhost/es_extended?charset=utf8mb4"
set mysql_connection_string "user=root;database=es_extended;password=12345;charset=utf8mb4"

Certain special characters are reserved or blocked and may cause issues when used in your password.
For more optional settings (such as multiple statements) you can reference pool.d.ts and connection.d.ts.

You can also add the following convars if you require extra information when testing queries.

set mysql_slow_query_warning 150
set mysql_debug true

Using the UI​

Before using the UI first you have to make sure you have the mysql_ui convar set to true:

set mysql_ui true

Also make sure that you have command ace permission access, then you should be able to use the mysql command in game to open up the UI and see your query data.

- + \ No newline at end of file diff --git a/index.html b/index.html index ed5deb03..ff25d3e4 100644 --- a/index.html +++ b/index.html @@ -5,13 +5,13 @@ Overextended | Overextended - +
ox

Overextended

Official documentation for Overextended resources

- + \ No newline at end of file diff --git a/markdown-page/index.html b/markdown-page/index.html index d40751ef..c2eeb089 100644 --- a/markdown-page/index.html +++ b/markdown-page/index.html @@ -5,13 +5,13 @@ Markdown page example | Overextended - +

Markdown page example

You don't need React to write simple standalone pages.

- + \ No newline at end of file diff --git a/search/index.html b/search/index.html index 6c8f3c77..55ef99e3 100644 --- a/search/index.html +++ b/search/index.html @@ -5,13 +5,13 @@ Search the documentation | Overextended - + - + \ No newline at end of file