diff --git a/resources/[housing]/renzu_motels-main.zip b/resources/[housing]/renzu_motels-main.zip
new file mode 100644
index 000000000..fc395dea1
Binary files /dev/null and b/resources/[housing]/renzu_motels-main.zip differ
diff --git a/resources/[housing]/renzu_motels/LICENSE b/resources/[housing]/renzu_motels/LICENSE
new file mode 100644
index 000000000..f288702d2
--- /dev/null
+++ b/resources/[housing]/renzu_motels/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/resources/[housing]/renzu_motels/README.md b/resources/[housing]/renzu_motels/README.md
new file mode 100644
index 000000000..1599ab469
--- /dev/null
+++ b/resources/[housing]/renzu_motels/README.md
@@ -0,0 +1,30 @@
+# renzu_motels
+Fivem - Motel Management. Hourly Rental System. Supports MLO and Shells. ESX/QBCORE
+
+
+
+# Features
+- Player Motel Business Management (change hour rates, hire employees, add / kick occupants)
+- Hourly Rental System
+- Configurable Maximum Occupants per room
+- Configurable Sharable Room Stash (stealable) or Unique per Players
+- Police can Break in using Gunshot in doors.
+- Lockpickable Doors
+- Supports MLO / Shells
+- Supports Multiple Skin resource for Wardrobes.
+- Support Targets or Zone Markers
+- Support Metadata item Keys Sharing
+
+# Dependency
+- ox_lib
+- ESX / QBCORE
+- ox_inventory / qb-inventory
+- ox_target / qb-target (optional)
+
+# Item name
+- keys
+
+# Todo
+```
+some features im looking to add later like Job Owneds
+```
diff --git a/resources/[housing]/renzu_motels/bridge/framework/client/esx.lua b/resources/[housing]/renzu_motels/bridge/framework/client/esx.lua
new file mode 100644
index 000000000..db55b740f
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/framework/client/esx.lua
@@ -0,0 +1,31 @@
+if not ESX then return end
+PlayerData = ESX.GetPlayerData()
+local kvpname = GetCurrentServerEndpoint()..'_inshells'
+
+RegisterNetEvent('esx:playerLoaded')
+AddEventHandler('esx:playerLoaded',function(playerData)
+ PlayerData = playerData
+ local login = GetResourceKvpString(kvpname)
+ if not login then return end
+ local data = json.decode(login)
+ LocalPlayer.state:set('inshell',true,true)
+ LocalPlayer.state:set('lastloc',data.lastloc,false)
+ DoScreenFadeOut(0)
+ EnterShell(data,true)
+end)
+
+RegisterNetEvent('esx:setJob')
+AddEventHandler('esx:setJob', function(job)
+ PlayerData.job = job
+end)
+
+GetInventoryItems = function(name)
+ local PlayerData = ESX.GetPlayerData()
+ local data = {}
+ for _, item in pairs(PlayerData.inventory) do
+ if name == item.name then
+ table.insert(data,item)
+ end
+ end
+ return data
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/framework/client/qbcore.lua b/resources/[housing]/renzu_motels/bridge/framework/client/qbcore.lua
new file mode 100644
index 000000000..6a2a1e5aa
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/framework/client/qbcore.lua
@@ -0,0 +1,49 @@
+if not QBCORE then return end
+PlayerData = QBCORE.Functions.GetPlayerData()
+local kvpname = GetCurrentServerEndpoint()..'_inshells'
+
+if PlayerData.job ~= nil then
+ PlayerData.job.grade = PlayerData.job.grade.level
+end
+
+if PlayerData.identifier == nil then
+ PlayerData.identifier = PlayerData.citizenid
+end
+
+RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
+ Wait(1500)
+ PlayerData = QBCORE.Functions.GetPlayerData()
+
+ if PlayerData.job ~= nil then
+ PlayerData.job.grade = PlayerData.job.grade.level
+ end
+
+ if PlayerData.identifier == nil then
+ PlayerData.identifier = PlayerData.citizenid
+ end
+ local login = GetResourceKvpString(kvpname)
+ if not login then return end
+ local data = json.decode(login)
+ LocalPlayer.state:set('inshell',true,true)
+ LocalPlayer.state:set('lastloc',data.lastloc,false)
+ DoScreenFadeOut(0)
+ EnterShell(data,true)
+end)
+
+RegisterNetEvent('QBCore:Client:OnJobUpdate', function(job)
+ PlayerData.job = job
+
+ PlayerData.job.grade = PlayerData.job.grade.level
+end)
+
+GetInventoryItems = function(name)
+ local data = {}
+ local PlayerData = QBCORE.Functions.GetPlayerData()
+ for _, item in pairs(PlayerData.items) do
+ if name == item.name then
+ item.metadata = item.info
+ table.insert(data,item)
+ end
+ end
+ return data
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/framework/server/esx.lua b/resources/[housing]/renzu_motels/bridge/framework/server/esx.lua
new file mode 100644
index 000000000..dd2171bfc
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/framework/server/esx.lua
@@ -0,0 +1,8 @@
+if not ESX then return end
+
+GetPlayerFromId = function(src)
+ if type(src) == 'string' then
+ return ESX.GetPlayerFromIdentifier(src)
+ end
+ return ESX.GetPlayerFromId(src)
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/framework/server/qbcore.lua b/resources/[housing]/renzu_motels/bridge/framework/server/qbcore.lua
new file mode 100644
index 000000000..78688179e
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/framework/server/qbcore.lua
@@ -0,0 +1,37 @@
+if not QBCORE then return end
+
+GetPlayerFromId = function(src)
+ local self = QBCORE.Functions.GetPlayer(src)
+ if not self then return end
+
+ if self.identifier == nil then
+ self.identifier = self.PlayerData.citizenid
+ end
+
+ self.getMoney = function(value)
+ return self.PlayerData.money['cash']
+ end
+
+ self.removeMoney = function(value)
+ self.Functions.RemoveMoney('cash',tonumber(value))
+ return true
+ end
+ self.name = self.PlayerData.charinfo.firstname
+
+ self.addMoney = function(value)
+ return self.Functions.AddMoney('cash',tonumber(value))
+ end
+
+ self.removeAccountMoney = function(type,val)
+ if type == 'money' then type = 'cash' end
+ self.Functions.RemoveMoney(type,tonumber(val))
+ return true
+ end
+
+ self.getAccount = function(type)
+ if type == 'money' then type = 'cash' end
+ return {money = self.PlayerData.money[type]}
+ end
+
+ return self
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/inventory/client/ox_inventory.lua b/resources/[housing]/renzu_motels/bridge/inventory/client/ox_inventory.lua
new file mode 100644
index 000000000..0a1630111
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/inventory/client/ox_inventory.lua
@@ -0,0 +1,5 @@
+if GetResourceState('ox_inventory') ~= 'started' then return end
+
+OpenStash = function(data,identifier)
+ TriggerEvent('ox_inventory:openInventory', 'stash', {id = 'stash_'..data.motel..'_'..identifier..'_'..data.index, name = 'Storage', slots = 70, weight = 70000, coords = GetEntityCoords(cache.ped)})
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/inventory/client/qb-inventory.lua b/resources/[housing]/renzu_motels/bridge/inventory/client/qb-inventory.lua
new file mode 100644
index 000000000..64511f9d0
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/inventory/client/qb-inventory.lua
@@ -0,0 +1,7 @@
+if GetResourceState('qb-inventory') ~= 'started' then return end
+
+OpenStash = function(data,identifier)
+ TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'stash_'..data.motel..'_'..identifier..'_'..data.index, {})
+ TriggerServerEvent("InteractSound_SV:PlayOnSource", "StashOpen", 0.4)
+ TriggerEvent("inventory:client:SetCurrentStash", 'stash_'..data.motel..'_'..identifier..'_'..data.index)
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/inventory/client/quasargago.lua b/resources/[housing]/renzu_motels/bridge/inventory/client/quasargago.lua
new file mode 100644
index 000000000..6e8391477
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/inventory/client/quasargago.lua
@@ -0,0 +1,7 @@
+if GetResourceState('qs-inventory') ~= 'started' then return end
+
+OpenStash = function(data,identifier)
+ TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'stash_'..data.motel..'_'..identifier..'_'..data.index, {})
+ TriggerServerEvent("InteractSound_SV:PlayOnSource", "StashOpen", 0.4)
+ TriggerEvent("inventory:client:SetCurrentStash", 'stash_'..data.motel..'_'..identifier..'_'..data.index)
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/inventory/server/ox_inventory.lua b/resources/[housing]/renzu_motels/bridge/inventory/server/ox_inventory.lua
new file mode 100644
index 000000000..204f4dce8
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/inventory/server/ox_inventory.lua
@@ -0,0 +1,9 @@
+if GetResourceState('ox_inventory') ~= 'started' then return end
+
+AddItem = function(src, item, count, metadata)
+ return exports.ox_inventory:AddItem(src, item, count, metadata)
+end
+
+RemoveItem = function(src, item, count, metadata)
+ return exports.ox_inventory:RemoveItem(src, item, count, metadata)
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/inventory/server/qb-inventory.lua b/resources/[housing]/renzu_motels/bridge/inventory/server/qb-inventory.lua
new file mode 100644
index 000000000..b92967d9e
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/inventory/server/qb-inventory.lua
@@ -0,0 +1,9 @@
+if GetResourceState('qb-inventory') ~= 'started' then return end
+
+AddItem = function(src, item, count, metadata)
+ return exports['qb-inventory']:AddItem(src, item, count, slot, metadata)
+end
+
+RemoveItem = function(src, item, count, metadata)
+ return exports['qb-inventory']:RemoveItem(src, item, count, slot, metadata)
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/inventory/server/quasargago.lua b/resources/[housing]/renzu_motels/bridge/inventory/server/quasargago.lua
new file mode 100644
index 000000000..28003b758
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/inventory/server/quasargago.lua
@@ -0,0 +1,10 @@
+if GetResourceState('qs-inventory') ~= 'started' then return end
+
+AddItem = function(src, item, count, metadata)
+ if metadata then metadata.showAllDescriptions = true end
+ return TriggerEvent('inventory:server:addItem', src, item, count, false, metadata)
+end
+
+RemoveItem = function(src, item, count, metadata)
+ return TriggerEvent('inventory:server:removeItem', src, item, count, false, metadata)
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/target/ox_target.lua b/resources/[housing]/renzu_motels/bridge/target/ox_target.lua
new file mode 100644
index 000000000..0eed3dab1
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/target/ox_target.lua
@@ -0,0 +1,113 @@
+if GetResourceState('ox_target') ~= 'started' or not config.target then return end
+
+MotelFunction = function(data)
+ if not data.Mlo and data.type ~= 'door' then return end
+ local options = {}
+ if data.type == 'door' then
+ local doorIndex = data.doorindex + (joaat(data.motel))
+ AddDoorToSystem(doorIndex, data.door, data.coord)
+ SetDoorState(data)
+ local blip = AddBlipForCoord(data.coord.x,data.coord.y,data.coord.z)
+ SetBlipSprite(blip,685+data.index)
+ SetBlipColour(blip,0)
+ SetBlipSecondaryColour(blip,255,255,255)
+ SetBlipAsShortRange(blip,true)
+ SetBlipScale(blip,0.3)
+ BeginTextCommandSetBlipName("STRING")
+ AddTextComponentString('Door '..data.index)
+ EndTextCommandSetBlipName(blip)
+ table.insert(blips,blip)
+ table.insert(options,{
+ items = {'lockpick'},
+ name = data.index .. '_' .. data.type..'_lockpick',
+ onSelect = function()
+ return LockPick(data)
+ end,
+ icon = 'fas fa-unlink',
+ label = 'Lock Pick'
+ })
+ if not data.Mlo then
+ table.insert(options,{
+ name = data.index .. '_' .. data.type..'_lockpick',
+ onSelect = function()
+ return EnterShell(data)
+ end,
+ icon = 'fas fa-person-booth',
+ label = 'Enter'
+ })
+ end
+ end
+ table.insert(options,{
+ name = data.index .. '_' .. data.type,
+ onSelect = function()
+ return RoomFunction(data)
+ end,
+ icon = config.icons[data.type],
+ label = data.label
+ })
+ local targetid = exports.ox_target:addBoxZone({
+ coords = data.coord,
+ size = vec3(2, 2, 2),
+ rotation = 45,
+ debug = false,
+ options = options
+ })
+ table.insert(zones,targetid)
+end
+
+removeTargetZone = function(id)
+ return exports['ox_target']:removeZone(id)
+end
+
+ShellTargets = function(data,offsets,loc,house)
+ Wait(2000)
+ for k,v in pairs(offsets) do
+ local options = {}
+ table.insert(options,{
+ name = data.motel .. '_' .. k..'_'..data.index,
+ onSelect = function()
+ data.type = k
+ return RoomFunction(data)
+ end,
+ icon = config.icons[k],
+ label = config.Text[k]
+ })
+ if k == 'exit' then
+ table.insert(options,{
+ name = data.motel .. '_' .. k..'_'..data.index..'_door',
+ onSelect = function()
+ data.type = 'door'
+ return Door(data)
+ end,
+ icon = config.icons[k],
+ label = 'Toggle Door'
+ })
+ end
+
+ if k == 'stash' then
+ local motels = GlobalState.Motels[data.motel]
+ local room = motels?.rooms[data.index] or {}
+ local keys = GetPlayerKeys(data,room)
+ for identifier,name in pairs(keys) do
+ table.insert(options,{
+ name = data.motel .. '_' .. k..'_'..data.index..'_'..identifier,
+ onSelect = function()
+ data.type = k
+ return RoomFunction(data,identifier)
+ end,
+ icon = config.icons[k],
+ label = config.Text[k]..' - ['..name..']'
+ })
+ end
+ end
+
+ local targetid = exports.ox_target:addBoxZone({
+ coords = loc+v,
+ size = vec3(2, 2, 2),
+ rotation = 45,
+ debug = false,
+ options = options
+ })
+ table.insert(shelzones,targetid)
+ end
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/target/qb-target.lua b/resources/[housing]/renzu_motels/bridge/target/qb-target.lua
new file mode 100644
index 000000000..291d95add
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/target/qb-target.lua
@@ -0,0 +1,124 @@
+if GetResourceState('ox_target') == 'started'
+or GetResourceState('ox_target') ~= 'started' and GetResourceState('qb-target') ~= 'started' or not config.target then return end
+
+MotelFunction = function(data)
+ if not data.Mlo and data.type ~= 'door' then return end
+ local options = {}
+ if data.type == 'door' then
+ local doorIndex = data.doorindex + (joaat(data.motel))
+ AddDoorToSystem(doorIndex, data.door, data.coord)
+ SetDoorState(data)
+ local blip = AddBlipForCoord(data.coord.x,data.coord.y,data.coord.z)
+ SetBlipSprite(blip,685+data.index)
+ SetBlipColour(blip,0)
+ SetBlipSecondaryColour(blip,255,255,255)
+ SetBlipAsShortRange(blip,true)
+ SetBlipScale(blip,0.3)
+ BeginTextCommandSetBlipName("STRING")
+ AddTextComponentString('Door '..data.index)
+ EndTextCommandSetBlipName(blip)
+ table.insert(blips,blip)
+ table.insert(options,{
+ item = 'lockpick',
+ name = data.index .. '_' .. data.type..'_lockpick',
+ action = function()
+ return LockPick(data)
+ end,
+ icon = 'fas fa-unlink',
+ label = 'Lock Pick'
+ })
+ if not data.Mlo then
+ table.insert(options,{
+ name = data.index .. '_' .. data.type..'_lockpick',
+ action = function()
+ return EnterShell(data)
+ end,
+ icon = 'fas fa-person-booth',
+ label = 'Enter'
+ })
+ end
+ end
+ table.insert(options,{
+ name = data.index .. '_' .. data.type,
+ action = function()
+ return RoomFunction(data)
+ end,
+ icon = config.icons[data.type],
+ label = data.label
+ })
+ local target = {
+ coords = data.coord,
+ size = vec3(2, 2, 2),
+ rotation = 45,
+ debug = drawZones,
+ options = options
+ }
+ local targetid = data.index .. '_' .. data.type
+ exports['qb-target']:AddBoxZone(targetid,data.coord,0.40,0.40,{
+ name = targetid,
+ debugPoly = false,
+ minZ = data.coord.z-0.2,
+ maxZ = data.coord.z+0.2
+ },target)
+ table.insert(zones,targetid)
+end
+
+removeTargetZone = function(id)
+ return exports['qb-target']:RemoveZone(id)
+end
+
+ShellTargets = function(data,offsets,loc,house)
+ Wait(2000)
+ for k,v in pairs(offsets) do
+ local options = {}
+ table.insert(options,{
+ name = data.motel .. '_' .. k..'_'..data.index,
+ action = function()
+ data.type = k
+ return RoomFunction(data)
+ end,
+ icon = config.icons[k],
+ label = config.Text[k]
+ })
+ if k == 'exit' then
+ table.insert(options,{
+ name = data.motel .. '_' .. k..'_'..data.index..'_door',
+ action = function()
+ data.type = 'door'
+ return Door(data)
+ end,
+ icon = config.icons[k],
+ label = 'Toggle Door'
+ })
+ end
+
+ if k == 'stash' then
+ local motels = GlobalState.Motels[data.motel]
+ local room = motels?.rooms[data.index] or {}
+ local keys = GetPlayerKeys(data,room)
+ for identifier,name in pairs(keys) do
+ table.insert(options,{
+ name = data.motel .. '_' .. k..'_'..data.index..'_'..identifier,
+ action = function()
+ data.type = k
+ return RoomFunction(data,identifier)
+ end,
+ icon = config.icons[k],
+ label = config.Text[k]..' - ['..name..']'
+ })
+ end
+ end
+
+ local targetid = data.motel .. '_' .. k..'_'..data.index
+ exports['qb-target']:AddBoxZone(targetid, loc+v, 0.75, 0.75, {
+ name = targetid,
+ debugPoly = false,
+ minZ = (loc+v).z-0.45,
+ maxZ = (loc+v).z+0.45,
+ }, {
+ options = options,
+ distance = 5.5
+ })
+ table.insert(shelzones,targetid)
+ end
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/bridge/zones.lua b/resources/[housing]/renzu_motels/bridge/zones.lua
new file mode 100644
index 000000000..5fa96889c
--- /dev/null
+++ b/resources/[housing]/renzu_motels/bridge/zones.lua
@@ -0,0 +1,178 @@
+if config.target then return end
+
+ZoneMenu = function(data)
+ local options = {}
+ if data.type == 'door' then
+ local haslockpick = false
+ for _, item in pairs(GetInventoryItems('lockpick') or {}) do
+ if item.name == 'lockpick' then
+ haslockpick = true
+ break
+ end
+ end
+ if haslockpick then
+ table.insert(options,{
+ items = {'lockpick'},
+ name = data.index .. '_' .. data.type..'_lockpick',
+ onSelect = function()
+ return LockPick(data)
+ end,
+ icon = 'unlink',
+ title = 'Lock Pick'
+ })
+ end
+ if not data.Mlo then
+ table.insert(options,{
+ name = data.index .. '_' .. data.type..'_lockpick',
+ onSelect = function()
+ return EnterShell(data)
+ end,
+ icon = 'person-booth',
+ title = 'Enter'
+ })
+ end
+ end
+ table.insert(options,{
+ name = data.index .. '_' .. data.type,
+ onSelect = function()
+ return RoomFunction(data)
+ end,
+ icon = config.icons[data.type],
+ title = data.label
+ })
+ if data.type == 'stash' then
+ local motels = GlobalState.Motels[data.motel]
+ local room = motels?.rooms[data.index] or {}
+ local keys = GetPlayerKeys(data,room)
+ for identifier,name in pairs(keys) do
+ table.insert(options,{
+ name = data.index .. '_' .. data.type,
+ onSelect = function()
+ return RoomFunction(data,identifier)
+ end,
+ icon = config.icons[data.type],
+ title = data.label..' - ['..name..']'
+ })
+ end
+ end
+ lib.registerContext({
+ id = 'door_menu',
+ title = 'Door Menu',
+ options = options
+ })
+ lib.showContext('door_menu')
+end
+
+MotelFunction = function(data)
+ if not data.Mlo and data.type ~= 'door' then return end
+ local options = {}
+ if data.type == 'door' then
+ local doorindex = data.doorindex + (joaat(data.motel))
+ AddDoorToSystem(doorindex, data.door, data.coord)
+ SetDoorState(data)
+ local blip = AddBlipForCoord(data.coord.x,data.coord.y,data.coord.z)
+ SetBlipSprite(blip,685+data.index)
+ SetBlipColour(blip,0)
+ SetBlipSecondaryColour(blip,255,255,255)
+ SetBlipAsShortRange(blip,true)
+ SetBlipScale(blip,0.3)
+ BeginTextCommandSetBlipName("STRING")
+ AddTextComponentString('Door '..data.index)
+ EndTextCommandSetBlipName(blip)
+ table.insert(blips,blip)
+ end
+
+ local point = lib.points.new(data.coord, 2)
+
+ function point:onEnter()
+ local text = data.type == 'door' and 'Door '..data.index or data.type:upper()
+ lib.showTextUI('[E] - '..text)
+ end
+
+ function point:onExit()
+ lib.hideTextUI()
+ 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, 0.4, 0.4, 0.4, 200, 255, 255, 50, false, true, 2, nil, nil, false)
+
+ if self.currentDistance < 1 and IsControlJustReleased(0, 38) then
+ ZoneMenu(data)
+ end
+ end
+ table.insert(zones,point)
+end
+
+removeTargetZone = function(point)
+ return point:remove()
+end
+
+RoomMenu = function(type,data)
+ local options = {}
+ table.insert(options,{
+ name = data.motel .. '_' .. type..'_'..data.index,
+ onSelect = function()
+ data.type = type
+ return RoomFunction(data)
+ end,
+ icon = config.icons[type],
+ title = type:upper()
+ })
+ if type == 'stash' then
+ local motels = GlobalState.Motels[data.motel]
+ local room = motels?.rooms[data.index] or {}
+ local keys = GetPlayerKeys(data,room)
+ for identifier,name in pairs(keys) do
+ table.insert(options,{
+ name = data.index .. '_' .. type,
+ onSelect = function()
+ data.type = type
+ return RoomFunction(data,identifier)
+ end,
+ icon = config.icons[type],
+ title = config.Text[type]..' - ['..name..']'
+ })
+ end
+ end
+ if type == 'exit' then
+ table.insert(options,{
+ name = data.motel .. '_' ..type..'_'..data.index..'_door',
+ onSelect = function()
+ data.type = 'door'
+ return Door(data)
+ end,
+ icon = config.icons[type],
+ title = 'Toggle Door'
+ })
+ end
+ lib.registerContext({
+ id = 'room_menu',
+ title = 'Room Menu',
+ options = options
+ })
+ lib.showContext('room_menu')
+end
+
+ShellTargets = function(data,offsets,loc,house)
+ Wait(2000)
+ for k,v in pairs(offsets) do
+ local point = lib.points.new(loc+v, 1.5)
+
+ function point:onEnter()
+ lib.showTextUI('[E] - Room '..k)
+ end
+
+ function point:onExit()
+ lib.hideTextUI()
+ 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, 0.4, 0.4, 0.4, 200, 255, 255, 50, false, true, 2, nil, nil, false)
+
+ if self.currentDistance < 1 and IsControlJustReleased(0, 38) then
+ RoomMenu(k,data)
+ end
+ end
+ table.insert(shelzones,point)
+ end
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/client/main.lua b/resources/[housing]/renzu_motels/client/main.lua
new file mode 100644
index 000000000..331c6f5b8
--- /dev/null
+++ b/resources/[housing]/renzu_motels/client/main.lua
@@ -0,0 +1,979 @@
+local kvpname = GetCurrentServerEndpoint()..'_inshells'
+CreateBlips = function()
+ for k,v in pairs(config.motels) do
+ local blip = AddBlipForCoord(v.rentcoord.x,v.rentcoord.y,v.rentcoord.z)
+ SetBlipSprite(blip,475)
+ SetBlipColour(blip,2)
+ SetBlipAsShortRange(blip,true)
+ SetBlipScale(blip,0.6)
+ BeginTextCommandSetBlipName("STRING")
+ AddTextComponentString(v.label)
+ EndTextCommandSetBlipName(blip)
+ end
+end
+
+RegisterNetEvent('renzu_motels:invoice')
+AddEventHandler('renzu_motels:invoice', function(data)
+ local motels = GlobalState.Motels
+ local buy = lib.alertDialog({
+ header = 'Invoice',
+ content = ' \n ## INFO \n **Description:** '..data.description..' \n **Amount:** $ '..data.amount..' \n **Payment method:** '..data.payment,
+ centered = true,
+ labels = {
+ cancel = 'close',
+ confirm = 'Pay'
+ },
+ cancel = true
+ })
+ if buy ~= 'cancel' then
+ local success = lib.callback.await('renzu_motels:payinvoice',false,data)
+ if success then
+ Notify('You Successfully Pay the Invoice','success')
+ else
+ Notify('Fail to Pay the Invoice','error')
+ end
+ end
+end)
+
+DoesPlayerHaveAccess = function(data)
+ for identifier, _ in pairs(data) do
+ if identifier == PlayerData?.identifier then return true end
+ end
+ return false
+end
+
+DoesPlayerHaveKey = function(data,room)
+ local items = GetInventoryItems('keys')
+ if not items then return false end
+ for k,v in pairs(items) do
+ if v.metadata?.type == data.motel and v.metadata?.serial == data.index then
+ return v.metadata?.owner and room?.players[v.metadata?.owner] or false
+ end
+ end
+ return false
+end
+
+GetPlayerKeys = function(data,room)
+ local items = GetInventoryItems('keys')
+ if not items then return false end
+ local keys = {}
+ for k,v in pairs(items) do
+ if v.metadata?.type == data.motel and v.metadata?.serial == data.index then
+ local key = v.metadata?.owner and room?.players[v.metadata?.owner]
+ if key then
+ keys[v.metadata.owner] = key.name
+ end
+ end
+ end
+ return keys
+end
+
+SetDoorState = function(data)
+ local motels = GlobalState.Motels or {}
+ local doorindex = data.index + (joaat(data.motel))
+ DoorSystemSetDoorState(doorindex, 1)
+end
+
+RegisterNetEvent('renzu_motels:Door', function(data)
+ if not data.Mlo then return end
+ local doorindex = data.doorindex + (joaat(data.motel))
+ DoorSystemSetDoorState(doorindex, DoorSystemGetDoorState(doorindex) == 0 and 1 or 0, false, false)
+end)
+
+Door = function(data)
+ local dist = #(data.coord - GetEntityCoords(cache.ped)) < 2
+ local motel = GlobalState.Motels[data.motel]
+ local moteldoor = motel and motel.rooms[data.index]
+ if moteldoor and DoesPlayerHaveAccess(motel.rooms[data.index].players)
+ or moteldoor and DoesPlayerHaveKey(data,moteldoor) or IsOwnerOrEmployee(data.motel) then
+ lib.RequestAnimDict('mp_doorbell')
+ TaskPlayAnim(PlayerPedId(), "mp_doorbell", "open_door", 1.0, 1.0, 1000, 1, 1, 0, 0, 0)
+ TriggerServerEvent('renzu_motels:Door', {
+ motel = data.motel,
+ index = data.index,
+ doorindex = data.doorindex,
+ coord = data.coord,
+ Mlo = data.Mlo,
+ })
+ local text
+ if data.Mlo then
+ local doorindex = data.index + (joaat(data.motel))
+ text = DoorSystemGetDoorState(doorindex) == 0 and 'You Locked the Motel Door' or 'You Unlocked the Motel Door'
+ else
+ text = not moteldoor?.lock and 'You Locked the Motel Door' or 'You Unlocked the Motel Door'
+ end
+ Wait(1000)
+ --PlaySoundFromEntity(-1, "Hood_Open", cache.ped , 'Lowrider_Super_Mod_Garage_Sounds', 0, 0)
+ local data = {
+ file = 'door',
+ volume = 0.5
+ }
+ SendNUIMessage({
+ type = "playsound",
+ content = data
+ })
+ Notify(text, 'inform')
+ else
+ Notify('you dont have access', 'error')
+ end
+end
+
+isRentExpired = function(data)
+ local motels = GlobalState.Motels[data.motel]
+ local room = motels?.rooms[data.index] or {}
+ local player = room?.players[PlayerData.identifier] or {}
+ return player?.duration and player?.duration < GlobalState.MotelTimer
+end
+
+RoomFunction = function(data,identifier)
+ if isRentExpired(data) then
+ return Notify('Your Rent is Due. \n Please Pay to Access')
+ end
+ if data.type == 'door' then
+ return Door(data)
+ elseif data.type == 'stash' then
+ local stashid = identifier or data.uniquestash and PlayerData.identifier or 'room'
+ return OpenStash(data,stashid)
+ elseif data.type == 'wardrobe' then
+ return config.wardrobes[config.wardrobe]()
+ elseif config.extrafunction[data.type] then
+ local stashid = identifier or data.uniquestash and PlayerData.identifier or 'room'
+ return config.extrafunction[data.type](data,stashid)
+ end
+end
+
+LockPick = function(data)
+ local success = nil
+ SetTimeout(1000,function()
+ repeat
+ local lockpick = lib.progressBar({
+ duration = 10000,
+ label = 'Breaking in..',
+ useWhileDead = false,
+ canCancel = true,
+ anim = {
+ dict = 'veh@break_in@0h@p_m_one@',
+ clip = 'low_force_entry_ds'
+ },
+ })
+ Wait(0)
+ until success ~= nil
+ end)
+ success = lib.skillCheck({'easy', 'easy', {areaSize = 60, speedMultiplier = 2}, 'easy'})
+ if lib.progressActive() then
+ lib.cancelProgress()
+ end
+ if success then
+ TriggerServerEvent('renzu_motels:Door', {
+ motel = data.motel,
+ index = data.index,
+ doorindex = data.doorindex,
+ coord = data.coord,
+ Mlo = data.Mlo
+ })
+ local doorindex = data.index + (joaat(data.motel))
+ Notify(DoorSystemGetDoorState(doorindex) == 0 and 'You Locked the Motel Door' or 'You Unlocked the Motel Door', 'inform')
+ end
+end
+
+Notify = function(msg,type)
+ lib.notify({
+ description = msg,
+ type = type or 'inform'
+ })
+end
+
+MyRoomMenu = function(data)
+ local motels = GlobalState.Motels
+ local rate = motels[data.motel].hour_rate or data.rate
+
+ local options = {
+ {
+ title = 'My Room ['..data.index..'] - Pay a rent',
+ description = 'Pay your rent in due or advanced to Door '..data.index..' \n Rent Duration: '..data.duration..' \n '..data.rental_period..' Rate: $ '..rate,
+ icon = 'money-bill-wave-alt',
+ onSelect = function()
+ local input = lib.inputDialog('Pay or Deposit to motel', {
+ {type = 'number', label = 'Amount to Deposit', description = '$ '..rate..' per '..data.rental_period..' \n Payment Method: '..data.payment, icon = 'money', default = rate},
+ })
+ if not input then return end
+ local success = lib.callback.await('renzu_motels:payrent',false,{
+ payment = data.payment,
+ index = data.index,
+ motel = data.motel,
+ amount = input[1],
+ rate = rate,
+ rental_period = data.rental_period
+ })
+ if success then
+ Notify('Successfully pay a rent', 'success')
+ else
+ Notify('Fail to pay a rent', 'error')
+ end
+ end,
+ arrow = true,
+ },
+ {
+ title = 'Generate Key Item',
+ description = 'Request a Door Key',
+ icon = 'key',
+ onSelect = function()
+ local success = lib.callback.await('renzu_motels:motelkey',false,{
+ index = data.index,
+ motel = data.motel,
+ })
+ if success then
+ Notify('Successfully requested a sharable motel key', 'success')
+ else
+ Notify('Fail to Generate Key', 'error')
+ end
+ end,
+ arrow = true,
+ },
+ {
+ title = 'End Rent',
+ description = 'End your rental period',
+ icon = 'ban',
+ onSelect = function()
+ if isRentExpired(data) then
+ Notify('Failed to End rent to room '..data.index..' \n Reason: your have a Balance Debt to pay','error')
+ return
+ end
+ local End = lib.alertDialog({
+ header = '## Warning',
+ content = ' You will no longer have access to the door and to your safes.',
+ centered = true,
+ labels = {
+ cancel = 'close',
+ confirm = 'End',
+ },
+ cancel = true
+ })
+ if End == 'cancel' then return end
+ local success = lib.callback.await('renzu_motels:removeoccupant',false,data,data.index,PlayerData.identifier)
+ if success then
+ Notify('Successfully End Your Rent to room '..data.index,'success')
+ else
+ Notify('Failed to End rent to room '..data.index,'error')
+ end
+ end,
+ arrow = true,
+ },
+ }
+ lib.registerContext({
+ id = 'myroom',
+ menu = 'roomlist',
+ title = 'My Motel Room Option',
+ options = options
+ })
+ lib.showContext('myroom')
+end
+
+CountOccupants = function(players)
+ local count = 0
+ for k,v in pairs(players or {}) do
+ count += 1
+ end
+ return count
+end
+
+RoomList = function(data)
+ local motels , time = lib.callback.await('renzu_motels:getMotels',false)
+ local rate = motels[data.motel].hour_rate or data.rate
+ local options = {}
+ --local motels = GlobalState.Motels
+ for doorindex,v in ipairs(data.doors) do
+ local playerroom = motels[data.motel].rooms[doorindex].players[PlayerData.identifier]
+ local duration = playerroom?.duration
+ local occupants = CountOccupants(motels[data.motel].rooms[doorindex].players)
+ if occupants < data.maxoccupants and not duration then
+ table.insert(options,{
+ title = 'Rent Motel room #'..doorindex,
+ description = 'Choose room #'..doorindex..' \n Occupants: '..occupants..'/'..data.maxoccupants,
+ icon = 'door-closed',
+ onSelect = function()
+ local input = lib.inputDialog('Rent Duration', {
+ {type = 'number', label = 'Select a Duration in '..data.rental_period..'s', description = '$ '..rate..' per '..data.rental_period..' \n Payment Method: '..data.payment, icon = 'clock', default = 1},
+ })
+ if not input then return end
+ local success = lib.callback.await('renzu_motels:rentaroom',false,{
+ index = doorindex,
+ motel = data.motel,
+ duration = input[1],
+ rate = rate,
+ rental_period = data.rental_period,
+ payment = data.payment,
+ uniquestash = data.uniquestash
+ })
+ if success then
+ Notify('Successfully rent a room', 'success')
+ else
+ Notify('Fail to Rent a Room', 'error')
+ end
+ end,
+ arrow = true,
+ })
+ elseif duration then
+ local hour = math.floor((duration - time) / 3600)
+ local duration_left = hour .. ' Hours : '..math.floor(((duration - time) / 60) - (60 * hour))..' Minutes'
+ table.insert(options,{
+ title = 'My Room Door #'..doorindex..' Options',
+ description = 'Pay your rent or request a motel key',
+ icon = 'cog',
+ onSelect = function()
+ return MyRoomMenu({
+ payment = data.payment,
+ index = doorindex,
+ motel = data.motel,
+ duration = duration_left,
+ rate = rate,
+ rental_period = data.rental_period
+ })
+ end,
+ arrow = true,
+ })
+ end
+ end
+ lib.registerContext({
+ id = 'roomlist',
+ menu = 'rentmenu',
+ title = 'Choose a Room',
+ options = options
+ })
+ lib.showContext('roomlist')
+end
+
+IsOwnerOrEmployee = function(motel)
+ local motels = GlobalState.Motels
+ return motels[motel].owned == PlayerData.identifier or motels[motel].employees[PlayerData.identifier]
+end
+
+MotelRentalMenu = function(data)
+ local motels = GlobalState.Motels
+ local rate = motels[data.motel].hour_rate or data.rate
+ local options = {}
+ if not data.manual then
+ table.insert(options,{
+ title = 'Rent a New Motel room',
+ description = ' \n Choose a room to rent \n '..data.rental_period..' Rate: $'..rate,
+ icon = 'hotel',
+ onSelect = function()
+ return RoomList(data)
+ end,
+ arrow = true,
+ })
+ end
+ if not motels[data.motel].owned and config.business or IsOwnerOrEmployee(data.motel) and config.business then
+ local title = not motels[data.motel].owned and 'Buy Motel Business' or 'Motel Management'
+ local description = not motels[data.motel].owned and 'Cost: '..data.businessprice or 'Manage Employees , Occupants and finance.'
+ table.insert(options,{
+ title = title,
+ description = description,
+ icon = 'hotel',
+ onSelect = function()
+ return MotelOwner(data)
+ end,
+ arrow = true,
+ })
+ end
+
+ if #options == 0 then
+ Notify('This Motels Manually Accept Occupants \n Contact the Owner')
+ Wait(1500)
+ return SendMessageApi(data.motel)
+ end
+
+ lib.registerContext({
+ id = 'rentmenu',
+ title = data.label,
+ options = options
+ })
+ lib.showContext('rentmenu')
+end
+
+SendMessageApi = function(motel)
+ local message = lib.alertDialog({
+ header = 'Do you want to Message the Owner?',
+ content = '## Message Motel Owner',
+ centered = true,
+ labels = {
+ cancel = 'close',
+ confirm = 'Message',
+ },
+ cancel = true
+ })
+ if message == 'cancel' then return end
+ local input = lib.inputDialog('Message', {
+ {type = 'input', label = 'Title', description = 'title of your message', icon = 'hash', required = true},
+ {type = 'textarea', label = 'Description', description = 'your message', icon = 'mail', required = true},
+ {type = 'number', label = 'Contact Number', icon = 'phone', required = false},
+ })
+
+ config.messageApi({title = input[1], message = input[2], motel = motel})
+end
+
+Owner = {}
+Owner.Rooms = {}
+Owner.Rooms.Occupants = function(data,index)
+ local motels , time = lib.callback.await('renzu_motels:getMotels',false)
+ local motel = motels[data.motel]
+ local players = motel.rooms[index] and motel.rooms[index].players or {}
+ local options = {}
+ for player,char in pairs(players) do
+ local hour = math.floor((char.duration - time) / 3600)
+ local name = char.name or 'No Name'
+ local duration_left = hour .. ' Hours : '..math.floor(((char.duration - time) / 60) - (60 * hour))..' Minutes'
+ table.insert(options,{
+ title = 'Occupant '..name,
+ description = 'Rent Duration: '..duration_left,
+ icon = 'hotel',
+ onSelect = function()
+ local kick = lib.alertDialog({
+ header = 'Confirmation',
+ content = '## Kick Occupant \n **Name:** '..name,
+ centered = true,
+ labels = {
+ cancel = 'close',
+ confirm = 'Kick',
+ waw = 'waw'
+ },
+ cancel = true
+ })
+ if kick == 'cancel' then return end
+ local success = lib.callback.await('renzu_motels:removeoccupant',false,data,index,player)
+ if success then
+ Notify('Successfully kicked '..name..' from room '..index,'success')
+ else
+ Notify('Failed to kicked '..name..' from room '..index,'error')
+ end
+ end,
+ arrow = true,
+ })
+ end
+ if data.maxoccupants > #options then
+ for i = 1, data.maxoccupants-#options do
+ table.insert(options,{
+ title = 'Vacant Slot ',
+ icon = 'hotel',
+ onSelect = function()
+ local input = lib.inputDialog('New Occupant', {
+ {type = 'number', label = 'Citizen ID', description = 'ID of the citizen you want to add', icon = 'id-card', required = true},
+ {type = 'number', label = 'Select a Duration in '..data.rental_period..'s', description = 'how many '..data.rental_period..'s', icon = 'clock', default = 1},
+ })
+ if not input then return end
+ local success = lib.callback.await('renzu_motels:addoccupant',false,data,index,input)
+ if success == 'exist' then
+ Notify('Already exist from room '..index,'error')
+ elseif success then
+ Notify('Successfully Add '..input[1]..' from room '..index,'success')
+ else
+ Notify('Failed to Add '..input[1]..' from room '..index,'error')
+ end
+ end,
+ arrow = true,
+ })
+ end
+ end
+ lib.registerContext({
+ menu = 'owner_rooms',
+ id = 'occupants_lists',
+ title = 'Room #'..index..' Occupants',
+ options = options
+ })
+ lib.showContext('occupants_lists')
+end
+
+Owner.Rooms.List = function(data)
+ local motels = GlobalState.Motels
+ local options = {}
+ for doorindex,v in ipairs(data.doors) do
+ local occupants = CountOccupants(motels[data.motel].rooms[doorindex].players)
+ table.insert(options,{
+ title = 'Room #'..doorindex,
+ description = 'Add or Kick Occupants from room #'..doorindex..' \n ***Occupants:*** '..occupants,
+ icon = 'hotel',
+ onSelect = function()
+ return Owner.Rooms.Occupants(data,doorindex)
+ end,
+ arrow = true,
+ })
+ end
+ lib.registerContext({
+ menu = 'motelmenu',
+ id = 'owner_rooms',
+ title = data.label,
+ options = options
+ })
+ lib.showContext('owner_rooms')
+end
+
+Owner.Employee = {}
+Owner.Employee.Manage = function(data)
+ local motel = GlobalState.Motels[data.motel]
+ local options = {
+ {
+ title = 'Add Employee',
+ description = 'Add nearby citizen to your motel employees',
+ icon = 'hotel',
+ onSelect = function()
+ local input = lib.inputDialog('Add Employee', {
+ {type = 'number', label = 'Citizen ID', description = 'ID of the citizen you want to add', icon = 'id-card', required = true},
+ })
+ if not input then return end
+ local success = lib.callback.await('renzu_motels:addemployee',false,data.motel,input[1])
+ if success then
+ Notify('Successfully Add to Employee Lists','success')
+ else
+ Notify('Failed to Add to Employee','error')
+ end
+ end,
+ arrow = true,
+ }
+ }
+ if motel and motel.employees then
+ for identifier,name in pairs(motel.employees) do
+ table.insert(options,{
+ title = name,
+ description = 'remove '..name..' to your Employee Lists',
+ icon = 'hotel',
+ onSelect = function()
+ local success = lib.callback.await('renzu_motels:removeemployee',false,data.motel,identifier)
+ if success then
+ Notify('Successfully remove from Employee Lists','success')
+ else
+ Notify('Failed to remove from Employee','error')
+ end
+ end,
+ arrow = true,
+ })
+ end
+ end
+ lib.registerContext({
+ id = 'employee_manage',
+ title = 'Employee Manage',
+ options = options
+ })
+ lib.showContext('employee_manage')
+end
+
+MotelOwner = function(data)
+ local motels = GlobalState.Motels
+ if not motels[data.motel].owned then
+ local buy = lib.alertDialog({
+ header = data.label,
+ content = ' \n ## INFO \n **Rooms:** '..#data.doors..' \n **Maximum Occupants:** '..#data.doors * data.maxoccupants..' \n **Price:** $'..data.businessprice,
+ centered = true,
+ labels = {
+ cancel = 'close',
+ confirm = 'buy'
+ },
+ cancel = true
+ })
+ if buy ~= 'cancel' then
+ local success = lib.callback.await('renzu_motels:buymotel',false,data)
+ if success then
+ Notify('You Successfully buy the motel','success')
+ else
+ Notify('Fail to buy the motel','error')
+ end
+ end
+ elseif IsOwnerOrEmployee(data.motel) then
+ local revenue = motels[data.motel].revenue or 0
+ local rate = motels[data.motel].hour_rate or data.rate
+ local options = {
+ {
+ title = 'Motel Rooms',
+ description = 'Add or Kick Occupants',
+ icon = 'hotel',
+ onSelect = function()
+ return Owner.Rooms.List(data)
+ end,
+ arrow = true,
+ },
+ {
+ title = 'Send Invoice',
+ description = 'Invoice nearby citizens',
+ icon = 'hotel',
+ onSelect = function()
+ local input = lib.inputDialog('Send Invoice', {
+ {type = 'number', label = 'Citizen ID', description = 'id of nearby citizen', icon = 'money', required = true},
+ {type = 'number', label = 'Amount', description = 'total amount to request', icon = 'money', required = true},
+ {type = 'input', label = 'Describe', description = 'Description of Invoice', icon = 'info'},
+ {type = 'checkbox', label = 'Payment Bank'},
+ })
+ if not input then return end
+ Notify('You Successfully Send the Invoice to '..input[1],'success')
+ local success = lib.callback.await('renzu_motels:sendinvoice',false,data.motel,input)
+ if success then
+ Notify('Invoice has been paid','success')
+ else
+ Notify('Invoice is not paid','error')
+ end
+ end,
+ arrow = true,
+ }
+ }
+ if motels[data.motel].owned == PlayerData.identifier then
+ table.insert(options,{
+ title = 'Adjust Hour Rates',
+ description = 'Modify current '..data.rental_period..' rates. \n '..data.rental_period..' Rates: '..rate,
+ icon = 'hotel',
+ onSelect = function()
+ local input = lib.inputDialog('Edit '..data.rental_period..' Rate', {
+ {type = 'number', label = 'Rate', description = 'Rate per '..data.rental_period..'', icon = 'money', required = true},
+ })
+ if not input then return end
+ local success = lib.callback.await('renzu_motels:editrate',false,data.motel,input[1])
+ if success then
+ Notify('You Successfully Change the '..data.rental_period..' Rate','success')
+ else
+ Notify('Fail to Modify','error')
+ end
+ end,
+ arrow = true,
+ })
+ table.insert(options,{
+ title = 'Motel Revenue',
+ description = 'Total: '..revenue,
+ icon = 'hotel',
+ onSelect = function()
+ local input = lib.inputDialog('Withdraw Funds', {
+ {type = 'number', label = 'Fund Amount', icon = 'money', required = true},
+ })
+ if not input then return end
+ local success = lib.callback.await('renzu_motels:withdrawfund',false,data.motel,input[1])
+ if success then
+ Notify('You Successfully Withdraw Funds','success')
+ else
+ Notify('Fail to Withdraw','error')
+ end
+ end,
+ arrow = true,
+ })
+ table.insert(options,{
+ title = 'Employee Management',
+ description = 'Add / Remove Employee',
+ icon = 'hotel',
+ onSelect = function()
+ return Owner.Employee.Manage(data)
+ end,
+ arrow = true,
+ })
+ table.insert(options,{
+ title = 'Transfer Ownership',
+ description = 'transfer to other nearby citizens',
+ icon = 'hotel',
+ onSelect = function()
+ local input = lib.inputDialog('Transfer Motel', {
+ {type = 'number', label = 'Citizen ID', description = 'ID of the citizen you want to be transfered', icon = 'id-card', required = true},
+ })
+ if not input then return end
+ local success = lib.callback.await('renzu_motels:transfermotel',false,data.motel,input[1])
+ if success then
+ Notify('Successfully Transfer Motel Ownership','success')
+ else
+ Notify('Failed to Transfer','error')
+ end
+ end,
+ arrow = true,
+ })
+ table.insert(options,{
+ title = 'Sell Motel',
+ description = 'Sell motel for half price',
+ icon = 'hotel',
+ onSelect = function()
+ local sell = lib.alertDialog({
+ header = data.label,
+ content = ' \n ## INFO \n **Selling Value:** $'..data.businessprice / 2,
+ centered = true,
+ labels = {
+ cancel = 'close',
+ confirm = 'Sell'
+ },
+ cancel = true
+ })
+ if sell ~= 'cancel' then
+ local success = lib.callback.await('renzu_motels:sellmotel',false,data)
+ if success then
+ Notify('You Successfully Sell the motel','success')
+ else
+ Notify('Fail to sell the motel','error')
+ end
+ end
+ end,
+ arrow = true,
+ })
+ end
+ lib.registerContext({
+ id = 'motelmenu',
+ menu = 'rentmenu',
+ title = data.label,
+ options = options
+ })
+ lib.showContext('motelmenu')
+ end
+end
+
+MotelRentalPoints = function(data)
+ local point = lib.points.new(data.rentcoord, 5, data)
+
+ function point:onEnter()
+ lib.showTextUI('[E] - Motel Rent', {
+ position = "top-center",
+ icon = 'hotel',
+ style = {
+ borderRadius = 0,
+ backgroundColor = '#48BB78',
+ color = 'white'
+ }
+ })
+ end
+
+ function point:onExit()
+ lib.hideTextUI()
+ 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, 0.7, 0.7, 0.7, 225, 225, 211, 50, false,true, 2, nil, nil, false)
+ if self.currentDistance < 1 and IsControlJustReleased(0, 38) then
+ MotelRentalMenu(data)
+ end
+ end
+ return point
+end
+
+local inMotelZone = false
+MotelZone = function(data)
+ local point = nil
+ function onEnter(self)
+ inMotelZone = true
+ Citizen.CreateThreadNow(function()
+ for index, doors in pairs(data.doors) do
+ for type, door in pairs(doors) do
+ if type == 'door' then
+ for doorindex,v in pairs(door) do
+ MotelFunction({
+ payment = data.payment or 'money',
+ uniquestash = data.uniquestash,
+ shell = data.shell,
+ Mlo = data.Mlo,
+ type = type,
+ index = index,
+ doorindex = index + doorindex,
+ coord = v.coord,
+ label = config.Text[type],
+ motel = data.motel,
+ door = v.model
+ })
+ end
+ else
+ MotelFunction({
+ payment = data.payment or 'money',
+ uniquestash = data.uniquestash,
+ shell = data.shell,
+ Mlo = data.Mlo,
+ type = type,
+ index = index,
+ coord = door,
+ label = config.Text[type],
+ motel = data.motel,
+ door = data.door
+ })
+ end
+ end
+ end
+ point = MotelRentalPoints(data)
+ end)
+ end
+
+ function onExit(self)
+ inMotelZone = false
+ point:remove()
+ for k,id in pairs(zones) do
+ removeTargetZone(id)
+ end
+ for k,id in pairs(blips) do
+ if DoesBlipExist(id) then
+ RemoveBlip(id)
+ end
+ end
+ zones = {}
+ end
+
+ local sphere = lib.zones.sphere({
+ coords = data.coord,
+ radius = data.radius,
+ debug = false,
+ inside = inside,
+ onEnter = onEnter,
+ onExit = onExit
+ })
+end
+
+--qb-interior func
+local house
+local inhouse = false
+function Teleport(x, y, z, h ,exit)
+ CreateThread(function()
+ SetEntityCoords(cache.ped, x, y, z, 0, 0, 0, false)
+ SetEntityHeading(cache.ped, h or 0.0)
+ Wait(1001)
+ DoScreenFadeIn(1000)
+ end)
+ if exit then
+ inhouse = false
+ TriggerEvent('qb-weathersync:client:EnableSync')
+ for k,id in pairs(shelzones) do
+ removeTargetZone(id)
+ end
+ DeleteEntity(house)
+ lib.callback.await('renzu_motels:SetRouting',false,data,'exit')
+ shelzones = {}
+ DeleteResourceKvp(kvpname)
+ LocalPlayer.state:set('inshell',false,true)
+ end
+end
+
+EnterShell = function(data,login)
+ local motels = GlobalState.Motels
+ if motels[data.motel].rooms[data.index].lock and not login then
+ Notify('Door is Locked', 'error')
+ return false
+ end
+ local shelldata = config.shells[data.shell or data.motel]
+ if not shelldata then
+ warn('Shell is not configure')
+ return
+ end
+ lib.callback.await('renzu_motels:SetRouting',false,data,'enter')
+ inhouse = true
+ Wait(1000)
+ local spawn = vec3(data.coord.x,data.coord.y,data.coord.z)+vec3(0.0,0.0,1500.0)
+ local offsets = shelldata.offsets
+ local model = shelldata.shell
+ DoScreenFadeOut(500)
+ while not IsScreenFadedOut() do
+ Wait(10)
+ end
+ inhouse = true
+ TriggerEvent('qb-weathersync:client:DisableSync')
+ RequestModel(model)
+ while not HasModelLoaded(model) do
+ Wait(1000)
+ end
+ local lastloc = GetEntityCoords(cache.ped)
+ house = CreateObject(model, spawn.x, spawn.y, spawn.z, false, false, false)
+ FreezeEntityPosition(house, true)
+ LocalPlayer.state:set('lastloc',data.lastloc or lastloc,false)
+ data.lastloc = data.lastloc or lastloc
+ if not login then
+ SendNUIMessage({
+ type = 'door'
+ })
+ end
+ Teleport(spawn.x + offsets.exit.x, spawn.y + offsets.exit.y, spawn.z+0.1, offsets.exit.h)
+ SetResourceKvp(kvpname,json.encode(data))
+
+ Citizen.CreateThreadNow(function()
+ ShellTargets(data,offsets,spawn,house)
+ while inhouse do
+ --SetRainLevel(0.0)
+ SetWeatherTypePersist('CLEAR')
+ SetWeatherTypeNow('CLEAR')
+ SetWeatherTypeNowPersist('CLEAR')
+ NetworkOverrideClockTime(18, 0, 0)
+ Wait(1)
+ end
+ end)
+ return house
+end
+
+function RotationToDirection(rotation)
+ local adjustedRotation =
+ {
+ x = (math.pi / 180) * rotation.x,
+ y = (math.pi / 180) * rotation.y,
+ z = (math.pi / 180) * rotation.z
+ }
+ local direction =
+ {
+ x = -math.sin(adjustedRotation.z) * math.abs(math.cos(adjustedRotation.x)),
+ y = math.cos(adjustedRotation.z) * math.abs(math.cos(adjustedRotation.x)),
+ z = math.sin(adjustedRotation.x)
+ }
+ return direction
+end
+
+function RayCastGamePlayCamera(distance,flag)
+ local cameraRotation = GetGameplayCamRot()
+ local cameraCoord = GetGameplayCamCoord()
+ local direction = RotationToDirection(cameraRotation)
+ local destination = vector3(cameraCoord.x + direction.x * distance,
+ cameraCoord.y + direction.y * distance,
+ cameraCoord.z + direction.z * distance
+ )
+ if not flag then
+ flag = 1
+ end
+
+ local a, b, c, d, e = GetShapeTestResultIncludingMaterial(StartShapeTestRay(cameraCoord.x, cameraCoord.y, cameraCoord.z, destination.x, destination.y, destination.z, flag, -1, 1))
+ return b, c, e, destination
+end
+
+local lastweapon = nil
+lib.onCache('weapon', function(weapon)
+ if not inMotelZone then return end
+ if not PlayerData.job then return end
+ if not config.breakinJobs[PlayerData.job.name] then return end
+ local motels = GlobalState.Motels
+ lastweapon = weapon
+ while weapon and weapon == lastweapon do
+ Wait(33)
+ if IsPedShooting(cache.ped) then
+ local _, bullet, _ = RayCastGamePlayCamera(200.0,1)
+ for k,data in pairs(config.motels) do
+ for k,v in pairs(data.doors) do
+ if v.door then
+ for k2,v in pairs(v.door) do
+ if #(vec3(bullet.x,bullet.y,bullet.z) - vec3(v.coord.x,v.coord.y,v.coord.z)) < 2 and motels[data.motel].rooms[k].lock then
+ TriggerServerEvent('renzu_motels:Door', {
+ motel = data.motel,
+ index = k,
+ doorindex = k + k2,
+ coord = v.coord,
+ Mlo = data.Mlo,
+ })
+ local text
+ if data.Mlo then
+ local doorindex = (k + k2) + (joaat(data.motel))
+ text = DoorSystemGetDoorState(doorindex) == 0 and 'You Destroy the Motel Door'
+ else
+ text = 'You Destroy the Motel Door'
+ end
+ Notify(text,'warning')
+ end
+ end
+ end
+ end
+ Wait(1000)
+ end
+ end
+ end
+end)
+
+RegisterNetEvent('renzu_motels:MessageOwner', function(data)
+ AddTextEntry('esxAdvancedNotification', data.message)
+ BeginTextCommandThefeedPost('esxAdvancedNotification')
+ ThefeedSetNextPostBackgroundColor(1)
+ AddTextComponentSubstringPlayerName(data.message)
+ EndTextCommandThefeedPostMessagetext('CHAR_FACEBOOK', 'CHAR_FACEBOOK', false, 1, data.motel, data.title)
+ EndTextCommandThefeedPostTicker(flash or false, true)
+end)
+
+Citizen.CreateThread(function()
+ while GlobalState.Motels == nil do Wait(1) end
+ for motel, data in pairs(config.motels) do
+ MotelZone(data)
+ end
+ CreateBlips()
+end)
diff --git a/resources/[housing]/renzu_motels/config.lua b/resources/[housing]/renzu_motels/config.lua
new file mode 100644
index 000000000..a8ea7abc6
--- /dev/null
+++ b/resources/[housing]/renzu_motels/config.lua
@@ -0,0 +1,388 @@
+config = {}
+config.wardrobe = 'illenium-appearance' -- choose your skin menu
+config.target = qb-target -- false = markers zones type. true = ox_target, qb-target
+config.business = false -- allowed players to purchase the motel
+config.autokickIfExpire = false -- auto kick occupants if rent is due. if false owner of motel must kick the occupants
+config.breakinJobs = { -- jobs can break in to door using gunfire in doors
+ ['police'] = true,
+ ['swat'] = true,
+}
+config.wardrobes = { -- skin menus
+ ['renzu_clothes'] = function()
+ exports.renzu_clothes:OpenClotheInventory()
+ end,
+ ['fivem-appearance'] = function()
+ return exports['fivem-appearance']:startPlayerCustomization() -- you could replace this with outfits events
+ end,
+ ['illenium-appearance'] = function()
+ return TriggerEvent('illenium-appearance:client:openOutfitMenu')
+ end,
+ ['qb-clothing'] = function()
+ return TriggerEvent('qb-clothing:client:openOutfitMenu')
+ end,
+ ['esx_skin'] = function()
+ TriggerEvent('esx_skin:openSaveableMenu')
+ end,
+}
+
+-- Shells Offsets and model name
+config.shells = {
+ ['standard'] = {
+ shell = `standardmotel_shell`, -- kambi shell
+ offsets = {
+ exit = vec3(327.53, -227.89, 39.84),
+ stash = vec3(1.368164, -3.134506, 1.16),
+ wardrobe = vec3(1.643646, 2.551102, 1.16),
+ }
+ },
+ ['modern'] = {
+ shell = `modernhotel_shell`, -- kambi shell
+ offsets = {
+ exit = vec3(5.410095, 4.299301, 0.9),
+ stash = vec3(-4.068207, 4.046188, 0.9),
+ wardrobe = vec3(2.811829, -3.619385, 0.9),
+ }
+ },
+}
+
+config.messageApi = function(data) -- {title,message,motel}
+ local motel = GlobalState.Motels[data.motel]
+ local identifier = motel.owned -- owner identifier
+ -- add your custom message here. ex. SMS phone
+
+ -- basic notification (remove this if using your own message system)
+ local success = lib.callback.await('renzu_motels:MessageOwner',false,{identifier = identifier, message = data.message, title = data.title, motel = data.motel})
+ if success then
+ Notify('message has been sent', 'success')
+ else
+ Notify('message fail \n owner is not available yet', 'error')
+ end
+end
+
+-- @shell string (shell type)
+-- @Mlo string ( toggle MLO or shell type)
+-- @hour_rate int ( per hour rates)
+-- @motel string (Motel Index Name)
+-- @rentcoord vec3 (coordinates of Rental Menu)
+-- @radius float ( total size radius of motel )
+-- @maxoccupants int (total player can rent in each Rooms)
+-- @uniquestash bool ( Toggle Non Sharable / Stealable Stash Storage )
+-- @doors table ( lists of doors feature coordinates. ex. stash, wardrobe) wardrobe,stash coords are only applicable in Mlo. using shells has offsets for stash and wardrobes.
+-- @manual boolean ( accept walk in occupants only )
+-- @businessprice int ( value of motel)
+-- @door int (door hash or doormodel `model`) for MLO type
+
+config.motels = {
+ [1] = { -- index name of motel
+ manual = false, -- set the motel to auto accept occupants or false only the owner of motel can accept Occupants
+ Mlo = false, -- if MLO you need to configure each doors coordinates,stash etc. if false resource will use shells
+ shell = 'standard', -- shell type, configure only if using Mlo = true
+ label = 'Pink Cage Motel',
+ rental_period = 'day',-- hour, day, month
+ rate = 1000, -- cost per period
+ businessprice = 1000000,
+ motel = 'pinkcage',
+ payment = 'money', -- money, bank
+ door = `gabz_pinkcage_doors_front`, -- door hash for MLO type
+ rentcoord = vec3(313.38,-225.20,54.212),
+ coord = vec3(326.04,-210.47,54.086), -- center of the motel location
+ radius = 50.0, -- radius of motel location
+ maxoccupants = 5, -- maximum renters per room
+ uniquestash = true, -- if true. each players has unique stash ID (non sharable and non stealable). if false stash is shared to all Occupants if maxoccupans is > 1
+ doors = { -- doors and other function of each rooms
+ [1] = { -- COORDINATES FOR GABZ PINKCAGE
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(307.21499633789,-212.79479980469,54.420265197754), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- [2] = {
+ -- coord = vec3(306.67614746094,-215.63456726074,54.22175),
+ -- model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ -- }
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(307.01657104492,-207.91079711914,53.758548736572), -- requires when using MLO
+ wardrobe = vec3(302.58380126953,-207.71691894531,54.598297119141), -- requires when using MLO
+ fridge = vec3(305.00064086914,-206.12855529785,54.544868469238), -- requires when using MLO
+ -- luckyme = vec3(0.0,0.0,0.0) -- extra
+ },
+ [2] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(310.95474243164,-202.91288757324,54.421058654785), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(310.91235351563,-198.10073852539,53.758598327637),
+ wardrobe = vec3(306.25433349609,-197.75250244141,54.564342498779),
+ fridge = vec3(308.79779052734,-196.23670959473,54.440326690674),
+ },
+ [3] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(316.28607177734,-194.54536437988,54.391784667969), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(321.10150146484,-194.42211914063,53.758399963379),
+ wardrobe = vec3(321.42459106445,-189.79216003418,54.65941619873),
+ fridge = vec3(322.92010498047,-192.31481933594,54.600353240967),
+ },
+ [4] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(314.36087036133,-219.91516113281,58.151386260986), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(309.6142578125,-220.16128540039,57.557399749756),
+ wardrobe = vec3(309.21203613281,-224.6675567627,58.375194549561),
+ fridge = vec3(307.6989440918,-222.11755371094,58.293560028076),
+ },
+ [5] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(307.22616577148,-212.77645874023,58.204700469971), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(306.89093017578,-207.88090515137,57.556159973145),
+ wardrobe = vec3(302.57464599609,-207.71339416504,58.440250396729),
+ fridge = vec3(305.044921875,-205.99066162109,58.394989013672),
+ },
+ [6] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(311.00057983398,-202.87718200684,58.148029327393), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(310.88967895508,-198.16856384277,57.556510925293),
+ wardrobe = vec3(306.09225463867,-198.40795898438,58.27188873291),
+ fridge = vec3(308.73110961914,-196.40968322754,58.407859802246),
+ },
+ [7] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(316.29287719727,-194.5479888916,58.212650299072), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(321.24801635742,-194.29737854004,57.556739807129),
+ wardrobe = vec3(321.46688842773,-189.68632507324,58.422557830811),
+ fridge = vec3(322.98544311523,-192.33996582031,58.386581420898),
+ },
+ [8] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(339.43377685547,-219.99412536621,54.431659698486), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(339.67279052734,-224.8221282959,53.759098052979),
+ wardrobe = vec3(344.28637695313,-224.95460510254,54.527130126953),
+ fridge = vec3(341.86477661133,-226.15287780762,54.642837524414),
+ },
+ [9] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(343.23126220703,-210.10203552246,54.410026550293), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(343.47601318359,-214.96635437012,53.758640289307),
+ wardrobe = vec3(347.99655151367,-215.08934020996,54.489669799805),
+ fridge = vec3(345.53387451172,-216.53938293457,54.698444366455),
+ },
+ [10] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(347.0237121582,-200.22482299805,54.414268493652), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(347.33102416992,-205.13743591309,53.759078979492),
+ wardrobe = vec3(351.68756103516,-205.30010986328,54.674419403076),
+ fridge = vec3(349.34033203125,-206.6258392334,54.639694213867),
+ },
+ [11] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(334.44702148438,-227.61134338379,58.205139160156), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(329.67590332031,-227.8233795166,57.556579589844),
+ wardrobe = vec3(329.43222045898,-232.33073425293,58.42276763916),
+ fridge = vec3(327.64138793945,-229.79788208008,58.355628967285),
+ },
+ [12] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(339.44650268555,-219.9709777832,58.177570343018), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(339.79351806641,-224.86245727539,57.55553817749),
+ wardrobe = vec3(344.26574707031,-225.00813293457,58.302909851074),
+ fridge = vec3(341.6985168457,-226.52975463867,58.367748260498),
+ },
+ [13] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(343.22320556641,-210.1229095459,58.176639556885), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(343.47412109375,-214.96145629883,57.55553817749),
+ wardrobe = vec3(348.07550048828,-215.08416748047,58.288040161133),
+ fridge = vec3(345.40502929688,-216.88189697266,58.281555175781),
+ },
+ [14] = {
+ door = { -- Door config requires when using MLO
+ [1] = { -- requested by community. supports multiple door models.
+ coord = vec3(347.03012084961,-200.20816040039,58.177433013916), -- exact coordinates of door
+ model = `gabz_pinkcage_doors_front` -- model of target door coordinates
+ },
+ -- support multiple doors just add new line of table
+ },
+ stash = vec3(347.12841796875,-205.05494689941,57.55553817749),
+ wardrobe = vec3(351.77719116211,-205.24267578125,58.351734161377),
+ fridge = vec3(349.24819946289,-206.78134155273,58.326892852783),
+ },
+
+ },
+ },
+
+ -- [2] = { -- index name of motel
+ -- manual = false, -- set the motel to auto accept occupants or false only the owner of motel can accept Occupants
+ -- Mlo = true, -- if MLO you need to configure each doors coordinates,stash etc. if false resource will use shells
+ -- shell = 'modern', -- shell type, configure only if using Mlo = true
+ -- label = 'Yacht Club Motel',
+ -- rental_period = 'day',-- hour, day, month
+ -- payment = 'money', -- money, bank
+ -- rate = 1000, -- cost per period
+ -- motel = 'yacht',
+ -- door = `gabz_pinkcage_doors_front`, -- door hash for MLO type
+ -- businessprice = 1000000,
+ -- rentcoord = vec3(-916.54,-1302.56,6.2001),
+ -- coord = vec3(-916.54,-1302.56,6.2001), -- center of the motel location
+ -- radius = 50.0, -- radius of motel location
+ -- maxoccupants = 5, -- maximum renters per room
+ -- uniquestash = true, -- if true. each players has unique stash ID (non sharable and non stealable). if false stash is shared to all Occupants if maxoccupans is > 1
+ -- doors = { -- doors and other function of each rooms
+ -- [1] = {
+ -- door = vec3(-936.25,-1311.38,6.20),
+ -- stash = vec3(-944.08,-1317.83,6.19),
+ -- wardrobe = vec3(-941.21,-1324.9,6.19),
+ -- --fridge = vec3(305.26,-206.43,54.22),
+ -- -- luckyme = vec3(0.0,0.0,0.0) -- extra shit
+ -- },
+ -- },
+ -- },
+
+ -- [3] = { -- index name of motel
+ -- businessprice = 1000000,
+ -- manual = false, -- set the motel to auto accept occupants or false only the owner of motel can accept Occupants
+ -- Mlo = false, -- if MLO you need to configure each doors coordinates,stash etc. if false resource will use shells
+ -- shell = 'modern', -- shell type, configure only if using Mlo = true
+ -- label = 'Motel Modern', -- hotel label
+ -- rental_period = 'day',-- hour, day, month
+ -- payment = 'money', -- money, bank
+ -- rate = 1000, -- cost per period
+ -- door = `gabz_pinkcage_doors_front`, -- door hash for MLO type
+ -- motel = 'hotelmodern3', -- hotel index name
+ -- rentcoord = vec3(515.21173095703,225.36326599121,104.74),
+ -- coord = vec3(505.55709838867,213.49201965332,102.89), -- center of the motel location
+ -- radius = 50.0, -- radius of motel location
+ -- maxoccupants = 5, -- maximum renters per room
+ -- uniquestash = true, -- if true. each players has unique stash ID (non sharable and non stealable). if false stash is shared to all Occupants if maxoccupans is > 1
+ -- doors = { -- doors and other function of each rooms
+ -- [1] = {
+ -- door = vec3(496.90872192383,237.74664306641,105.28434753418),
+ -- -- stash = vec3(-944.08,-1317.83,6.19),
+ -- -- wardrobe = vec3(-941.21,-1324.9,6.19),
+ -- --fridge = vec3(305.26,-206.43,54.22),
+ -- -- luckyme = vec3(0.0,0.0,0.0) -- extra shit
+ -- },
+ -- },
+ -- }
+}
+config.extrafunction = {
+ ['bed'] = function(data,identifier)
+ TriggerEvent('luckyme')
+ end,
+ ['fridge'] = function(data,identifier)
+ TriggerEvent('ox_inventory:openInventory', 'stash', {id = 'fridge_'..data.motel..'_'..identifier..'_'..data.index, name = 'Fridge', slots = 30, weight = 20000, coords = GetEntityCoords(cache.ped)})
+ end,
+ ['exit'] = function(data)
+ local coord = LocalPlayer.state.lastloc or vec3(data.coord.x,data.coord.y,data.coord.z)
+ DoScreenFadeOut(500)
+ while not IsScreenFadedOut() do
+ Wait(10)
+ end
+ SendNUIMessage({
+ type = 'door'
+ })
+ return Teleport(coord.x,coord.y,coord.z,0.0,true)
+ end,
+}
+
+config.Text = {
+ ['stash'] = 'Stash',
+ ['fridge'] = 'My Fridge',
+ ['wardrobe'] = 'Wardrobe',
+ ['bed'] = 'Sleep',
+ ['door'] = 'Door',
+ ['exit'] = 'Exit',
+}
+
+config.icons = {
+ ['door'] = 'fas fa-door-open',
+ ['stash'] = 'fas fa-box',
+ ['wardrobe'] = 'fas fa-tshirt',
+ ['fridge'] = 'fas fa-ice-cream',
+ ['bed'] = 'fas fa-bed',
+ ['exit'] = 'fas fa-door-open',
+}
+
+config.stashblacklist = {
+ ['stash'] = { -- type of inventory
+ blacklist = { -- list of blacklists items
+ water = true,
+ },
+ },
+ ['fridge'] = { -- type of inventory
+ blacklist = { -- list of blacklists items
+ WEAPON_PISTOL = true,
+ },
+ },
+}
+
+PlayerData,ESX,QBCORE,zones,shelzones,blips = {},nil,nil,{},{},{}
+
+function import(file)
+ local name = ('%s.lua'):format(file)
+ local content = LoadResourceFile(GetCurrentResourceName(),name)
+ local f, err = load(content)
+ return f()
+end
+
+if GetResourceState('es_extended') == 'started' then
+ ESX = exports['es_extended']:getSharedObject()
+elseif GetResourceState('qb-core') == 'started' then
+ QBCORE = exports['qb-core']:GetCoreObject()
+end
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/data/audio/door.mp4 b/resources/[housing]/renzu_motels/data/audio/door.mp4
new file mode 100644
index 000000000..43657090f
Binary files /dev/null and b/resources/[housing]/renzu_motels/data/audio/door.mp4 differ
diff --git a/resources/[housing]/renzu_motels/data/audio/door.ogg b/resources/[housing]/renzu_motels/data/audio/door.ogg
new file mode 100644
index 000000000..61a43bbd0
Binary files /dev/null and b/resources/[housing]/renzu_motels/data/audio/door.ogg differ
diff --git a/resources/[housing]/renzu_motels/data/image/hotelmodern3.png b/resources/[housing]/renzu_motels/data/image/hotelmodern3.png
new file mode 100644
index 000000000..2bae9cbcc
Binary files /dev/null and b/resources/[housing]/renzu_motels/data/image/hotelmodern3.png differ
diff --git a/resources/[housing]/renzu_motels/data/image/pinkcage.png b/resources/[housing]/renzu_motels/data/image/pinkcage.png
new file mode 100644
index 000000000..1a9683ae0
Binary files /dev/null and b/resources/[housing]/renzu_motels/data/image/pinkcage.png differ
diff --git a/resources/[housing]/renzu_motels/data/index.html b/resources/[housing]/renzu_motels/data/index.html
new file mode 100644
index 000000000..16580dbd8
--- /dev/null
+++ b/resources/[housing]/renzu_motels/data/index.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+ Renzu Motels
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/data/motels.json b/resources/[housing]/renzu_motels/data/motels.json
new file mode 100644
index 000000000..027d5f34b
--- /dev/null
+++ b/resources/[housing]/renzu_motels/data/motels.json
@@ -0,0 +1,62 @@
+[
+ {
+ "pinkcage": [
+ {
+ "fridge": {
+ "x": 305.260009765625,
+ "y": -206.42999267578128,
+ "z": 54.22000122070312
+ },
+ "door": {
+ "x": 307.3800048828125,
+ "y": -213.27000427246097,
+ "z": 54.20999908447265
+ },
+ "stash": {
+ "x": 307.5,
+ "y": -207.49600219726565,
+ "z": 54.54000091552734
+ },
+ "wardrobe": {
+ "x": 302.6799926757813,
+ "y": -207.44000244140625,
+ "z": 54.22000122070312
+ }
+ },
+ {
+ "door": {
+ "x": 311.0899963378906,
+ "y": -203.17999267578128,
+ "z": 54.20999908447265
+ },
+ "stash": {
+ "x": 310.82000732421875,
+ "y": -198.02000427246097,
+ "z": 54.75
+ },
+ "wardrobe": {
+ "x": 306.5899963378906,
+ "y": -197.57000732421875,
+ "z": 54.22000122070312
+ }
+ },
+ {
+ "door": {
+ "x": 315.9100036621094,
+ "y": -194.3999938964844,
+ "z": 54.2400016784668
+ },
+ "stash": {
+ "x": 320.989990234375,
+ "y": -194.38999938964844,
+ "z": 54.75
+ },
+ "wardrobe": {
+ "x": 321.7099914550781,
+ "y": -189.86000061035156,
+ "z": 54.22000122070312
+ }
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/data/script.js b/resources/[housing]/renzu_motels/data/script.js
new file mode 100644
index 000000000..9d986fb34
--- /dev/null
+++ b/resources/[housing]/renzu_motels/data/script.js
@@ -0,0 +1,32 @@
+function playsound(table) {
+ var file = table['file']
+ var volume = table['volume']
+ var audioPlayer = null;
+ if (audioPlayer != null) {
+ audioPlayer.pause();
+ }
+ if (volume == undefined) {
+ volume = 0.2
+ }
+ audioPlayer = new Audio("./audio/" + file + ".ogg");
+ audioPlayer.volume = volume;
+ audioPlayer.play();
+}
+
+window.addEventListener('message', function(event) {
+ var data = event.data;
+ if (event.data.type == 'playsound') {
+ playsound(event.data.content)
+ }
+ if (event.data.type == 'door') {
+ document.getElementById('door').innerHTML = `
+
+ `
+ setTimeout(function() {
+ document.getElementById('door').innerHTML = ''
+ }, 7000)
+ }
+
+});
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/fxmanifest.lua b/resources/[housing]/renzu_motels/fxmanifest.lua
new file mode 100644
index 000000000..212394512
--- /dev/null
+++ b/resources/[housing]/renzu_motels/fxmanifest.lua
@@ -0,0 +1,34 @@
+fx_version 'cerulean'
+lua54 'yes'
+game 'gta5'
+shared_scripts {
+ '@ox_lib/init.lua',
+ 'config.lua',
+}
+ui_page {
+ 'data/index.html',
+}
+client_scripts {
+ 'bridge/framework/client/*.lua',
+ 'bridge/inventory/client/*.lua',
+ 'bridge/target/*.lua',
+ 'bridge/zones.lua',
+ 'client/main.lua'
+}
+
+server_scripts {
+ '@oxmysql/lib/MySQL.lua',
+ 'bridge/framework/server/*.lua',
+ 'bridge/inventory/server/*.lua',
+ 'server/main.lua'
+}
+
+files {
+ 'data/image/*.png',
+ 'data/index.html',
+ 'data/script.js',
+ 'data/audio/door.mp4',
+ 'data/audio/door.ogg',
+ 'stream/starter_shells_k4mb1.ytyp'
+}
+data_file 'DLC_ITYP_REQUEST' 'starter_shells_k4mb1.ytyp'
diff --git a/resources/[housing]/renzu_motels/server/main.lua b/resources/[housing]/renzu_motels/server/main.lua
new file mode 100644
index 000000000..3f93cf5e9
--- /dev/null
+++ b/resources/[housing]/renzu_motels/server/main.lua
@@ -0,0 +1,335 @@
+--DeleteResourceKvp('renzu_motels')
+GlobalState.Motels = nil
+local db = import 'server/sql'
+local rental_period = {
+ ['hour'] = 3600,
+ ['day'] = 86400,
+ ['month'] = 2592000
+}
+CreateInventoryHooks = function(motel,Type)
+ if GetResourceState('ox_inventory') ~= 'started' then return end
+ local inventory = '^'..Type..'_'..motel..'_%w+'
+ local hookId = exports.ox_inventory:registerHook('swapItems', function(payload)
+ return false
+ end, {
+ print = false,
+ itemFilter = config.stashblacklist[Type].blacklist,
+ inventoryFilter = {
+ inventory,
+ }
+ })
+end
+
+Citizen.CreateThreadNow(function()
+ Wait(2000)
+ GlobalState.Motels = db.fetchAll()
+ local motels = GlobalState.Motels
+ for k,v in pairs(config.motels) do
+ for doorindex,_ in pairs(v.doors) do
+ local doorindex = tonumber(doorindex)
+ motels[v.motel].rooms[doorindex].lock = true
+ if motels[v.motel].rooms[doorindex].players and GetResourceState('ox_inventory') == 'started' then
+ for id,_ in pairs(motels[v.motel].rooms[doorindex].players) do
+ local stashid = v.uniquestash and id or 'room'
+ exports.ox_inventory:RegisterStash('stash_'..v.motel..'_'..stashid..'_'..doorindex, 'Storage', 70, 70000, false)
+ exports.ox_inventory:RegisterStash('fridge_'..v.motel..'_'..stashid..'_'..doorindex, 'Fridge', 70, 70000, false)
+ end
+ CreateInventoryHooks(v.motel,'stash')
+ CreateInventoryHooks(v.motel,'fridge')
+ end
+ end
+ end
+ GlobalState.Motels = motels
+ local save = {}
+ while true do
+ if config.autokickIfExpire then
+ local motels = GlobalState.Motels
+ for motel,data in pairs(motels) do
+ if not save[motel] then save[motel] = 0 end
+ for doorindex,v in pairs(data.rooms or {}) do
+ local doorindex = tonumber(doorindex)
+ for player,char in pairs(v.players or {}) do
+ if (char.duration - os.time()) < 0 then
+ motels[motel].rooms[doorindex].players[player] = nil
+ db.updateall('rooms = ?', '`motel`', motel, json.encode(motels[motel].rooms))
+ end
+ end
+ if save[motel] <= 0 then
+ save[motel] = 60
+ db.updateall('rooms = ?', '`motel`', motel, json.encode(motels[motel].rooms))
+ end
+ end
+ save[motel] -= 1
+ end
+ GlobalState.Motels = motels
+ end
+ GlobalState.MotelTimer = os.time()
+ Wait(60000)
+ end
+end)
+
+lib.callback.register('renzu_motels:rentaroom', function(src,data)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ local identifier = xPlayer.identifier
+ if not motels[data.motel].rooms[data.index].players[identifier] and data.duration > 0 then
+ local money = xPlayer.getAccount(data.payment).money
+ local amount = (data.duration * data.rate)
+ if money <= amount then return end
+ xPlayer.removeAccountMoney(data.payment,amount)
+ if not motels[data.motel].rooms[data.index].players[identifier] then motels[data.motel].rooms[data.index].players[identifier] = {} end
+ motels[data.motel].rooms[data.index].players[identifier].name = xPlayer.name
+ motels[data.motel].rooms[data.index].players[identifier].duration = (os.time() + ( data.duration * rental_period[data.rental_period]))
+ motels[data.motel].revenue += amount
+ GlobalState.Motels = motels
+ db.updateall('rooms = ?, revenue = ?', '`motel`', data.motel, json.encode(motels[data.motel].rooms),motels[data.motel].revenue)
+ if GetResourceState('ox_inventory') == 'started' then
+ local stashid = data.uniquestash and identifier or 'room'
+ exports.ox_inventory:RegisterStash('stash_'..data.motel..'_'..stashid..'_'..data.index, 'Storage', 70, 70000, false)
+ exports.ox_inventory:RegisterStash('fridge_'..data.motel..'_'..stashid..'_'..data.index, 'Fridge', 70, 70000, false)
+ end
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:payrent', function(src,data)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ local duration = data.amount / data.rate
+ if duration < 1.0 then return false end
+ local money = xPlayer.getAccount(data.payment).money
+ if money < data.amount then
+ return false
+ end
+ if motels[data.motel].rooms[data.index].players[xPlayer.identifier] then
+ xPlayer.removeAccountMoney(data.payment,data.amount)
+ motels[data.motel].revenue += data.amount
+ motels[data.motel].rooms[data.index].players[xPlayer.identifier].duration += ( duration * rental_period[data.rental_period])
+ GlobalState.Motels = motels
+ db.updateall('rooms = ?, revenue = ?', '`motel`', data.motel, json.encode(motels[data.motel].rooms),motels[data.motel].revenue)
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:getMotels', function(src,data)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ return motels, os.time()
+end)
+
+lib.callback.register('renzu_motels:motelkey', function(src,data)
+ local xPlayer = GetPlayerFromId(src)
+ local metadata = {
+ type = data.motel,
+ serial = data.index,
+ label = 'Motel Key',
+ description = 'personal motel key for '..data.motel..' door #'..data.index..' \n Motel Room Owner: '..xPlayer.name,
+ owner = xPlayer.identifier
+ }
+ return AddItem(src, 'keys', 1, metadata)
+end)
+
+lib.callback.register('renzu_motels:buymotel', function(src,data)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ local money = xPlayer.getAccount(data.payment).money
+ if not motels[data.motel].owned and money >= data.businessprice then
+ xPlayer.removeAccountMoney(data.payment,data.businessprice)
+ motels[data.motel].owned = xPlayer.identifier
+ GlobalState.Motels = motels
+ db.updateall('owned = ?', '`motel`', data.motel, motels[data.motel].owned)
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:removeoccupant', function(src,data,index,player)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ if motels[data.motel].owned == xPlayer.identifier or motels[data.motel].rooms[index].players[player] then
+ motels[data.motel].rooms[index].players[player] = nil
+ GlobalState.Motels = motels
+ db.updateall('rooms = ?', '`motel`', data.motel, json.encode(motels[data.motel].rooms))
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:addoccupant', function(src,data,index,player)
+ local xPlayer = GetPlayerFromId(src)
+ local toPlayer = GetPlayerFromId(tonumber(player[1]))
+ local motels = GlobalState.Motels
+ if motels[data.motel].owned == xPlayer.identifier and toPlayer then
+ if motels[data.motel].rooms[index].players[toPlayer.identifier] then return 'exist' end
+ if not motels[data.motel].rooms[index].players[toPlayer.identifier] then motels[data.motel].rooms[index].players[toPlayer.identifier] = {} end
+ motels[data.motel].rooms[index].players[toPlayer.identifier].name = toPlayer.name
+ motels[data.motel].rooms[index].players[toPlayer.identifier].duration = ( os.time() + (tonumber(player[2]) * rental_period[data.rental_period]))
+ GlobalState.Motels = motels
+ db.updateall('rooms = ?', '`motel`', data.motel, json.encode(motels[data.motel].rooms))
+ if GetResourceState('ox_inventory') == 'started' then
+ local stashid = data.uniquestash and toPlayer.identifier or 'room'
+ exports.ox_inventory:RegisterStash('stash_'..data.motel..'_'..stashid..'_'..index, 'Storage', 70, 70000, false)
+ exports.ox_inventory:RegisterStash('fridge_'..data.motel..'_'..stashid..'_'..index, 'Fridge', 70, 70000, false)
+ end
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:editrate', function(src,motel,rate)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ if motels[motel].owned == xPlayer.identifier then
+ motels[motel].hour_rate = tonumber(rate)
+ db.updateall('hour_rate = ?', '`motel`', motel, motels[motel].hour_rate)
+ GlobalState.Motels = motels
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:addemployee', function(src,motel,id)
+ local xPlayer = GetPlayerFromId(src)
+ local toPlayer = GetPlayerFromId(tonumber(id))
+ local motels = GlobalState.Motels
+ if motels[motel].owned == xPlayer.identifier and toPlayer then
+ motels[motel].employees[toPlayer.identifier] = toPlayer.name
+ GlobalState.Motels = motels
+ db.updateall('employees = ?', '`motel`', motel, json.encode(motels[motel].employees))
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:removeemployee', function(src,motel,identifier)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ if motels[motel].owned == xPlayer.identifier then
+ motels[motel].employees[identifier] = nil
+ GlobalState.Motels = motels
+ db.updateall('employees = ?', '`motel`', motel, json.encode(motels[motel].employees))
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:transfermotel', function(src,motel,id)
+ local xPlayer = GetPlayerFromId(src)
+ local toPlayer = GetPlayerFromId(tonumber(id))
+ local motels = GlobalState.Motels
+ if motels[motel].owned == xPlayer.identifier and toPlayer then
+ motels[motel].owned = toPlayer.identifier
+ GlobalState.Motels = motels
+ db.updateall('owned = ?', '`motel`', motel, motels[motel].owned)
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:sellmotel', function(src,data)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ if motels[data.motel].owned == xPlayer.identifier then
+ motels[data.motel].owned = nil
+ motels[data.motel].employees = {}
+ GlobalState.Motels = motels
+ xPlayer.addMoney(data.businessprice / 2)
+ db.updateall('owned = ?, employees = ?', '`motel`', data.motel, motels[data.motel].owned,'[]')
+ return true
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:withdrawfund', function(src,motel,amount)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ if motels[motel].owned == xPlayer.identifier then
+ if motels[motel].revenue < amount or amount < 0 then return false end
+ motels[motel].revenue -= amount
+ GlobalState.Motels = motels
+ db.updateall('revenue = ?', '`motel`', motel, motels[motel].revenue)
+ xPlayer.addMoney(tonumber(amount))
+ return true
+ end
+ return false
+end)
+
+local invoices = {}
+lib.callback.register('renzu_motels:sendinvoice', function(src,motel,data)
+ local toPlayer = tonumber(data[1])
+ if data[1] == -1 or not GetPlayerFromId(toPlayer) then return false end
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ if motels[motel].owned == xPlayer.identifier or motels[motel].employees[xPlayer.identifier] then
+ local id = math.random(999,9999)
+ invoices[id] = data[2]
+ TriggerClientEvent('renzu_motels:invoice',toPlayer,{
+ motel = motel,
+ amount = data[2],
+ description = data[3],
+ id = id,
+ payment = data[4] and 'bank' or 'money',
+ sender = src
+ })
+ local timer = 60
+ while invoices[id] ~= 'paid' and timer > 0 do timer -= 1 Wait(1000) end
+ local paid = invoices[id] == 'paid'
+ invoices[id] = nil
+ return paid
+ end
+ return false
+end)
+
+lib.callback.register('renzu_motels:payinvoice', function(src,data)
+ local xPlayer = GetPlayerFromId(src)
+ local motels = GlobalState.Motels
+ if invoices[data.id] then
+ local money = xPlayer.getAccount(data.payment).money
+ if money >= data.amount then
+ motels[data.motel].revenue += tonumber(data.amount)
+ xPlayer.removeAccountMoney(data.payment,tonumber(data.amount))
+ GlobalState.Motels = motels
+ invoices[data.id] = 'paid'
+ db.updateall('revenue = ?', '`motel`', data.motel, motels[data.motel].revenue)
+ end
+ return invoices[data.id] == 'paid'
+ end
+ return false
+end)
+
+local routings = {}
+lib.callback.register('renzu_motels:SetRouting', function(src,data,Type)
+ local xPlayer = GetPlayerFromId(src)
+ if Type == 'enter' then
+ routings[src] = GetPlayerRoutingBucket(src)
+ SetPlayerRoutingBucket(src,data.index+100)
+ else
+ SetPlayerRoutingBucket(src,routings[src])
+ end
+ return true
+end)
+
+lib.callback.register('renzu_motels:MessageOwner', function(src,data)
+ local motels = GlobalState.Motels
+ if not motels[data.motel] or motels[data.motel].owned ~= data.identifier then return end
+ local xPlayer = GetPlayerFromId(data.identifier)
+ if xPlayer then
+ TriggerClientEvent('renzu_motels:MessageOwner',xPlayer.source, data)
+ return true
+ end
+ return false
+end)
+
+RegisterServerEvent("renzu_motels:Door")
+AddEventHandler('renzu_motels:Door', function(data)
+ local source = source
+ TriggerClientEvent('renzu_motels:Door', -1, data)
+ if not data.Mlo then
+ local motels = GlobalState.Motels
+ motels[data.motel].rooms[data.index].lock = not motels[data.motel].rooms[data.index].lock
+ --db.updateall('rooms = ?', '`motel`', data.motel, json.encode(motels[data.motel].rooms))
+ GlobalState.Motels = motels
+ end
+end)
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/server/sql.lua b/resources/[housing]/renzu_motels/server/sql.lua
new file mode 100644
index 000000000..09b07ef61
--- /dev/null
+++ b/resources/[housing]/renzu_motels/server/sql.lua
@@ -0,0 +1,91 @@
+
+local db = setmetatable({},{
+ __call = function(self)
+
+ self.insert = function(...)
+ local str = 'INSERT INTO %s (%s, %s, %s, %s, %s, %s) VALUES(?, ?, ?, ?, ?, ?)'
+ return MySQL.insert.await(str:format('renzu_motels','motel','hour_rate','revenue','employees','rooms','owned'),{...})
+ end
+
+ self.update = function(column, where, string, data)
+ local str = 'UPDATE %s SET %s WHERE %s = ?'
+ return MySQL.update(str:format('renzu_motels',column,where),{data,string})
+ end
+
+ self.updateall = function(pattern, where, string, ...)
+ local str = 'UPDATE %s SET % WHERE %s = ?'
+ local str = 'UPDATE renzu_motels SET '..pattern..' WHERE '..where..' = ?'
+ local data = {...}
+ table.insert(data,string)
+ return MySQL.update(str,data)
+ end
+
+ self.query = function(column, where, string)
+ local str = 'SELECT %s FROM %s WHERE %s = ?'
+ return MySQL.query.await(str:format(column,'renzu_motels',where),{string})
+ end
+
+ self.fetchAll = function()
+ local str = 'SELECT * FROM renzu_motels'
+ local query = MySQL.query.await(str)
+ local data = {}
+ for k,v in pairs(query) do
+ for column, value in pairs(v) do
+ if v.motel then
+ if column ~= 'id' and value then
+ if not data[column] then data[column] = {} end
+ local success, result = pcall(json.decode, value)
+ result = result == nil and value or result
+ if not data[v.motel] then data[v.motel] = {} end
+ if column == 'owned' and result == 0 then result = nil end
+ if column == 'hour_rate' and result == 0 then result = nil end
+ data[v.motel][column] = result
+ end
+ end
+ end
+ end
+ return data
+ end
+
+ return self
+ end
+})
+
+Citizen.CreateThreadNow(function()
+ local success, result = pcall(MySQL.scalar.await, 'SELECT 1 FROM renzu_motels')
+ if not success then
+ MySQL.query.await([[CREATE TABLE `renzu_motels` (
+ `id` int NOT NULL AUTO_INCREMENT KEY,
+ `motel` varchar(64) DEFAULT NULL,
+ `hour_rate` int DEFAULT 0,
+ `revenue` int DEFAULT 0,
+ `employees` longtext DEFAULT NULL,
+ `rooms` longtext DEFAULT NULL,
+ `owned` varchar(64) DEFAULT NULL
+ )]])
+ print("^2SQL INSTALL SUCCESSFULLY ^0")
+ end
+ Wait(500)
+ for k,v in pairs(config.motels) do
+ local query = MySQL.query.await('SELECT rooms FROM renzu_motels WHERE `motel` = ?',{v.motel})
+ if not query[1] then
+ local doors = {}
+ for doorindex,_ in pairs(v.doors) do
+ if not doors.rooms then doors.rooms = {} end
+ if not doors.rooms[doorindex] then doors.rooms[doorindex] = {} end
+ if not doors.rooms[doorindex].players then doors.rooms[doorindex].players = {} end
+ doors.rooms[doorindex].lock = true
+ end
+ db.insert(v.motel,0,0,'[]',json.encode(doors.rooms),0)
+ elseif query[1] and #v.doors > #json.decode(query[1].rooms) then
+ local addnew = (#v.doors - #json.decode(query[1].rooms))
+ local rooms = json.decode(query[1].rooms) or {}
+ for i = 1, addnew do
+ table.insert(rooms,{players = {}, lock = true})
+ end
+ db.updateall('rooms = ?', '`motel`', v.motel, json.encode(rooms))
+ end
+ end
+end)
+
+return db()
\ No newline at end of file
diff --git a/resources/[housing]/renzu_motels/stream/modernhotel_shell.ydr b/resources/[housing]/renzu_motels/stream/modernhotel_shell.ydr
new file mode 100644
index 000000000..7cb8638a2
Binary files /dev/null and b/resources/[housing]/renzu_motels/stream/modernhotel_shell.ydr differ
diff --git a/resources/[housing]/renzu_motels/stream/standardmotel_shell.ydr b/resources/[housing]/renzu_motels/stream/standardmotel_shell.ydr
new file mode 100644
index 000000000..df6fe6670
Binary files /dev/null and b/resources/[housing]/renzu_motels/stream/standardmotel_shell.ydr differ
diff --git a/resources/[housing]/renzu_motels/stream/starter_shells_k4mb1.ytyp b/resources/[housing]/renzu_motels/stream/starter_shells_k4mb1.ytyp
new file mode 100644
index 000000000..a4bba2f6e
Binary files /dev/null and b/resources/[housing]/renzu_motels/stream/starter_shells_k4mb1.ytyp differ