1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-07-14 18:34:49 +02:00
parent 19fb68f805
commit 01d047b3cc
53 changed files with 3222 additions and 5 deletions

View file

@ -0,0 +1,659 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
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.
ox_doorlock
Copyright (C) 2022
Linden <https://www.github.com/thelindat>
Luke <https://github.com/LukeWasTakenn>
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 <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
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
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -0,0 +1,130 @@
# Ox Doorlock
Door management resource, with compatibility for ox_core, qb-core, and es_extended.
Successor to nui_doorlock with less scuff and more stuff.
_The UI needs to be built - use the [latest release](https://github.com/overextended/ox_doorlock/releases/latest/download/ox_doorlock.zip) if you want to drag-n-drop._
## Dependencies
### [oxmysql](https://github.com/overextended/oxmysql)
Doors are stored in a database for ease-of-use and to allow data to be easily cleared or shared.
mysql-async is no longer supported.
- does not support error-catching (pcall)
- people use older versions which do not support parameters as arrays
- it isn't maintained and has issues that will never be resolved
### [ox_lib](https://github.com/overextended/ox_lib) (v2.3.0 or higher)
Used for some UI elements (i.e. notifications, progress circle, input), and cache.
### [ox_target](https://github.com/overextended/ox_target) (preferred) or [qtarget](https://github.com/overextended/qtarget) (deprecated) or [qb-target](https://github.com/qbcore-framework/qb-target)
(Optional) Used for lockpicking.
## Usage
Use the `/doorlock` command to open the UI and enter the settings for your new door.
Once you confirm the settings, activate your targeting resource (typically LALT) to select the entity (or entities) to use.
Adding any arguments after the command will open the closest door to you, to easily modify it.
## Conversion
Placing nui_doorlock config files into the `convert` folder will convert the data and insert it into the database.
Success is _not_ guaranteed if using a fork on nui_doorlock, like the qb version.
## Client API
- Use the closest door. Still performs server-side checks, so may fail.
```lua
exports.ox_doorlock:useClosestDoor()
```
- Pick the lock of the closest door. Still performs server-side checks, so may fail.
```lua
exports.ox_doorlock:pickClosestDoor()
```
## Server API
- Get data for door
```lua
local mrpd_locker_rooms = exports.ox_doorlock:getDoor(1)
local mrpd_locker_rooms = exports.ox_doorlock:getDoorFromName('mrpd locker rooms')
```
- Set door state (0: unlocked, 1: locked)
```lua
TriggerEvent('ox_doorlock:setState', mrpd_locker_rooms.id, state)
```
- Listen for event when door is toggled
```lua
AddEventHandler('ox_doorlock:stateChanged', function(source, doorId, state, usedItem)
if usedItem == 'trainticket' then
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem(usedItem, 1)
end
end)
```
## Door Settings
### General
- Door name
- Used to easily identify the door.
- Passcode
- Door can be unlocked by anybody by using the code or phrase.
- Autolock interval
- Door will be locked after x seconds.
- Interact distance
- Door can only be used when within x metres.
- Door rate
- Door movement speed for sliding/garage/automatic doors, or swinging doors when locked.
- Locked
- Sets the door as locked by default.
- Double
- Door is a set of two doors, controlled together.
- Automatic
- Sliding/garage/automatic door.
- Lockpick
- Door can be lockpicked when interacting with a targeting resource.
- Hide UI
- No indicators (i.e. icon, text) will display on the door.
### Characters
- Character Id
- Character identifier used by a framework (i.e. player.charid, xPlayer.identifier, Player.CitizenId).
### Groups
- Group
- Framework dependent, referring to jobs, gangs, etc.
- Grade
- The minimum grade to allow access for the group (0 to allow all).
### Items
- Item
- Name of the item.
- Metadata type
- Requires metadata support (i.e. ox_inventory) to check slot.metadata.type
### Lockpick
- Difficulty
- Sets the skillcheck difficulty (see [docs](https://overextended.github.io/docs/ox_lib/Interface/Client/skillcheck)).
- Area size
- Custom difficulty area size.
- Speed multiplier
- Custom difficulty idicator speed.

View file

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<Dat54>
<Version value="7314721" />
<ContainerPaths>
<Item>dlc_oxdoorlock\oxdoorlock</Item>
</ContainerPaths>
<Items>
<!-- SimpleSounds -->
<Item type="SimpleSound">
<Name>button_remote_simple</Name>
<Header>
<Flags value="0x00008004" />
<Volume value="200" />
<Category>scripted</Category>
</Header>
<ContainerName>dlc_oxdoorlock/oxdoorlock</ContainerName>
<FileName>button_remote</FileName>
<WaveSlotNum value="0" />
</Item>
<Item type="SimpleSound">
<Name>door_bolt_simple</Name>
<Header>
<Flags value="0x00008004" />
<Volume value="200" />
<Category>scripted</Category>
</Header>
<ContainerName>dlc_oxdoorlock/oxdoorlock</ContainerName>
<FileName>door_bolt</FileName>
<WaveSlotNum value="0" />
</Item>
<Item type="SimpleSound">
<Name>metal_locker_simple</Name>
<Header>
<Flags value="0x00008004" />
<Volume value="200" />
<Category>scripted</Category>
</Header>
<ContainerName>dlc_oxdoorlock/oxdoorlock</ContainerName>
<FileName>metal_locker</FileName>
<WaveSlotNum value="0" />
</Item>
<Item type="SimpleSound">
<Name>metallic_creak_simple</Name>
<Header>
<Flags value="0x00008004" />
<Volume value="200" />
<Category>scripted</Category>
</Header>
<ContainerName>dlc_oxdoorlock/oxdoorlock</ContainerName>
<FileName>metallic_creak</FileName>
<WaveSlotNum value="0" />
</Item>
<!-- SoundSets !-->
<Item type="SoundSet">
<Name>dlc_oxdoorlock_set</Name>
<Header>
<Flags value="0xAAAAAAAA" />
</Header>
<SoundSets>
<Item>
<ScriptName>button_remote</ScriptName>
<ChildSound>button_remote_directional</ChildSound>
</Item>
<Item>
<ScriptName>door_bolt</ScriptName>
<ChildSound>door_bolt_directional</ChildSound>
</Item>
<Item>
<ScriptName>metal_locker</ScriptName>
<ChildSound>metal_locker_directional</ChildSound>
</Item>
<Item>
<ScriptName>metallic_creak</ScriptName>
<ChildSound>metallic_creak_directional</ChildSound>
</Item>
</SoundSets>
</Item>
<Item type="DirectionalSound">
<Name>button_remote_directional</Name>
<Header>
<Flags value="0x00008004" />
<Volume value="200" />
<Category>scripted</Category>
</Header>
<ChildSound>button_remote_simple</ChildSound>
<InnerAngle value="20" />
<OuterAngle value="65" />
<RearAttenuation value="-3" />
<YawAngle value="90" />
<PitchAngle value="0" />
</Item>
<Item type="DirectionalSound">
<Name>door_bolt_directional</Name>
<Header>
<Flags value="0x00008004" />
<Volume value="200" />
<Category>scripted</Category>
</Header>
<ChildSound>door_bolt_simple</ChildSound>
<InnerAngle value="20" />
<OuterAngle value="65" />
<RearAttenuation value="-3" />
<YawAngle value="90" />
<PitchAngle value="0" />
</Item>
<Item type="DirectionalSound">
<Name>metal_locker_directional</Name>
<Header>
<Flags value="0x00008004" />
<Volume value="200" />
<Category>scripted</Category>
</Header>
<ChildSound>metal_locker_simple</ChildSound>
<InnerAngle value="20" />
<OuterAngle value="65" />
<RearAttenuation value="-3" />
<YawAngle value="90" />
<PitchAngle value="0" />
</Item>
<Item type="DirectionalSound">
<Name>metallic_creak_directional</Name>
<Header>
<Flags value="0x00008004" />
<Volume value="200" />
<Category>scripted</Category>
</Header>
<ChildSound>metallic_creak_simple</ChildSound>
<InnerAngle value="20" />
<OuterAngle value="65" />
<RearAttenuation value="-3" />
<YawAngle value="90" />
<PitchAngle value="0" />
</Item>
</Items>
</Dat54>

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<AudioWaveContainer>
<Version value="1" />
<ChunkIndices value="True" />
<Streams>
<Item>
<Name>button_remote</Name>
<FileName>button_remote.wav</FileName>
<Chunks>
<Item>
<Type>peak</Type>
</Item>
<Item>
<Type>data</Type>
</Item>
<Item>
<Type>format</Type>
<Codec>ADPCM</Codec>
<Samples value="25600" />
<SampleRate value="44100" />
<Headroom value="-161" />
<PlayBegin value="0" />
<PlayEnd value="0" />
<LoopBegin value="0" />
<LoopEnd value="0" />
<LoopPoint value="-1" />
<Peak unk="0" />
</Item>
</Chunks>
</Item>
<Item>
<Name>door_bolt</Name>
<FileName>door_bolt.wav</FileName>
<Chunks>
<Item>
<Type>peak</Type>
</Item>
<Item>
<Type>data</Type>
</Item>
<Item>
<Type>format</Type>
<Codec>ADPCM</Codec>
<Samples value="26069" />
<SampleRate value="44100" />
<Headroom value="-161" />
<PlayBegin value="0" />
<PlayEnd value="0" />
<LoopBegin value="0" />
<LoopEnd value="0" />
<LoopPoint value="-1" />
<Peak unk="0" />
</Item>
</Chunks>
</Item>
<Item>
<Name>metal_locker</Name>
<FileName>metal_locker.wav</FileName>
<Chunks>
<Item>
<Type>peak</Type>
</Item>
<Item>
<Type>data</Type>
</Item>
<Item>
<Type>format</Type>
<Codec>ADPCM</Codec>
<Samples value="36864" />
<SampleRate value="44100" />
<Headroom value="-161" />
<PlayBegin value="0" />
<PlayEnd value="0" />
<LoopBegin value="0" />
<LoopEnd value="0" />
<LoopPoint value="-1" />
<Peak unk="0" />
</Item>
</Chunks>
</Item>
<Item>
<Name>metallic_creak</Name>
<FileName>metallic_creak.wav</FileName>
<Chunks>
<Item>
<Type>peak</Type>
</Item>
<Item>
<Type>data</Type>
</Item>
<Item>
<Type>format</Type>
<Codec>ADPCM</Codec>
<Samples value="17489" />
<SampleRate value="44100" />
<Headroom value="-161" />
<PlayBegin value="0" />
<PlayEnd value="0" />
<LoopBegin value="0" />
<LoopEnd value="0" />
<LoopPoint value="-1" />
<Peak unk="0" />
</Item>
</Chunks>
</Item>
</Streams>
</AudioWaveContainer>

View file

@ -0,0 +1,349 @@
if not LoadResourceFile(cache.resource, 'web/build/index.html') then
error('Unable to load UI. Build ox_doorlock or download the latest release.\n ^3https://github.com/overextended/ox_doorlock/releases/latest/download/ox_doorlock.zip^0')
end
if not lib.checkDependency('ox_lib', '3.14.0', true) then return end
local function createDoor(door)
local double = door.doors
door.zone = GetLabelText(GetNameOfZone(door.coords.x, door.coords.y, door.coords.z))
if double then
for i = 1, 2 do
AddDoorToSystem(double[i].hash, double[i].model, double[i].coords.x, double[i].coords.y, double[i].coords.z, false, false, false)
DoorSystemSetDoorState(double[i].hash, 4, false, false)
DoorSystemSetDoorState(double[i].hash, door.state, false, false)
if door.doorRate or not door.auto then
DoorSystemSetAutomaticRate(double[i].hash, door.doorRate or 10.0, false, false)
end
end
else
AddDoorToSystem(door.hash, door.model, door.coords.x, door.coords.y, door.coords.z, false, false, false)
DoorSystemSetDoorState(door.hash, 4, false, false)
DoorSystemSetDoorState(door.hash, door.state, false, false)
if door.doorRate or not door.auto then
DoorSystemSetAutomaticRate(door.hash, door.doorRate or 10.0, false, false)
end
end
end
local nearbyDoors = {}
local Entity = Entity
lib.callback('ox_doorlock:getDoors', false, function(data)
doors = data
for _, door in pairs(data) do
createDoor(door)
end
while true do
table.wipe(nearbyDoors)
local coords = GetEntityCoords(cache.ped)
for _, door in pairs(doors) do
local double = door.doors
door.distance = #(coords - door.coords)
if double then
if door.distance < 80 then
for i = 1, 2 do
if not double[i].entity and IsModelValid(double[i].model) then
local entity = GetClosestObjectOfType(double[i].coords.x, double[i].coords.y, double[i].coords.z, 1.0, double[i].model, false, false, false)
if entity ~= 0 then
double[i].entity = entity
Entity(entity).state.doorId = door.id
end
end
end
if door.distance < 20 then
nearbyDoors[#nearbyDoors + 1] = door
end
else
for i = 1, 2 do
double[i].entity = nil
end
end
elseif door.distance < 80 then
if not door.entity and IsModelValid(door.model) then
local entity = GetClosestObjectOfType(door.coords.x, door.coords.y, door.coords.z, 1.0, door.model, false, false, false)
if entity ~= 0 then
local min, max = GetModelDimensions(door.model)
local points = {
GetOffsetFromEntityInWorldCoords(entity, min.x, min.y, min.z).xy,
GetOffsetFromEntityInWorldCoords(entity, min.x, min.y, max.z).xy,
GetOffsetFromEntityInWorldCoords(entity, min.x, max.y, max.z).xy,
GetOffsetFromEntityInWorldCoords(entity, min.x, max.y, min.z).xy,
GetOffsetFromEntityInWorldCoords(entity, max.x, min.y, min.z).xy,
GetOffsetFromEntityInWorldCoords(entity, max.x, min.y, max.z).xy,
GetOffsetFromEntityInWorldCoords(entity, max.x, max.y, max.z).xy,
GetOffsetFromEntityInWorldCoords(entity, max.x, max.y, min.z).xy
}
local centroid = vec2(0, 0)
for i = 1, 8 do
centroid += points[i]
end
centroid = centroid / 8
door.coords = vec3(centroid.x, centroid.y, door.coords.z)
door.entity = entity
Entity(entity).state.doorId = door.id
end
end
if door.distance < 20 then
nearbyDoors[#nearbyDoors + 1] = door
end
elseif door.entity then
door.entity = nil
end
end
Wait(500)
end
end)
RegisterNetEvent('ox_doorlock:setState', function(id, state, source, data)
if not doors then return end
if data then
doors[id] = data
createDoor(data)
if NuiHasLoaded then
SendNuiMessage(json.encode({
action = 'updateDoorData',
data = data
}))
end
end
if Config.Notify and source == cache.serverId then
if state == 0 then
lib.notify({
type = 'success',
icon = 'unlock',
description = locale('unlocked_door')
})
else
lib.notify({
type = 'success',
icon = 'lock',
description = locale('locked_door')
})
end
end
local door = data or doors[id]
local double = door.doors
door.state = state
if double then
DoorSystemSetDoorState(double[1].hash, door.state, false, false)
DoorSystemSetDoorState(double[2].hash, door.state, false, false)
if door.holdOpen then
DoorSystemSetHoldOpen(double[1].hash, door.state == 0)
DoorSystemSetHoldOpen(double[2].hash, door.state == 0)
end
while door.state == 1 and (not IsDoorClosed(double[1].hash) or not IsDoorClosed(double[2].hash)) do Wait(0) end
else
DoorSystemSetDoorState(door.hash, door.state, false, false)
if door.holdOpen then DoorSystemSetHoldOpen(door.hash, door.state == 0) end
while door.state == 1 and not IsDoorClosed(door.hash) do Wait(0) end
end
if door.state == state and door.distance and door.distance < 20 then
if Config.NativeAudio then
RequestScriptAudioBank('dlc_oxdoorlock/oxdoorlock', false)
local sound = state == 0 and door.unlockSound or door.lockSound or 'door_bolt'
local soundId = GetSoundId()
PlaySoundFromCoord(soundId, sound, door.coords.x, door.coords.y, door.coords.z, 'DLC_OXDOORLOCK_SET', false, 0, false)
ReleaseSoundId(soundId)
ReleaseNamedScriptAudioBank('dlc_oxdoorlock/oxdoorlock')
else
local volume = (0.01 * GetProfileSetting(300)) / (door.distance / 2)
if volume > 1 then volume = 1 end
local sound = state == 0 and door.unlockSound or door.lockSound or 'door-bolt-4'
SendNUIMessage({
action = 'playSound',
data = {
sound = sound,
volume = volume
}
})
end
end
end)
RegisterNetEvent('ox_doorlock:editDoorlock', function(id, data)
if source == '' then return end
local door = doors[id]
local double = door.doors
local doorState = data and data.state or 0
if data then
data.zone = door.zone or GetLabelText(GetNameOfZone(door.coords.x, door.coords.y, door.coords.z))
-- hacky method to resolve a bug with "closest door" by forcing a distance recalculation
if door.distance < 20 then door.distance = 80 end
elseif ClosestDoor?.id == id then
ClosestDoor = nil
end
if double then
for i = 1, 2 do
local doorHash = double[i].hash
if data then
if data.doorRate or door.doorRate or not data.auto then
DoorSystemSetAutomaticRate(doorHash, data.doorRate or door.doorRate and 0.0 or 10.0, false, false)
end
DoorSystemSetDoorState(doorHash, doorState, false, false)
if data.holdOpen then DoorSystemSetHoldOpen(doorHash, doorState == 0) end
else
DoorSystemSetDoorState(doorHash, 4, false, false)
DoorSystemSetDoorState(doorHash, 0, false, false)
if double[i].entity then
Entity(double[i].entity).state.doorId = nil
end
end
end
else
if data then
if data.doorRate or door.doorRate or not data.auto then
DoorSystemSetAutomaticRate(door.hash, data.doorRate or door.doorRate and 0.0 or 10.0, false, false)
end
DoorSystemSetDoorState(door.hash, doorState, false, false)
if data.holdOpen then DoorSystemSetHoldOpen(door.hash, doorState == 0) end
else
DoorSystemSetDoorState(door.hash, 4, false, false)
DoorSystemSetDoorState(door.hash, 0, false, false)
if door.entity then
Entity(door.entity).state.doorId = nil
end
end
end
doors[id] = data
if NuiHasLoaded then
SendNuiMessage(json.encode({
action = 'updateDoorData',
data = data or id
}))
end
end)
ClosestDoor = nil
lib.callback.register('ox_doorlock:inputPassCode', function()
return ClosestDoor?.passcode and lib.inputDialog(locale('door_lock'), {
{
type = 'input',
label = locale('passcode'),
password = true,
icon = 'lock'
},
})?[1]
end)
local lastTriggered = 0
local function useClosestDoor()
if not ClosestDoor then return false end
local gameTimer = GetGameTimer()
if gameTimer - lastTriggered > 500 then
lastTriggered = gameTimer
TriggerServerEvent('ox_doorlock:setState', ClosestDoor.id, ClosestDoor.state == 1 and 0 or 1)
end
end
exports('useClosestDoor', useClosestDoor)
CreateThread(function()
local lockDoor = locale('lock_door')
local unlockDoor = locale('unlock_door')
local showUI
local drawSprite = Config.DrawSprite
if drawSprite then
local sprite1 = drawSprite[0]?[1]
local sprite2 = drawSprite[1]?[1]
if sprite1 then
RequestStreamedTextureDict(sprite1, true)
end
if sprite2 then
RequestStreamedTextureDict(sprite2, true)
end
end
local SetDrawOrigin = SetDrawOrigin
local ClearDrawOrigin = ClearDrawOrigin
local DrawSprite = drawSprite and DrawSprite
while true do
local num = #nearbyDoors
if num > 0 then
local ratio = drawSprite and GetAspectRatio(true)
for i = 1, num do
local door = nearbyDoors[i]
if door.distance < door.maxDistance then
if door.distance < (ClosestDoor?.distance or 10) then
ClosestDoor = door
end
if drawSprite and not door.hideUi then
local sprite = drawSprite[door.state]
if sprite then
SetDrawOrigin(door.coords.x, door.coords.y, door.coords.z)
DrawSprite(sprite[1], sprite[2], sprite[3], sprite[4], sprite[5], sprite[6] * ratio, sprite[7], sprite[8], sprite[9], sprite[10], sprite[11])
ClearDrawOrigin()
end
end
end
end
else ClosestDoor = nil end
if ClosestDoor and ClosestDoor.distance < ClosestDoor.maxDistance then
if Config.DrawTextUI and not ClosestDoor.hideUi and ClosestDoor.state ~= showUI then
lib.showTextUI(ClosestDoor.state == 0 and lockDoor or unlockDoor)
showUI = ClosestDoor.state
end
if not PickingLock and IsDisabledControlJustReleased(0, 38) then
useClosestDoor()
end
elseif showUI then
lib.hideTextUI()
showUI = nil
end
Wait(num > 0 and 0 or 500)
end
end)

View file

@ -0,0 +1,410 @@
local Entity = Entity
local function getDoorFromEntity(data)
local entity = type(data) == 'table' and data.entity or data
if not entity then return end
local state = Entity(entity)?.state
local doorId = state?.doorId
if not doorId then return end
local door = doors[doorId]
if not door then
state.doorId = nil
end
return door
end
exports('getClosestDoorId', function() return ClosestDoor?.id end)
exports('getDoorIdFromEntity', function(entityId) return getDoorFromEntity(entityId)?.id end) -- same as Entity(entityId).state.doorId
local function entityIsNotDoor(data)
local entity = type(data) == 'number' and data or data.entity
return not getDoorFromEntity(entity)
end
PickingLock = false
local function canPickLock(entity)
if PickingLock then return false end
local door = getDoorFromEntity(entity)
return door and door.lockpick and (Config.CanPickUnlockedDoors or door.state == 1)
end
---@param entity number
local function pickLock(entity)
local door = getDoorFromEntity(entity)
if not door or PickingLock or not door.lockpick or (not Config.CanPickUnlockedDoors and door.state == 0) then return end
PickingLock = true
TaskTurnPedToFaceCoord(cache.ped, door.coords.x, door.coords.y, door.coords.z, 4000)
Wait(500)
local animDict = lib.requestAnimDict('mp_common_heist')
TaskPlayAnim(cache.ped, animDict, 'pick_door', 3.0, 1.0, -1, 49, 0, true, true, true)
local success = lib.skillCheck(door.lockpickDifficulty or Config.LockDifficulty)
local rand = math.random(1, success and 100 or 5)
if success then
TriggerServerEvent('ox_doorlock:setState', door.id, door.state == 1 and 0 or 1, true)
end
if rand == 1 then
TriggerServerEvent('ox_doorlock:breakLockpick')
lib.notify({ type = 'error', description = locale('lockpick_broke') })
end
StopEntityAnim(cache.ped, 'pick_door', animDict, 0)
RemoveAnimDict(animDict)
PickingLock = false
end
exports('pickClosestDoor', function()
if not ClosestDoor then return end
pickLock(ClosestDoor.entity)
end)
local tempData = {}
local function addDoorlock(data)
local entity = type(data) == 'number' and data or data.entity
local model = GetEntityModel(entity)
local coords = GetEntityCoords(entity)
AddDoorToSystem(`temp`, model, coords.x, coords.y, coords.z, false, false, false)
DoorSystemSetDoorState(`temp`, 4, false, false)
coords = GetEntityCoords(entity)
tempData[#tempData + 1] = {
entity = entity,
model = model,
coords = coords,
heading = math.floor(GetEntityHeading(entity) + 0.5)
}
RemoveDoorFromSystem(`temp`)
end
local isAddingDoorlock = false
RegisterNUICallback('notify', function(data, cb)
cb(1)
lib.notify({ title = data })
end)
RegisterNUICallback('createDoor', function(data, cb)
cb(1)
SetNuiFocus(false, false)
data.state = data.state and 1 or 0
if data.items and not next(data.items) then
data.items = nil
end
if data.characters and not next(data.characters) then
data.characters = nil
end
if data.lockpickDifficulty and not next(data.lockpickDifficulty) then
data.lockpickDifficulty = nil
end
if data.groups and not next(data.groups) then
data.groups = nil
end
if not data.id then
isAddingDoorlock = true
local doorCount = data.doors and 2 or 1
local lastEntity = 0
lib.showTextUI(locale('add_door_textui'))
repeat
DisablePlayerFiring(cache.playerId, true)
DisableControlAction(0, 25, true)
local hit, entity, coords = lib.raycast.cam(1|16)
local changedEntity = lastEntity ~= entity
local doorA = tempData[1]?.entity
if changedEntity and lastEntity ~= doorA then
SetEntityDrawOutline(lastEntity, false)
end
lastEntity = entity
if hit then
---@diagnostic disable-next-line: param-type-mismatch
DrawMarker(28, coords.x, coords.y, coords.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2, 0.2, 0.2, 255, 42, 24,
100, false, false, 0, true, false, false, false)
end
if hit and entity > 0 and GetEntityType(entity) == 3 and (doorCount == 1 or doorA ~= entity) and entityIsNotDoor(entity) then
if changedEntity then
SetEntityDrawOutline(entity, true)
end
if IsDisabledControlJustPressed(0, 24) then
addDoorlock(entity)
end
end
if IsDisabledControlJustPressed(0, 25) then
SetEntityDrawOutline(entity, false)
if not doorA then
isAddingDoorlock = false
return lib.hideTextUI()
end
SetEntityDrawOutline(doorA, false)
table.wipe(tempData)
end
until tempData[doorCount]
lib.hideTextUI()
SetEntityDrawOutline(tempData[1].entity, false)
if data.doors then
SetEntityDrawOutline(tempData[2].entity, false)
tempData[1].entity = nil
tempData[2].entity = nil
data.doors = tempData
else
data.model = tempData[1].model
data.coords = tempData[1].coords
data.heading = tempData[1].heading
end
else
if data.doors then
for i = 1, 2 do
local coords = data.doors[i].coords
data.doors[i].coords = vector3(coords.x, coords.y, coords.z)
data.doors[i].entity = nil
end
else
data.entity = nil
end
data.coords = vector3(data.coords.x, data.coords.y, data.coords.z)
data.distance = nil
data.zone = nil
end
isAddingDoorlock = false
------------------------------------
------- Brutal Housing Editing -----
------------------------------------
if PropertyID ~= nil then
if data.name:match("^(.-)_") == nil or data.name:match("^(.-)_") ~= PropertyID then
data.name = PropertyID.."_"..data.name
end
local coords = data.coords or data.doors[1].coords
if coords ~= nil then
if #(coords - vector3(PropertyCoords.x, PropertyCoords.y, PropertyCoords.z)) > MaxDoorlockDistance then
TriggerEvent('brutal_housing:client:SendNotifyNumber', 75)
return
end
else
return
end
PropertyID = nil
PropertyCoords = nil
end
------------------------------------
------- Brutal Housing Editing -----
------------------------------------
TriggerServerEvent('ox_doorlock:editDoorlock', data.id or false, data)
table.wipe(tempData)
end)
RegisterNUICallback('deleteDoor', function(id, cb)
cb(1)
TriggerServerEvent('ox_doorlock:editDoorlock', id)
end)
RegisterNUICallback('teleportToDoor', function(id, cb)
cb(1)
SetNuiFocus(false, false)
local doorCoords = doors[id].coords
if not doorCoords then return end
SetEntityCoords(cache.ped, doorCoords.x, doorCoords.y, doorCoords.z, false, false, false, false)
end)
RegisterNUICallback('exit', function(_, cb)
cb(1)
SetNuiFocus(false, false)
end)
------------------------------------
------- Brutal Housing Editing -----
------------------------------------
PropertyID = nil
PropertyCoords = nil
MaxDoorlockDistance = 50.0
RegisterNetEvent("ox_doorlock:dataFromHousing")
AddEventHandler("ox_doorlock:dataFromHousing", function(propertyID, coords, maxdoorlockdistance)
PropertyID = propertyID
PropertyCoords = coords
MaxDoorlockDistance = maxdoorlockdistance
if isAddingDoorlock then return end
NuiHasLoaded = true
local allowedDoors = {}
for k,v in pairs(doors) do
print(v.name:match("^(.-)_"), PropertyID)
if v.name:match("^(.-)_") == PropertyID then
table.insert(allowedDoors, v)
end
end
SendNuiMessage(json.encode({
action = 'updateDoorData',
data = allowedDoors
}, { with_hole = false }))
Wait(100)
SendNUIMessage({
action = 'setSoundFiles',
data = lib.callback.await('ox_doorlock:getSounds', false)
})
SetNuiFocus(true, true)
SendNuiMessage(json.encode({
action = 'setVisible',
data = id
}))
end)
------------------------------------
------- Brutal Housing Editing -----
------------------------------------
local function openUi(id)
if source == '' or isAddingDoorlock then return end
------------------------------------
------- Brutal Housing Editing -----
------------------------------------
PropertyID = nil
PropertyCoords = nil
------------------------------------
------- Brutal Housing Editing -----
------------------------------------
NuiHasLoaded = true
SendNuiMessage(json.encode({
action = 'updateDoorData',
data = doors
}, { with_hole = false }))
Wait(100)
SendNUIMessage({
action = 'setSoundFiles',
data = lib.callback.await('ox_doorlock:getSounds', false)
})
SetNuiFocus(true, true)
SendNuiMessage(json.encode({
action = 'setVisible',
data = id
}))
end
RegisterNetEvent('ox_doorlock:triggeredCommand', function(closest)
openUi(closest and ClosestDoor?.id or nil)
end)
CreateThread(function()
local target
if GetResourceState('ox_target'):find('start') then
target = {
ox = true,
exp = exports.ox_target
}
elseif GetResourceState('qb-target'):find('start') then
target = {
qb = true,
exp = exports['qb-target']
}
elseif GetResourceState('qtarget'):find('start') then
target = {
qt = true,
exp = exports.qtarget
}
end
if not target then return end
if target.ox then
target.exp:addGlobalObject({
{
name = 'pickDoorlock',
label = locale('pick_lock'),
icon = 'fas fa-user-lock',
onSelect = pickLock,
canInteract = canPickLock,
items = Config.LockpickItems,
anyItem = true,
distance = 1
}
})
else
local options = {
{
label = locale('pick_lock'),
icon = 'fas fa-user-lock',
action = pickLock,
canInteract = canPickLock,
item = Config.LockpickItems[1],
distance = 1
}
}
---@cast target table
if target.qt then
target.exp:Object({ options = options })
elseif target.qb then
target.exp:AddGlobalObject({ options = options })
end
options = { locale('pick_lock') }
AddEventHandler('onResourceStop', function(resource)
if resource == cache.resource then
if target.qt then
return target.exp:RemoveObject(options)
end
if target.qb then
return target.exp:RemoveGlobalObject(options)
end
end
end)
end
end)

View file

@ -0,0 +1,38 @@
---@type DoorlockConfig
---@diagnostic disable-next-line: missing-fields
Config = {}
---Trigger a notification on the client when the door state is successfully updated.
Config.Notify = false
---Create a persistent notification while in-range of a door, prompting to lock/unlock.
Config.DrawTextUI = false
---Set the properties used by [DrawSprite](https://docs.fivem.net/natives/?_0xE7FFAE5EBF23D890).
Config.DrawSprite = {
-- Unlocked
[0] = { 'mpsafecracking', 'lock_open', 0, 0, 0.018, 0.018, 0, 255, 255, 255, 100 },
-- Locked
[1] = { 'mpsafecracking', 'lock_closed', 0, 0, 0.018, 0.018, 0, 255, 255, 255, 100 },
}
---Allow the specified ace principal to use 'command.doorlock'.
Config.CommandPrincipal = 'group.admin'
---Allow players with the 'command.doorlock' principal to use any door.
Config.PlayerAceAuthorised = false
---The default skill check difficulty when lockpicking a door.
Config.LockDifficulty = { 'easy', 'easy', 'medium' }
---Allow lockpicks to be used to lock an unlocked door.
Config.CanPickUnlockedDoors = false
---An array of items that function as lockpicks.
Config.LockpickItems = {
'lockpick'
}
---Play sounds using game audio (sound natives) instead of through NUI.
Config.NativeAudio = true

View file

@ -0,0 +1,51 @@
--[[ FX Information ]]--
fx_version 'cerulean'
use_experimental_fxv2_oal 'yes'
lua54 'yes'
game 'gta5'
--[[ Resource Information ]]--
name 'ox_doorlock'
version '1.17.0'
license 'GPL-3.0-or-later'
author 'Overextended'
repository 'https://github.com/overextended/ox_doorlock'
--[[ Manifest ]]--
shared_scripts {
'@ox_lib/init.lua',
'config.lua',
}
client_scripts {
'client/main.lua',
'client/utils.lua',
}
server_scripts {
'@oxmysql/lib/MySQL.lua',
'server/main.lua',
}
ui_page 'web/build/index.html'
files {
'web/build/index.html',
'web/build/**/*',
'locales/*.json',
'audio/data/oxdoorlock_sounds.dat54.rel',
'audio/dlc_oxdoorlock/oxdoorlock.awc',
}
data_file 'AUDIO_WAVEPACK' 'audio/dlc_oxdoorlock'
data_file 'AUDIO_SOUNDDATA' 'audio/data/oxdoorlock_sounds.dat'
dependencies {
'oxmysql',
'ox_lib',
}
ox_libs {
'locale',
'table',
}

View file

@ -0,0 +1,19 @@
{
"unlocked_door": "الباب مفتوح",
"locked_door": "الباب مغلق",
"lock_door": "[E] غلق",
"unlock_door": "[E] فتح",
"door_lock": "قفل الباب",
"passcode": "الكود",
"lockpick_broke": "المفك مكسور",
"pick_lock": "حصل مفتاح",
"add_lock": "إضافة باب",
"edit_lock": "تعديل باب",
"remove_lock": "حدف باب",
"cannot_unlock": "غير ممكن",
"cannot_lock": "غير ممكن",
"create_modify_lock": "إنشاء أو تعديل قفل باب",
"add_door_textui": "**إنشاء باب جديد** \n[LMB] للتأكيد إضغط \n[RMB] للإلغاء إضغط",
"command_closest": "إنشاء قفل أو التفعل مع أقرب باب"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Dveře odemčeny",
"locked_door": "Dveře zamčeny",
"lock_door": "[E] Zamknout dveře",
"unlock_door": "[E] Odemknout dveře",
"door_lock": "Zámek dveří",
"passcode": "Přístupový kód",
"lockpick_broke": "Šperhák se zlomil",
"pick_lock": "Vypáčit zámek",
"add_lock": "Přidat zámek",
"edit_lock": "Upravit zámek",
"remove_lock": "Odebrat zámek",
"cannot_unlock": "Nelze odemknout dveře",
"cannot_lock": "Nelze zamknout dveře",
"create_modify_lock": "Vytvořit zámek, nebo upravit existující",
"add_door_textui": "**Vytvořit nový zámek** \nPokračovat pomocí [LMB] \nZrušit pomocí [RMB]",
"command_closest": "Otevřít UI pro nejbližší zámek"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Tür aufgeschlossen",
"locked_door": "Tür verschlossen",
"lock_door": "[E] Tür verschließen",
"unlock_door": "[E] Tür aufschließen",
"door_lock": "Türschloss",
"passcode": "Zugangscode",
"lockpick_broke": "Dein Dietrich ist zerbrochen",
"pick_lock": "Tür aufbrechen",
"add_lock": "Türschloss hinzufügen",
"edit_lock": "Türschloss bearbeiten",
"remove_lock": "Türschloss entfernen",
"cannot_unlock": "Es ist nicht möglich die Tür aufzuschließen",
"cannot_lock": "Es ist nicht möglich die Tür zu verschließen",
"create_modify_lock": "Erstelle ein Türschloss oder bearbeite ein vorhandenes",
"add_door_textui": "Neue Tür erstellen \nMit [LMB] interagieren \nMit [RMB] abbrechen",
"command_closest": "Öffne die UI direkt zur nächstgelegenen Tür"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Unlocked door",
"locked_door": "Locked door",
"lock_door": "[E] Lock door",
"unlock_door": "[E] Unlock door",
"door_lock": "Door lock",
"passcode": "Passcode",
"lockpick_broke": "Your lockpick broke",
"pick_lock": "Pick lock",
"add_lock": "Add doorlock",
"edit_lock": "Edit doorlock",
"remove_lock": "Remove doorlock",
"cannot_unlock": "Unable to unlock door",
"cannot_lock": "Unable to lock door",
"create_modify_lock": "Create a doorlock, or modify an existing one",
"add_door_textui": "**Create new door** \nInteract with [LMB] \nCancel with [RMB]",
"command_closest": "Open UI directly to closest doorlock"
}

View file

@ -0,0 +1,16 @@
{
"unlocked_door": "Abierto",
"locked_door": "Cerrado",
"lock_door": "[E] Cerrar",
"unlock_door": "[E] Abrir",
"door_lock": "Bloqueo de Puertas",
"passcode": "PIN",
"lockpick_broke": "Se ha roto tu ganzúa",
"pick_lock": "Forzar",
"add_lock": "Añadir cerradura",
"edit_lock": "Editar cerradura",
"remove_lock": "Borrar cerradura",
"cannot_unlock": "No se puede abrir la cerradura",
"cannot_lock": "No se puede cerrar la cerradura",
"create_modify_lock": "Crear una cerradura o modificar una existente"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Avatud",
"locked_door": "Lukustatud",
"lock_door": "[E] Lukusta uks",
"unlock_door": "[E] Ava uks",
"door_lock": "Ukselukk",
"passcode": "Parool",
"lockpick_broke": "Sinu muukraud murdus",
"pick_lock": "Murra ukselukk lahti",
"add_lock": "Lisa ukselukk",
"edit_lock": "Muuda ukselukku",
"remove_lock": "Eemalda ukselukk",
"cannot_unlock": "Sa ei saa seda avada..",
"cannot_lock": "Sa ei saa seda lukustada..",
"create_modify_lock": "Lisa uus ukselukk või muuda eelmiseid",
"add_door_textui": "**Lisa uus ukselukk** \nKasuta [LMB] \nKatkesta [RMB]",
"command_closest": "Ava lähima ukse UI"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Ovi avattu",
"locked_door": "Ovi lukittu",
"lock_door": "[E] Lukitse ovi",
"unlock_door": "[E] Avaa ovi",
"door_lock": "Ovilukko",
"passcode": "Salasana",
"lockpick_broke": "Tiirikka hajosi",
"pick_lock": "Tiirikoi lukko",
"add_lock": "Lisää ovilukko",
"edit_lock": "Muokkaa ovilukkoa",
"remove_lock": "Poista ovilukko",
"cannot_unlock": "Et voi avata ovea",
"cannot_lock": "Et voi lukita ovea",
"create_modify_lock": "Luo ovilukko, tai muokkaa olemassaolevaa lukkoa",
"add_door_textui": "**Aseta Uusi Lukko** \nAseta [LMB] \nPeruuta [RMB]",
"command_closest": "Avaa ovilukko valikko lähimmästä ovesta"
}

View file

@ -0,0 +1,17 @@
{
"unlocked_door": "Porte déverrouillée",
"locked_door": "Porte verrouillée",
"lock_door": "[E] Verrouiller la porte",
"unlock_door": "[E] Déverrouiller la porte",
"door_lock": "Verrou de porte",
"passcode": "Mot de passe",
"lockpick_broke": "Votre crochet s'est cassé",
"pick_lock": "Crocheter la serrure",
"add_lock": "Ajouter une serrure",
"edit_lock": "Modifier la serrure",
"remove_lock": "Retirer la serrure",
"cannot_unlock": "Impossible de déverrouiller la porte",
"cannot_lock": "Impossible de verrouiller la porte",
"create_modify_lock": "Ajouter / Modifier une serrure",
"add_door_textui": "**Créer une porte** \nIntéragir avec [LMB] \nAnnuler avec [RMB]"
}

View file

@ -0,0 +1,16 @@
{
"unlocked_door": "Otključana vrata",
"locked_door": "Zaključana vrata",
"lock_door": "[E] Zaključaj vrata",
"unlock_door": "[E] Otključaj vrata",
"door_lock": "Lokot",
"passcode": "Lozinka",
"lockpick_broke": "Polomila Vam se brava",
"pick_lock": "Odaberi bravu",
"add_lock": "Dodaj lokot",
"edit_lock": "Uredi lokot",
"remove_lock": "Obriši lokot",
"cannot_unlock": "Nije moguće otključati vrata",
"cannot_lock": "Nije moguće zaključati vrata",
"create_modify_lock": "Dodaj lokot na vrata ili uredi postojeći"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Ajtó kinyitva",
"locked_door": "Ajtó bezárva",
"lock_door": "[E] Bezárás",
"unlock_door": "[E] Kinyitás",
"door_lock": "Ajtózár",
"passcode": "Jelszó",
"lockpick_broke": "A zárfeltörőd eltört",
"pick_lock": "Zárfeltörés",
"add_lock": "Ajtózár hozzáadása",
"edit_lock": "Ajtózár szerkesztése",
"remove_lock": "Ajtózár törlése",
"cannot_unlock": "Nem tudtad kinyitni az ajtót",
"cannot_lock": "Nem tudtad bezárni az ajtót",
"create_modify_lock": "Készíts vagy szerkessz egy ajtózárat.",
"add_door_textui": "**Ajtó létrehozása** \nKiválaszt [LMB] \nMégse [RMB]",
"command_closest": "UI megnyitása közvetlenül a legközelebbi ajtózárhoz"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Porta sbloccata",
"locked_door": "Porta chiusa",
"lock_door": "[E] Chiudi porta",
"unlock_door": "[E] Apri porta",
"door_lock": "Serratura della porta",
"passcode": "codice di accesso",
"lockpick_broke": "il tuo grimaldello si è rotto",
"pick_lock": "Scassina serratura",
"add_lock": "Aggiungi serratura",
"edit_lock": "Modifica serratura",
"remove_lock": "Rimuovi serratura",
"cannot_unlock": "Impossibile aprire la porta",
"cannot_lock": "Impossibile chiudere la porta",
"create_modify_lock": "Crea una serratura o modificane una esistente",
"add_door_textui": "**Crea una nuova porta** \nInteragire con [LMB] \nAnnulla con [RMB]",
"command_closest": "Apri l'interfaccia utente direttamente alla serratura più vicina"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Durys atrakintos",
"locked_door": "Durys užrakintos",
"lock_door": "[E] Užrakinti duris",
"unlock_door": "[E] Atrakinti duris",
"door_lock": "Durų užraktas",
"passcode": "Slaptažodis",
"lockpick_broke": "Tavo įsilaužimo įrankis sulūžo",
"pick_lock": "Įsilaužti",
"add_lock": "Pridėti užraktą",
"edit_lock": "Redaguoti užraktą",
"remove_lock": "Panaikinti užraktą",
"cannot_unlock": "Durų atidaryti nepavyko",
"cannot_lock": "Durų užrakinti nepavyko",
"create_modify_lock": "Sukurk naują durų užraktą, arba redaguok egzistuojantį",
"add_door_textui": "**Naujos durys** \nSąveikauti [LMB] \nAtšaukti [RMB]",
"command_closest": "Atidaryti artimiausių durų UI sąsają"
}

View file

@ -0,0 +1,16 @@
{
"unlocked_door": "Open deur",
"locked_door": "Gesloten deur",
"lock_door": "[E] Sluiten",
"unlock_door": "[E] Openen",
"door_lock": "Deurslot",
"passcode": "Toegangscode",
"lockpick_broke": "Je lockpick is gebroken",
"pick_lock": "Pick lock",
"add_lock": "Deurslot toevoegen",
"edit_lock": "Deurslot aanpassen",
"remove_lock": "Deurslot verwijderen",
"cannot_unlock": "Niet mogelijk om de deur te openen",
"cannot_lock": "Niet mogelijk om de deur te sluiten",
"create_modify_lock": "Maak een slot of pas er een aan"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Låst opp dør",
"locked_door": "Låst dør",
"lock_door": "[E] Lås dør",
"unlock_door": "[E] Lås opp dør",
"door_lock": "Dørlås",
"passcode": "Passord",
"lockpick_broke": "Din låsdirk har gått i stykker",
"pick_lock": "Dirk låsen",
"add_lock": "Legg til dørlås",
"edit_lock": "Rediger dørlås",
"remove_lock": "Fjern dørlås",
"cannot_unlock": "Kan ikke låse opp døren",
"cannot_lock": "Kan ikke låse døren",
"create_modify_lock": "Opprett en dørlås, eller endre en eksisterende",
"add_door_textui": "Opprett ny dør \nInterager med [LMB] \nAvbryt med [RMB]",
"command_closest": "Åpne UI direkte til nærmeste dørlås"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Otwarte drzwi",
"locked_door": "Zamknięte drzwi",
"lock_door": "[E] Zamknij drzwi",
"unlock_door": "[E] Otwórz drzwi",
"door_lock": "Zamek",
"passcode": "Hasło",
"lockpick_broke": "Twój wytrych się złamał",
"pick_lock": "Wyłam zamek",
"add_lock": "Dodaj zamek",
"edit_lock": "Edytuj zamek",
"remove_lock": "Usuń zamek",
"cannot_unlock": "Nie możesz otworzyć drzwi",
"cannot_lock": "Nie możesz zamknąć drzwi",
"create_modify_lock": "Utwórz zamek lub edytuj istniejący",
"add_door_textui": "**Utwórz nowy zamek** \nInterakcja z [LMB] \nAnuluj z [RMB]",
"command_closest": "Otwórz UI bezpośrednio do najbliższyego zamka"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Porta Destrancada",
"locked_door": "Porta Trancada",
"lock_door": "[E] Trancar Porta",
"unlock_door": "[E] Destrancar Porta",
"door_lock": "Fechadura",
"passcode": "Senha",
"lockpick_broke": "Sua lockpick quebrou",
"pick_lock": "Usar Lockpick",
"add_lock": "Adicionar Fechadura",
"edit_lock": "Editar Fechadura",
"remove_lock": "Remover Fechadura",
"cannot_unlock": "Não foi possivel destrancar a porta",
"cannot_lock": "Não foi possível trancar a porta",
"create_modify_lock": "Criar uma fechadura, ou modificar uma existente",
"add_door_textui": "**Criar nova fechadura** \nInteragir com [LMB] \nCancelar com [RMB]",
"command_closest": "Abra a interface mais próximo da fechadura"
}

View file

@ -0,0 +1,18 @@
{
"unlocked_door": "Porta Destrancada",
"locked_door": "Porta Trancada",
"lock_door": "[E] Trancar Porta",
"unlock_door": "[E] Destrancar Porta",
"door_lock": "Fechadura",
"passcode": "Código de Acesso",
"lockpick_broke": "A tua gazua partiu-se",
"pick_lock": "Usar Gazua",
"add_lock": "Adicionar Fechadura",
"edit_lock": "Editar Fechadura",
"remove_lock": "Remover Fechadura",
"cannot_unlock": "Não foi possível destrancar a porta",
"cannot_lock": "Não foi possível trancar a porta",
"create_modify_lock": "Criar uma fechadura ou modificar uma existente",
"add_door_textui": "**Criar nova fechadura** \nInteragir com [LMB] \nCancelar com [RMB]",
"command_closest": "Abra a interface da fechadura mais próxima"
}

View file

@ -0,0 +1,16 @@
{
"unlocked_door": "Olåst",
"locked_door": "Låst",
"lock_door": "[E] Lås",
"unlock_door": "[E] Lås upp",
"door_lock": "Dörrlås",
"passcode": "Lösenord",
"lockpick_broke": "Ditt dyrkset gick sönder",
"pick_lock": "Dyrka upp dörr",
"add_lock": "Lägg till lås",
"edit_lock": "Redigera lås",
"remove_lock": "Ta bort dörrlås",
"cannot_unlock": "Kan inte låsa upp",
"cannot_lock": "Kan inte låsa",
"create_modify_lock": "Lägg till dörrlås eller redigera befintligt"
}

View file

@ -0,0 +1,17 @@
{
"unlocked_door": "已将门解锁",
"locked_door": "已将门锁上",
"lock_door": "[E] 锁门",
"unlock_door": "[E] 解锁门",
"door_lock": "门锁",
"passcode": "密码",
"lockpick_broke": "你的开锁工具坏了",
"pick_lock": "撬锁",
"add_lock": "加入门锁",
"edit_lock": "编辑门锁",
"remove_lock": "删除门锁",
"cannot_unlock": "无法解锁门",
"cannot_lock": "无法锁门",
"add_door_textui": "**创建门锁** \n互动 [LMB] \n取消 [RMB]",
"create_modify_lock": "建立或修改已存在的门锁"
}

View file

@ -0,0 +1,17 @@
{
"unlocked_door": "已將門解鎖",
"locked_door": "已將門鎖上",
"lock_door": "[E] 鎖門",
"unlock_door": "[E] 解鎖門",
"door_lock": "門鎖",
"passcode": "密碼",
"lockpick_broke": "你的開鎖工具壞了",
"pick_lock": "撬鎖",
"add_lock": "加入門鎖",
"edit_lock": "編輯門鎖",
"remove_lock": "刪除門鎖",
"cannot_unlock": "無法解鎖門",
"cannot_lock": "無法鎖門",
"add_door_textui": "**創建門鎖** \n互動 [LMB] \n取消 [RMB]",
"create_modify_lock": "建立或修改已存在的門鎖"
}

View file

@ -0,0 +1,136 @@
---@diagnostic disable: inject-field
---@type table?
Config.DoorList = {}
local utils = require 'server.utils'
local function flattenTableToArray(tbl)
if type(tbl) == 'table' then
if table.type(tbl) == 'array' then return tbl end
local array = {}
for k in pairs(tbl) do
array[#array + 1] = k
end
return array
end
end
MySQL.ready(function()
local files, fileCount = utils.getFilesInDirectory('convert', '%.lua')
if fileCount > 0 then
print(('^3Found %d nui_doorlock config files.^0'):format(fileCount))
end
local query =
'INSERT INTO `ox_doorlock` (`name`, `data`) SELECT ?, ? WHERE NOT EXISTS (SELECT 1 FROM `ox_doorlock` WHERE `name` = ?)'
local queries = {}
for i = 1, fileCount do
local fileName = files[i]
local file = LoadResourceFile('ox_doorlock', ('convert/%s.lua'):format(fileName))
if file then
load(file)()
if next(Config.DoorList) then
local size = 0
for k, door in pairs(Config.DoorList) do
size += 1
local double = door.doors
local qb = door.objName or (double and double[1].objName)
if qb then
if double then
for j = 1, 2 do
double[j].objHash = double[j].objName
double[j].objHeading = double[j].objYaw or 0
end
else
door.objHash = door.objName
door.objHeading = door.objYaw or 0
end
local groups = door.authorizedJobs or {}
if door.authorizedGangs then
for gang, grade in pairs(door.authorizedGangs) do
groups[gang] = grade
end
end
door.authorizedJobs = next(groups) and groups
door.lockpick = door.pickable
door.showNUI = not door.hideLabel
door.characters = flattenTableToArray(door.authorizedCitizenIDs)
end
local data = {
auto = door.slides or door.garage or door.sliding or door.doublesliding,
autolock = (door.autolock and door.autolock / 1000) or (door.autoLock and door.autoLock / 1000),
coords = door.objCoords,
heading = door.objHeading and math.floor(door.objHeading + 0.5),
model = door.objHash,
characters = door.characters,
groups = door.authorizedJobs,
items = door.items,
lockpick = door.lockpick,
hideUi = door.showNUI ~= nil and not door.showNUI or false,
lockSound = door.audioLock?.file and door.audioLock.file:gsub('%.ogg', ''),
unlockSound = door.audioUnlock?.file and door.audioUnlock.file:gsub('%.ogg', ''),
maxDistance = door.maxDistance or door.distance,
doorRate = door.doorRate and door.doorRate + 0.0 or nil,
state = door.locked and 1 or 0,
passcode = door.passcode,
doors = double and {
{
coords = double[1].objCoords,
heading = math.floor(double[1].objHeading + 0.5),
model = double[1].objHash,
},
{
coords = double[2].objCoords,
heading = math.floor(double[2].objHeading + 0.5),
model = double[2].objHash,
},
},
}
if data.auto and not data.lockSound then
if door.audioRemote then
data.lockSound = 'button-remote'
end
end
if double and not data.coords then
double = data.doors
data.coords = double[1].coords - ((double[1].coords - double[2].coords) / 2)
end
local name = ('%s %s'):format(fileName, k)
queries[size] = {
query = query, values = { name, json.encode(data), name }
}
end
print(('^3Loaded %d doors from convert/%s.lua.^0'):format(size, fileName))
if MySQL.transaction.await(queries) then
SaveResourceFile('ox_doorlock', ('convert/%s.lua'):format(fileName),
'-- This file has already been converted for ox_doorlock and should be removed.\r\ndo return end\r\n\r\n' ..
file, -1)
end
table.wipe(Config.DoorList)
table.wipe(queries)
end
end
end
Config.DoorList = nil
end)

View file

@ -0,0 +1,65 @@
local resourceName = 'es_extended'
SetTimeout(0, function()
local ESX = exports[resourceName]:getSharedObject()
GetPlayer = ESX.GetPlayerFromId
if not ESX.GetConfig().OxInventory then
function RemoveItem(playerId, item)
local player = GetPlayer(playerId)
if player then player.removeInventoryItem(item, 1) end
end
---@param player table
---@param items string[] | { name: string, remove?: boolean, metadata?: string }[]
---@param removeItem? boolean
---@return string?
function DoesPlayerHaveItem(player, items, removeItem)
for i = 1, #items do
local item = items[i]
local itemName = item.name or item
local data = player.getInventoryItem(itemName)
if data?.count > 0 then
if removeItem or item.remove then
player.removeInventoryItem(itemName, 1)
end
return itemName
end
end
end
end
end)
function GetCharacterId(player)
return player.identifier
end
function IsPlayerInGroup(player, filter)
local type = type(filter)
if type == 'string' then
if player.job.name == filter then
return player.job.name, player.job.grade
end
else
local tabletype = table.type(filter)
if tabletype == 'hash' then
local grade = filter[player.job.name]
if grade and grade <= player.job.grade then
return player.job.name, player.job.grade
end
elseif tabletype == 'array' then
for i = 1, #filter do
if player.job.name == filter[i] then
return player.job.name, player.job.grade
end
end
end
end
end

View file

@ -0,0 +1,36 @@
local resourceName = 'ND_Core'
local NDCore = exports[resourceName]
function GetPlayer(src)
return NDCore:getPlayer(src)
end
function GetCharacterId(player)
return player.id
end
function IsPlayerInGroup(player, groups)
local type = type(groups)
if type == "string" then
return player.getGroup(groups)
end
if table.type(groups) == "array" then
for i = 1, #groups do
local groupName = groups[i]
local groupInfo = player.getGroup(groupName)
if groupInfo then
return groupName, groupInfo.rank
end
end
return
end
for groupName, grade in pairs(groups) do
local groupInfo = player.getGroup(groupName)
if groupInfo and grade and grade <= groupInfo.rank then
return groupName, groupInfo.rank
end
end
end

View file

@ -0,0 +1,16 @@
if not lib.checkDependency('ox_core', '0.21.3', true) then return end
local Ox = require '@ox_core.lib.init' --[[@as OxServer]]
GetPlayer = Ox.GetPlayer
---@param player OxPlayerServer
function GetCharacterId(player)
return player.charId
end
---@param player OxPlayerServer
---@param groups string | string[] | table<string, number>
function IsPlayerInGroup(player, groups)
return player.getGroup(groups)
end

View file

@ -0,0 +1,97 @@
local resourceName = 'qb-core'
SetTimeout(0, function()
local QB = exports[resourceName]:GetCoreObject()
GetPlayer = QB.Functions.GetPlayer
if GetResourceState('ox_inventory') == 'missing' then
function RemoveItem(playerId, item, slot)
local player = GetPlayer(playerId)
if player then player.Functions.RemoveItem(item, 1, slot) end
end
---@param player table
---@param items string[] | { name: string, remove?: boolean, metadata?: string }[]
---@param removeItem? boolean
---@return string?
function DoesPlayerHaveItem(player, items, removeItem)
for i = 1, #items do
local item = items[i]
local itemName = item.name or item
if item.metadata then
local playerItems = player.Functions.GetItemsByName(itemName)
for j = 1, #playerItems do
local data = playerItems[j]
if data.info.type == item.metadata then
if removeItem or item.remove then
player.Functions.RemoveItem(itemName, 1, data.slot)
end
return itemName
end
end
else
local data = player.Functions.GetItemByName(itemName)
if data then
if item.remove then
player.Functions.RemoveItem(itemName, 1, data.slot)
end
return itemName
end
end
end
end
end
end)
function GetCharacterId(player)
return player.PlayerData.citizenid
end
local groups = { 'job', 'gang' }
function IsPlayerInGroup(player, filter)
local type = type(filter)
if type == 'string' then
for i = 1, #groups do
local data = player.PlayerData[groups[i]]
if data.name == filter then
return data.name, data.grade.level
end
end
else
local tabletype = table.type(filter)
if tabletype == 'hash' then
for i = 1, #groups do
local data = player.PlayerData[groups[i]]
local grade = filter[data.name]
if grade and grade <= data.grade.level then
return data.name, data.grade.level
end
end
elseif tabletype == 'array' then
for i = 1, #filter do
local group = filter[i]
for j = 1, #groups do
local data = player.PlayerData[groups[j]]
if data.name == group then
return data.name, data.grade.level
end
end
end
end
end
end

View file

@ -0,0 +1,377 @@
if not LoadResourceFile(cache.resource, 'web/build/index.html') then
error(
'Unable to load UI. Build ox_doorlock or download the latest release.\n ^3https://github.com/overextended/ox_doorlock/releases/latest/download/ox_doorlock.zip^0')
end
if not lib.checkDependency('oxmysql', '2.4.0') then return end
if not lib.checkDependency('ox_lib', '3.14.0') then return end
lib.versionCheck('overextended/ox_doorlock')
require 'server.convert'
local utils = require 'server.utils'
local doors = {}
local function encodeData(door)
local double = door.doors
return json.encode({
auto = door.auto,
autolock = door.autolock,
coords = door.coords,
doors = double and {
{
coords = double[1].coords,
heading = double[1].heading,
model = double[1].model,
},
{
coords = double[2].coords,
heading = double[2].heading,
model = double[2].model,
},
},
characters = door.characters,
groups = door.groups,
heading = door.heading,
items = door.items,
lockpick = door.lockpick,
hideUi = door.hideUi,
holdOpen = door.holdOpen,
lockSound = door.lockSound,
maxDistance = door.maxDistance,
doorRate = door.doorRate,
model = door.model,
state = door.state,
unlockSound = door.unlockSound,
passcode = door.passcode,
lockpickDifficulty = door.lockpickDifficulty
})
end
local function getDoor(door)
door = type(door) == 'table' and door or doors[door]
if not door then return false end
return {
id = door.id,
name = door.name,
state = door.state,
coords = door.coords,
characters = door.characters,
groups = door.groups,
items = door.items,
maxDistance = door.maxDistance,
}
end
exports('getDoor', getDoor)
exports('getAllDoors', function()
local allDoors = {}
for _, door in pairs(doors) do
allDoors[#allDoors+1] = getDoor(door)
end
return allDoors
end)
exports('getDoorFromName', function(name)
for _, door in pairs(doors) do
if door.name == name then
return getDoor(door)
end
end
end)
exports('editDoor', function(id, data)
local door = doors[id]
if door then
for k, v in pairs(data) do
if k ~= 'id' then
local current = door[k]
local t1 = type(current)
local t2 = type(v)
if t1 ~= 'nil' and v ~= '' and t1 ~= t2 then
error(("Expected '%s' for door.%s, received %s (%s)"):format(t1, k, t2, v))
end
door[k] = v ~= '' and v or nil
end
end
MySQL.update('UPDATE ox_doorlock SET name = ?, data = ? WHERE id = ?', { door.name, encodeData(door), id })
TriggerClientEvent('ox_doorlock:editDoorlock', -1, id, door)
end
end)
local soundDirectory = Config.NativeAudio and 'audio/dlc_oxdoorlock/oxdoorlock' or 'web/build/sounds'
local fileFormat = Config.NativeAudio and '%.wav' or '%.ogg'
local sounds = utils.getFilesInDirectory(soundDirectory, fileFormat)
lib.callback.register('ox_doorlock:getSounds', function()
return sounds
end)
local function createDoor(id, door, name)
local double = door.doors
door.id = id
door.name = name
if double then
for i = 1, 2 do
double[i].hash = joaat(('ox_door_%s_%s'):format(id, i))
local coords = double[i].coords
double[i].coords = vector3(coords.x, coords.y, coords.z)
end
if not door.coords then
door.coords = double[1].coords - ((double[1].coords - double[2].coords) / 2)
end
else
door.hash = joaat(('ox_door_%s'):format(id))
end
door.coords = vector3(door.coords.x, door.coords.y, door.coords.z)
if not door.state then
door.state = 1
end
if type(door.items?[1]) == 'string' then
local items = {}
for i = 1, #door.items do
items[i] = {
name = door.items[i],
remove = false,
}
end
door.items = items
MySQL.update('UPDATE ox_doorlock SET data = ? WHERE id = ?', { encodeData(door), id })
end
doors[id] = door
return door
end
local isLoaded = false
local ox_inventory = exports.ox_inventory
SetTimeout(0, function()
if GetPlayer then return end
function GetPlayer(_) end
end)
function RemoveItem(playerId, item, slot)
local player = GetPlayer(playerId)
if player then ox_inventory:RemoveItem(playerId, item, 1, nil, slot) end
end
---@param player table
---@param items string[] | { name: string, remove?: boolean, metadata?: string }[]
---@param removeItem? boolean
---@return string?
function DoesPlayerHaveItem(player, items, removeItem)
local playerId = player.source or player.PlayerData.source
for i = 1, #items do
local item = items[i]
local itemName = item.name or item
local data = ox_inventory:Search(playerId, 'slots', itemName, item.metadata)[1]
if data and data.count > 0 then
if removeItem or item.remove then
ox_inventory:RemoveItem(playerId, itemName, 1, nil, data.slot)
end
return itemName
end
end
end
local function isAuthorised(playerId, door, lockpick)
if Config.PlayerAceAuthorised and IsPlayerAceAllowed(playerId, 'command.doorlock') then
return true
end
-- e.g. add_ace group.police "doorlock.mrpd locker rooms" allow
-- add_principal fivem:123456 group.police
-- or add_ace identifier.fivem:123456 "doorlock.mrpd locker rooms" allow
if IsPlayerAceAllowed(playerId, ('doorlock.%s'):format(door.name)) then
return true
end
local player = GetPlayer(playerId)
local authorised = door.passcode or false --[[@as boolean | string | nil]]
if player then
if lockpick then
return DoesPlayerHaveItem(player, Config.LockpickItems)
end
if door.characters and table.contains(door.characters, GetCharacterId(player)) then
return true
end
if door.groups then
authorised = IsPlayerInGroup(player, door.groups) and true or nil
end
if not authorised and door.items then
authorised = DoesPlayerHaveItem(player, door.items) or nil
end
if authorised ~= nil and door.passcode then
authorised = door.passcode == lib.callback.await('ox_doorlock:inputPassCode', playerId)
end
------------------------------------
------- Brutal Housing Editing -----
------------------------------------
if GetResourceState("brutal_housing") == "started" then
local propertyID = door.name:match("^(.-)_")
if propertyID ~= nil then
TriggerEvent('brutal_housing:server:hasKeyToHouse', playerId, propertyID, function(hasKey)
authorised = hasKey
end)
end
end
------------------------------------
------- Brutal Housing Editing -----
------------------------------------
end
return authorised
end
local sql = LoadResourceFile(cache.resource, 'sql/ox_doorlock.sql')
if sql then MySQL.query(sql) end
MySQL.ready(function()
while Config.DoorList do Wait(100) end
local response = MySQL.query.await('SELECT `id`, `name`, `data` FROM `ox_doorlock`')
for i = 1, #response do
local door = response[i]
createDoor(door.id, json.decode(door.data), door.name)
end
isLoaded = true
TriggerEvent('ox_doorlock:loaded')
end)
---@param id number
---@param state 0 | 1 | boolean
---@param lockpick? boolean
---@return boolean
local function setDoorState(id, state, lockpick)
local door = doors[id]
state = (state == 1 or state == 0) and state or (state and 1 or 0)
if door then
local authorised = not source or source == '' or isAuthorised(source, door, lockpick)
if authorised then
door.state = state
TriggerClientEvent('ox_doorlock:setState', -1, id, state, source)
if door.autolock and state == 0 then
SetTimeout(door.autolock * 1000, function()
if door.state ~= 1 then
door.state = 1
TriggerClientEvent('ox_doorlock:setState', -1, id, door.state)
TriggerEvent('ox_doorlock:stateChanged', nil, door.id, door.state == 1)
end
end)
end
TriggerEvent('ox_doorlock:stateChanged', source, door.id, state == 1,
type(authorised) == 'string' and authorised)
return true
end
if source then
lib.notify(source,
{ type = 'error', icon = 'lock', description = state == 0 and 'cannot_unlock' or 'cannot_lock' })
end
end
return false
end
RegisterNetEvent('ox_doorlock:setState', setDoorState)
exports('setDoorState', setDoorState)
lib.callback.register('ox_doorlock:getDoors', function()
while not isLoaded do Wait(100) end
return doors, sounds
end)
RegisterNetEvent('ox_doorlock:editDoorlock', function(id, data)
if IsPlayerAceAllowed(source, 'command.doorlock') then
if data then
if not data.coords then
local double = data.doors
data.coords = double[1].coords - ((double[1].coords - double[2].coords) / 2)
end
if not data.name then
data.name = tostring(data.coords)
end
end
if id then
if data then
MySQL.update('UPDATE ox_doorlock SET name = ?, data = ? WHERE id = ?',
{ data.name, encodeData(data), id })
else
MySQL.update('DELETE FROM ox_doorlock WHERE id = ?', { id })
end
doors[id] = data
TriggerClientEvent('ox_doorlock:editDoorlock', -1, id, data)
else
local insertId = MySQL.insert.await('INSERT INTO ox_doorlock (name, data) VALUES (?, ?)',
{ data.name, encodeData(data) })
local door = createDoor(insertId, data, data.name)
TriggerClientEvent('ox_doorlock:setState', -1, door.id, door.state, false, door)
end
end
end)
RegisterNetEvent('ox_doorlock:breakLockpick', function()
local player = GetPlayer(source)
return player and DoesPlayerHaveItem(player, Config.LockpickItems, true)
end)
lib.addCommand('doorlock', {
help = locale('create_modify_lock'),
params = {
{
name = 'closest',
help = locale('command_closest'),
optional = true,
},
},
restricted = Config.CommandPrincipal
}, function(source, args)
TriggerClientEvent('ox_doorlock:triggeredCommand', source, args.closest)
end)

View file

@ -0,0 +1,44 @@
local resourcePath = GetResourcePath(cache.resource):gsub('//', '/') .. '/'
local utils = {}
function utils.getFilesInDirectory(path, pattern)
local files = {}
local fileCount = 0
local system = os.getenv('OS')
local command = system and system:match('Windows') and 'dir "' or 'ls "'
local suffix = command == 'dir "' and '/" /b' or '/"'
local dir = io.popen(command .. resourcePath .. path .. suffix)
if dir then
for line in dir:lines() do
if line:match(pattern) then
fileCount += 1
files[fileCount] = line:gsub(pattern, '')
end
end
dir:close()
end
return files, fileCount
end
local frameworks = { 'es_extended', 'ND_Core', 'ox_core', 'qb-core' }
local sucess = false
for i = 1, #frameworks do
local framework = frameworks[i]
if GetResourceState(framework):find('start') then
require(('server.framework.%s'):format(framework:lower()))
sucess = true
break
end
end
if not sucess then
warn('no compatible framework was loaded, most features will not work')
end
return utils

View file

@ -0,0 +1,37 @@
/*
Run this file after ox_doorlock.sql
Works with https://www.gta5-mods.com/maps/community-mission-row-pd
*/
INSERT INTO `ox_doorlock` (`id`, `name`, `data`) VALUES
(1, 'community_mrpd 1', '{"coords":{"x":434.7478942871094,"y":-981.916748046875,"z":30.83926963806152},"groups":{"police":0,"offpolice":0},"maxDistance":2.5,"state":0,"doors":[{"coords":{"x":434.7478942871094,"y":-980.618408203125,"z":30.83926963806152},"model":-1215222675,"heading":270},{"coords":{"x":434.7478942871094,"y":-983.215087890625,"z":30.83926963806152},"model":320433149,"heading":270}],"hideUi":false}'),
(2, 'community_mrpd 2', '{"coords":{"x":468.6697998046875,"y":-1014.4520263671875,"z":26.53623962402343},"groups":{"police":0},"maxDistance":2.5,"state":1,"doors":[{"coords":{"x":469.9679870605469,"y":-1014.4520263671875,"z":26.53623962402343},"model":-2023754432,"heading":180},{"coords":{"x":467.3716125488281,"y":-1014.4520263671875,"z":26.53623962402343},"model":-2023754432,"heading":0}],"hideUi":false}'),
(3, 'community_mrpd 3', '{"coords":{"x":463.4783020019531,"y":-1003.5380249023438,"z":25.00598907470703},"model":-1033001619,"groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"hideUi":false}'),
(4, 'community_mrpd 4', '{"coords":{"x":488.8948059082031,"y":-1017.2100219726563,"z":27.14863014221191},"auto":true,"lockSound":"button-remote","groups":{"police":0},"heading":90,"maxDistance":5,"state":1,"model":-1603817716,"hideUi":false}'),
(5, 'community_mrpd 5', '{"coords":{"x":431.4056091308594,"y":-1001.1690063476563,"z":26.71261024475097},"auto":true,"lockSound":"button-remote","groups":{"police":0},"heading":0,"maxDistance":5,"state":1,"model":-190780785,"hideUi":false}'),
(6, 'community_mrpd 6', '{"coords":{"x":436.223388671875,"y":-1001.1690063476563,"z":26.71261024475097},"auto":true,"lockSound":"button-remote","groups":{"police":0},"heading":0,"maxDistance":5,"state":1,"model":-190780785,"hideUi":false}'),
(7, 'community_mrpd 7', '{"coords":{"x":450.10418701171877,"y":-985.7384033203125,"z":30.83930969238281},"model":1557126584,"groups":{"police":0,"offpolice":0},"heading":90,"maxDistance":2,"state":1,"hideUi":false}'),
(8, 'community_mrpd 8', '{"coords":{"x":464.15838623046877,"y":-1011.260009765625,"z":33.01121139526367},"model":507213820,"groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"hideUi":false}'),
(9, 'community_mrpd 9', '{"coords":{"x":461.2864990234375,"y":-985.3206176757813,"z":30.83926963806152},"model":749848321,"groups":{"police":0},"heading":90,"maxDistance":2,"state":1,"hideUi":false}'),
(10, 'community_mrpd 10', '{"coords":{"x":446.57281494140627,"y":-980.0106201171875,"z":30.83930969238281},"model":-1320876379,"groups":{"police":0},"heading":180,"maxDistance":2,"state":1,"hideUi":false}'),
(11, 'community_mrpd 11', '{"coords":{"x":453.09381103515627,"y":-983.2293701171875,"z":30.83926963806152},"model":-1033001619,"groups":{"police":0},"heading":91,"maxDistance":2,"state":1,"hideUi":false}'),
(12, 'community_mrpd 12', '{"coords":{"x":464.36138916015627,"y":-984.677978515625,"z":43.83443832397461},"model":-340230128,"groups":{"police":0},"heading":90,"maxDistance":2,"state":1,"hideUi":false}'),
(13, 'community_mrpd 13', '{"coords":{"x":442.6625061035156,"y":-988.2412719726563,"z":26.81977081298828},"model":-131296141,"groups":{"police":0},"heading":179,"maxDistance":2,"state":1,"hideUi":false}'),
(14, 'community_mrpd 14', '{"coords":{"x":471.3153991699219,"y":-986.1090698242188,"z":25.05794906616211},"model":-131296141,"groups":{"police":0},"heading":270,"maxDistance":2,"state":1,"hideUi":false}'),
(15, 'community_mrpd 15', '{"coords":{"x":467.5935974121094,"y":-977.9932861328125,"z":25.05794906616211},"model":-131296141,"groups":{"police":0},"heading":180,"maxDistance":2,"state":1,"hideUi":false}'),
(16, 'community_mrpd 16', '{"coords":{"x":463.6145935058594,"y":-980.5814208984375,"z":25.05794906616211},"model":-131296141,"groups":{"police":0},"heading":90,"maxDistance":2,"state":1,"hideUi":false}'),
(17, 'community_mrpd 17', '{"coords":{"x":464.5701904296875,"y":-992.6641235351563,"z":25.0644302368164},"model":631614199,"lockSound":"metal-locker","groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"unlockSound":"metallic-creak","hideUi":false}'),
(18, 'community_mrpd 18', '{"coords":{"x":461.8064880371094,"y":-994.4086303710938,"z":25.0644302368164},"model":631614199,"lockSound":"metal-locker","groups":{"police":0},"heading":270,"maxDistance":2,"state":1,"unlockSound":"metallic-creak","hideUi":false}'),
(19, 'community_mrpd 19', '{"coords":{"x":461.8064880371094,"y":-997.6583862304688,"z":25.0644302368164},"model":631614199,"lockSound":"metal-locker","groups":{"police":0},"heading":90,"maxDistance":2,"state":1,"unlockSound":"metallic-creak","hideUi":false}'),
(20, 'community_mrpd 20', '{"coords":{"x":461.8064880371094,"y":-1001.302001953125,"z":25.0644302368164},"model":631614199,"lockSound":"metal-locker","groups":{"police":0},"heading":90,"maxDistance":2,"state":1,"unlockSound":"metallic-creak","hideUi":false}'),
(21, 'community_mrpd 21', '{"coords":{"x":467.19219970703127,"y":-996.4594116210938,"z":25.00598907470703},"model":-1033001619,"groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"hideUi":false}'),
(22, 'community_mrpd 22', '{"coords":{"x":471.4754943847656,"y":-996.4594116210938,"z":25.00598907470703},"model":-1033001619,"groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"hideUi":false}'),
(23, 'community_mrpd 23', '{"coords":{"x":475.7543029785156,"y":-996.4594116210938,"z":25.00598907470703},"model":-1033001619,"groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"hideUi":false}'),
(24, 'community_mrpd 24', '{"coords":{"x":480.03009033203127,"y":-996.4594116210938,"z":25.00598907470703},"model":-1033001619,"groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"hideUi":false}'),
(25, 'community_mrpd 25', '{"coords":{"x":468.4872131347656,"y":-1003.5479736328125,"z":25.01313972473144},"model":-1033001619,"groups":{"police":0},"heading":180,"maxDistance":2,"state":1,"hideUi":false}'),
(26, 'community_mrpd 26', '{"coords":{"x":471.4747009277344,"y":-1003.5380249023438,"z":25.01222991943359},"model":-1033001619,"groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"hideUi":false}'),
(27, 'community_mrpd 27', '{"coords":{"x":477.0495910644531,"y":-1003.552001953125,"z":25.01203918457031},"auto":false,"groups":{"police":0},"heading":179,"lockpick":false,"maxDistance":2,"state":1,"model":-1033001619,"hideUi":false}'),
(28, 'community_mrpd 28', '{"coords":{"x":480.03009033203127,"y":-1003.5380249023438,"z":25.00598907470703},"model":-1033001619,"groups":{"police":0},"heading":0,"maxDistance":2,"state":1,"hideUi":false}'),
(29, 'community_mrpd 29', '{"coords":{"x":444.7078857421875,"y":-989.4453735351563,"z":30.83930969238281},"groups":{"police":0},"maxDistance":2.5,"state":1,"doors":[{"coords":{"x":443.4078063964844,"y":-989.4453735351563,"z":30.83930969238281},"model":185711165,"heading":180},{"coords":{"x":446.00799560546877,"y":-989.4453735351563,"z":30.83930969238281},"model":185711165,"heading":0}],"hideUi":false}'),
(30, 'community_mrpd 30', '{"coords":{"x":445.9197998046875,"y":-999.0016479492188,"z":30.7890396118164},"groups":{"police":0},"maxDistance":2.5,"state":1,"doors":[{"coords":{"x":447.2184143066406,"y":-999.0023193359375,"z":30.78941917419433},"model":-1033001619,"heading":180},{"coords":{"x":444.6211853027344,"y":-999.0009765625,"z":30.78866004943847},"model":-1033001619,"heading":0}],"hideUi":false}'),
(31, 'community_mrpd 31', '{"coords":{"x":445.9298400878906,"y":-997.044677734375,"z":30.84351921081543},"groups":{"police":0},"maxDistance":2.5,"state":0,"doors":[{"coords":{"x":444.62939453125,"y":-997.044677734375,"z":30.84351921081543},"model":-2023754432,"heading":0},{"coords":{"x":447.23028564453127,"y":-997.044677734375,"z":30.84351921081543},"model":-2023754432,"heading":180}],"hideUi":false}');

View file

@ -0,0 +1,17 @@
/*
Run this file after ox_doorlock.sql
Works with the standard Mission Row PD interior
*/
INSERT INTO `ox_doorlock` (`id`, `name`, `data`) VALUES
(1, 'mrpd locker rooms', '{"maxDistance":2,"heading":90,"coords":{"x":450.1041259765625,"y":-985.7384033203125,"z":30.83930206298828},"groups":{"police":0},"state":1,"model":1557126584,"hideUi":false}'),
(2, 'mrpd cells/briefing', '{"maxDistance":2,"coords":{"x":444.7078552246094,"y":-989.4454345703125,"z":30.83930206298828},"doors":[{"model":185711165,"coords":{"x":446.0079345703125,"y":-989.4454345703125,"z":30.83930206298828},"heading":0},{"model":185711165,"coords":{"x":443.40777587890627,"y":-989.4454345703125,"z":30.83930206298828},"heading":180}],"groups":{"police":0},"state":1,"hideUi":false}'),
(3, 'mrpd cell 3', '{"maxDistance":2,"heading":90,"coords":{"x":461.8065185546875,"y":-1001.9515380859375,"z":25.06442832946777},"lockSound":"metal-locker","groups":{"police":0},"state":1,"unlockSound":"metallic-creak","model":631614199,"hideUi":false}'),
(4, 'mrpd back entrance', '{"maxDistance":2,"coords":{"x":468.6697692871094,"y":-1014.4520263671875,"z":26.5362319946289},"doors":[{"model":-2023754432,"coords":{"x":467.37164306640627,"y":-1014.4520263671875,"z":26.5362319946289},"heading":0},{"model":-2023754432,"coords":{"x":469.9678955078125,"y":-1014.4520263671875,"z":26.5362319946289},"heading":180}],"groups":{"police":0},"state":1,"hideUi":false}'),
(5, 'mrpd cells security door', '{"maxDistance":2,"heading":0,"coords":{"x":464.1282958984375,"y":-1003.5386962890625,"z":25.00598907470703},"autolock":5,"groups":{"police":0},"state":1,"model":-1033001619,"hideUi":false}'),
(6, 'mrpd cell 2', '{"maxDistance":2,"heading":90,"coords":{"x":461.8064880371094,"y":-998.3082885742188,"z":25.06442832946777},"lockSound":"metal-locker","groups":{"police":0},"state":1,"unlockSound":"metallic-creak","model":631614199,"hideUi":false}'),
(7, 'mrpd captain\'s office', '{"maxDistance":2,"heading":180,"coords":{"x":446.57281494140627,"y":-980.0105590820313,"z":30.83930206298828},"groups":{"police":0},"state":1,"model":-1320876379,"hideUi":false}'),
(8, 'mrpd gate', '{"maxDistance":6,"heading":90,"coords":{"x":488.894775390625,"y":-1017.2102661132813,"z":27.14714050292968},"groups":{"police":0},"auto":true,"state":1,"model":-1603817716,"hideUi":false}'),
(9, 'mrpd cell 1', '{"maxDistance":2,"heading":270,"coords":{"x":461.8065185546875,"y":-993.7586059570313,"z":25.06442832946777},"lockSound":"metal-locker","groups":{"police":0},"state":1,"unlockSound":"metallic-creak","model":631614199,"hideUi":false}'),
(10, 'mrpd cells main', '{"maxDistance":2,"heading":360,"coords":{"x":463.92010498046877,"y":-992.6640625,"z":25.06442832946777},"lockSound":"metal-locker","groups":{"police":0},"state":1,"unlockSound":"metallic-creak","model":631614199,"hideUi":false}'),
(11, 'mrpd armoury', '{"maxDistance":2,"heading":270,"coords":{"x":453.08428955078127,"y":-982.5794677734375,"z":30.81926536560058},"autolock":5,"groups":{"police":0},"state":1,"model":749848321,"hideUi":false}');

View file

@ -0,0 +1,7 @@
CREATE TABLE
IF NOT EXISTS `ox_doorlock` (
`id` int (11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`data` longtext NOT NULL,
PRIMARY KEY (`id`)
);

View file

@ -0,0 +1,23 @@
---@class DrawSpriteProps
---@field [1] string textureDict
---@field [2] string textureName
---@field [3] number screenX
---@field [4] number screenY
---@field [5] number width
---@field [6] number height
---@field [7] number heading
---@field [8] integer red
---@field [9] integer green
---@field [10] integer blue
---@field [11] integer alpha
---@class DoorlockConfig
---@field Notify boolean
---@field DrawTextUI boolean
---@field CommandPrincipal string
---@field PlayerAceAuthorised boolean
---@field LockDifficulty SkillCheckDifficulity | SkillCheckDifficulity[]
---@field CanPickUnlockedDoors boolean
---@field LockpickItems string[]
---@field NativeAudio boolean
---@field DrawSprite { [0]: DrawSpriteProps, [1]: DrawSpriteProps }

View file

@ -0,0 +1 @@
@import"https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;400;500;600;700&display=swap";@import"https://use.typekit.net/qgr5ebd.css";body{margin:0;font-family:Roboto,-apple-system,BlinkMacSystemFont,Segoe UI,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;height:100vh;user-select:none;background:none!important;overflow:hidden}#root{height:100%}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}::-webkit-scrollbar{width:3px;border-radius:3px}::-webkit-scrollbar-track{background:rgb(95,95,95);border-radius:3px}::-webkit-scrollbar-thumb{background:#888;border-radius:3px}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NUI React Boilerplate</title>
<script type="module" crossorigin src="./assets/index.9bf400a2.js"></script>
<link rel="stylesheet" href="./assets/index.828bc70f.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

View file

@ -31,13 +31,27 @@ config.stashes = {
owner = false,
jobs = { ambulance = true, police = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } } -- all ranks for ambulance job, only 9 ranks for police job
},
---- NORDIS HAUS ----
{
coords = vec3(443.6447, -975.7927, 30.6896),
textUiLabel = 'Open Global Stash',
name = 'globalstash', -- uniq name
label = 'Global Stash',
slots = 70,
coords = vec3(-1238.3628, 838.1411, 192.8895, 330.3338),
textUiLabel = 'öffnen',
name = 'nordisideboard', -- uniq name
label = 'Sideboard',
slots = 10,
weight = 70000,
},
{
coords = vec3(-1230.7251, 839.1404, 192.8895, 61.2964),
textUiLabel = 'öffnen',
name = 'nordisfridge', -- uniq name
label = 'Kühlschrank',
slots = 20,
weight = 70000,
},
}
}