diff --git a/server-data/resources/[esx_addons]/esx_realparking/LICENSE b/server-data/resources/[esx_addons]/esx_realparking/LICENSE
new file mode 100644
index 00000000..f288702d
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/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/server-data/resources/[esx_addons]/esx_realparking/README.md b/server-data/resources/[esx_addons]/esx_realparking/README.md
new file mode 100644
index 00000000..d638b20d
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/README.md
@@ -0,0 +1,62 @@
+# esx_realparking
+A real car parking script for FiveM
+
+![Parking example](https://i.imgur.com/J6SqHBK.png)
+
+## Features
+
+- Store the car like the real life
+- Support esx_vehicleshop
+- Parking anywhere
+- Parking fees for player
+
+## Requirements
+
+1. [ESX](https://github.com/ESX-Org/es_extended)
+2. [esx_vehicleshop](https://github.com/ESX-Org/esx_vehicleshop)
+
+## Download & Installation
+
+### Using YumV
+
+```
+yum install esx_realparking
+```
+
+### Using Git
+
+```
+git clone https://github.com/kasuganosoras/esx_realparking
+```
+
+### Manually
+
+- Download https://github.com/kasuganosoras/esx_realparking/archive/master.zip
+- Put it in the `[esx]` directory
+
+## Installation
+
+- Import esx_realparking.sql to your database
+- Add this in your `server.cfg`
+
+```
+start esx_realparking
+```
+
+## Videos
+
+https://www.youtube.com/watch?v=sDsqSuw2yKg
+
+## Legal
+
+### License
+
+esx_realparking - car parking script for ESX
+
+Copyright (C) 2021 Akkariin
+
+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 http://www.gnu.org/licenses/.
diff --git a/server-data/resources/[esx_addons]/esx_realparking/client/main.lua b/server-data/resources/[esx_addons]/esx_realparking/client/main.lua
new file mode 100644
index 00000000..0e6ce945
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/client/main.lua
@@ -0,0 +1,571 @@
+--[[ ===================================================== ]]
+--
+--[[ FiveM Real Parking Script by Akkariin ]]
+--
+--[[ ===================================================== ]]
+--
+
+-- Arrays
+PlayerData = {}
+LocalVehicles = {}
+GlobalVehicles = {}
+
+-- Variables
+ESX = nil
+CurrentFee = nil
+LastPlate = nil
+PlayerIdentifier = nil
+SpawnedVehicles = false
+DeletingEntities = false
+
+-- Refresh the vehicles
+
+RegisterNetEvent("esx_realparking:refreshVehicles")
+AddEventHandler("esx_realparking:refreshVehicles", function(vehicles)
+ DebugLog("Server request refresh vehicles list")
+ GlobalVehicles = vehicles
+ RemoveVehicles(vehicles)
+ Citizen.Wait(1000)
+ SpawnVehicles(vehicles)
+end)
+
+RegisterNetEvent("esx_realparking:addVehicle")
+AddEventHandler("esx_realparking:addVehicle", function(vehicle, owner)
+ if owner == GetPlayerServerId(PlayerId()) then
+ DeleteEntity(GetVehiclePedIsIn(GetPlayerPed(-1), false))
+ end
+ SpawnVehicle(vehicle)
+end)
+
+RegisterNetEvent("esx_realparking:deleteVehicle")
+AddEventHandler("esx_realparking:deleteVehicle", function(vehicle)
+ DeleteLocalVehicle(vehicle)
+end)
+
+RegisterNetEvent("esx_realparking:impoundVehicle")
+AddEventHandler("esx_realparking:impoundVehicle", function(vehicle)
+ ImpoundVehicle(vehicle)
+end)
+
+function DebugLog(text)
+ if Config.debug then
+ print(string.format("[DEBUG] %s", text))
+ end
+end
+
+-- Get the stored vehicle player is in
+
+function GetPedInStoredCar(ped)
+ local tempVeh = GetVehiclePedIsIn(ped)
+ local findVeh = false
+ for i = 1, #LocalVehicles do
+ if LocalVehicles[i] ~= nil and LocalVehicles[i].entity == tempVeh then
+ findVeh = LocalVehicles[i]
+ break
+ end
+ end
+ -- Clean memory
+ tempVeh = nil
+ return findVeh
+end
+
+-- Spawn local vehicles
+
+function SpawnVehicles(vehicles)
+ Citizen.CreateThread(function()
+ while DeletingEntities do
+ Citizen.Wait(100)
+ end
+ DebugLog("Start spawn all vehicles")
+ for i = 1, #vehicles, 1 do
+ local vehicleProps = vehicles[i].vehicle.props
+ DeleteLocalVehicle(vehicles[i].vehicle)
+ DeleteNearVehicle(vec3(vehicles[i].vehicle.location.x, vehicles[i].vehicle.location.y, vehicles[i].vehicle.location.z))
+ local carLivery = -1
+ if type(vehicles[i].vehicle.livery) ~= "nil" then
+ carLivery = vehicles[i].vehicle.livery
+ end
+ LoadModel(vehicleProps["model"])
+ local tempVeh = CreateVehicle(vehicleProps["model"], vehicles[i].vehicle.location.x, vehicles[i].vehicle.location.y, vehicles[i].vehicle.location.z, vehicles[i].vehicle.location.h, false)
+ ESX.Game.SetVehicleProperties(tempVeh, vehicleProps)
+ RequestCollisionAtCoord(vehicles[i].vehicle.location.x, vehicles[i].vehicle.location.y, vehicles[i].vehicle.location.z)
+ SetVehicleOnGroundProperly(tempVeh)
+ SetEntityAsMissionEntity(tempVeh, true, true)
+ SetModelAsNoLongerNeeded(vehicleProps["model"])
+ SetEntityInvincible(tempVeh, true)
+ SetVehicleLivery(tempVeh, vehicles[i].vehicle.livery)
+ NetworkFadeInEntity(tempVeh, false)
+ Wait(100)
+ FreezeEntityPosition(tempVeh, true)
+ if vehicles[i].owner ~= PlayerData.identifier then
+ SetVehicleDoorsLocked(tempVeh, 2)
+ end
+ table.insert(LocalVehicles, {
+ entity = tempVeh,
+ data = vehicles[i].vehicle,
+ plate = vehicles[i].plate,
+ fee = vehicles[i].fee,
+ owner = vehicles[i].owner,
+ name = vehicles[i].name,
+ livery = carLivery,
+ health = vehicles[i].vehicle.health,
+ location = vehicles[i].vehicle.location,
+ })
+ if LastPlate ~= nil and vehicles[i].plate == LastPlate then
+ TaskWarpPedIntoVehicle(GetPlayerPed(-1), tempVeh, -1)
+ Wait(500)
+ TaskLeaveVehicle(GetPlayerPed(-1), tempVeh)
+ LastPlate = nil
+ end
+ Wait(300)
+ -- Clean memory
+ vehicleProps, carLivery, tempVeh = nil
+ end
+ end)
+end
+
+-- Spawn single vehicle
+
+function SpawnVehicle(vehicleData)
+ Citizen.CreateThread(function()
+ while DeletingEntities do
+ Citizen.Wait(100)
+ end
+ DeleteLocalVehicle(vehicleData.vehicle)
+ DeleteNearVehicle(vec3(vehicleData.vehicle.location.x, vehicleData.vehicle.location.y, vehicleData.vehicle.location.z))
+ local vehicleProps = vehicleData.vehicle.props
+ local carLivery = -1
+ if type(vehicleData.vehicle.livery) ~= "nil" then
+ carLivery = vehicleData.vehicle.livery
+ end
+ LoadModel(vehicleProps["model"])
+ local tempVeh = CreateVehicle(vehicleProps["model"], vehicleData.vehicle.location.x, vehicleData.vehicle.location.y, vehicleData.vehicle.location.z, vehicleData.vehicle.location.h, false)
+ ESX.Game.SetVehicleProperties(tempVeh, vehicleProps)
+ RequestCollisionAtCoord(vehicleData.vehicle.location.x, vehicleData.vehicle.location.y, vehicleData.vehicle.location.z)
+ SetVehicleOnGroundProperly(tempVeh)
+ SetEntityAsMissionEntity(tempVeh, true, true)
+ SetModelAsNoLongerNeeded(vehicleProps["model"])
+ SetEntityInvincible(tempVeh, true)
+ SetVehicleLivery(tempVeh, vehicleData.vehicle.livery)
+ SetVehicleEngineHealth(tempVeh, vehicleData.vehicle.health.engine)
+ SetVehicleBodyHealth(tempVeh, vehicleData.vehicle.health.body)
+ SetVehiclePetrolTankHealth(tempVeh, vehicleData.vehicle.health.tank)
+ NetworkFadeInEntity(tempVeh, false)
+ Wait(100)
+ FreezeEntityPosition(tempVeh, true)
+ if vehicleData.owner ~= PlayerData.identifier then
+ SetVehicleDoorsLocked(tempVeh, 2)
+ end
+ table.insert(LocalVehicles, {
+ entity = tempVeh,
+ data = vehicleData.vehicle,
+ plate = vehicleData.plate,
+ fee = vehicleData.fee,
+ owner = vehicleData.owner,
+ name = vehicleData.name,
+ livery = carLivery,
+ health = vehicleData.vehicle.health,
+ location = vehicleData.vehicle.location,
+ })
+ if LastPlate ~= nil and vehicleData.plate == LastPlate then
+ TaskWarpPedIntoVehicle(GetPlayerPed(-1), tempVeh, -1)
+ Wait(500)
+ TaskLeaveVehicle(GetPlayerPed(-1), tempVeh)
+ LastPlate = nil
+ end
+ -- Clean memory
+ vehicleProps, carLivery, tempVeh = nil
+ end)
+end
+
+-- When player drive the car
+
+function DriveVehicle(vehicle)
+ -- Delete the local entity first
+ DeleteNearVehicle(vector3(vehicle.location.x, vehicle.location.y, vehicle.location.z))
+ local vehicleProps = vehicle.props
+ LoadModel(vehicleProps["model"])
+ local tempVeh = CreateVehicle(vehicleProps["model"], vehicle.location.x, vehicle.location.y, vehicle.location.z, vehicle.location.h, true)
+ ESX.Game.SetVehicleProperties(tempVeh, vehicleProps)
+ SetVehicleOnGroundProperly(tempVeh)
+ SetVehicleLivery(tempVeh, vehicle.livery)
+ SetVehicleEngineHealth(tempVeh, vehicle.health.engine)
+ SetVehicleBodyHealth(tempVeh, vehicle.health.body)
+ SetVehiclePetrolTankHealth(tempVeh, vehicle.health.tank)
+ TaskWarpPedIntoVehicle(GetPlayerPed(-1), tempVeh, -1)
+ -- Clean memory
+ vehicleProps, tempVeh = nil
+end
+
+-- Remove the local vehicles
+
+function RemoveVehicles(vehicles)
+ DebugLog("Start delete vehicles")
+ DeletingEntities = true
+ for i = 1, #vehicles, 1 do
+ local tmpLoc = {
+ ["x"] = vehicles[i].vehicle.location.x,
+ ["y"] = vehicles[i].vehicle.location.y,
+ ["z"] = vehicles[i].vehicle.location.z,
+ ["h"] = 0.0,
+ }
+ local veh, distance = ESX.Game.GetClosestVehicle(tmpLoc)
+ if NetworkGetEntityIsLocal(veh) and distance < 1 then
+ local driver = GetPedInVehicleSeat(veh, -1)
+ if not DoesEntityExist(driver) or not IsPedAPlayer(driver) then
+ local tmpModel = GetEntityModel(veh)
+ SetModelAsNoLongerNeeded(tmpModel)
+ DeleteEntity(veh)
+ Citizen.Wait(300)
+ end
+ end
+ -- Clean memory
+ tmpLoc, veh, distance, driver, tmpModel = nil
+ end
+ LocalVehicles = {}
+ DeletingEntities = false
+ DebugLog("Finished delete vehicles")
+end
+
+function CheckVehicleImpound()
+ for i = 1, #LocalVehicles do
+ if type(LocalVehicles[i]) ~= "nil" and type(LocalVehicles[i].entity) ~= "nil" then
+ if not DoesEntityExist(LocalVehicles[i].entity) then
+ DebugLog("Vehicle" .. tostring(LocalVehicles[i].entity) .. " has been impound, remove from database")
+ ImpoundVehicle(LocalVehicles[i].entity)
+ LocalVehicles[i] = nil
+ end
+ end
+ end
+end
+
+function UpdateVehicleStatus()
+ for i = 1, #LocalVehicles do
+ if type(LocalVehicles[i]) ~= "nil" and type(LocalVehicles[i].entity) ~= "nil" then
+ if DoesEntityExist(LocalVehicles[i].entity) and type(LocalVehicles[i].onground) == "nil" then
+ if GetDistanceBetweenCoords(GetEntityCoords(LocalVehicles[i].entity), GetEntityCoords(GetPlayerPed(-1))) < 50.0 then
+ SetEntityCoords(LocalVehicles[i].entity, LocalVehicles[i].location.x, LocalVehicles[i].location.y, LocalVehicles[i].location.z)
+ SetVehicleOnGroundProperly(LocalVehicles[i].entity)
+ LocalVehicles[i].onground = true
+ end
+ end
+ end
+ end
+end
+
+-- Delete single vehicle
+
+function DeleteLocalVehicle(vehicle)
+ for i = 1, #LocalVehicles do
+ if type(vehicle.plate) ~= "nil" and type(LocalVehicles[i]) ~= "nil" and type(LocalVehicles[i].plate) ~= "nil" then
+ if vehicle.plate == LocalVehicles[i].plate then
+ NetworkRequestControlOfEntity(LocalVehicles[i].entity)
+ local tmpModel = GetEntityModel(LocalVehicles[i].entity)
+ SetModelAsNoLongerNeeded(tmpModel)
+ DeleteEntity(LocalVehicles[i].entity)
+ LocalVehicles[i] = nil
+ tmpModel = nil
+ end
+ end
+ end
+end
+
+-- Delete the vehicle near the location
+
+function DeleteNearVehicle(location)
+ local veh, distance = ESX.Game.GetClosestVehicle(location)
+ if distance <= 1 then
+ for i = 1, #LocalVehicles do
+ if LocalVehicles[i] ~= nil and LocalVehicles[i].entity == veh then
+ LocalVehicles[i] = nil
+ end
+ end
+ local driver = GetPedInVehicleSeat(veh, -1)
+ if not DoesEntityExist(driver) or not IsPedAPlayer(driver) then
+ NetworkRequestControlOfEntity(veh)
+ local tmpModel = GetEntityModel(veh)
+ SetModelAsNoLongerNeeded(tmpModel)
+ DeleteEntity(veh)
+ tmpModel = nil
+ end
+ end
+end
+
+-- Impound vehicle for esx_policejob
+
+function ImpoundVehicle(vehicle)
+ for i = 1, #LocalVehicles do
+ if LocalVehicles[i] ~= nil and vehicle == LocalVehicles[i].entity then
+ local deleteData = LocalVehicles[i]
+ ESX.TriggerServerCallback("esx_realparking:impoundVehicle", function(callback)
+ if callback.status then
+ DeleteEntity(deleteData.entity)
+ LocalVehicles[i] = nil
+ end
+ deleteData = nil
+ end, LocalVehicles[i])
+ end
+ end
+end
+
+-- Just some help text
+
+function DisplayHelpText(text)
+ SetTextComponentFormat("STRING")
+ AddTextComponentString(text)
+ DisplayHelpTextFromStringLabel(0, 0, 1, -1)
+end
+
+-- Load car model
+
+function LoadModel(model)
+ while not HasModelLoaded(model) do
+ RequestModel(model)
+ Citizen.Wait(1)
+ end
+end
+
+-- Draw 3d text on screen
+
+function Draw3DText(x, y, z, textInput, fontId, scaleX, scaleY)
+ local px, py, pz = table.unpack(GetGameplayCamCoords())
+ local dist = GetDistanceBetweenCoords(px, py, pz, x, y, z, 1)
+ local scale = (1 / dist) * 20
+ local fov = (1 / GetGameplayCamFov()) * 100
+ local scale = scale * fov
+ SetTextScale(scaleX * scale, scaleY * scale)
+ SetTextFont(fontId)
+ SetTextProportional(1)
+ SetTextColour(250, 250, 250, 255)
+ SetTextDropshadow(1, 1, 1, 1, 255)
+ SetTextEdge(2, 0, 0, 0, 150)
+ SetTextDropShadow()
+ SetTextOutline()
+ SetTextEntry("STRING")
+ SetTextCentre(1)
+ AddTextComponentString(textInput)
+ SetDrawOrigin(x, y, z + 2, 0)
+ DrawText(0.0, 0.0)
+ ClearDrawOrigin()
+ px, py, pz, dist, scale, fov, scale = nil
+end
+
+-- Main thread
+
+Citizen.CreateThread(function()
+ while ESX == nil do
+ Citizen.Wait(10)
+ ESX = exports["es_extended"]:getSharedObject()
+ end
+ Wait(1000)
+ while not ESX.IsPlayerLoaded() do
+ Citizen.Wait(10)
+ end
+ PlayerData = ESX.GetPlayerData()
+ ESX.TriggerServerCallback("esx_realparking:getPlayerIdentifier", function(callback)
+ PlayerIdentifier = callback
+ Citizen.Wait(500)
+ end)
+end)
+
+-- Check distance
+
+Citizen.CreateThread(function()
+ while PlayerIdentifier == nil do
+ Citizen.Wait(10)
+ end
+ while true do
+ Wait(100)
+ local pl = GetEntityCoords(GetPlayerPed(-1))
+ local inParking = false
+ local crParking = nil
+ for k, v in pairs(Config.ParkingLocations) do
+ if GetDistanceBetweenCoords(pl.x, pl.y, pl.z, v.x, v.y, v.z, true) < v.size + 20.0 then
+ inParking = true
+ crParking = k
+ end
+ end
+ if inParking then
+ if not SpawnedVehicles then
+ RemoveVehicles(GlobalVehicles)
+ while DeletingEntities do
+ Wait(100)
+ end
+ DebugLog("Player enter parking radius")
+ TriggerServerEvent("esx_realparking:refreshVehicles", crParking)
+ SpawnedVehicles = true
+ Wait(2000)
+ end
+ CheckVehicleImpound()
+ UpdateVehicleStatus()
+ else
+ if SpawnedVehicles then
+ DebugLog("Player leave parking radius")
+ RemoveVehicles(GlobalVehicles)
+ SpawnedVehicles = false
+ end
+ end
+ -- Clean memory
+ pl, inParking, crParking = nil
+ end
+end)
+
+-- Update vehicle coords
+
+Citizen.CreateThread(function()
+ while true do
+ if #LocalVehicles ~= 0 then
+ UpdateVehicleStatus()
+ end
+ collectgarbage("collect")
+ Wait(1000)
+ end
+end)
+
+-- Draw text thread
+
+Citizen.CreateThread(function()
+ while true do
+ Wait(0)
+ local fd = true
+ local pl = GetEntityCoords(GetPlayerPed(-1))
+ if fd then
+ fd = false
+ for k, v in pairs(Config.ParkingLocations) do
+ if GetDistanceBetweenCoords(pl.x, pl.y, pl.z, v.enter.x, v.enter.y, v.enter.z, true) < 20 then
+ Draw3DText(v.enter.x, v.enter.y, v.enter.z, v.name, 0, 0.2, 0.2)
+ Draw3DText(v.enter.x, v.enter.y, v.enter.z - 0.5, string.format(_U("parking_fee", v.fee)), 0, 0.1, 0.1)
+ fd = true
+ end
+ end
+ for k, v in pairs(LocalVehicles) do
+ if GetDistanceBetweenCoords(pl.x, pl.y, pl.z, v.data.location.x, v.data.location.y, v.data.location.z, true) < 3.0 then
+ Draw3DText(v.data.location.x, v.data.location.y, v.data.location.z, string.format(_U("owner", v.name)), 0, 0.08, 0.08)
+ Draw3DText(v.data.location.x, v.data.location.y, v.data.location.z - 0.2, string.format(_U("plate", v.plate)), 0, 0.05, 0.05)
+ fd = true
+ end
+ end
+ else
+ Wait(100)
+ end
+ -- Clean memory
+ pl = nil
+ end
+end)
+
+-- Creating blips
+
+Citizen.CreateThread(function()
+ for k, v in pairs(Config.ParkingLocations) do
+ local tempBlip = AddBlipForCoord(v.enter.x, v.enter.y, v.enter.z)
+ SetBlipSprite(tempBlip, 523)
+ SetBlipColour(tempBlip, 11)
+ SetBlipAsShortRange(tempBlip, true)
+ BeginTextCommandSetBlipName("STRING")
+ AddTextComponentString(v.name)
+ EndTextCommandSetBlipName(tempBlip)
+ -- Clean memory
+ tempBlip = nil
+ end
+end)
+
+-- Logic thread
+
+Citizen.CreateThread(function()
+ while true do
+ Citizen.Wait(0)
+ local pl = GetEntityCoords(GetPlayerPed(-1))
+ local inParking = false
+ local parkName = nil
+ local parkData = nil
+ for k, v in pairs(Config.ParkingLocations) do
+ if pl.x > v.x - v.size and pl.x < v.x + v.size and pl.y > v.y - v.size and pl.y < v.y + v.size and pl.z > v.z - v.height and pl.z < v.z + v.height then
+ inParking = true
+ parkName = k
+ parkData = v
+ end
+ end
+ if inParking and IsPedInAnyVehicle(GetPlayerPed(-1)) then
+ local storedVehicle = GetPedInStoredCar(GetPlayerPed(-1))
+ if storedVehicle ~= false then
+ DisplayHelpText(string.format(_U("need_parking_fee", storedVehicle.fee)))
+ else
+ if parkData.notify == nil or parkData.notify then
+ DisplayHelpText(_U("press_to_save"))
+ end
+ end
+ if IsControlJustReleased(0, Config.KeyToSave) then
+ if storedVehicle ~= false then
+ DoScreenFadeOut(250)
+ Wait(500)
+ ESX.TriggerServerCallback("esx_realparking:driveCar", function(callback)
+ if callback.status then
+ DeleteVehicle(storedVehicle.entity)
+ DeleteVehicle(GetVehiclePedIsIn(GetPlayerPed(-1)))
+ storedVehicle = nil
+ Wait(500)
+ DriveVehicle(callback.vehData)
+ ESX.ShowNotification(callback.message)
+ else
+ ESX.ShowNotification(callback.message)
+ end
+ Wait(1000)
+ DoScreenFadeIn(250)
+ -- Clean memory
+ storedVehicle = nil
+ end, storedVehicle)
+ else
+ local veh = GetVehiclePedIsIn(GetPlayerPed(-1))
+ if veh ~= 0 then
+ local speed = GetEntitySpeed(veh)
+ if speed > 0 then
+ ESX.ShowNotification(_U("stop_the_car"))
+ elseif IsThisModelACar(GetEntityModel(veh)) or IsThisModelABike(GetEntityModel(veh)) or IsThisModelABicycle(GetEntityModel(veh)) then
+ local vehProps = ESX.Game.GetVehicleProperties(veh)
+ local vehPos = GetEntityCoords(veh)
+ local vehHead = GetEntityHeading(veh)
+ local engHealth = GetVehicleEngineHealth(veh)
+ local bdyHealth = GetVehicleBodyHealth(veh)
+ local tnkHealth = GetVehiclePetrolTankHealth(veh)
+ LastPlate = vehProps.plate
+ DoScreenFadeOut(250)
+ Wait(500)
+ ESX.TriggerServerCallback("esx_realparking:saveCar", function(callback)
+ if callback.status then
+ DeleteVehicle(veh)
+ ESX.ShowNotification(callback.message)
+ else
+ ESX.ShowNotification(callback.message)
+ end
+ Wait(1000)
+ DoScreenFadeIn(250)
+ -- Clean memory
+ vehProps, vehPos, vehHead, engHealth, bdyHealth, tnkHealth = nil
+ end, {
+ location = { x = vehPos.x, y = vehPos.y, z = vehPos.z, h = vehHead },
+ props = vehProps,
+ parking = parkName,
+ livery = GetVehicleLivery(veh),
+ health = {
+ engine = engHealth,
+ body = bdyHealth,
+ tank = tnkHealth,
+ },
+ })
+ else
+ ESX.ShowNotification(_U("only_allow_car"))
+ end
+ end
+ -- Clean memory
+ veh = nil
+ end
+ end
+ else
+ Citizen.Wait(500)
+ end
+ -- Clean memory
+ pl = nil
+ parkName = nil
+ parkData = nil
+ end
+end)
diff --git a/server-data/resources/[esx_addons]/esx_realparking/config.lua b/server-data/resources/[esx_addons]/esx_realparking/config.lua
new file mode 100644
index 00000000..2e7f2094
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/config.lua
@@ -0,0 +1,65 @@
+Config = {}
+
+-- If you are using ESX 1.2.0 or higher please leave this to false
+Config.UsingOldESX = false
+
+-- locale
+Config.Locale = "it"
+
+-- The key to save the car, default key is "E" (horn)
+Config.KeyToSave = 51
+
+-- Enable debug mode
+Config.debug = false
+
+-- Parking locations
+Config.ParkingLocations = {
+ parking1 = {
+ x = -327.73, -- Central location X, Y, Z of the parking
+ y = -934.12, -- Y
+ z = 31.08, -- Z
+ size = 55.0, -- The parking range radius (Horizontal), set to 10000.0 then you can parking anywhere
+ height = 10.0, -- The parking range radius (Vertical)
+ name = "Public Parking", -- The name of the parking (blips)
+ fee = 1000, -- How much parking fee per day (Real life time), set 0 or false to disable
+ enter = { x = -279.25, y = -890.39, z = 30.08 }, -- The entrance of the parking
+ maxcar = 500, -- Max vehicles can save on this parking
+ notify = true, -- Display the "Press E to save" notification, set to false can disable it
+ },
+ parking2 = {
+ x = -340.03,
+ y = 285.19,
+ z = 84.77,
+ size = 15.0,
+ height = 10.0,
+ name = "Public Parking",
+ fee = 500,
+ enter = { x = -338.57, y = 267.16, z = 85.73 },
+ maxcar = 10,
+ notify = true,
+ },
+ parking3 = {
+ x = 446.98,
+ y = 246.07,
+ z = 103.86,
+ size = 25.0,
+ height = 10.0,
+ name = "Public Parking",
+ fee = 800,
+ enter = { x = 467.96, y = 265.07, z = 103.09 },
+ maxcar = 20,
+ notify = true,
+ },
+ parking4 = {
+ x = 374.35,
+ y = 279.49,
+ z = 103.32,
+ size = 20.0,
+ height = 10.0,
+ name = "Public Parking",
+ fee = 700,
+ enter = { x = 364.77, y = 298.98, z = 103.5 },
+ maxcar = 15,
+ notify = true,
+ },
+}
diff --git a/server-data/resources/[esx_addons]/esx_realparking/esx_realparking.sql b/server-data/resources/[esx_addons]/esx_realparking/esx_realparking.sql
new file mode 100644
index 00000000..c929db72
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/esx_realparking.sql
@@ -0,0 +1,11 @@
+CREATE TABLE `car_parking` (
+ `id` int(10) NOT NULL AUTO_INCREMENT,
+ `owner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+ `plate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+ `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
+ `time` bigint(20) NOT NULL,
+ `parking` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
+
+INSERT INTO `items`(`name`, `label`, `limit`) VALUES ('parkingcard', 'Parking Card', -1);
diff --git a/server-data/resources/[esx_addons]/esx_realparking/esx_realparking_newESX.sql b/server-data/resources/[esx_addons]/esx_realparking/esx_realparking_newESX.sql
new file mode 100644
index 00000000..4607d369
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/esx_realparking_newESX.sql
@@ -0,0 +1,11 @@
+CREATE TABLE `car_parking` (
+ `id` int(10) NOT NULL AUTO_INCREMENT,
+ `owner` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+ `plate` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+ `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
+ `time` bigint(20) NOT NULL,
+ `parking` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+ PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
+
+INSERT INTO `items`(`name`, `label`, `weight`) VALUES ('parkingcard', 'Parking Card', 0);
diff --git a/server-data/resources/[esx_addons]/esx_realparking/fxmanifest.lua b/server-data/resources/[esx_addons]/esx_realparking/fxmanifest.lua
new file mode 100644
index 00000000..be2487fc
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/fxmanifest.lua
@@ -0,0 +1,20 @@
+fx_version("adamant")
+game("gta5")
+version("1.0.2")
+
+shared_script("@es_extended/imports.lua")
+
+client_scripts({
+ "@es_extended/locale.lua",
+ "config.lua",
+ "locales/*.lua",
+ "client/main.lua",
+})
+
+server_scripts({
+ "@mysql-async/lib/MySQL.lua",
+ "@es_extended/locale.lua",
+ "config.lua",
+ "locales/*.lua",
+ "server/main.lua",
+})
diff --git a/server-data/resources/[esx_addons]/esx_realparking/locales/bg.lua b/server-data/resources/[esx_addons]/esx_realparking/locales/bg.lua
new file mode 100644
index 00000000..fef27a27
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/locales/bg.lua
@@ -0,0 +1,16 @@
+Locales["en"] = {
+ ["only_allow_car"] = "Тук може да паркирате само леки автомобили",
+ ["car_saved"] = "Колата Ви беше паркирана и съхранена",
+ ["press_to_save"] = "Натиснете ~INPUT_CONTEXT~ за да паркирате и съхраните Вашият автомобил",
+ ["not_your_car"] = "Тази кола не е ваша собственост, че да я съхраните",
+ ["need_parking_fee"] = "Press ~INPUT_CONTEXT~ to pay the parking fees for ~g~$%s~s~",
+ ["not_enough_money"] = "Нямате достатъчно средства",
+ ["parking_fee"] = "Такса паркинг: ~g~$%s/ден",
+ ["pay_success"] = "Вие заплатихте такса от ~g~$%s~s~ и може да продължите своето пътуване",
+ ["parking_full"] = "Паркингът е пълен, може да опитате другите ни локации",
+ ["invalid_car"] = "Това не е Вашият автомобил",
+ ["already_parking"] = "Съществува автомобил с Вашият регистрационен номер на този паркинг",
+ ["owner"] = "Собственик: ~y~%s~s~",
+ ["plate"] = "Регистрационен номер: ~g~%s~s~",
+ ["stop_the_car"] = "You should stop the car first",
+}
diff --git a/server-data/resources/[esx_addons]/esx_realparking/locales/de.lua b/server-data/resources/[esx_addons]/esx_realparking/locales/de.lua
new file mode 100644
index 00000000..28ec7ac7
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/locales/de.lua
@@ -0,0 +1,17 @@
+-- German translate by moistnutzz
+Locales["de"] = {
+ ["only_allow_car"] = "Du kannst nur hier Parken",
+ ["car_saved"] = "Dein Auto wurde eingeparkt",
+ ["press_to_save"] = "Drücke ~INPUT_CONTEXT~ um dein Auto einzuparken",
+ ["not_your_car"] = "Du musst dieses Auto besitzen um es einzuparken",
+ ["need_parking_fee"] = "Drücke ~INPUT_CONTEXT~ um die Parkgebühren zu bezahlen ~g~$%s~s~",
+ ["not_enough_money"] = "Du hast nicht genügend Geld",
+ ["parking_fee"] = "Parkgebühren: ~g~$%s/Tag",
+ ["pay_success"] = "Du hast die Parkgebühr von: ~g~$%s~s~ bezahlt, du kannst dein Auto nun fahren",
+ ["parking_full"] = "Dieser Parkplatz ist voll, du kannst hier nicht Parken",
+ ["invalid_car"] = "Du hast dieses Auto hier nicht eingeparkt oder hast keine Erlaubnis, dieses Auto zu fahren",
+ ["already_parking"] = "Dieses Auto ist schon auf dem Parkplatz mit dem selben Nummernschild",
+ ["owner"] = "Besitzer: ~y~%s~s~",
+ ["plate"] = "Nummernschild: ~g~%s~s~",
+ ["stop_the_car"] = "You should stop the car first",
+}
diff --git a/server-data/resources/[esx_addons]/esx_realparking/locales/en.lua b/server-data/resources/[esx_addons]/esx_realparking/locales/en.lua
new file mode 100644
index 00000000..463461b4
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/locales/en.lua
@@ -0,0 +1,16 @@
+Locales["en"] = {
+ ["only_allow_car"] = "You only can store cars here",
+ ["car_saved"] = "You car has been stored",
+ ["press_to_save"] = "Press ~INPUT_CONTEXT~ to store your car",
+ ["not_your_car"] = "You have to own the car to store it",
+ ["need_parking_fee"] = "Press ~INPUT_CONTEXT~ to pay the parking fees for ~g~$%s~s~",
+ ["not_enough_money"] = "You don't have enough money",
+ ["parking_fee"] = "Parking fees: ~g~$%s/day",
+ ["pay_success"] = "You paid parking fee for ~g~$%s~s~ and you can drive the car now",
+ ["parking_full"] = "This parking is full, you can't parking here",
+ ["invalid_car"] = "You didn't store the car here or you don't have permission to drive this car",
+ ["already_parking"] = "This car parking has already stored a car with same plate",
+ ["owner"] = "Owner: ~y~%s~s~",
+ ["plate"] = "Plate: ~g~%s~s~",
+ ["stop_the_car"] = "You should stop the car first",
+}
diff --git a/server-data/resources/[esx_addons]/esx_realparking/locales/es.lua b/server-data/resources/[esx_addons]/esx_realparking/locales/es.lua
new file mode 100644
index 00000000..0c36a792
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/locales/es.lua
@@ -0,0 +1,16 @@
+Locales["es"] = {
+ ["only_allow_car"] = "Solo puedes guardar coches aquí",
+ ["car_saved"] = "Tu coche ha sido guardado",
+ ["press_to_save"] = "Presiona ~INPUT_CONTEXT~ para guardar tu coche",
+ ["not_your_car"] = "Tiene que ser tu coche para poder guardarlo",
+ ["need_parking_fee"] = "Presiona ~INPUT_CONTEXT~ para pagar las tasas de aparcamiento por ~g~$%s~s~",
+ ["not_enough_money"] = "No tienes suficiente dinero",
+ ["parking_fee"] = "Tasas de Apartamiento: ~g~$%s/día",
+ ["pay_success"] = "Has pagado las tasas de aparcamiento por ~g~$%s~s~ y ya puede recoger tu coche",
+ ["parking_full"] = "El aparcamiento está completo,no puedes aparcar aquí",
+ ["invalid_car"] = "No has guardado el vehículo aquí o no tienes autorización para conducir este coche",
+ ["already_parking"] = "Este aparcamiento ya ha guardado un coche con la misma matrícula",
+ ["owner"] = "Dueño: ~y~%s~s~",
+ ["plate"] = "Matrícula: ~g~%s~s~",
+ ["stop_the_car"] = "You should stop the car first",
+}
diff --git a/server-data/resources/[esx_addons]/esx_realparking/locales/fr.lua b/server-data/resources/[esx_addons]/esx_realparking/locales/fr.lua
new file mode 100644
index 00000000..0809ebc9
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/locales/fr.lua
@@ -0,0 +1,16 @@
+Locales["fr"] = {
+ ["only_allow_car"] = "Vous ne pouvez stocker que des voitures ici",
+ ["car_saved"] = "Votre voiture est garé",
+ ["press_to_save"] = "Appuyez sur ~INPUT_CONTEXT~ pour garer votre véhicule",
+ ["not_your_car"] = "Vous devez posséder la voiture pour la garer",
+ ["need_parking_fee"] = "Appuyez sur ~INPUT_CONTEXT~ pour payer les frais de stationnement pour ~g~$%s~s~",
+ ["not_enough_money"] = "Vous n'avez pas assez d'argent",
+ ["parking_fee"] = "Frais de stationnement: ~g~$%s/jour",
+ ["pay_success"] = "Vous avez payé des frais de stationnement pour ~g~$%s~s~ et vous pouvez conduire la voiture maintenant",
+ ["parking_full"] = "Ce parking est plein, vous ne pouvez pas vous garer ici",
+ ["invalid_car"] = "Vous n'avez pas entreposé la voiture ici ou vous n'avez pas l'autorisation de conduire cette voiture",
+ ["already_parking"] = "Ce parking a déjà stocké une voiture avec la même plaque",
+ ["owner"] = "Propriétaire: ~y~%s~s~",
+ ["plate"] = "Plaque d'immatriculation: ~g~%s~s~",
+ ["stop_the_car"] = "You should stop the car first",
+}
diff --git a/server-data/resources/[esx_addons]/esx_realparking/locales/it.lua b/server-data/resources/[esx_addons]/esx_realparking/locales/it.lua
new file mode 100644
index 00000000..d2473f1f
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/locales/it.lua
@@ -0,0 +1,16 @@
+Locales["it"] = {
+ ["only_allow_car"] = "Puoi depositare solo le auto qui",
+ ["car_saved"] = "La tua auto è stata depositata",
+ ["press_to_save"] = "Premi ~INPUT_CONTEXT~ per posteggiare la tua auto",
+ ["not_your_car"] = "Devi possedere l'auto per conservarla",
+ ["need_parking_fee"] = "Premi ~INPUT_CONTEXT~ per pagare le tariffe del parcheggio ~g~$%s~s~",
+ ["not_enough_money"] = "Non hai abbastanza soldi",
+ ["parking_fee"] = "Tasse di parcheggio: ~g~$%s/day",
+ ["pay_success"] = "Hai pagato il parcheggio ~g~$%s~s~ ora puoi guidare",
+ ["parking_full"] = "Questo parcheggio è pieno, non puoi parcheggiare qui",
+ ["invalid_car"] = "Non hai lasciato l'auto qui o non hai il permesso di guidarla",
+ ["already_parking"] = "In questo parcheggio è già custodita un'auto con la stessa targa",
+ ["owner"] = "Proprietario: ~y~%s~s~",
+ ["plate"] = "Targa: ~g~%s~s~",
+ ["stop_the_car"] = "Dovresti prima fermare la macchina",
+}
diff --git a/server-data/resources/[esx_addons]/esx_realparking/locales/zh.lua b/server-data/resources/[esx_addons]/esx_realparking/locales/zh.lua
new file mode 100644
index 00000000..8d8b3d04
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/locales/zh.lua
@@ -0,0 +1,16 @@
+Locales["zh"] = {
+ ["only_allow_car"] = "你只能在這裡停放汽車",
+ ["car_saved"] = "你的車輛已經保存",
+ ["press_to_save"] = "按下 ~INPUT_CONTEXT~ 來保存你的車輛",
+ ["not_your_car"] = "你必須擁有這輛車的所有權才能保存",
+ ["need_parking_fee"] = "按下 ~INPUT_CONTEXT~ 來繳納 ~g~¥%s元~s~ 停車費後即可離開",
+ ["not_enough_money"] = "你沒有足夠的錢",
+ ["parking_fee"] = "停車費用:~g~¥%s元/天",
+ ["pay_success"] = "你已支付了停車費 ~g~¥%s元~s~,現在可以將車開走了",
+ ["parking_full"] = "這個停車場已經不能再停放更多的車了",
+ ["invalid_car"] = "你沒有在這個停車場存放這輛車",
+ ["already_parking"] = "這個停車場已經停著一輛相同車牌的車了",
+ ["owner"] = "車主:~y~%s~s~",
+ ["plate"] = "車牌:~g~%s~s~",
+ ["stop_the_car"] = "請先把車停下來才能保存",
+}
diff --git a/server-data/resources/[esx_addons]/esx_realparking/server/main.lua b/server-data/resources/[esx_addons]/esx_realparking/server/main.lua
new file mode 100644
index 00000000..2e3af817
--- /dev/null
+++ b/server-data/resources/[esx_addons]/esx_realparking/server/main.lua
@@ -0,0 +1,280 @@
+ESX = exports["es_extended"]:getSharedObject()
+
+-- When the client request to refresh the vehicles
+
+RegisterServerEvent("esx_realparking:refreshVehicles")
+AddEventHandler("esx_realparking:refreshVehicles", function(parkingName)
+ local xPlayer = ESX.GetPlayerFromId(source)
+ RefreshVehicles(xPlayer, source, parkingName)
+end)
+
+-- Save the car to database
+
+ESX.RegisterServerCallback("esx_realparking:saveCar", function(source, cb, vehicleData)
+ local xPlayer = ESX.GetPlayerFromId(source)
+ local plate = vehicleData.props.plate
+ local isFound = false
+ FindPlayerVehicles(xPlayer.identifier, function(vehicles)
+ for k, v in pairs(vehicles) do
+ if type(v.plate) ~= "nil" and string.trim(plate) == string.trim(v.plate) then
+ isFound = true
+ end
+ end
+ if GetVehicleNumOfParking(vehicleData.parking) > Config.ParkingLocations[vehicleData.parking].maxcar then
+ cb({
+ status = false,
+ message = _U("parking_full"),
+ })
+ elseif isFound then
+ MySQL.Async.fetchAll("SELECT * FROM `car_parking` WHERE `owner` = @identifier AND `plate` = @plate", {
+ ["@identifier"] = xPlayer.identifier,
+ ["@plate"] = plate,
+ }, function(rs)
+ if type(rs) == "table" and #rs > 0 then
+ cb({
+ status = false,
+ message = _U("already_parking"),
+ })
+ else
+ MySQL.Async.execute("INSERT INTO `car_parking` (`owner`, `plate`, `data`, `time`, `parking`) VALUES (@owner, @plate, @data, @time, @parking)", {
+ ["@owner"] = xPlayer.identifier,
+ ["@plate"] = plate,
+ ["@data"] = json.encode(vehicleData),
+ ["@time"] = os.time(),
+ ["@parking"] = vehicleData.parking,
+ })
+ MySQL.Async.execute("UPDATE `owned_vehicles` SET `stored` = 2 WHERE `plate` = @plate AND `owner` = @identifier", {
+ ["@plate"] = plate,
+ ["@identifier"] = xPlayer.identifier,
+ })
+ MySQL.Async.execute("UPDATE `owned_vehicles` SET `vehicle` = @vehicle WHERE `owner` = @owner AND `plate` = @plate", {
+ ["@owner"] = xPlayer.identifier,
+ ["@vehicle"] = json.encode(vehicleData.props),
+ ["@plate"] = plate,
+ })
+ MySQL.Async.execute("UPDATE `owned_vehicles` SET `parking` = @parking WHERE `plate` = @plate AND `owner` = @identifier", {
+ ["@plate"] = plate,
+ ["@identifier"] = xPlayer.identifier,
+ ["@parking"] = "parking",
+ })
+ cb({
+ status = true,
+ message = _U("car_saved"),
+ })
+ Wait(100)
+ TriggerClientEvent("esx_realparking:addVehicle", -1, { vehicle = vehicleData, plate = plate, fee = 0.0, owner = xPlayer.identifier, name = xPlayer.getName() }, xPlayer.source)
+ end
+ end)
+ else
+ cb({
+ status = false,
+ message = _U("not_your_car"),
+ })
+ end
+ end)
+end)
+
+-- When player request to drive the car
+
+ESX.RegisterServerCallback("esx_realparking:driveCar", function(source, cb, vehicleData)
+ local xPlayer = ESX.GetPlayerFromId(source)
+ local plate = vehicleData.plate
+ local isFound = false
+ FindPlayerVehicles2(xPlayer.identifier, function(vehicles)
+ for k, v in pairs(vehicles) do
+ if type(v.plate) ~= "nil" and string.trim(plate) == string.trim(v.plate) then
+ isFound = true
+ end
+ end
+ if isFound then
+ MySQL.Async.fetchAll("SELECT * FROM `car_parking` WHERE `owner` = @identifier AND `plate` = @plate", {
+ ["@identifier"] = xPlayer.identifier,
+ ["@plate"] = plate,
+ }, function(rs)
+ if type(rs) == "table" and #rs > 0 and rs[1] ~= nil then
+ local fee = math.floor(((os.time() - rs[1].time) / 86400) * Config.ParkingLocations[rs[1].parking].fee)
+ local playerMoney = xPlayer.getMoney()
+ local parkingCard = xPlayer.getInventoryItem("parkingcard").count
+ if parkingCard > 0 then
+ fee = 0
+ end
+ if playerMoney >= fee then
+ xPlayer.removeMoney(fee)
+ MySQL.Async.execute("DELETE FROM `car_parking` WHERE `plate` = @plate AND `owner` = @identifier", {
+ ["@plate"] = plate,
+ ["@identifier"] = xPlayer.identifier,
+ })
+ MySQL.Async.execute("UPDATE `owned_vehicles` SET `stored` = 0 WHERE `plate` = @plate", {
+ ["@plate"] = plate,
+ })
+ MySQL.Async.execute("UPDATE `owned_vehicles` SET `owner` = @identifier WHERE `plate` = @plate", {
+ ["@plate"] = plate,
+ ["@identifier"] = xPlayer.identifier,
+ })
+ cb({
+ status = true,
+ message = string.format(_U("pay_success", fee)),
+ vehData = json.decode(rs[1].data),
+ })
+ TriggerClientEvent("esx_realparking:deleteVehicle", -1, {
+ plate = plate,
+ })
+ else
+ cb({
+ status = false,
+ message = _U("not_enough_money"),
+ })
+ end
+ else
+ cb({
+ status = false,
+ message = _U("invalid_car"),
+ })
+ end
+ end)
+ else
+ cb({
+ status = false,
+ message = _U("not_your_car"),
+ })
+ end
+ end)
+end)
+
+-- When the police impound the car, support for esx_policejob
+
+ESX.RegisterServerCallback("esx_realparking:impoundVehicle", function(source, cb, vehicleData)
+ local xPlayer = ESX.GetPlayerFromId(source)
+ local plate = vehicleData.plate
+ MySQL.Async.fetchAll("SELECT * FROM `car_parking` WHERE `plate` = @plate", {
+ ["@plate"] = plate,
+ }, function(rs)
+ if type(rs) == "table" and #rs > 0 and rs[1] ~= nil then
+ print("Police impound the vehicle: ", vehicleData.plate, rs[1].owner)
+ MySQL.Async.execute("DELETE FROM `car_parking` WHERE `plate` = @plate AND `owner` = @identifier", {
+ ["@plate"] = plate,
+ ["@identifier"] = rs[1].owner,
+ })
+ MySQL.Async.execute("UPDATE `owned_vehicles` SET `stored` = 0 WHERE `plate` = @plate", {
+ ["@plate"] = plate,
+ })
+ MySQL.Async.execute("UPDATE `owned_vehicles` SET `owner` = @identifier WHERE `plate` = @plate", {
+ ["@plate"] = plate,
+ ["@identifier"] = rs[1].owner,
+ })
+ cb({
+ status = true,
+ })
+ TriggerClientEvent("esx_realparking:deleteVehicle", -1, {
+ plate = plate,
+ })
+ else
+ cb({
+ status = false,
+ message = _U("invalid_car"),
+ })
+ end
+ end)
+end)
+
+-- Send the identifier to client
+
+ESX.RegisterServerCallback("esx_realparking:getPlayerIdentifier", function(source, cb)
+ local xPlayer = ESX.GetPlayerFromId(source)
+ local playerId = xPlayer.identifier
+ if type(playerId) ~= "nil" then
+ cb(playerId)
+ else
+ print("[RealParking][ERROR] Failed to get the player identifier!")
+ end
+end)
+
+-- Refresh client local vehicles entity
+
+function RefreshVehicles(xPlayer, src, parkingName)
+ if src == nil then
+ src = -1
+ end
+ local vehicles = {}
+ local nameList = {}
+ if Config.UsingOldESX then
+ local nrs = MySQL.Sync.fetchAll("SELECT `identifier`, `name` FROM `users`")
+ if type(nrs) == "table" then
+ for k, v in pairs(nrs) do
+ nameList[v.identifier] = v.name
+ end
+ end
+ else
+ local nrs = MySQL.Sync.fetchAll("SELECT `identifier`, `firstname`, `lastname` FROM `users`")
+ if type(nrs) == "table" then
+ for k, v in pairs(nrs) do
+ nameList[v.identifier] = tostring(v.firstname) .. " " .. tostring(v.lastname)
+ end
+ end
+ end
+ local querySQL = "SELECT * FROM `car_parking`"
+ local queryArg = {}
+ if parkingName ~= nil then
+ querySQL = "SELECT * FROM `car_parking` WHERE `parking` = @parkingName"
+ queryArg = {
+ ["@parkingName"] = parkingName,
+ }
+ end
+ MySQL.Async.fetchAll(querySQL, queryArg, function(rs)
+ for k, v in pairs(rs) do
+ local vehicle = json.decode(v.data)
+ local plate = v.plate
+ local fee = math.floor(((os.time() - v.time) / 86400) * Config.ParkingLocations[v.parking].fee)
+ if fee < 0 then
+ fee = 0
+ end
+ table.insert(vehicles, { vehicle = vehicle, plate = plate, fee = fee, owner = v.owner, name = nameList[v.owner] })
+ end
+ TriggerClientEvent("esx_realparking:refreshVehicles", src, vehicles)
+ end)
+end
+
+-- Get the number of the vehicles
+
+function GetVehicleNumOfParking(name)
+ local rs = MySQL.Sync.fetchAll("SELECT `id` FROM `car_parking` WHERE `parking` = @parking", { ["@parking"] = name })
+ if type(rs) == "table" then
+ return #rs
+ else
+ return 0
+ end
+end
+
+-- Get all vehicles the player owned
+
+function FindPlayerVehicles(id, cb)
+ local vehicles = {}
+ MySQL.Async.fetchAll("SELECT * FROM `owned_vehicles` WHERE `owner` = @identifier", { ["@identifier"] = id }, function(rs)
+ for k, v in pairs(rs) do
+ local vehicle = json.decode(v.vehicle)
+ local plate = v.plate
+ table.insert(vehicles, { vehicle = vehicle, plate = plate })
+ end
+ cb(vehicles)
+ end)
+end
+function FindPlayerVehicles2(id, cb)
+ local vehicles = {}
+ MySQL.Async.fetchAll("SELECT * FROM `car_parking` WHERE `owner` = @identifier", { ["@identifier"] = id }, function(rs)
+ for k, v in pairs(rs) do
+ local vehicle = json.decode(v.vehicle)
+ local plate = v.plate
+ table.insert(vehicles, { vehicle = vehicle, plate = plate })
+ end
+ cb(vehicles)
+ end)
+end
+-- Clear the text
+
+string.trim = function(text)
+ if text ~= nil then
+ return text:match("^%s*(.-)%s*$")
+ else
+ return nil
+ end
+end
diff --git a/server-data/resources/[ox]/ox_inventory/data/items.lua b/server-data/resources/[ox]/ox_inventory/data/items.lua
index 2a29fe2b..da1fc6a4 100644
--- a/server-data/resources/[ox]/ox_inventory/data/items.lua
+++ b/server-data/resources/[ox]/ox_inventory/data/items.lua
@@ -14,6 +14,10 @@ return {
label = "Dirty Money",
},
+ ["parkingcard"] = {
+ label = "Tessera parcheggio",
+ },
+
["burger"] = {
label = "Burger",
weight = 220,
@@ -34,7 +38,7 @@ return {
anim = "eating",
prop = "burger",
usetime = 2500,
- notification = "Stai mangiano una fetta di panettone",
+ notification = "Stai mangiando una fetta di panettone",
},
},