0.0.1
This commit is contained in:
674
resources/[core]/esx_multicharacter/LICENSE.md
Normal file
674
resources/[core]/esx_multicharacter/LICENSE.md
Normal file
@@ -0,0 +1,674 @@
|
||||
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.
|
||||
|
||||
esx_multicharacter
|
||||
Copyright (C) 2022-2024 ESX Framework, Linden, KASH
|
||||
|
||||
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.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
esx_multicharacter Copyright (C) 2022-2024 ESX Framework, Linden, KASH
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
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>.
|
||||
60
resources/[core]/esx_multicharacter/client/main.lua
Normal file
60
resources/[core]/esx_multicharacter/client/main.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
local nuiReady = false
|
||||
|
||||
CreateThread(function()
|
||||
while not ESX.PlayerLoaded do
|
||||
Wait(100)
|
||||
|
||||
if NetworkIsPlayerActive(ESX.playerId) then
|
||||
ESX.DisableSpawnManager()
|
||||
DoScreenFadeOut(0)
|
||||
Multicharacter:SetupCharacters()
|
||||
break
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Events
|
||||
|
||||
ESX.SecureNetEvent("esx_multicharacter:SetupUI", function(data, slots)
|
||||
if not nuiReady then
|
||||
print('[WARNING]', 'NUI not ready yet, awaiting...')
|
||||
ESX.Await(function()
|
||||
return nuiReady == true
|
||||
end, 'NUI Failed to load after 10000ms', 10000)
|
||||
end
|
||||
Multicharacter:SetupUI(data, slots)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded', function(playerData, isNew, skin)
|
||||
Multicharacter:PlayerLoaded(playerData, isNew, skin)
|
||||
end)
|
||||
|
||||
ESX.SecureNetEvent('esx:onPlayerLogout', function()
|
||||
DoScreenFadeOut(500)
|
||||
Wait(5000)
|
||||
|
||||
Multicharacter.spawned = false
|
||||
|
||||
Multicharacter:SetupCharacters()
|
||||
TriggerEvent("esx_skin:resetFirstSpawn")
|
||||
end)
|
||||
|
||||
-- Relog
|
||||
|
||||
if Config.Relog then
|
||||
RegisterCommand("relog", function()
|
||||
if Multicharacter.canRelog then
|
||||
Multicharacter.canRelog = false
|
||||
TriggerServerEvent("esx_multicharacter:relog")
|
||||
|
||||
ESX.SetTimeout(10000, function()
|
||||
Multicharacter.canRelog = true
|
||||
end)
|
||||
end
|
||||
end, false)
|
||||
end
|
||||
|
||||
RegisterNuiCallback('nuiReady', function(_, cb)
|
||||
nuiReady = true
|
||||
cb(1)
|
||||
end)
|
||||
77
resources/[core]/esx_multicharacter/client/modules/menu.lua
Normal file
77
resources/[core]/esx_multicharacter/client/modules/menu.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
Menu = {}
|
||||
|
||||
function Menu:CheckModel(character)
|
||||
if not character.model and character.skin then
|
||||
if character.skin.model then
|
||||
character.model = character.skin.model
|
||||
elseif character.skin.sex == 1 then
|
||||
character.model = `mp_f_freemode_01`
|
||||
else
|
||||
character.model = `mp_m_freemode_01`
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local GetSlot = function()
|
||||
for i = 1, Multicharacter.slots do
|
||||
if not Multicharacter.Characters[i] then
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Menu:NewCharacter()
|
||||
local slot = GetSlot()
|
||||
|
||||
TriggerServerEvent("esx_multicharacter:CharacterChosen", slot, true)
|
||||
TriggerEvent("esx_identity:showRegisterIdentity")
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
SetPedAoBlobRendering(playerPed, false)
|
||||
SetEntityAlpha(playerPed, 0, false)
|
||||
|
||||
Multicharacter:CloseUI()
|
||||
end
|
||||
|
||||
|
||||
function Menu:InitCharacter()
|
||||
local Characters = Multicharacter.Characters
|
||||
local Character = next(Characters)
|
||||
self:CheckModel(Characters[Character])
|
||||
|
||||
if not Multicharacter.spawned then
|
||||
Multicharacter:SetupCharacter(Character)
|
||||
end
|
||||
Wait(500)
|
||||
|
||||
SendNUIMessage({
|
||||
action = "ToggleMulticharacter",
|
||||
data = {
|
||||
show = true,
|
||||
Characters = Characters,
|
||||
CanDelete = Config.CanDelete,
|
||||
AllowedSlot = Multicharacter.slots,
|
||||
Locale = Locales[Config.Locale].UI,
|
||||
}
|
||||
})
|
||||
|
||||
SetNuiFocus(true, true)
|
||||
end
|
||||
|
||||
function Menu:SelectCharacter(index)
|
||||
Multicharacter:SetupCharacter(index)
|
||||
local playerPed = PlayerPedId()
|
||||
SetPedAoBlobRendering(playerPed, true)
|
||||
ResetEntityAlpha(playerPed)
|
||||
end
|
||||
|
||||
function Menu:PlayCharacter()
|
||||
Multicharacter:CloseUI()
|
||||
TriggerServerEvent("esx_multicharacter:CharacterChosen", Multicharacter.spawned, false)
|
||||
end
|
||||
|
||||
function Menu:DeleteCharacter()
|
||||
TriggerServerEvent("esx_multicharacter:DeleteCharacter", Multicharacter.spawned)
|
||||
Multicharacter.spawned = false
|
||||
end
|
||||
@@ -0,0 +1,282 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
Multicharacter = {}
|
||||
Multicharacter._index = Multicharacter
|
||||
Multicharacter.canRelog = true
|
||||
Multicharacter.Characters = {}
|
||||
Multicharacter.hidePlayers = false
|
||||
|
||||
function Multicharacter:SetupCamera()
|
||||
self.cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
|
||||
SetCamActive(self.cam, true)
|
||||
RenderScriptCams(true, false, 1, true, true)
|
||||
|
||||
local offset = GetOffsetFromEntityInWorldCoords(self.playerPed, 0, 1.7, 0.4)
|
||||
|
||||
SetCamCoord(self.cam, offset.x + 0.7, offset.y , offset.z)
|
||||
PointCamAtCoord(self.cam, self.spawnCoords.x + 0.4, self.spawnCoords.y, self.spawnCoords.z + 1.3)
|
||||
end
|
||||
|
||||
function Multicharacter:AwaitFadeIn()
|
||||
while IsScreenFadingIn() do
|
||||
Wait(200)
|
||||
end
|
||||
end
|
||||
|
||||
function Multicharacter:AwaitFadeOut()
|
||||
while IsScreenFadingOut() do
|
||||
Wait(200)
|
||||
end
|
||||
end
|
||||
|
||||
function Multicharacter:DestoryCamera()
|
||||
if self.cam then
|
||||
SetCamActive(self.cam, false)
|
||||
RenderScriptCams(false, false, 0, true, true)
|
||||
self.cam = nil
|
||||
end
|
||||
end
|
||||
|
||||
local HiddenCompents = {}
|
||||
|
||||
local function HideComponents(hide)
|
||||
local components = {11, 12, 21}
|
||||
for i = 1, #components do
|
||||
if hide then
|
||||
local size = GetHudComponentSize(components[i])
|
||||
if size.x > 0 or size.y > 0 then
|
||||
HiddenCompents[components[i]] = size
|
||||
SetHudComponentSize(components[i], 0.0, 0.0)
|
||||
end
|
||||
else
|
||||
if HiddenCompents[components[i]] then
|
||||
local size = HiddenCompents[components[i]]
|
||||
SetHudComponentSize(components[i], size.x, size.z)
|
||||
HiddenCompents[components[i]] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
DisplayRadar(not hide)
|
||||
end
|
||||
|
||||
function Multicharacter:HideHud(hide)
|
||||
self.hidePlayers = true
|
||||
|
||||
MumbleSetVolumeOverride(ESX.PlayerId, 0.0)
|
||||
HideComponents(hide)
|
||||
end
|
||||
|
||||
function Multicharacter:SetupCharacters()
|
||||
ESX.PlayerLoaded = false
|
||||
ESX.PlayerData = {}
|
||||
|
||||
self.spawned = false
|
||||
|
||||
self.playerPed = PlayerPedId()
|
||||
self.spawnCoords = Config.Spawn[ESX.Math.Random(1,#Config.Spawn)]
|
||||
|
||||
SetEntityCoords(self.playerPed, self.spawnCoords.x, self.spawnCoords.y, self.spawnCoords.z, true, false, false, false)
|
||||
SetEntityHeading(self.playerPed, self.spawnCoords.w)
|
||||
|
||||
SetPlayerControl(ESX.PlayerId, false, 0)
|
||||
self:SetupCamera()
|
||||
self:HideHud(true)
|
||||
|
||||
ShutdownLoadingScreen()
|
||||
ShutdownLoadingScreenNui()
|
||||
TriggerEvent("esx:loadingScreenOff")
|
||||
|
||||
SetTimeout(200, function()
|
||||
TriggerServerEvent("esx_multicharacter:SetupCharacters")
|
||||
end)
|
||||
end
|
||||
|
||||
function Multicharacter:GetSkin()
|
||||
local character = self.Characters[self.tempIndex]
|
||||
local skin = character and character.skin or Config.Default
|
||||
if not character.model then
|
||||
if character.sex == TranslateCap("female") then
|
||||
skin.sex = 1
|
||||
else
|
||||
skin.sex = 0
|
||||
end
|
||||
end
|
||||
return skin
|
||||
end
|
||||
|
||||
function Multicharacter:SpawnTempPed()
|
||||
self.canRelog = false
|
||||
local skin = self:GetSkin()
|
||||
ESX.SpawnPlayer(skin, self.spawnCoords, function()
|
||||
DoScreenFadeIn(600)
|
||||
self.playerPed = PlayerPedId()
|
||||
end)
|
||||
end
|
||||
|
||||
function Multicharacter:ChangeExistingPed()
|
||||
local newCharacter = self.Characters[self.tempIndex]
|
||||
local spawnedCharacter = self.Characters[self.spawned]
|
||||
|
||||
if not newCharacter.model then
|
||||
newCharacter.model = newCharacter.sex == TranslateCap("male") and `mp_m_freemode_01` or `mp_f_freemode_01`
|
||||
end
|
||||
|
||||
if spawnedCharacter and spawnedCharacter.model then
|
||||
local model = ESX.Streaming.RequestModel(newCharacter.model)
|
||||
if model then
|
||||
SetPlayerModel(ESX.playerId, newCharacter.model)
|
||||
SetModelAsNoLongerNeeded(newCharacter.model)
|
||||
end
|
||||
end
|
||||
TriggerEvent("skinchanger:loadSkin", newCharacter.skin)
|
||||
end
|
||||
|
||||
function Multicharacter:PrepForUI()
|
||||
FreezeEntityPosition(self.playerPed, true)
|
||||
SetPedAoBlobRendering(self.playerPed, true)
|
||||
SetEntityAlpha(self.playerPed, 255, false)
|
||||
end
|
||||
|
||||
function Multicharacter:CloseUI()
|
||||
SendNUIMessage({
|
||||
action = "ToggleMulticharacter",
|
||||
data = {
|
||||
show = false
|
||||
}
|
||||
})
|
||||
SetNuiFocus(false, false)
|
||||
end
|
||||
|
||||
function Multicharacter:SetupCharacter(index)
|
||||
local character = self.Characters[index]
|
||||
self.tempIndex = index
|
||||
|
||||
if not self.spawned then
|
||||
self:SpawnTempPed()
|
||||
elseif character and character.skin then
|
||||
self:ChangeExistingPed()
|
||||
end
|
||||
|
||||
self.spawned = index
|
||||
self.playerPed = PlayerPedId()
|
||||
self:PrepForUI()
|
||||
end
|
||||
|
||||
function Multicharacter:SetupUI(characters, slots)
|
||||
DoScreenFadeOut(0)
|
||||
|
||||
self.Characters = characters
|
||||
self.slots = slots
|
||||
|
||||
local Character = next(self.Characters)
|
||||
if not Character then
|
||||
self.canRelog = false
|
||||
|
||||
ESX.SpawnPlayer(Config.Default, self.spawnCoords, function()
|
||||
DoScreenFadeIn(400)
|
||||
self:AwaitFadeIn()
|
||||
|
||||
self.playerPed = PlayerPedId()
|
||||
SetPedAoBlobRendering(self.playerPed, false)
|
||||
SetEntityAlpha(self.playerPed, 0, false)
|
||||
|
||||
TriggerServerEvent("esx_multicharacter:CharacterChosen", 1, true)
|
||||
TriggerEvent("esx_identity:showRegisterIdentity")
|
||||
end)
|
||||
else
|
||||
Menu:InitCharacter()
|
||||
end
|
||||
end
|
||||
|
||||
function Multicharacter:LoadSkinCreator(skin)
|
||||
TriggerEvent("skinchanger:loadSkin", skin, function()
|
||||
DoScreenFadeIn(600)
|
||||
SetPedAoBlobRendering(self.playerPed, true)
|
||||
ResetEntityAlpha(self.playerPed)
|
||||
|
||||
TriggerEvent("esx_skin:openSaveableMenu", function()
|
||||
Multicharacter.finishedCreation = true
|
||||
end, function()
|
||||
Multicharacter.finishedCreation = true
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function Multicharacter:SetDefaultSkin(playerData)
|
||||
|
||||
local skin = Config.Default[playerData.sex]
|
||||
skin.sex = playerData.sex == "m" and 0 or 1
|
||||
|
||||
local model = skin.sex == 0 and `mp_m_freemode_01` or `mp_f_freemode_01`
|
||||
---@diagnostic disable-next-line: cast-local-type
|
||||
model = ESX.Streaming.RequestModel(model)
|
||||
|
||||
if not model then
|
||||
return
|
||||
end
|
||||
|
||||
SetPlayerModel(ESX.playerId, model)
|
||||
SetModelAsNoLongerNeeded(model)
|
||||
self.playerPed = PlayerPedId()
|
||||
|
||||
self:LoadSkinCreator(skin)
|
||||
end
|
||||
|
||||
function Multicharacter:Reset()
|
||||
self.Characters = {}
|
||||
self.tempIndex = nil
|
||||
self.playerPed = PlayerPedId()
|
||||
self.hidePlayers = false
|
||||
self.slots = nil
|
||||
|
||||
SetTimeout(10000, function()
|
||||
self.canRelog = true
|
||||
end)
|
||||
end
|
||||
|
||||
function Multicharacter:PlayerLoaded(playerData, isNew, skin)
|
||||
DoScreenFadeOut(750)
|
||||
self:AwaitFadeOut()
|
||||
|
||||
local esxSpawns = ESX.GetConfig().DefaultSpawns
|
||||
local spawn = esxSpawns[math.random(1, #esxSpawns)]
|
||||
|
||||
if not isNew and playerData.coords then
|
||||
spawn = playerData.coords
|
||||
end
|
||||
|
||||
if isNew or not skin or #skin == 1 then
|
||||
self.finishedCreation = false
|
||||
self:SetDefaultSkin(playerData)
|
||||
|
||||
while not self.finishedCreation do
|
||||
Wait(200)
|
||||
end
|
||||
|
||||
skin = exports["skinchanger"]:GetSkin()
|
||||
DoScreenFadeOut(500)
|
||||
self:AwaitFadeOut()
|
||||
|
||||
elseif not isNew then
|
||||
TriggerEvent("skinchanger:loadSkin", skin or self.Characters[self.spawned].skin)
|
||||
end
|
||||
|
||||
self:DestoryCamera()
|
||||
ESX.SpawnPlayer(skin, spawn, function()
|
||||
self:HideHud(false)
|
||||
SetPlayerControl(ESX.playerId, true, 0)
|
||||
|
||||
self.playerPed = PlayerPedId()
|
||||
FreezeEntityPosition(self.playerPed, false)
|
||||
SetEntityCollision(self.playerPed, true, true)
|
||||
|
||||
DoScreenFadeIn(750)
|
||||
|
||||
self:AwaitFadeIn()
|
||||
|
||||
TriggerServerEvent("esx:onPlayerSpawn")
|
||||
TriggerEvent("esx:onPlayerSpawn")
|
||||
TriggerEvent("esx:restoreLoadout")
|
||||
|
||||
self:Reset()
|
||||
end)
|
||||
end
|
||||
23
resources/[core]/esx_multicharacter/client/modules/nui.lua
Normal file
23
resources/[core]/esx_multicharacter/client/modules/nui.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
RegisterNuiCallback('SelectCharacter', function (data, cb)
|
||||
local selectedIndex = tonumber(data.id)
|
||||
|
||||
if selectedIndex then
|
||||
Menu:SelectCharacter(selectedIndex)
|
||||
end
|
||||
cb('ok')
|
||||
end)
|
||||
|
||||
RegisterNuiCallback('PlayCharacter', function (data, cb)
|
||||
Menu:PlayCharacter()
|
||||
cb('ok')
|
||||
end)
|
||||
|
||||
RegisterNuiCallback('DeleteCharacter', function (data, cb)
|
||||
Menu:DeleteCharacter()
|
||||
cb('ok')
|
||||
end)
|
||||
|
||||
RegisterNuiCallback('CreateCharacter', function (data, cb)
|
||||
Menu:NewCharacter()
|
||||
cb('ok')
|
||||
end)
|
||||
229
resources/[core]/esx_multicharacter/config.lua
Normal file
229
resources/[core]/esx_multicharacter/config.lua
Normal file
@@ -0,0 +1,229 @@
|
||||
Config = {}
|
||||
Config.Locale = GetConvar("esx:locale", "en")
|
||||
|
||||
-- Allows players to delete their characters
|
||||
Config.CanDelete = true
|
||||
|
||||
if IsDuplicityVersion() then
|
||||
-- This is the default number of slots for EVERY player
|
||||
-- If you want to manage extra slots for specific players you can do it by using '/setslots' and '/remslots' commands
|
||||
Config.Slots = 3
|
||||
--------------------
|
||||
|
||||
-- Text to prepend to each character (char#:identifier) - keep it short
|
||||
Config.Prefix = "char"
|
||||
else
|
||||
-- Sets the location for the character selection scene
|
||||
-- To set the spawn location for new characters, modify the default value in the users SQL table
|
||||
Config.Spawn = {
|
||||
{ x = -284.2856, y = 562.4627, z = 172.9182, w = 19.9895 },
|
||||
}
|
||||
--------------------
|
||||
|
||||
-- Do not use unless you are prepared to adjust your resources to correctly reset data
|
||||
-- Information: https://github.com/thelindat/esx_multicharacter#relogging
|
||||
Config.Relog = true
|
||||
--------------------
|
||||
|
||||
-- Default appearance for new characters
|
||||
Config.Default = {
|
||||
["m"] = {
|
||||
mom = 43,
|
||||
dad = 29,
|
||||
grandparents = 0,
|
||||
face_md_weight = 61,
|
||||
skin_md_weight = 27,
|
||||
face_g_weight = 0,
|
||||
nose_1 = -5,
|
||||
nose_2 = 6,
|
||||
nose_3 = 5,
|
||||
nose_4 = 8,
|
||||
nose_5 = 10,
|
||||
nose_6 = 0,
|
||||
cheeks_1 = 2,
|
||||
cheeks_2 = -10,
|
||||
cheeks_3 = 6,
|
||||
lip_thickness = -2,
|
||||
jaw_1 = 0,
|
||||
jaw_2 = 0,
|
||||
chin_1 = 0,
|
||||
chin_2 = 0,
|
||||
chin_13 = 0,
|
||||
chin_4 = 0,
|
||||
neck_thickness = 0,
|
||||
hair_1 = 76,
|
||||
hair_2 = 0,
|
||||
hair_color_1 = 61,
|
||||
hair_color_2 = 29,
|
||||
tshirt_1 = 4,
|
||||
tshirt_2 = 2,
|
||||
torso_1 = 23,
|
||||
torso_2 = 2,
|
||||
decals_1 = 0,
|
||||
decals_2 = 0,
|
||||
arms = 1,
|
||||
arms_2 = 0,
|
||||
pants_1 = 28,
|
||||
pants_2 = 3,
|
||||
shoes_1 = 70,
|
||||
shoes_2 = 2,
|
||||
mask_1 = 0,
|
||||
mask_2 = 0,
|
||||
bproof_1 = 0,
|
||||
bproof_2 = 0,
|
||||
chain_1 = 22,
|
||||
chain_2 = 2,
|
||||
helmet_1 = -1,
|
||||
helmet_2 = 0,
|
||||
glasses_1 = 0,
|
||||
glasses_2 = 0,
|
||||
watches_1 = -1,
|
||||
watches_2 = 0,
|
||||
bracelets_1 = -1,
|
||||
bracelets_2 = 0,
|
||||
bags_1 = 0,
|
||||
bags_2 = 0,
|
||||
eye_color = 0,
|
||||
eye_squint = 0,
|
||||
eyebrows_2 = 0,
|
||||
eyebrows_1 = 0,
|
||||
eyebrows_3 = 0,
|
||||
eyebrows_4 = 0,
|
||||
eyebrows_5 = 0,
|
||||
eyebrows_6 = 0,
|
||||
makeup_1 = 0,
|
||||
makeup_2 = 0,
|
||||
makeup_3 = 0,
|
||||
makeup_4 = 0,
|
||||
lipstick_1 = 0,
|
||||
lipstick_2 = 0,
|
||||
lipstick_3 = 0,
|
||||
lipstick_4 = 0,
|
||||
ears_1 = -1,
|
||||
ears_2 = 0,
|
||||
chest_1 = 0,
|
||||
chest_2 = 0,
|
||||
chest_3 = 0,
|
||||
bodyb_1 = -1,
|
||||
bodyb_2 = 0,
|
||||
bodyb_3 = -1,
|
||||
bodyb_4 = 0,
|
||||
age_1 = 0,
|
||||
age_2 = 0,
|
||||
blemishes_1 = 0,
|
||||
blemishes_2 = 0,
|
||||
blush_1 = 0,
|
||||
blush_2 = 0,
|
||||
blush_3 = 0,
|
||||
complexion_1 = 0,
|
||||
complexion_2 = 0,
|
||||
sun_1 = 0,
|
||||
sun_2 = 0,
|
||||
moles_1 = 0,
|
||||
moles_2 = 0,
|
||||
beard_1 = 11,
|
||||
beard_2 = 10,
|
||||
beard_3 = 0,
|
||||
beard_4 = 0,
|
||||
},
|
||||
["f"] = {
|
||||
mom = 28,
|
||||
dad = 6,
|
||||
grandparents = 0,
|
||||
face_md_weight = 63,
|
||||
skin_md_weight = 60,
|
||||
face_g_weight = 0,
|
||||
nose_1 = -10,
|
||||
nose_2 = 4,
|
||||
nose_3 = 5,
|
||||
nose_4 = 0,
|
||||
nose_5 = 0,
|
||||
nose_6 = 0,
|
||||
cheeks_1 = 0,
|
||||
cheeks_2 = 0,
|
||||
cheeks_3 = 0,
|
||||
lip_thickness = 0,
|
||||
jaw_1 = 0,
|
||||
jaw_2 = 0,
|
||||
chin_1 = -10,
|
||||
chin_2 = 10,
|
||||
chin_13 = -10,
|
||||
chin_4 = 0,
|
||||
neck_thickness = -5,
|
||||
hair_1 = 43,
|
||||
hair_2 = 0,
|
||||
hair_color_1 = 29,
|
||||
hair_color_2 = 35,
|
||||
tshirt_1 = 111,
|
||||
tshirt_2 = 5,
|
||||
torso_1 = 25,
|
||||
torso_2 = 2,
|
||||
decals_1 = 0,
|
||||
decals_2 = 0,
|
||||
arms = 3,
|
||||
arms_2 = 0,
|
||||
pants_1 = 12,
|
||||
pants_2 = 2,
|
||||
shoes_1 = 20,
|
||||
shoes_2 = 10,
|
||||
mask_1 = 0,
|
||||
mask_2 = 0,
|
||||
bproof_1 = 0,
|
||||
bproof_2 = 0,
|
||||
chain_1 = 85,
|
||||
chain_2 = 0,
|
||||
helmet_1 = -1,
|
||||
helmet_2 = 0,
|
||||
glasses_1 = 33,
|
||||
glasses_2 = 12,
|
||||
watches_1 = -1,
|
||||
watches_2 = 0,
|
||||
bracelets_1 = -1,
|
||||
bracelets_2 = 0,
|
||||
bags_1 = 0,
|
||||
bags_2 = 0,
|
||||
eye_color = 8,
|
||||
eye_squint = -6,
|
||||
eyebrows_2 = 7,
|
||||
eyebrows_1 = 32,
|
||||
eyebrows_3 = 52,
|
||||
eyebrows_4 = 9,
|
||||
eyebrows_5 = -5,
|
||||
eyebrows_6 = -8,
|
||||
makeup_1 = 0,
|
||||
makeup_2 = 0,
|
||||
makeup_3 = 0,
|
||||
makeup_4 = 0,
|
||||
lipstick_1 = 0,
|
||||
lipstick_2 = 0,
|
||||
lipstick_3 = 0,
|
||||
lipstick_4 = 0,
|
||||
ears_1 = -1,
|
||||
ears_2 = 0,
|
||||
chest_1 = 0,
|
||||
chest_2 = 0,
|
||||
chest_3 = 0,
|
||||
bodyb_1 = -1,
|
||||
bodyb_2 = 0,
|
||||
bodyb_3 = -1,
|
||||
bodyb_4 = 0,
|
||||
age_1 = 0,
|
||||
age_2 = 0,
|
||||
blemishes_1 = 0,
|
||||
blemishes_2 = 0,
|
||||
blush_1 = 0,
|
||||
blush_2 = 0,
|
||||
blush_3 = 0,
|
||||
complexion_1 = 0,
|
||||
complexion_2 = 0,
|
||||
sun_1 = 0,
|
||||
sun_2 = 0,
|
||||
moles_1 = 12,
|
||||
moles_2 = 8,
|
||||
beard_1 = 0,
|
||||
beard_2 = 0,
|
||||
beard_3 = 0,
|
||||
beard_4 = 0,
|
||||
},
|
||||
}
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
CREATE TABLE `multicharacter_slots` (
|
||||
`identifier` VARCHAR(60) NOT NULL,
|
||||
`slots` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`identifier`) USING BTREE,
|
||||
INDEX `slots` (`slots`) USING BTREE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
ALTER TABLE `users` ADD COLUMN
|
||||
`disabled` TINYINT(1) NULL DEFAULT '0';
|
||||
25
resources/[core]/esx_multicharacter/fxmanifest.lua
Normal file
25
resources/[core]/esx_multicharacter/fxmanifest.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
fx_version 'cerulean'
|
||||
game 'gta5'
|
||||
author 'ESX-Framework - Linden - KASH'
|
||||
description 'Allows players to have multiple characters on the same account.'
|
||||
version '1.13.5'
|
||||
lua54 'yes'
|
||||
|
||||
dependencies { 'es_extended', 'esx_context', 'esx_identity', 'esx_skin' }
|
||||
|
||||
shared_scripts { '@es_extended/imports.lua', '@es_extended/locale.lua', 'locales/*.lua', 'config.lua' }
|
||||
|
||||
server_scripts {
|
||||
'@oxmysql/lib/MySQL.lua',
|
||||
'server/*.lua',
|
||||
'server/modules/*.lua'
|
||||
}
|
||||
|
||||
client_scripts {
|
||||
"client/modules/*.lua",
|
||||
'client/*.lua'
|
||||
}
|
||||
|
||||
ui_page 'web/build/index.html'
|
||||
|
||||
files { 'web/build/index.html', 'web/build/**/*.*'}
|
||||
32
resources/[core]/esx_multicharacter/locales/ar.lua
Normal file
32
resources/[core]/esx_multicharacter/locales/ar.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
Locales["ar"] = {
|
||||
["male"] = "ذكر",
|
||||
["female"] = "أنثى",
|
||||
["select_char"] = "اختيار شخصية",
|
||||
["select_char_description"] = "اختر شخصية للعب بها.",
|
||||
["create_char"] = "شخصية جديدة",
|
||||
["char_play"] = "العب",
|
||||
["char_play_description"] = "الدخول إلى المدينة.",
|
||||
["char_disabled"] = "معطلة",
|
||||
["char_disabled_description"] = "لا يمكن استخدام هذه الشخصية.",
|
||||
["char_delete"] = "حذف",
|
||||
["char_delete_description"] = "حذف هذه الشخصية نهائيًا.",
|
||||
["char_delete_confirmation"] = "تأكيد الحذف",
|
||||
["char_delete_confirmation_description"] = "هل أنت متأكد من حذف الشخصية المحددة؟",
|
||||
["char_delete_yes_description"] = "نعم، أنا متأكد من حذف الشخصية المحددة",
|
||||
["char_delete_no_description"] = "لا، العودة إلى خيارات الشخصية",
|
||||
["character"] = "الشخصية: %s",
|
||||
["return"] = "رجوع",
|
||||
["return_description"] = "العودة لاختيار الشخصية.",
|
||||
["command_setslots"] = "تحديد عدد خانات الشخصيات للاعب",
|
||||
["command_remslots"] = "إزالة عدد خانات الشخصيات للاعب",
|
||||
["command_enablechar"] = "تفعيل شخصية معينة للاعب",
|
||||
["command_disablechar"] = "تعطيل شخصية معينة للاعب",
|
||||
["command_charslot"] = "رقم خانة الشخصية",
|
||||
["command_identifier"] = "معرّف اللاعب",
|
||||
["command_slots"] = "عدد الخانات",
|
||||
["slotsadd"] = "تم تعيين %s خانات إلى %s",
|
||||
["slotsrem"] = "تمت إزالة الخانات من %s",
|
||||
["charenabled"] = "تم تفعيل الشخصية #%s لـ %s",
|
||||
["chardisabled"] = "تم تعطيل الشخصية #%s لـ %s",
|
||||
["charnotfound"] = "الشخصية #%s لـ %s غير موجودة",
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/cs.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/cs.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["cs"] = {
|
||||
["male"] = "Muž",
|
||||
["female"] = "Žena",
|
||||
["command_setslots"] = "Nastavit počet multicharakterových slotů hráče",
|
||||
["command_remslots"] = "Odebrat počet multicharakterových slotů hráče",
|
||||
["command_enablechar"] = "Povolit danou postavu hráče",
|
||||
["command_disablechar"] = "Zakázat danou postavu hráče",
|
||||
["command_charslot"] = "Číslo slotu postavy",
|
||||
["command_identifier"] = "Identifikátor hráče",
|
||||
["command_slots"] = "Počet slotů",
|
||||
["slotsadd"] = "Nastavil jsi %s slotů pro %s",
|
||||
["slotsrem"] = "Odebral jsi sloty pro %s",
|
||||
["charenabled"] = "Povolil jsi postavu #%s hráče %s",
|
||||
["chardisabled"] = "Zakázal jsi postavu #%s hráče %s",
|
||||
["charnotfound"] = "Postava #%s hráče %s neexistuje",
|
||||
|
||||
UI = {
|
||||
["title"] = "VÝBĚR POSTAVY",
|
||||
["char_info_title"] = "Informace o postavě",
|
||||
["play"] = "HRÁT",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/da.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/da.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["da"] = {
|
||||
["male"] = "Mand",
|
||||
["female"] = "Kvinde",
|
||||
["command_setslots"] = "Indstil antal multikarakter-slots for en spiller",
|
||||
["command_remslots"] = "Fjern antal multikarakter-slots for en spiller",
|
||||
["command_enablechar"] = "Aktivér en given karakter for en spiller",
|
||||
["command_disablechar"] = "Deaktivér en given karakter for en spiller",
|
||||
["command_charslot"] = "Karakterens slotnummer",
|
||||
["command_identifier"] = "Spillerens identifikator",
|
||||
["command_slots"] = "Antal slots",
|
||||
["slotsadd"] = "Du satte %s slots til %s",
|
||||
["slotsrem"] = "Du fjernede slots fra %s",
|
||||
["charenabled"] = "Du aktiverede karakter #%s for %s",
|
||||
["chardisabled"] = "Du deaktiverede karakter #%s for %s",
|
||||
["charnotfound"] = "Karakter #%s for %s findes ikke",
|
||||
|
||||
UI = {
|
||||
["title"] = "KARAKTERVALG",
|
||||
["char_info_title"] = "Karakterinformation",
|
||||
["play"] = "SPIL",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/de.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/de.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["de"] = {
|
||||
["male"] = "Männlich",
|
||||
["female"] = "Weiblich",
|
||||
["command_setslots"] = "Anzahl der Mehrcharakter-Slots eines Spielers festlegen",
|
||||
["command_remslots"] = "Anzahl der Mehrcharakter-Slots eines Spielers entfernen",
|
||||
["command_enablechar"] = "Einen bestimmten Charakter eines Spielers aktivieren",
|
||||
["command_disablechar"] = "Einen bestimmten Charakter eines Spielers deaktivieren",
|
||||
["command_charslot"] = "Slot-Nummer des Charakters",
|
||||
["command_identifier"] = "Spielerkennung",
|
||||
["command_slots"] = "Anzahl der Slots",
|
||||
["slotsadd"] = "Du hast %s Slots für %s festgelegt",
|
||||
["slotsrem"] = "Du hast Slots von %s entfernt",
|
||||
["charenabled"] = "Du hast Charakter #%s von %s aktiviert",
|
||||
["chardisabled"] = "Du hast Charakter #%s von %s deaktiviert",
|
||||
["charnotfound"] = "Charakter #%s von %s existiert nicht",
|
||||
|
||||
UI = {
|
||||
["title"] = "CHARAKTERAUSWAHL",
|
||||
["char_info_title"] = "Charakterinformation",
|
||||
["play"] = "SPIELEN",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/en.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/en.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["en"] = {
|
||||
["male"] = "Male",
|
||||
["female"] = "Female",
|
||||
["command_setslots"] = "Set multicharacter slots number of a player",
|
||||
["command_remslots"] = "Remove multicharacter slots number of a player",
|
||||
["command_enablechar"] = "Enable a given character of a player",
|
||||
["command_disablechar"] = "Disable a given character of a player",
|
||||
["command_charslot"] = "Slot number of the character",
|
||||
["command_identifier"] = "Player identifier",
|
||||
["command_slots"] = "# of slots",
|
||||
["slotsadd"] = "You set %s slots to %s",
|
||||
["slotsrem"] = "You removed slots to %s",
|
||||
["charenabled"] = "You enabled character #%s of %s",
|
||||
["chardisabled"] = "You disabled character #%s of %s",
|
||||
["charnotfound"] = "Character #%s of %s doesn't exist",
|
||||
|
||||
UI = {
|
||||
["title"] = "CHARACTER SELECTION",
|
||||
["char_info_title"] = "Character Info",
|
||||
["play"] = "PLAY",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/es.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/es.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["es"] = {
|
||||
["male"] = "Hombre",
|
||||
["female"] = "Mujer",
|
||||
["command_setslots"] = "Establecer número de ranuras multicaracter para un jugador",
|
||||
["command_remslots"] = "Eliminar número de ranuras multicaracter para un jugador",
|
||||
["command_enablechar"] = "Habilitar un personaje específico de un jugador",
|
||||
["command_disablechar"] = "Deshabilitar un personaje específico de un jugador",
|
||||
["command_charslot"] = "Número de ranura del personaje",
|
||||
["command_identifier"] = "Identificador del jugador",
|
||||
["command_slots"] = "Número de ranuras",
|
||||
["slotsadd"] = "Has establecido %s ranuras para %s",
|
||||
["slotsrem"] = "Has eliminado ranuras para %s",
|
||||
["charenabled"] = "Has habilitado el personaje #%s de %s",
|
||||
["chardisabled"] = "Has deshabilitado el personaje #%s de %s",
|
||||
["charnotfound"] = "El personaje #%s de %s no existe",
|
||||
|
||||
UI = {
|
||||
["title"] = "SELECCIÓN DE PERSONAJE",
|
||||
["char_info_title"] = "Información del personaje",
|
||||
["play"] = "JUGAR",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/fi.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/fi.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["fi"] = {
|
||||
["male"] = "Mies",
|
||||
["female"] = "Nainen",
|
||||
["command_setslots"] = "Aseta pelaajalle monihahmoslottien määrä",
|
||||
["command_remslots"] = "Poista pelaajalta monihahmoslotteja",
|
||||
["command_enablechar"] = "Ota käyttöön pelaajan tietty hahmo",
|
||||
["command_disablechar"] = "Poista käytöstä pelaajan tietty hahmo",
|
||||
["command_charslot"] = "Hahmon slottinumero",
|
||||
["command_identifier"] = "Pelaajan tunniste",
|
||||
["command_slots"] = "Slottien määrä",
|
||||
["slotsadd"] = "Asetit %s slottia pelaajalle %s",
|
||||
["slotsrem"] = "Poistit slottien määrän pelaajalta %s",
|
||||
["charenabled"] = "Otat käyttöön hahmon #%s pelaajalta %s",
|
||||
["chardisabled"] = "Poistit käytöstä hahmon #%s pelaajalta %s",
|
||||
["charnotfound"] = "Hahmo #%s pelaajalta %s ei ole olemassa",
|
||||
|
||||
UI = {
|
||||
["title"] = "HAHMON VALINTA",
|
||||
["char_info_title"] = "Hahmon tiedot",
|
||||
["play"] = "PELAA",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/fr.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/fr.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["fr"] = {
|
||||
["male"] = "Homme",
|
||||
["female"] = "Femme",
|
||||
["command_setslots"] = "Définir le nombre d'emplacements multicaractères d'un joueur",
|
||||
["command_remslots"] = "Retirer le nombre d'emplacements multicaractères d'un joueur",
|
||||
["command_enablechar"] = "Activer un personnage spécifique d'un joueur",
|
||||
["command_disablechar"] = "Désactiver un personnage spécifique d'un joueur",
|
||||
["command_charslot"] = "Numéro d'emplacement du personnage",
|
||||
["command_identifier"] = "Identifiant du joueur",
|
||||
["command_slots"] = "Nombre d'emplacements",
|
||||
["slotsadd"] = "Vous avez défini %s emplacements pour %s",
|
||||
["slotsrem"] = "Vous avez retiré des emplacements pour %s",
|
||||
["charenabled"] = "Vous avez activé le personnage #%s de %s",
|
||||
["chardisabled"] = "Vous avez désactivé le personnage #%s de %s",
|
||||
["charnotfound"] = "Le personnage #%s de %s n'existe pas",
|
||||
|
||||
UI = {
|
||||
["title"] = "SÉLECTION DE PERSONNAGE",
|
||||
["char_info_title"] = "Infos du personnage",
|
||||
["play"] = "JOUER",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/gr.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/gr.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["gr"] = {
|
||||
["male"] = "Άνδρας",
|
||||
["female"] = "Γυναίκα",
|
||||
["command_setslots"] = "Ορισμός αριθμού multicharacter θέσεων για έναν παίκτη",
|
||||
["command_remslots"] = "Αφαίρεση αριθμού multicharacter θέσεων από έναν παίκτη",
|
||||
["command_enablechar"] = "Ενεργοποίηση συγκεκριμένου χαρακτήρα ενός παίκτη",
|
||||
["command_disablechar"] = "Απενεργοποίηση συγκεκριμένου χαρακτήρα ενός παίκτη",
|
||||
["command_charslot"] = "Αριθμός θέσης χαρακτήρα",
|
||||
["command_identifier"] = "Αναγνωριστικό παίκτη",
|
||||
["command_slots"] = "Αριθμός θέσεων",
|
||||
["slotsadd"] = "Ορίσατε %s θέσεις για τον/την %s",
|
||||
["slotsrem"] = "Αφαιρέσατε θέσεις από τον/την %s",
|
||||
["charenabled"] = "Ενεργοποιήσατε τον χαρακτήρα #%s του/της %s",
|
||||
["chardisabled"] = "Απενεργοποιήσατε τον χαρακτήρα #%s του/της %s",
|
||||
["charnotfound"] = "Ο χαρακτήρας #%s του/της %s δεν υπάρχει",
|
||||
|
||||
UI = {
|
||||
["title"] = "ΕΠΙΛΟΓΗ ΧΑΡΑΚΤΗΡΑ",
|
||||
["char_info_title"] = "Πληροφορίες Χαρακτήρα",
|
||||
["play"] = "ΠΑΙΞΕ",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/he.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/he.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["he"] = {
|
||||
["male"] = "זכר",
|
||||
["female"] = "נקבה",
|
||||
["command_setslots"] = "הגדר מספר חריצי דמויות מרובות לשחקן",
|
||||
["command_remslots"] = "הסר מספר חריצי דמויות מרובות משחקן",
|
||||
["command_enablechar"] = "אפשר דמות מסוימת של שחקן",
|
||||
["command_disablechar"] = "נטרל דמות מסוימת של שחקן",
|
||||
["command_charslot"] = "מספר חריץ הדמות",
|
||||
["command_identifier"] = "מזהה שחקן",
|
||||
["command_slots"] = "מספר חריצים",
|
||||
["slotsadd"] = "הגדרת %s חריצים עבור %s",
|
||||
["slotsrem"] = "הסרת חריצים מ-%s",
|
||||
["charenabled"] = "איפשרת את הדמות #%s של %s",
|
||||
["chardisabled"] = "נטרלת את הדמות #%s של %s",
|
||||
["charnotfound"] = "הדמות #%s של %s לא קיימת",
|
||||
|
||||
UI = {
|
||||
["title"] = "בחירת דמות",
|
||||
["char_info_title"] = "פרטי דמות",
|
||||
["play"] = "שחק",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/hu.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/hu.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["hu"] = {
|
||||
["male"] = "Férfi",
|
||||
["female"] = "Nő",
|
||||
["command_setslots"] = "Többszereplős slotok számának beállítása egy játékos számára",
|
||||
["command_remslots"] = "Többszereplős slotok számának eltávolítása egy játékostól",
|
||||
["command_enablechar"] = "Egy adott karakter engedélyezése egy játékosnál",
|
||||
["command_disablechar"] = "Egy adott karakter letiltása egy játékosnál",
|
||||
["command_charslot"] = "A karakter slot száma",
|
||||
["command_identifier"] = "Játékos azonosító",
|
||||
["command_slots"] = "Slotok száma",
|
||||
["slotsadd"] = "%s slotot állítottál be %s játékosnak",
|
||||
["slotsrem"] = "Eltávolítottad a slotokat %s játékostól",
|
||||
["charenabled"] = "Engedélyezted a(z) #%s karaktert %s játékosnál",
|
||||
["chardisabled"] = "Letiltottad a(z) #%s karaktert %s játékosnál",
|
||||
["charnotfound"] = "A(z) #%s karakter %s játékosnál nem létezik",
|
||||
|
||||
UI = {
|
||||
["title"] = "KARAKTER KIVÁLASZTÁSA",
|
||||
["char_info_title"] = "Karakterinformáció",
|
||||
["play"] = "JÁTÉK",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/it.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/it.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["it"] = {
|
||||
["male"] = "Maschio",
|
||||
["female"] = "Femmina",
|
||||
["command_setslots"] = "Imposta il numero di slot multicarattere per un giocatore",
|
||||
["command_remslots"] = "Rimuovi il numero di slot multicarattere da un giocatore",
|
||||
["command_enablechar"] = "Abilita un determinato personaggio di un giocatore",
|
||||
["command_disablechar"] = "Disabilita un determinato personaggio di un giocatore",
|
||||
["command_charslot"] = "Numero dello slot del personaggio",
|
||||
["command_identifier"] = "Identificatore del giocatore",
|
||||
["command_slots"] = "Numero di slot",
|
||||
["slotsadd"] = "Hai impostato %s slot per %s",
|
||||
["slotsrem"] = "Hai rimosso gli slot da %s",
|
||||
["charenabled"] = "Hai abilitato il personaggio #%s di %s",
|
||||
["chardisabled"] = "Hai disabilitato il personaggio #%s di %s",
|
||||
["charnotfound"] = "Il personaggio #%s di %s non esiste",
|
||||
|
||||
UI = {
|
||||
["title"] = "SELEZIONE DEL PERSONAGGIO",
|
||||
["char_info_title"] = "Informazioni del personaggio",
|
||||
["play"] = "GIOCA",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/nl.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/nl.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["nl"] = {
|
||||
["male"] = "Man",
|
||||
["female"] = "Vrouw",
|
||||
["command_setslots"] = "Stel het aantal multi-personage slots in voor een speler",
|
||||
["command_remslots"] = "Verwijder het aantal multi-personage slots van een speler",
|
||||
["command_enablechar"] = "Schakel een specifiek personage van een speler in",
|
||||
["command_disablechar"] = "Schakel een specifiek personage van een speler uit",
|
||||
["command_charslot"] = "Personage slotnummer",
|
||||
["command_identifier"] = "Speleridentificatie",
|
||||
["command_slots"] = "Aantal slots",
|
||||
["slotsadd"] = "Je hebt %s slots ingesteld voor %s",
|
||||
["slotsrem"] = "Je hebt slots verwijderd van %s",
|
||||
["charenabled"] = "Je hebt personage #%s van %s ingeschakeld",
|
||||
["chardisabled"] = "Je hebt personage #%s van %s uitgeschakeld",
|
||||
["charnotfound"] = "Personage #%s van %s bestaat niet",
|
||||
|
||||
UI = {
|
||||
["title"] = "PERSONAGE SELECTIE",
|
||||
["char_info_title"] = "Personage Informatie",
|
||||
["play"] = "SPEEL",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/pl.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/pl.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["pl"] = {
|
||||
["male"] = "Mężczyzna",
|
||||
["female"] = "Kobieta",
|
||||
["command_setslots"] = "Ustaw liczbę slotów multi-postaci dla gracza",
|
||||
["command_remslots"] = "Usuń liczbę slotów multi-postaci od gracza",
|
||||
["command_enablechar"] = "Włącz konkretną postać gracza",
|
||||
["command_disablechar"] = "Wyłącz konkretną postać gracza",
|
||||
["command_charslot"] = "Numer slotu postaci",
|
||||
["command_identifier"] = "Identyfikator gracza",
|
||||
["command_slots"] = "Liczba slotów",
|
||||
["slotsadd"] = "Ustawiłeś %s slotów dla %s",
|
||||
["slotsrem"] = "Usunąłeś sloty od %s",
|
||||
["charenabled"] = "Włączyłeś postać #%s dla %s",
|
||||
["chardisabled"] = "Wyłączyłeś postać #%s dla %s",
|
||||
["charnotfound"] = "Postać #%s dla %s nie istnieje",
|
||||
|
||||
UI = {
|
||||
["title"] = "WYBÓR POSTACI",
|
||||
["char_info_title"] = "Informacje o postaci",
|
||||
["play"] = "GRAJ",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/pt.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/pt.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["pt"] = {
|
||||
["male"] = "Masculino",
|
||||
["female"] = "Feminino",
|
||||
["command_setslots"] = "Defina o número de slots de múltiplos personagens para um jogador",
|
||||
["command_remslots"] = "Remova o número de slots de múltiplos personagens de um jogador",
|
||||
["command_enablechar"] = "Ative um personagem específico de um jogador",
|
||||
["command_disablechar"] = "Desative um personagem específico de um jogador",
|
||||
["command_charslot"] = "Número do slot do personagem",
|
||||
["command_identifier"] = "Identificador do jogador",
|
||||
["command_slots"] = "Número de slots",
|
||||
["slotsadd"] = "Você definiu %s slots para %s",
|
||||
["slotsrem"] = "Você removeu slots de %s",
|
||||
["charenabled"] = "Você ativou o personagem #%s de %s",
|
||||
["chardisabled"] = "Você desativou o personagem #%s de %s",
|
||||
["charnotfound"] = "O personagem #%s de %s não existe",
|
||||
|
||||
UI = {
|
||||
["title"] = "SELEÇÃO DE PERSONAGEM",
|
||||
["char_info_title"] = "Informações do personagem",
|
||||
["play"] = "JOGAR",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/sl.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/sl.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["sl"] = {
|
||||
["male"] = "Moški",
|
||||
["female"] = "Ženska",
|
||||
["command_setslots"] = "Nastavi število večkarakternih slotov za igralca",
|
||||
["command_remslots"] = "Odstrani število večkarakternih slotov igralcu",
|
||||
["command_enablechar"] = "Omogoči določen lik igralca",
|
||||
["command_disablechar"] = "Onemogoči določen lik igralca",
|
||||
["command_charslot"] = "Številka slota lika",
|
||||
["command_identifier"] = "Identifikator igralca",
|
||||
["command_slots"] = "Število slotov",
|
||||
["slotsadd"] = "Nastavil si %s slotov za %s",
|
||||
["slotsrem"] = "Odstranil si slot(e) od %s",
|
||||
["charenabled"] = "Omogočil si lika #%s za %s",
|
||||
["chardisabled"] = "Onemogočil si lika #%s za %s",
|
||||
["charnotfound"] = "Lik #%s za %s ne obstaja",
|
||||
|
||||
UI = {
|
||||
["title"] = "IZBIRA LIKA",
|
||||
["char_info_title"] = "Informacije o liku",
|
||||
["play"] = "IGRAJ",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/sr.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/sr.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["sr"] = {
|
||||
["male"] = "Muški",
|
||||
["female"] = "Ženski",
|
||||
["command_setslots"] = "Postavi broj multi-karakternih slotova za igrača",
|
||||
["command_remslots"] = "Ukloni broj multi-karakternih slotova od igrača",
|
||||
["command_enablechar"] = "Omogući određeni lik igrača",
|
||||
["command_disablechar"] = "Onemogući određeni lik igrača",
|
||||
["command_charslot"] = "Broj slota lika",
|
||||
["command_identifier"] = "Identifikator igrača",
|
||||
["command_slots"] = "Broj slotova",
|
||||
["slotsadd"] = "Postavio si %s slotova za %s",
|
||||
["slotsrem"] = "Uklonio si slotove od %s",
|
||||
["charenabled"] = "Omogućio si lika #%s za %s",
|
||||
["chardisabled"] = "Onemogućio si lika #%s za %s",
|
||||
["charnotfound"] = "Lik #%s za %s ne postoji",
|
||||
|
||||
UI = {
|
||||
["title"] = "IZBOR LIKA",
|
||||
["char_info_title"] = "Informacije o liku",
|
||||
["play"] = "IGRAJ",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/sv.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/sv.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["sv"] = {
|
||||
["male"] = "Man",
|
||||
["female"] = "Kvinna",
|
||||
["command_setslots"] = "Sätt antalet multikaraktärsplatser för en spelare",
|
||||
["command_remslots"] = "Ta bort antalet multikaraktärsplatser från en spelare",
|
||||
["command_enablechar"] = "Aktivera en specifik karaktär för en spelare",
|
||||
["command_disablechar"] = "Inaktivera en specifik karaktär för en spelare",
|
||||
["command_charslot"] = "Karaktärsplatsnummer",
|
||||
["command_identifier"] = "Spelaridentifierare",
|
||||
["command_slots"] = "Antal platser",
|
||||
["slotsadd"] = "Du har satt %s platser för %s",
|
||||
["slotsrem"] = "Du har tagit bort platser från %s",
|
||||
["charenabled"] = "Du har aktiverat karaktär #%s för %s",
|
||||
["chardisabled"] = "Du har inaktiverat karaktär #%s för %s",
|
||||
["charnotfound"] = "Karaktär #%s för %s finns inte",
|
||||
|
||||
UI = {
|
||||
["title"] = "KARAKTÄRSVAL",
|
||||
["char_info_title"] = "Karaktärsinformation",
|
||||
["play"] = "SPELA",
|
||||
}
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/locales/zh-cn.lua
Normal file
22
resources/[core]/esx_multicharacter/locales/zh-cn.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
Locales["zh-cn"] = {
|
||||
["male"] = "男性",
|
||||
["female"] = "女性",
|
||||
["command_setslots"] = "为玩家设置多角色槽位数量",
|
||||
["command_remslots"] = "移除玩家的多角色槽位数量",
|
||||
["command_enablechar"] = "启用玩家的指定角色",
|
||||
["command_disablechar"] = "禁用玩家的指定角色",
|
||||
["command_charslot"] = "角色槽位编号",
|
||||
["command_identifier"] = "玩家标识",
|
||||
["command_slots"] = "槽位数量",
|
||||
["slotsadd"] = "你已为 %s 设置了 %s 个槽位",
|
||||
["slotsrem"] = "你已移除了 %s 的槽位",
|
||||
["charenabled"] = "你已启用了 %s 的角色 #%s",
|
||||
["chardisabled"] = "你已禁用了 %s 的角色 #%s",
|
||||
["charnotfound"] = "%s 的角色 #%s 不存在",
|
||||
|
||||
UI = {
|
||||
["title"] = "角色选择",
|
||||
["char_info_title"] = "角色信息",
|
||||
["play"] = "开始游戏",
|
||||
}
|
||||
}
|
||||
38
resources/[core]/esx_multicharacter/readme.md
Normal file
38
resources/[core]/esx_multicharacter/readme.md
Normal file
@@ -0,0 +1,38 @@
|
||||
<h1 align='center'>[ESX] Multi-Character</a></h1><p align='center'><b><a href='https://discord.esx-framework.org/'>Discord</a> - <a href='https://esx-framework.org/'>Website</a> - <a href='https://docs.esx-framework.org/'>Documentation</a></b></h5>
|
||||
|
||||
A Simplistic system, that allows Players to have multiple Characters, which can be customised for all player with `Config.Slots` or personally set a players character count using `setslots`, `remslots`, `enablechar` and `disablechar` Commands :)
|
||||
|
||||

|
||||
|
||||
## Notes
|
||||
|
||||
- Characters are stored in the users table as `char#:license`
|
||||
- Character deletion does not require manual entries for the tables to remove
|
||||
|
||||
## Kashacters
|
||||
|
||||
- This project is forked from the [Kashacters resource](https://github.com/FiveEYZ/esx_kashacter)
|
||||
- Most of the code has been entirely rewritten
|
||||
- KASH has given permission for this resource to use his code and the addition of a license
|
||||
- The license obviously does not apply to previous versions and KASH has stated his resource is free to be used however
|
||||
|
||||
<br>
|
||||
<table><tr><td><h4 align='center'>Legal Notices</h4></tr></td>
|
||||
<tr><td>
|
||||
Official Multi-Character system for ESX Legacy
|
||||
|
||||
Copyright © 2022-2024 Linden, ESX-Framework and KASH
|
||||
|
||||
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>.
|
||||
</td></tr></table>
|
||||
44
resources/[core]/esx_multicharacter/server/main.lua
Normal file
44
resources/[core]/esx_multicharacter/server/main.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
Server = {}
|
||||
Server._index = Server
|
||||
|
||||
Server.oneSync = GetConvar("onesync", "off")
|
||||
Server.slots = Config.Slots or 4
|
||||
Server.prefix = Config.Prefix or "char"
|
||||
Server.identifierType = ESX.GetConfig("Identifier") or GetConvar("sv_lan", "") == "true" and "ip" or "license"
|
||||
|
||||
AddEventHandler("playerConnecting", function(_, _, deferrals)
|
||||
local source = source
|
||||
Server:OnConnecting(source, deferrals)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx_multicharacter:SetupCharacters", function()
|
||||
local source = source
|
||||
Multicharacter:SetupCharacters(source)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx_multicharacter:CharacterChosen", function(charid, isNew)
|
||||
local source = source
|
||||
Multicharacter:CharacterChosen(source, charid, isNew)
|
||||
end)
|
||||
|
||||
AddEventHandler("esx_identity:completedRegistration", function(source, data)
|
||||
Multicharacter:RegistrationComplete(source, data)
|
||||
end)
|
||||
|
||||
AddEventHandler("playerDropped", function()
|
||||
local source = source
|
||||
Multicharacter:PlayerDropped(source)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx_multicharacter:DeleteCharacter", function(charid)
|
||||
if not Config.CanDelete or type(charid) ~= "number" or string.len(charid) > 2 then
|
||||
return
|
||||
end
|
||||
local source = source
|
||||
Database:DeleteCharacter(source, charid)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx_multicharacter:relog", function()
|
||||
local source = source
|
||||
TriggerEvent("esx:playerLogout", source)
|
||||
end)
|
||||
@@ -0,0 +1,85 @@
|
||||
ESX.RegisterCommand(
|
||||
"setslots",
|
||||
"admin",
|
||||
function(xPlayer, args)
|
||||
Database:SetSlots(args.identifier, args.slots)
|
||||
xPlayer.triggerEvent("esx:showNotification", TranslateCap("slotsadd", args.slots, args.identifier))
|
||||
end,
|
||||
true,
|
||||
{
|
||||
help = TranslateCap("command_setslots"),
|
||||
validate = true,
|
||||
arguments = {
|
||||
{ name = "identifier", help = TranslateCap("command_identifier"), type = "string" },
|
||||
{ name = "slots", help = TranslateCap("command_slots"), type = "number" },
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
ESX.RegisterCommand(
|
||||
"remslots",
|
||||
"admin",
|
||||
function(xPlayer, args)
|
||||
local removed = Database:RemoveSlots(args.identifier)
|
||||
|
||||
if removed then
|
||||
xPlayer.triggerEvent("esx:showNotification", TranslateCap("slotsrem", args.identifier))
|
||||
end
|
||||
end,
|
||||
true,
|
||||
{
|
||||
help = TranslateCap("command_remslots"),
|
||||
validate = true,
|
||||
arguments = {
|
||||
{ name = "identifier", help = TranslateCap("command_identifier"), type = "string" },
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
ESX.RegisterCommand(
|
||||
"enablechar",
|
||||
"admin",
|
||||
function(xPlayer, args)
|
||||
local enabled = Database:EnableSlot(args.identifier, args.charslot)
|
||||
if enabled then
|
||||
xPlayer.triggerEvent("esx:showNotification", TranslateCap("charenabled", args.charslot, args.identifier))
|
||||
else
|
||||
xPlayer.triggerEvent("esx:showNotification", TranslateCap("charnotfound", args.charslot, args.identifier))
|
||||
end
|
||||
end,
|
||||
true,
|
||||
{
|
||||
help = TranslateCap("command_enablechar"),
|
||||
validate = true,
|
||||
arguments = {
|
||||
{ name = "identifier", help = TranslateCap("command_identifier"), type = "string" },
|
||||
{ name = "charslot", help = TranslateCap("command_charslot"), type = "number" },
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
ESX.RegisterCommand(
|
||||
"disablechar",
|
||||
"admin",
|
||||
function(xPlayer, args)
|
||||
local disabled = Database:DisableSlot(args.identifier, args.charslot)
|
||||
if disabled then
|
||||
xPlayer.triggerEvent("esx:showNotification", TranslateCap("chardisabled", args.charslot, args.identifier))
|
||||
else
|
||||
xPlayer.triggerEvent("esx:showNotification", TranslateCap("charnotfound", args.charslot, args.identifier))
|
||||
end
|
||||
end,
|
||||
true,
|
||||
{
|
||||
help = TranslateCap("command_disablechar"),
|
||||
validate = true,
|
||||
arguments = {
|
||||
{ name = "identifier", help = TranslateCap("command_identifier"), type = "string" },
|
||||
{ name = "charslot", help = TranslateCap("command_charslot"), type = "number" },
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
RegisterCommand("forcelog", function(source)
|
||||
TriggerEvent("esx:playerLogout", source)
|
||||
end, true)
|
||||
144
resources/[core]/esx_multicharacter/server/modules/database.lua
Normal file
144
resources/[core]/esx_multicharacter/server/modules/database.lua
Normal file
@@ -0,0 +1,144 @@
|
||||
Database = {}
|
||||
Database.connected = false
|
||||
Database.found = false
|
||||
Database.tables = { users = "identifier" }
|
||||
|
||||
function Database:GetConnection()
|
||||
local connectionString = GetConvar("mysql_connection_string", "")
|
||||
|
||||
if connectionString == "" then
|
||||
error(connectionString .. "\n^1Unable to start Multicharacter - unable to determine database from mysql_connection_string^0", 0)
|
||||
elseif connectionString:find("mysql://") then
|
||||
connectionString = connectionString:sub(9, -1)
|
||||
|
||||
self.name = connectionString:sub(connectionString:find("/") + 1, -1):gsub("[%?]+[%w%p]*$", "")
|
||||
self.found = true
|
||||
else
|
||||
local confPairs = { string.strsplit(";", connectionString) }
|
||||
for i = 1, #confPairs do
|
||||
local confPair = confPairs[i]
|
||||
local key, value = confPair:match("^%s*(.-)%s*=%s*(.-)%s*$")
|
||||
if key == "database" then
|
||||
self.name = value
|
||||
self.found = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MySQL.ready(function()
|
||||
local length = 42 + #Server.prefix
|
||||
local DB_COLUMNS = MySQL.query.await(('SELECT TABLE_NAME, COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = "%s" AND DATA_TYPE = "varchar" AND COLUMN_NAME IN (?)'):format(Database.name, length), {
|
||||
{ "identifier", "owner" },
|
||||
})
|
||||
|
||||
if DB_COLUMNS then
|
||||
local columns = {}
|
||||
local count = 0
|
||||
|
||||
for i = 1, #DB_COLUMNS do
|
||||
local column = DB_COLUMNS[i]
|
||||
Database.tables[column.TABLE_NAME] = column.COLUMN_NAME
|
||||
|
||||
if column?.CHARACTER_MAXIMUM_LENGTH < length then
|
||||
count = count + 1
|
||||
columns[column.TABLE_NAME] = column.COLUMN_NAME
|
||||
end
|
||||
end
|
||||
|
||||
if next(columns) then
|
||||
local query = "ALTER TABLE `%s` MODIFY COLUMN `%s` VARCHAR(%s)"
|
||||
local queries = table.create(count, 0)
|
||||
|
||||
for k, v in pairs(columns) do
|
||||
queries[#queries + 1] = { query = query:format(k, v, length) }
|
||||
end
|
||||
|
||||
if MySQL.transaction.await(queries) then
|
||||
print(("[^2INFO^7] Updated ^5%s^7 columns to use ^5VARCHAR(%s)^7"):format(count, length))
|
||||
else
|
||||
print(("[^2INFO^7] Unable to update ^5%s^7 columns to use ^5VARCHAR(%s)^7"):format(count, length))
|
||||
end
|
||||
end
|
||||
|
||||
Database.connected = true
|
||||
|
||||
ESX.Jobs = ESX.GetJobs()
|
||||
while not next(ESX.Jobs) do
|
||||
Wait(500)
|
||||
ESX.Jobs = ESX.GetJobs()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function Database:DeleteCharacter(source, charid)
|
||||
local identifier = ("%s%s:%s"):format(Server.prefix, charid, ESX.GetIdentifier(source))
|
||||
local query = "DELETE FROM `%s` WHERE %s = ?"
|
||||
local queries = {}
|
||||
local count = 0
|
||||
|
||||
for table, column in pairs(self.tables) do
|
||||
count = count + 1
|
||||
queries[count] = { query = query:format(table, column), values = { identifier } }
|
||||
end
|
||||
|
||||
MySQL.transaction(queries, function(result)
|
||||
if result then
|
||||
local name = GetPlayerName(source)
|
||||
print(("[^2INFO^7] Player ^5%s %s^7 has deleted a character ^5(%s)^7"):format(name, source, identifier))
|
||||
Wait(50)
|
||||
Multicharacter:SetupCharacters(source)
|
||||
else
|
||||
error("\n^1Transaction failed while trying to delete " .. identifier .. "^0")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function Database:GetPlayerSlots(identifier)
|
||||
return MySQL.scalar.await("SELECT slots FROM multicharacter_slots WHERE identifier = ?", { identifier }) or
|
||||
Server.slots
|
||||
end
|
||||
|
||||
function Database:GetPlayerInfo(identifier, slots)
|
||||
return MySQL.query.await(
|
||||
"SELECT identifier, accounts, job, job_grade, firstname, lastname, dateofbirth, sex, skin, disabled FROM users WHERE identifier LIKE ? LIMIT ?",
|
||||
{ identifier, slots })
|
||||
end
|
||||
|
||||
function Database:SetSlots(identifier, slots)
|
||||
MySQL.insert("INSERT INTO `multicharacter_slots` (`identifier`, `slots`) VALUES (?, ?) ON DUPLICATE KEY UPDATE `slots` = VALUES(`slots`)", {
|
||||
identifier,
|
||||
slots,
|
||||
})
|
||||
end
|
||||
|
||||
function Database:RemoveSlots(identifier)
|
||||
local slots = MySQL.scalar.await("SELECT `slots` FROM `multicharacter_slots` WHERE identifier = ?", {
|
||||
identifier,
|
||||
})
|
||||
|
||||
if slots then
|
||||
MySQL.update("DELETE FROM `multicharacter_slots` WHERE `identifier` = ?", {
|
||||
identifier,
|
||||
})
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function Database:EnableSlot(identifier, slot)
|
||||
local selectedCharacter = ("char%s:%s"):format(slot, identifier)
|
||||
|
||||
local updated = MySQL.update.await("UPDATE `users` SET `disabled` = 0 WHERE identifier = ?", {selectedCharacter})
|
||||
return updated > 0
|
||||
end
|
||||
|
||||
function Database:DisableSlot(identifier, slot)
|
||||
local selectedCharacter = ("char%s:%s"):format(slot, identifier)
|
||||
|
||||
local updated = MySQL.update.await("UPDATE `users` SET `disabled` = 1 WHERE identifier = ?", {selectedCharacter})
|
||||
return updated > 0
|
||||
end
|
||||
|
||||
Database:GetConnection()
|
||||
@@ -0,0 +1,87 @@
|
||||
ESX.Players = {}
|
||||
|
||||
function Server:ResetPlayers()
|
||||
if next(ESX.Players) then
|
||||
local players = table.clone(ESX.Players)
|
||||
table.wipe(ESX.Players)
|
||||
|
||||
for _, v in pairs(players) do
|
||||
ESX.Players[ESX.GetIdentifier(v.source)] = v.identifier
|
||||
end
|
||||
else
|
||||
ESX.Players = {}
|
||||
end
|
||||
end
|
||||
|
||||
function Server:OnConnecting(source, deferrals)
|
||||
deferrals.defer()
|
||||
Wait(0) -- Required
|
||||
local identifier
|
||||
local correctLicense, _ = pcall(function()
|
||||
identifier = ESX.GetIdentifier(source)
|
||||
end)
|
||||
|
||||
-- luacheck: ignore
|
||||
if not SetEntityOrphanMode then
|
||||
return deferrals.done(("[ESX Multicharacter] ESX Requires a minimum Artifact version of 10188, Please update your server."))
|
||||
end
|
||||
|
||||
if Server.oneSync == "off" or Server.oneSync == "legacy" then
|
||||
return deferrals.done(("[ESX Multicharacter] ESX Requires Onesync Infinity to work. This server currently has Onesync set to: %s"):format(Server.oneSync))
|
||||
end
|
||||
|
||||
if not Database.found then
|
||||
deferrals.done("[ESX Multicharacter] Cannot Find the servers mysql_connection_string. Please make sure it is correctly configured in your server.cfg")
|
||||
end
|
||||
|
||||
if not Database.connected then
|
||||
deferrals.done("[ESX Multicharacter] OxMySQL Was Unable To Connect to your database. Please make sure it is turned on and correctly configured in your server.cfg")
|
||||
end
|
||||
|
||||
if not identifier or not correctLicense then return deferrals.done(("[ESX Multicharacter] Unable to retrieve player identifier.\nIdentifier type: %s"):format(Server.identifierType)) end
|
||||
|
||||
if ESX.GetConfig().EnableDebug or not ESX.Players[identifier] then
|
||||
ESX.Players[identifier] = source
|
||||
return deferrals.done()
|
||||
end
|
||||
|
||||
---@param staleSrc number
|
||||
local function cleanupStalePlayer(staleSrc)
|
||||
deferrals.update(("[ESX Multicharacter] Cleaning stale player entry..."):format(identifier))
|
||||
TriggerEvent("esx:onPlayerDropped", staleSrc, "esx_stale_player_obj", function()
|
||||
ESX.Players[identifier] = source
|
||||
deferrals.done()
|
||||
end)
|
||||
end
|
||||
|
||||
local function reject()
|
||||
return deferrals.done(
|
||||
("[ESX Multicharacter] There was an error loading your character!\nError code: identifier-active\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same account.\n\nYour identifier: %s"):format(
|
||||
identifier)
|
||||
)
|
||||
end
|
||||
|
||||
local plyRef = ESX.Players[identifier] ---@type number|string If player has not chosen character yet, plyRef = source, otherwise plyRef = identifier prefix ("char1", "char2", etc.)
|
||||
if type(plyRef) == "number" then
|
||||
if GetPlayerPing(plyRef --[[@as string]]) > 0 then
|
||||
return reject()
|
||||
end
|
||||
|
||||
return cleanupStalePlayer(plyRef)
|
||||
end
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromIdentifier(("%s:%s"):format(plyRef, identifier))
|
||||
if not xPlayer then
|
||||
ESX.Players[identifier] = source
|
||||
return deferrals.done()
|
||||
end
|
||||
|
||||
if GetPlayerPing(xPlayer.source --[[@as string]]) > 0 then
|
||||
return reject()
|
||||
end
|
||||
|
||||
return cleanupStalePlayer(xPlayer.source)
|
||||
end
|
||||
|
||||
|
||||
Server:ResetPlayers()
|
||||
@@ -0,0 +1,100 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
|
||||
Multicharacter = {}
|
||||
Multicharacter._index = Multicharacter
|
||||
Multicharacter.awaitingRegistration = {}
|
||||
|
||||
function Multicharacter:SetupCharacters(source)
|
||||
SetPlayerRoutingBucket(source, source)
|
||||
while not Database.connected do
|
||||
Wait(100)
|
||||
end
|
||||
|
||||
local identifier = ESX.GetIdentifier(source)
|
||||
ESX.Players[identifier] = source
|
||||
|
||||
local slots = Database:GetPlayerSlots(identifier)
|
||||
identifier = Server.prefix .. "%:" .. identifier
|
||||
|
||||
local rawCharacters = Database:GetPlayerInfo(identifier, slots)
|
||||
local characters
|
||||
|
||||
if rawCharacters then
|
||||
local characterCount = #rawCharacters
|
||||
characters = table.create(0, characterCount)
|
||||
|
||||
for i = 1, characterCount, 1 do
|
||||
local v = rawCharacters[i]
|
||||
local job, grade = v.job or "unemployed", tostring(v.job_grade)
|
||||
|
||||
if ESX.Jobs[job] and ESX.Jobs[job].grades[grade] then
|
||||
if job ~= "unemployed" then
|
||||
grade = ESX.Jobs[job].grades[grade].label
|
||||
else
|
||||
grade = ""
|
||||
end
|
||||
job = ESX.Jobs[job].label
|
||||
end
|
||||
|
||||
local accounts = json.decode(v.accounts)
|
||||
local idString = string.sub(v.identifier, #Server.prefix + 1, string.find(v.identifier, ":") - 1)
|
||||
local id = tonumber(idString)
|
||||
if id then
|
||||
characters[id] = {
|
||||
id = id,
|
||||
bank = accounts.bank,
|
||||
money = accounts.money,
|
||||
job = job,
|
||||
job_grade = grade,
|
||||
firstname = v.firstname,
|
||||
lastname = v.lastname,
|
||||
dateofbirth = v.dateofbirth,
|
||||
skin = v.skin and json.decode(v.skin) or {},
|
||||
disabled = v.disabled,
|
||||
sex = v.sex == "m" and TranslateCap("male") or TranslateCap("female"),
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
TriggerClientEvent("esx_multicharacter:SetupUI", source, characters, slots)
|
||||
end
|
||||
|
||||
function Multicharacter:CharacterChosen(source, charid, isNew)
|
||||
if type(charid) ~= "number" or string.len(charid) > 2 or type(isNew) ~= "boolean" then
|
||||
return
|
||||
end
|
||||
|
||||
if isNew then
|
||||
self.awaitingRegistration[source] = charid
|
||||
else
|
||||
SetPlayerRoutingBucket(source, 0)
|
||||
if not ESX.GetConfig().EnableDebug then
|
||||
local identifier = ("%s%s:%s"):format(Server.prefix, charid, ESX.GetIdentifier(source))
|
||||
|
||||
if ESX.GetPlayerFromIdentifier(identifier) then
|
||||
DropPlayer(source, "[ESX Multicharacter] Your identifier " .. identifier .. " is already on the server!")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local charIdentifier = ("%s%s"):format(Server.prefix, charid)
|
||||
TriggerEvent("esx:onPlayerJoined", source, charIdentifier)
|
||||
ESX.Players[ESX.GetIdentifier(source)] = charIdentifier
|
||||
end
|
||||
end
|
||||
|
||||
function Multicharacter:RegistrationComplete(source, data)
|
||||
local charId = self.awaitingRegistration[source]
|
||||
local charIdentifier = ("%s%s"):format(Server.prefix, charId)
|
||||
self.awaitingRegistration[source] = nil
|
||||
ESX.Players[ESX.GetIdentifier(source)] = charIdentifier
|
||||
|
||||
SetPlayerRoutingBucket(source, 0)
|
||||
TriggerEvent("esx:onPlayerJoined", source, charIdentifier, data)
|
||||
end
|
||||
|
||||
function Multicharacter:PlayerDropped(player)
|
||||
self.awaitingRegistration[player] = nil
|
||||
ESX.Players[ESX.GetIdentifier(player)] = nil
|
||||
end
|
||||
28
resources/[core]/esx_multicharacter/web/eslint.config.js
Normal file
28
resources/[core]/esx_multicharacter/web/eslint.config.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import js from '@eslint/js';
|
||||
import globals from 'globals';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import reactRefresh from 'eslint-plugin-react-refresh';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ['dist'] },
|
||||
{
|
||||
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||
files: ['**/*.{ts,tsx}'],
|
||||
languageOptions: {
|
||||
ecmaVersion: 2020,
|
||||
globals: globals.browser,
|
||||
},
|
||||
plugins: {
|
||||
'react-hooks': reactHooks,
|
||||
'react-refresh': reactRefresh,
|
||||
},
|
||||
rules: {
|
||||
...reactHooks.configs.recommended.rules,
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true },
|
||||
],
|
||||
},
|
||||
}
|
||||
);
|
||||
13
resources/[core]/esx_multicharacter/web/index.html
Normal file
13
resources/[core]/esx_multicharacter/web/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>ESX MULTICHARACTER</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
34
resources/[core]/esx_multicharacter/web/package.json
Normal file
34
resources/[core]/esx_multicharacter/web/package.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "vite-react-app",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify/react": "^6.0.0",
|
||||
"lucide-react": "^0.344.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.9.1",
|
||||
"@types/react": "^18.3.5",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"autoprefixer": "^10.4.18",
|
||||
"eslint": "^9.9.1",
|
||||
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.11",
|
||||
"globals": "^15.9.0",
|
||||
"postcss": "^8.4.35",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5.5.3",
|
||||
"typescript-eslint": "^8.3.0",
|
||||
"vite": "^5.4.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
62
resources/[core]/esx_multicharacter/web/src/App.tsx
Normal file
62
resources/[core]/esx_multicharacter/web/src/App.tsx
Normal file
@@ -0,0 +1,62 @@
|
||||
import CharacterSelection from "./components/CharacterSelection";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useNuiEvent } from "./utils/useNuiEvent";
|
||||
import { Character, Locale } from "./types/Character";
|
||||
import { fetchNui } from "./utils/fetchNui";
|
||||
|
||||
function App() {
|
||||
const [isVisible, setIsVisible] = useState<boolean>(false);
|
||||
const [characters, setCharacters] = useState<Character[]>([]);
|
||||
const [Candelete, setCandelete] = useState<boolean>(false);
|
||||
const [MaxAllowedSlot, setMaxAllowedSlot] = useState<number>(0);
|
||||
const [locale, setLocale] = useState<Locale>({
|
||||
char_info_title: "",
|
||||
play: "",
|
||||
title: "",
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
fetchNui("nuiReady");
|
||||
}, []);
|
||||
|
||||
useNuiEvent("ToggleMulticharacter", (data: any) => {
|
||||
if (data.show) {
|
||||
const validCharacters = data.Characters.filter(
|
||||
(char: any) => char !== null
|
||||
);
|
||||
const parsedCharacters: Character[] = validCharacters.map(
|
||||
(char: any, index: number) => ({
|
||||
id: char.id.toString(),
|
||||
name: `${char.firstname} ${char.lastname}`,
|
||||
birthDate: char.dateofbirth,
|
||||
gender: char.sex,
|
||||
occupation: char.job,
|
||||
disabled: char.disabled,
|
||||
isActive: index === 0,
|
||||
})
|
||||
);
|
||||
|
||||
setIsVisible(true);
|
||||
setCharacters(parsedCharacters);
|
||||
setCandelete(data.CanDelete);
|
||||
setMaxAllowedSlot(data.AllowedSlot);
|
||||
setLocale(data.Locale);
|
||||
} else {
|
||||
setIsVisible(false);
|
||||
setCharacters([]);
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
isVisible && (
|
||||
<CharacterSelection
|
||||
initialCharacters={characters}
|
||||
Candelete={Candelete}
|
||||
MaxAllowedSlot={MaxAllowedSlot}
|
||||
locale={locale}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
BIN
resources/[core]/esx_multicharacter/web/src/assets/esxLogo.png
Normal file
BIN
resources/[core]/esx_multicharacter/web/src/assets/esxLogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,102 @@
|
||||
import React from 'react';
|
||||
import { Character } from '../types/Character';
|
||||
import { Icon } from '@iconify/react';
|
||||
|
||||
interface CharacterCardProps {
|
||||
character: Character;
|
||||
onSelect: (id: string) => void;
|
||||
onInfoClick: (id: string) => void;
|
||||
showInfo: boolean;
|
||||
PlayCharacter: () => void;
|
||||
}
|
||||
|
||||
const CharacterCard: React.FC<CharacterCardProps> = ({
|
||||
character,
|
||||
onSelect,
|
||||
onInfoClick,
|
||||
showInfo,
|
||||
PlayCharacter
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<div className='flex justify-center items-center mb-4'>
|
||||
<div
|
||||
className={`
|
||||
h-[65px] w-[462px] cursor-pointer rounded-[5px] overflow-hidden group
|
||||
${character.isActive
|
||||
? ''
|
||||
: 'cursor-pointer rounded-[5px] overflow-hidden bg-[#38383880] border-2 border-[#ffffff50] hover:border-[#FFFFFF] hover:bg-[#38383840'}
|
||||
`}
|
||||
onClick={() => onSelect(character.id)}
|
||||
>
|
||||
<div
|
||||
className={`
|
||||
flex items-center gap-2 transition-all duration-300
|
||||
${character.isActive ? 'text-[#fb9b04]' : 'text-gray-400 group-hover:text-[#FFFFFF]'}
|
||||
`}
|
||||
>
|
||||
<div
|
||||
className={`
|
||||
flex items-center rounded-[5px] p-4 overflow-hidden
|
||||
${character.isActive
|
||||
? 'h-[65px] bg-[#fb9b0440] border-2 border-[#fb9b04]'
|
||||
: 'h-[60px]'}
|
||||
${character.isActive && showInfo ? 'w-full' : character.isActive ? 'w-[411px]' : 'w-full'}
|
||||
`}
|
||||
>
|
||||
<Icon
|
||||
icon="material-symbols:person-rounded"
|
||||
width="30"
|
||||
height="30"
|
||||
className={`mr-3 flex-shrink-0`}
|
||||
/>
|
||||
<div className="flex justify-center items-center w-full h-full overflow-hidden">
|
||||
<span className={`font-bold text-[24px] tracking-wide whitespace-nowrap ${character.isActive ? 'truncate' : 'ml-2'}`}>
|
||||
{character.name}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{character.isActive && (
|
||||
<div className="flex gap-2 flex-shrink-0">
|
||||
<button
|
||||
className={`
|
||||
h-[65px] rounded-[5px] ${character.disabled ? 'bg-gray-500' : 'bg-orange-500 hover:bg-orange-600'} flex text-black items-center justify-center transition-all duration-300
|
||||
${showInfo ? 'w-0 scale-0 opacity-0 overflow-hidden' : 'w-[65px] h-[65px] scale-100 opacity-100'}
|
||||
`}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
PlayCharacter();
|
||||
}}
|
||||
disabled={character.disabled}
|
||||
>
|
||||
<Icon
|
||||
icon="si:play-fill"
|
||||
width="30"
|
||||
height="30"
|
||||
color="#383838"
|
||||
/>
|
||||
</button>
|
||||
<button
|
||||
className="w-[65px] h-[65px] rounded-[5px] bg-orange-500 text-black flex items-center justify-center transition-colors hover:bg-orange-600 flex-shrink-0"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onInfoClick(character.id);
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
icon="bi:info"
|
||||
width="30"
|
||||
height="30"
|
||||
color="#383838"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
};
|
||||
|
||||
export default CharacterCard;
|
||||
@@ -0,0 +1,71 @@
|
||||
import React from 'react';
|
||||
import { Info, Cake, User2, Briefcase, Trash2 } from 'lucide-react';
|
||||
import { Character, Locale } from '../types/Character';
|
||||
import { Icon } from '@iconify/react';
|
||||
|
||||
interface CharacterInfoProps {
|
||||
character: Character;
|
||||
onClose: () => void;
|
||||
isAllowedtoDelete: boolean;
|
||||
PlayCharacter : () => void;
|
||||
handleDelete: () => void;
|
||||
locale: Locale;
|
||||
}
|
||||
|
||||
const CharacterInfo: React.FC<CharacterInfoProps> = ({ character, onClose, isAllowedtoDelete , PlayCharacter, handleDelete, locale}) => {
|
||||
if (!character) return null;
|
||||
|
||||
return (
|
||||
<div className='flex justify-center items-center'>
|
||||
<div className="w-[462px] bg-neutral-900 rounded-b-lg p-4 animate-slideDown">
|
||||
<div className="mb-4">
|
||||
<h3 className="text-gray-400 uppercase text-sm mb-3 font-semibold flex items-center">
|
||||
<Info className="mr-2" size={16} /> {locale.char_info_title}
|
||||
</h3>
|
||||
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<div className="bg-neutral-800 p-3 rounded flex items-center">
|
||||
<Cake className="mr-3 text-white" size={18} />
|
||||
<div className="flex justify-center w-full">
|
||||
<span className="text-white mr-1">{character.birthDate}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-neutral-800 p-3 rounded flex items-center">
|
||||
<User2 className="mr-3 text-white-400" size={18} />
|
||||
<div className="flex justify-center w-full">
|
||||
<span className="text-white mr-6">{character.gender}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-neutral-800 p-3 rounded flex items-center col-span-2">
|
||||
<Briefcase className="mr-3 text-white-400" size={18} />
|
||||
<div className="flex justify-center w-full">
|
||||
<span className="text-white mr-6">{character.occupation}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
className={`flex-1 ${character.disabled ? 'bg-gray-500' : 'bg-neutral-800 hover:bg-[#FFA31A] hover:text-[#383838]'} text-white py-2 px-4 font-semibold text-[16px] rounded-[5px] flex items-center justify-center transition-colors`}
|
||||
onClick={PlayCharacter}
|
||||
disabled={character.disabled}
|
||||
>
|
||||
<Icon icon="flowbite:play-solid" width={23} height={23} className="mr-2" />
|
||||
{locale.play}
|
||||
</button>
|
||||
{isAllowedtoDelete && (
|
||||
<button
|
||||
className="bg-neutral-800 text-white p-2 rounded hover:bg-red-900 transition-colors"
|
||||
onClick={handleDelete}
|
||||
>
|
||||
<Trash2 size={18} />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CharacterInfo;
|
||||
@@ -0,0 +1,119 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Plus } from 'lucide-react';
|
||||
import { Character, Locale } from '../types/Character';
|
||||
import CharacterCard from './CharacterCard';
|
||||
import CharacterInfo from './CharacterInfo';
|
||||
import Logo from '../assets/esxLogo.png';
|
||||
import { fetchNui } from '../utils/fetchNui';
|
||||
|
||||
interface CharacterSelectionProps {
|
||||
initialCharacters: Character[];
|
||||
Candelete: boolean;
|
||||
MaxAllowedSlot : number;
|
||||
locale : Locale;
|
||||
}
|
||||
|
||||
const CharacterSelection: React.FC<CharacterSelectionProps> = ({ initialCharacters, Candelete, MaxAllowedSlot, locale }) => {
|
||||
const [characters, setCharacters] = useState<Character[]>(initialCharacters);
|
||||
const [showInfo, setShowInfo] = useState<string | null>(null);
|
||||
const [selectedCharacter, setSelectedCharacter] = useState<Character | null>(
|
||||
characters.find(char => char.isActive) || null
|
||||
);
|
||||
|
||||
const handleSelectCharacter = (id: string) => {
|
||||
if (selectedCharacter?.id === id) return;
|
||||
|
||||
const updatedCharacters = characters.map(char => ({
|
||||
...char,
|
||||
isActive: char.id === id
|
||||
}));
|
||||
|
||||
setCharacters(updatedCharacters);
|
||||
setSelectedCharacter(updatedCharacters.find(char => char.id === id) || null);
|
||||
setShowInfo(null);
|
||||
fetchNui('SelectCharacter', {id : id})
|
||||
};
|
||||
|
||||
const toggleInfo = (id: string) => {
|
||||
setShowInfo(showInfo === id ? null : id);
|
||||
};
|
||||
|
||||
const PlayCharacter = () => {
|
||||
fetchNui('PlayCharacter')
|
||||
}
|
||||
|
||||
const handleCreateCharacter = () => {
|
||||
fetchNui('CreateCharacter')
|
||||
}
|
||||
|
||||
const handleDeleteCharacter = () => {
|
||||
if (!selectedCharacter) return;
|
||||
|
||||
const updatedCharactersRaw = characters.filter(char => char.id !== selectedCharacter.id);
|
||||
|
||||
fetchNui('DeleteCharacter');
|
||||
|
||||
if (updatedCharactersRaw.length > 0) {
|
||||
const updatedCharacters = updatedCharactersRaw.map((char, index) => ({
|
||||
...char,
|
||||
isActive: index === 0
|
||||
}));
|
||||
|
||||
setCharacters(updatedCharacters);
|
||||
setSelectedCharacter(updatedCharacters[0]);
|
||||
setShowInfo(null);
|
||||
} else {
|
||||
setCharacters([]);
|
||||
setSelectedCharacter(null);
|
||||
setShowInfo(null);
|
||||
handleCreateCharacter();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="h-screen bg-[#161616F2] text-white w-[527px] border-r border-neutral-800 overflow-hidden animate-slideIn flex flex-col">
|
||||
<div className="p-4 flex-1 overflow-auto">
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<img src={Logo} alt="Logo" className="h-16 ml-1" />
|
||||
<h2 className="text-[24px] font-bold tracking-wide text-right flex-1">{locale.title}</h2>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{characters.map(character => (
|
||||
<div key={character.id}>
|
||||
<CharacterCard
|
||||
character={character}
|
||||
onSelect={handleSelectCharacter}
|
||||
onInfoClick={toggleInfo}
|
||||
showInfo={showInfo === character.id}
|
||||
PlayCharacter={PlayCharacter}
|
||||
/>
|
||||
{character.isActive && showInfo === character.id && (
|
||||
<CharacterInfo
|
||||
character={character}
|
||||
onClose={() => setShowInfo(null)}
|
||||
isAllowedtoDelete={Candelete}
|
||||
PlayCharacter={PlayCharacter}
|
||||
handleDelete={handleDeleteCharacter}
|
||||
locale={locale}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="p-4 border-t border-neutral-800">
|
||||
<button
|
||||
className={`w-full h-[70px] ${characters.length >= MaxAllowedSlot ? 'bg-gray-500' : 'bg-[#FB9B04] cursor-pointer hover:bg-orange-600'} text-[#383838] p-3 rounded flex items-center justify-center transition-colors`}
|
||||
onClick={handleCreateCharacter}
|
||||
disabled={characters.length >= MaxAllowedSlot}
|
||||
>
|
||||
<Plus size={24} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CharacterSelection;
|
||||
58
resources/[core]/esx_multicharacter/web/src/index.css
Normal file
58
resources/[core]/esx_multicharacter/web/src/index.css
Normal file
@@ -0,0 +1,58 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
--primary: #ff9800;
|
||||
--primary-dark: #f57c00;
|
||||
--dark-bg: #1c1c1c;
|
||||
--card-bg: #262626;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: "Poppins", sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
transform: translateX(-100%);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateX(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes slideDown {
|
||||
from {
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
to {
|
||||
max-height: 500px;
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-slideIn {
|
||||
animation: slideIn 0.5s ease-out forwards;
|
||||
}
|
||||
|
||||
.animate-slideDown {
|
||||
animation: slideDown 0.3s ease-out forwards;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.transition-all {
|
||||
transition-property: all;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 300ms;
|
||||
}
|
||||
7
resources/[core]/esx_multicharacter/web/src/main.tsx
Normal file
7
resources/[core]/esx_multicharacter/web/src/main.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import App from './App.tsx';
|
||||
import './index.css';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<App />
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
export interface Character {
|
||||
id: string;
|
||||
name: string;
|
||||
birthDate: string;
|
||||
gender: 'MALE' | 'FEMALE';
|
||||
occupation: string;
|
||||
isActive?: boolean;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export interface Locale {
|
||||
char_info_title: string;
|
||||
play : string;
|
||||
title : string;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { isEnvBrowser } from "./misc";
|
||||
|
||||
/**
|
||||
* Simple wrapper around fetch API tailored for CEF/NUI use. This abstraction
|
||||
* can be extended to include AbortController if needed or if the response isn't
|
||||
* JSON. Tailor it to your needs.
|
||||
*
|
||||
* @param eventName - The endpoint eventname to target
|
||||
* @param data - Data you wish to send in the NUI Callback
|
||||
* @param mockData - Mock data to be returned if in the browser
|
||||
*
|
||||
* @return returnData - A promise for the data sent back by the NuiCallbacks CB argument
|
||||
*/
|
||||
|
||||
export async function fetchNui<T = unknown>(
|
||||
eventName: string,
|
||||
data?: unknown,
|
||||
mockData?: T,
|
||||
): Promise<T> {
|
||||
const options = {
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=UTF-8",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
};
|
||||
|
||||
if (isEnvBrowser() && mockData) return mockData;
|
||||
|
||||
const resourceName = (window as any).GetParentResourceName
|
||||
? (window as any).GetParentResourceName()
|
||||
: "nui-frame-app";
|
||||
|
||||
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
||||
|
||||
const respFormatted = await resp.json();
|
||||
|
||||
return respFormatted;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Will return whether the current environment is in a regular browser
|
||||
// and not CEF
|
||||
export const isEnvBrowser = (): boolean => !(window as any).invokeNative;
|
||||
|
||||
// Basic no operation function
|
||||
export const noop = () => {};
|
||||
@@ -0,0 +1,49 @@
|
||||
import { MutableRefObject, useEffect, useRef } from "react";
|
||||
import { noop } from "./misc";
|
||||
|
||||
interface NuiMessageData<T = unknown> {
|
||||
action: string;
|
||||
data: T;
|
||||
}
|
||||
|
||||
type NuiHandlerSignature<T> = (data: T) => void;
|
||||
|
||||
/**
|
||||
* A hook that manage events listeners for receiving data from the client scripts
|
||||
* @param action The specific `action` that should be listened for.
|
||||
* @param handler The callback function that will handle data relayed by this hook
|
||||
*
|
||||
* @example
|
||||
* useNuiEvent<{visibility: true, wasVisible: 'something'}>('setVisible', (data) => {
|
||||
* // whatever logic you want
|
||||
* })
|
||||
*
|
||||
**/
|
||||
|
||||
export const useNuiEvent = <T = unknown>(
|
||||
action: string,
|
||||
handler: (data: T) => void,
|
||||
) => {
|
||||
const savedHandler: MutableRefObject<NuiHandlerSignature<T>> = useRef(noop);
|
||||
|
||||
// Make sure we handle for a reactive handler
|
||||
useEffect(() => {
|
||||
savedHandler.current = handler;
|
||||
}, [handler]);
|
||||
|
||||
useEffect(() => {
|
||||
const eventListener = (event: MessageEvent<NuiMessageData<T>>) => {
|
||||
const { action: eventAction, data } = event.data;
|
||||
|
||||
if (savedHandler.current) {
|
||||
if (eventAction === action) {
|
||||
savedHandler.current(data);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("message", eventListener);
|
||||
// Remove Event Listener on component cleanup
|
||||
return () => window.removeEventListener("message", eventListener);
|
||||
}, [action]);
|
||||
};
|
||||
1
resources/[core]/esx_multicharacter/web/src/vite-env.d.ts
vendored
Normal file
1
resources/[core]/esx_multicharacter/web/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
33
resources/[core]/esx_multicharacter/web/tailwind.config.js
Normal file
33
resources/[core]/esx_multicharacter/web/tailwind.config.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
orange: {
|
||||
500: '#FF9800',
|
||||
600: '#F57C00',
|
||||
},
|
||||
neutral: {
|
||||
800: '#262626',
|
||||
900: '#1c1c1c',
|
||||
}
|
||||
},
|
||||
animation: {
|
||||
'slide-in': 'slideIn 0.5s ease-out forwards',
|
||||
'slide-down': 'slideDown 0.3s ease-out forwards',
|
||||
},
|
||||
keyframes: {
|
||||
slideIn: {
|
||||
'0%': { transform: 'translateX(-100%)', opacity: 0 },
|
||||
'100%': { transform: 'translateX(0)', opacity: 1 },
|
||||
},
|
||||
slideDown: {
|
||||
'0%': { maxHeight: '0', opacity: 0, transform: 'translateY(-10px)' },
|
||||
'100%': { maxHeight: '500px', opacity: 1, transform: 'translateY(0)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
24
resources/[core]/esx_multicharacter/web/tsconfig.app.json
Normal file
24
resources/[core]/esx_multicharacter/web/tsconfig.app.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
7
resources/[core]/esx_multicharacter/web/tsconfig.json
Normal file
7
resources/[core]/esx_multicharacter/web/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
22
resources/[core]/esx_multicharacter/web/tsconfig.node.json
Normal file
22
resources/[core]/esx_multicharacter/web/tsconfig.node.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
14
resources/[core]/esx_multicharacter/web/vite.config.ts
Normal file
14
resources/[core]/esx_multicharacter/web/vite.config.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: './',
|
||||
plugins: [react()],
|
||||
optimizeDeps: {
|
||||
exclude: ['lucide-react'],
|
||||
},
|
||||
build: {
|
||||
outDir: 'build',
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user