Merge branch 'master' of github.com:Jackzmc/sourcemod-plugins

This commit is contained in:
Jackzie 2024-01-15 15:52:36 -06:00
commit e8c39d87e2
241 changed files with 88699 additions and 1 deletions

35
.gitignore vendored Normal file
View file

@ -0,0 +1,35 @@
sm_*
.*/
scripting_ext/
!scripting/include/guesswho/*
!scripting/include/feedthetrolls
!scripting/include/hideandseek
!scripting/include/guessswho/*
!scripting/hideandseek.sp
!scripting/guessswho.sp
!scripting/sm_namespamblock.sp
!plugins/sm_namespamblock.smx
.push.settings.jsonc*
template.config.js
scripting/sm_give.sp
scripting/include/steamtools.inc
scripting/L4D2Testing.sp
plugins/L4D2Testing.smx
scripting/cancer.sp
plugins/sm_give.smx
plugins/l4d2_stats_recorder.smx
scripting/l4d2_stats_recorder.sp
scripting/include/smlib.inc
scripting/l4d2_custom.sp
plugins/l4d2_custom.smx
plugins/disable_cameras.smx
plugins/l4d_esfp.smx
plugins/customstatus.smx
scripting/l4d_esfp.sp
scripting/customstatus.sp
plugins/ssh.smx
scripting/include/ssh.inc
scripting/ssh.sp
scripting/l4d2_witch_force_attack_cmd.sp
l4d2_stats_plugin/
data

674
LICENSE Normal file
View 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.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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:
<program> Copyright (C) <year> <name of author>
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>.

458
README.md Normal file
View file

@ -0,0 +1,458 @@
# sourcemod-plugins
This is a collection of sourcemod plugins, most are used on my servers. The majority of the plugins are created by me, but some are modifications of other plugins.
Some of the plugins / changes are very specific, but may be useful to someone.
Not always the latest versions. If you have any interest with a plugin, I can make sure to upload the latest.
Useful things:
1. Netprop viewer https://jackz.me/netprops/l4d2
## Plugin List
### Created by Me
* #### CSGO
* [csgo-knifehp](#csgo-knifehp) - First plugin I've made
* [CSGOTroll](#csgotroll) - Abandoned friend trolling plugin
* #### L4D2
* [l4d2-manual-director](#l4d2-manual-director) - Spawn specials on demand via director or at your cursor
* [l4d2-info-cmd](#l4d2-info-cmd) - Prints a full state of all survivors, useful for external information
* [AutoWarpBot](#autowarpbot) - Abandoned
* [L4D2FFKickProtection](#l4d2ffkickprotection) - Prevents players being voted off from friendly firing and prevents admins from being kicked
* [l4d2_avoid_minigun](#l4d2_avoid_minigun) - Makes bots avoid being infront of any in-use miniguns. Useful for spawned miniguns
* [l4d2_ai_minigun](#l4d2_ai_minigun) - Based off [Silver's Survivor Bot Holdout plugin](https://forums.alliedmods.net/showthread.php?p=1741099), allows you to spawn survivor bots but with no limit.
* [L4D2Tools](#l4d2tools) - A collection of utilities, mostly just used with [l4d_survivor_identity_fix](#l4d_survivor_identity_fix) and the /model command
* [l4d2_swarm](#l4d2_swarm) - Uses vscript RushVictim to make all zombies target a player, like a more subtle vomitplayer
* [l4d2_feedthetrolls](#l4d2_feedthetrolls) - Full collection of tools to troll your friends or troll the trolls
* [l4d2_autobotcrown](#l4d2_autobotcrown) - Bots will auto crown
* [l4d2_extraplayeritems](#l4d2_extraplayeritems) - Includes tons of utilities for 5+ games, such as 5+ player hud, extra kit / item spawning, and more
* [l4d2_population_control](#l4d2_population_control) - Allows you to custom the type of zombies that spawn (% of clowns, mud men, etc..)
* [globalbans](#globalbans) - Bans synced via mysql, way lighter than the sourcebans cesspool.
* [l4d2_rollback](#l4d2_rollback) - Abandoned and broken, but makes periodic backup of all player's items
* [l4d2_autorestart](#l4d2_autorestart) - Restarts server if it's been on for a certain uptime or when empty with just bots.
* [l4d2_TKStopper](#l4d2_tkstopper) - All the teamkiller and shitty-aim player punishments. Auto increasing reverse ff and teamkill detection
* [l4d2_crescendo_control](#l4d2_crescendo_control) - Prevents players from running far ahead and starting events, and logs button presses
* [l4d2_vocalize_control](#l4d2_vocalize_control) - Allows you to locally mute someone from vocalizing
* [l4d2_guesswho](#l4d2_guesswho) - Garry's Mod's Guess Who in l4d2, inspired by hide and seek
* [l4d2_hideandseek](#l4d2_hideandseek) - An enhancement to the base hide and seek mutation
* [l4d2_hats](#l4d2_hats) - Entity Hats & Entity editing
* [l4d2_prophunt](#l4d2_prophunt) - Garry's Mod inspired prop hunt, inspired by hide and seek
* [sm_namespamblock](#sm_namespamblock) - Basic plugin that bans players if they change their name in rapid succession
* [l4d2-stats-plugin](https://github.com/jackzmc/l4d2-stats-plugin) - Custom stats recorder, see https://stats.jackz.me
* [l4d2-ai-tweaks](#l4d2_ai_tweaks) - Very minor tweaks to survivor bots' behavior
### Modified Others
* [200IQBots_FlyYouFools](#200iqbots_flyyoufools) - Improved code to make it support multiple tanks and work better
* [l4d_survivor_identity_fix](#l4d_survivor_identity_fix) - Use with [L4D2Tools](#l4d2tools) to change models, some fixes
* [BetterWitchAvoidance](#betterwitchavoidance)
* l4d_anti_rush - Modified plugin to add a forward, so other plugins (like feedthetrolls) can do something. In addition, use highest flow value achieved for players (fixes issue when admins go back and players who haven't moved suddenly get punished)
* [l4d2_sb_fix](#l4d2_sb_fix) - Updated to 1.11 & latest sourcepawn syntax & removed the FCVAR_NOTIFY from all cvars (why is that added?)
* GrabEnt - Improved version that prevents moving certain entities (such as invisual walls, ragdolls, etc) and improved some code
## Dependencies
This is a list of most common dependencies, independent if they are used for a certain plugin.
Check the plugin info for an exact list.
* [Left 4 Dhooks Direct](https://forums.alliedmods.net/showthread.php?t=321696)
* [Scene Processor](https://forums.alliedmods.net/showthread.php?p=2147410)
### Development Dependencies
Most L4D2 plugins use my own include: jutils.inc, it's provided in this repo.
Some do require newer includes for my modified plugins (such as my improved survivor identity fix)
## Descriptions
### csgo-knifehp
On knife kill, gives the player 100 HP (configurable)
* **Convars:**
* `knifehp_enable <0/1>` - Enable regaining health on knife kill
* `knifehp_max_health <#>` - Maximum health to set an attacker to
* `knifehp_amount <#>` - Amount of health to give attacker
### l4d2-manual-director
~~Probably going to be posted publicly sometime.~~ Allows you to spawn specials on cursor, or via director, forcefully, bypassing limits
* **Convars:**
* `manual_director_version|mandirector_version` - ... gets version
* `mandirector_notify_spawn <1/0>` - Should spawning specials notify on use?
* `mandirector_announce_level <0/1/2/3>` - Announcement types. 0 - None, 1 - Only bosses, 2 - Only specials+, 3 - Everything
* `mandirector_enable_tank <0/1>` - Should tanks be allowed to be spawned?
* `mandirector_enable_witch <0/1>` - Should witches be allowed to be spawned?
* `mandirector_enable_mob <0/1>` - Should mobs be allowed to be spawned
* **Commands:**
* `sm_spawnspecial <special> [amount]` - Spawn a special via director
* `sm_forcespecial <special> [amount]` - Force spawn a special via director, bypassing spawn limits
* `sm_forcecursor <special> [amount]` - Force spawn a special at cursor, bypassing spawn limits
* `sm_cursormenu` - Show the spawn menu for cursor spawning
* `sm_specialmenu` - Show the spawn menu for director spawning
* `sm_directormenu` (Same as sm_specialmenu for now)
### l4d2-info-cmd
Technically 'l4d2 game info', haven't changed name. Just prints general information, used for a project
* **Commands:**
* `sm_gameinfo`
* Example Response:
```
>map,diff,mode,tempoState,totalSeconds
c1m1_hotel,1,coop,3,1622
>id,name,bot,health,status,throwSlot,kitSlot,pillSlot,survivorType,velocity,primaryWpn,secondaryWpn
1,Jackz,0,80,alive,0,,first_aid_kit,,Bill,0,,pistol
3,Zoey,1,75,alive,0,,first_aid_kit,,Zoey,0,,pistol
4,Francis,1,76,alive,0,,,,Francis,0,,pistol
5,Louis,1,90,alive,0,,first_aid_kit,,Louis,0,,pistol
```
### AutoWarpBot
Simple l4d2 plugin that will auto teleport bots to checkpoint once all real players have reached the saferoom.
Doesn't really work well. Abandoned.
### 200IQBots_FlyYouFools
Updated version of ConnerRia's plugin. Improves bots avoidance of tanks. Change from original is updated sourcepawn syntax, some optimizations/cleanup, and fixes such as bots avoiding tank that has not been activated, or not escaping in vehicle due to presence of tank.
Latest version now has support for multiple tanks, the bots might not avoid them as effectively as they would with one tank but they still try their best.
* **Convars:**
* `FlyYouFools_Version` - Prints the version of plugin
### BetterWitchAvoidance
Inspired by the 200IQBots_FlyYouFools. Bots avoid witch if its over 40% anger when close, or a little bigger range at 60% or more. Not recommended to use, normal behavior seems fine.
### L4D2FFKickProtection
Simple plugin that prevents a player that is being vote-kicked from doing any ff damage to teammates.
It also prevents vote kicking of admins, instead will notify admins.
It also makes any vote kicks created by an admin to instantly be accepted by all players
* **Convars:**
* `sm_votekick_force_threshold <#>` - The threshold of damage where the offending player is just immediately kicked. 0 -> Any attempted damage, -1 -> No auto kick.
### CSGOTroll
Another joke plugin, with it configured, a victim will have a % chance their shots just fail. This can be for the AWP or all weapons at least for now.
* **Convars:**
* `troll_enable <0/1>` - Enable troll. 0 -> OFF, 1 -> Shots
* `troll_shot_fail_percentage <0.0-1.0>` - percentage float (0.0 to 1.0) chance that victims' shots fail
* `troll_targets <ids>` - comma separated list of steamid64 targets (ex: STEAM_0:0:75141700)
* `troll_shot_mode <0/1>` - 0 -> ALL Weapons, 1 -> AWP
### l4d2_avoid_minigun
Makes the bots avoid standing in front of or on top of the player that is using a minigun. It checks every 2.0 seconds if they are in the way, then forces them to move to behind you. There is no configuration, all automatic.
### l4d2_ai_minigun
Requires: [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
Spawn the holdout bots used in the passing. This supports all 8 characters, including with the minigun. They can spawn with any weapon or default to ak47.
**Notes:**
* The minigun holdout bot has to internally be Louis, so it will be Louis making sounds, with whatever model specified being shown. This doesn't apply for normal holdout bot.
* \<survivor name> can be "bill" or their numeric id (4).
Code modified from https://forums.alliedmods.net/showthread.php?p=1741099
* **Commands:**
* `sm_ai_minigun <survivor name>` - Spawns an ai bot with minigun infront of wherever you are looking. Can also use numbers (0-7).
* `sm_ai_holdout <survivor name> [wpn]` - Spawns a normal ai holdout bot (no minigun), with any weapon w/ laser sight (default is ak).
* `sm_ai_remove_far` - Removes any holdout or minigun bots that are 750 units or more from any player.
### L4D2Tools
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
* [Scene Processor](https://forums.alliedmods.net/showthread.php?p=2147410)
* [Modified L4D Survivor Identity Fix](#l4d_survivor_identity_fix)
A collection of small tools:
* Notification of when someone picks up laser sights (only the first user, includes bots),
* Record time it takes for a finale or gauntlet run to be completed.
* Record the amount of friendly fire damage done
* Set the survivor models of any survivor with updated [l4d_survivor_identity_fix](#l4d_survivor_identity_fix)
* Automatically returns melee weapons that an idle bot dropped once no longer idle
* Automatically make players go idle when ping spikes
* Slowly kill any zombies attacking survivor bot's blind spots (Fixes brain dead bots stuck taking damage and not killing them)
* **Convars:**
* `sm_laser_use_notice <0/1>` - Enable notification of when a laser box was used first
* `sm_time_finale <0/1/2>` - Record the time it takes to complete finale. 0 -> OFF, 1 -> Gauntlets Only, 2 -> All finales
* `sm_ff_notice <0/1/2>` - Should we record FF damages? 0: OFF, 1: To chat, 2: To HUD text.
* `sm_autoidle_ping_max <30.0...>` - "The highest ping a player can have until they will automatically go idle.\n0=OFF, Min is 30
* **Commands:**
* `sm_model <player> <character>` - Sets the survivor model of the target player(s). 'character' is name or ID of character.
* `sm_surv <player> <character>` - Sets the m_survivorCharacter prop only of the target player(s). 'character' is name or ID of character.
### l4d2_swarm
This plugin is used to counter trolls and otherwise bad players. It simply uses the new script function RushVictim() to make all zombies in X radius attack Y target. It's that simple.
This really only affects wandering zombies, mobs and panic events, but it may work slightly when bile or pipes are thrown. It does not and can't change the targets of zombies.
* **Convars:**
* `sm_swarm_default_range <20-Infinity>` - The default range for commands & menus. Defaults to 7,500
* **Commands:**
* `sm_swarm [player] [range]` - Swarm a player, or random if none."
* Aliases: `sm_rush`
* `sm_rushmenu` - Opens a menu to quickly rush any player. Can be bound to a key to quickly rush as well
* Aliases: `sm_rmenu`
* `sm_swarmtoggle <player> [range]` - Will continuously run the swarm method on the player at the range. Use the command again or type "disable" for player to disable. Switching players will not disable, just switches target.
* Aliases: `sm_rushtoggle`, `sm_rt`
* `sm_rushtogglemenu` - Will open a menu to quickly select a player to continuously rush.
* Aliases: `sm_rtmenu`
### l4d2_feedthetrolls
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
* (Optional) [Scene Processor](https://forums.alliedmods.net/showthread.php?p=2147410)
* (Optional) [Actions](https://forums.alliedmods.net/showthread.php?t=336374)
* (Optional) [Modified L4D Antirush](#l4d_anti_rush)
This plugin allows you to enact certain troll modes on any player, some are subtle some are less so. Either way, it works great to deal with a rusher, an asshole or even your friends.
See updated list of trolls and their descriptions:
https://admin.jackz.me/docs/ftt
* **Convars:**
* `sm_ftt_autopunish_mode <#>` - (Not used, WIP) Sets the modes that auto punish will activate for. 1 -> Early crescendo activations
* `sm_ftt_autopunish_action <#>` - Which actions will autopunish activate? Add bits together. 0=None, 1=TankMagnet 2=SpecialMagnet 4=Swarm 8=VomitPlayer
* `sm_ftt_autopunish_expires <0...>` - How many minutes (in gameticks) until autopunish trolls are removed. 0 for never.
* **Commands:**
* `sm_fta [player]` - The main command, opens a menu to select a troll to apply, with modifiers and flags
* `sm_ftr [player]` - Removes all active trolls from a player
* `sm_ftc [player]` - Opens a menu to select a combo of trolls
* `sm_ftl` - Lists all players that have a mode applied.
* `sm_ftm` - Lists all troll options & their descriptions
* `sm_mark` - Toggles marking a player to be banned when they fully disconnect
* `sm_insta [player] [special]` - (No arguments opens menu) - Spawns a special via the director that will only target the victim
* `sm_inface [player] [special]` - Identical to above, but special will be spawned as close as possible to survivor. Boomers auto explode, jockeys on their head, etc.
* `sm_bots_attack <player> [target health]` - Slightly broken, but makes all bots shoot at player until they hit X health or a timeout is reached. Turn on `sb_friendlyfire` for it to be effective.
* `sm_stagger <player>` - Makes a player stagger, shortcut to the Stagger troll
* `sm_witch_attack <player>` - Makes all witches agro on the player
* `sm_scharge <player> [timeout seconds]` - Will wait till there's no obstructions and players in the way, then spawns a charger behind them to charge them.
* `sm_healbots <player> [# bots or 0 default]` - Makes n amount of bots chase a player down to heal them. Won't stop until they are healed, they die, or you run command again.
* `sm_csplat <player> <top/front/back> - Shortcut to Car Splat. Spawns car in top/front/back that hits the player`
### l4d2_autobotcrown
Makes any suitable bot (> 40 hp, has shotgun) automatically crown a witch. Supports multiple bots and witches, but only one bot can crown one witch at a time. Plugin is disabled in realism, and is really on suitable for coop or versus. Even works with idle players.
Bots do sometimes miss, but sometimes still manage to kill witch. They also don't care if there is danger in the way (fire, acid, angry witch).
* **Convars:**
* `l4d2_autocrown_allowed_difficulty <default: 7>` - The difficulties the plugin is active on. 1=Easy, 2=Normal 4=Advanced 8=Expert. Add numbers together.
* `l4d2_autocrown_modes_tog <default: 7>` - (Not implemented) - Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together
### l4d2_extraplayeritems
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
* [L4D Info Editor](https://forums.alliedmods.net/showthread.php?p=2614626)
* (Development dependency) Updated l4d2_weapon_stocks.inc
A well rounded tool that provides extra utilities to a 5+ co-op campaign.
Features:
* Automatically giving extra kits for each extra player in saferooms
* Increasing item count for items randomly depending on player count
* Fix same-models survivors having to fight over ammo pack usage
* Automatically lock the first saferoom door for every chapter, until a threshold of players or time has passed
* Includes a HUD that shows all the survivors and their items, and optionally their ping (breaks randomly not sure why)
* Includes a new 5+ special spawning director
* Spawn an extra tank that scales with player count
* **Convars:**
* `epi_item_chance` - The base chance (multiplied by player count) of an extra item being spawned. Default: 0.056
* `epi_kitmode` - Decides how extra kits should be added. Default is 0
* 0 -> Overwrites previous extra kits
* 1 -> Adds onto previous extra kits
* `epi_updateminplayers` - Should the plugin update abm's cvar min_players convar to the player count? (0 no, 1 yes)
* `epi_doorunlock_percent` - The percent of players that need to be loaded in before saferoom door is opened.
* Default is 0.8, set to 0 to disable door locking
* `epi_doorunlock_wait` - How many seconds after to unlock saferoom door. 0 to disable timer
* `epi_doorunlock_open` - Controls when or if the door automatically opens after unlocked. Add bits together.
* 0 = Never, 1 = When timer expires, 2 = When all players loaded in
* `epi_hudstate` - Controls when the extra player hud shows.
* 0 = Never, 1 = When 5+ players, 2 = Always on
* `epi_sp_spawning` - Determines what specials are spawned. Add bits together.
* 1 = Specials, 2 = Witches, 4 = Tanks
* `epi_enabled` - When should epi be enabled?
* 0 = OFF, 1 = Only when 5+ and official map, 2 = Only when 5+, 3 = Always
* `epi_tank_chunkhp` - The amount of health to add to a tank per extra player
* `epi_gamemodes` - Comma separated list of allowed gamemodes.
### l4d_survivor_identity_fix
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
A fork of [Survivor Identity Fix plugin](https://forums.alliedmods.net/showthread.php?t=280539) that adds support for other plugins to update the model cache. This is used by [L4D2Tools](#L4D2Tools) to update the identity when someone changes their model with `sm_model`. It also will clear the memory of model when a player disconnects entirely or on a new map.
In addition, has a fix for the passing finale, and will automatically temporarily change L4D characters to L4D2 until finale starts preventing game messing up their characters.
### l4d2_population_control
Allows you to set the chances that a common spawns as a certain uncommon. The order of the cvars is the order the percentages are ran
* **Convars:**
* `l4d2_population_chance <0.0-1.0>` Default: 1.0, the chance that the code runs on a spawn (basically if 0.0, none of the % chances will run for all types)
* `l4d2_population_clowns <0.0-1.0>` The chance that on a common spawn that the special will be a clown.
* `l4d2_population_mud <0.0-1.0>` The chance that on a common spawn that the special will be a mud common.
* `l4d2_population_ceda <0.0-1.0>` The chance that on a common spawn that the special will be a ceda common.
* `l4d2_population_worker <0.0-1.0>` The chance that on a common spawn that the special will be a worker common.
* `l4d2_population_riot <0.0-1.0>` The chance that on a common spawn that the special will be a riot common.
* `l4d2_population_jimmy <0.0-1.0>` The chance that on a common spawn that the special will be a jimmy common
* `l4d2_population_common <#>` - The maximum amount of commons that can spawn.
* 0 will turn off,
* value > 0 will enforce the exact value
* value < 0 will enforce z_common_limit + | value |
* **Commands:**
* `sm_populations` or `sm_population_list` - Lists all the cvar values
### globalbans
This plugin will store bans in a database and read from it on connect. This allows you to easily have bans global between servers.
It will automatically intercept any ban that calls OnBanIdentity or OnBanClient (so sm_ban will work normally)
Note: All admin players are ignored
* **Convars:**
* `sm_globalbans_kick_type <0/1/2>`
* 0 = Do not kick, just notify
* 1 = Kick if banned
* 2 = Kick if cannot reach database
### l4d2_rollback
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
An idea that you can either manually or have events (friendly fire, new player joining) trigger saving all the player's states. Then if say, a troll comes and kills you and/or incaps your team, you can just quick restore to exactly the point you were at with the same items, health, etc.
Currently **abandoned.**
Currently auto triggers:
1. On any recent friendly fire (only triggers once per 100 game ticks)
2. Any new player joins (only triggers once per 100 game ticks)
* **Commands:**
* `sm_save` - Initiates a manual save of all player's states
* `sm_state` - Lists all the states
* `sm_restore <player(s)>` - Restores the selected player's state. @all for all
### l4d2_autorestart
Plugin that automatically restarts server when the server is NOT hibernating, with bots around and no players.
This fixes an issue with custom maps that force sb_all_bot_game to 1 and disable hibernation.
### l4d2_TKStopper
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
Plugin that prevents team killers by checking multiple criterias. Default system is as:
Any survivor that attacks another survivor
1. If within first 2 minutes of joining, no damage is dealt to either victim or attacker. This prevents the next person to join being punished.
2. If during the finale vehicle arrival, they do 0x damage to victim and take 2x reverse friendly fire
3. If neither #1 or #2, both the victim and the attacker take 1/2 the original damage
4. If victim is in a saferoom, no damage is dealt.
See https://admin.jackz.me/docs/plugins#tkstopper for some more implementation information
During any of the above three conditions, if they deal (or attempt to deal) over 75 HP in 15 seconds (configurable) they will be instantly banned for a set period of time (60 minutes). If they are for sure a team killer, it can be extended to a permanent ban.
* **Cvars:**
* `l4d2_tk_forgiveness_time <#>` - The minimum amount of seconds to pass (in seconds) where a player's previous accumulated FF is forgive. Default is 15s
* `l4d2_tk_bantime` - How long in minutes should a player be banned for? 0 for permanently. Default is 60
* `l4d2_tk_ban_ff_threshold` - How much damage does a player need to do before being instantly banned. Default 75 HP
* `l4d2_tk_ban_join_time` - Upto how many minutes should any new player's FF be ignored. Default is 2 Minutes
### l4d2_crescendo_control
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
This plugin prevents the activation of buttons ahead of the team. It will prevent players from starting crescendos (and some small other activities as a side effect) until a certain threshold of the team has reached the area.
_This plugin is not perfect, sometimes it may trigger early, or not trigger at all depending on the map. Sometimes you need to as admins, move forward to allow non-admins to activate events._
* **Cvars:**
* `l4d2_crescendo_percent`
* `l4d2_crescendo_range`
### l4d2_vocalize_control
A very small plugin that simply allows a player to mute another player's vocalizations only for them.
* **Commands:**
* `sm_vgag <player(s)>` - Vocalize gag or ungags selected player(s) for the command activator only
### l4d2_sb_fix
A fork of https://forums.alliedmods.net/showthread.php?p=2757330
- Updated to latest sourcepawn syntax (now 1.11)
- Fixed some stupid things (all cvars being FCVAR_NOTIFY)
### l4d2_hideandseek
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
* [Scene Processor](https://forums.alliedmods.net/showthread.php?p=2147410)
A sourcemod extenstion of the vscript gamemode (https://steamcommunity.com/sharedfiles/filedetails/?id=2467133506)
- Player blockers, portals, and props to change and control the maps
- Optional climbable infected ladders, and heart beat when seeker nearby
- Some quality of life (winner messages, change seeker mid game, change map time)
- and a lot more
### l4d2_guesswho
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
* [Scene Processor](https://forums.alliedmods.net/showthread.php?p=2147410)
Based off gmod guess who game, find the real players amongst a group of bots.
All logic is written in this plugin, thus is required.
Vscript required for hud & mutation
Gamemode: https://steamcommunity.com/sharedfiles/filedetails/?id=2823719841
Requires l4dtoolz and left4dhooks, and optionally skip intro cutscene
### l4d2_prophunt
Requires:
* [Left4Dhooks](https://forums.alliedmods.net/showthread.php?t=321696)
* [Scene Processor](https://forums.alliedmods.net/showthread.php?p=2147410)
Based off gmod prop hunt, find the real players amongst a group of props.
All logic is written in this plugin, thus is required.
Vscript required for hud & mutation
* Gamemode: https://steamcommunity.com/sharedfiles/filedetails/?id=2850550331
* Demo Map: https://steamcommunity.com/sharedfiles/filedetails/?id=2855027013 (makes most prop_static -> prop_dynamic)
Requires l4dtoolz and left4dhooks, and optionally skip intro cutscene
### l4d2_hats
Lets you hat any entity (has blacklist support), including players. Yeet, place, restore, and more with the hats.
**Be warned, this can cause server crashes.** It's a lot stable now, but some features are disabled by default (reverse hats + visible hats) as they caused too many crashes. Most crashes are caused by hats and ladders, but default settings prevent it.
It also includes an entity editor and invisible wall creator. View the file to see commands and cvars
### sm_namespamblock
If a user changes their name 3 times within 10 seconds, they will be temp banned for 10 minutes.
Requires recompile to change.
* **Commands:**
* `status2` - Shitty name, but shows all non-admin players, sorted by last joined ascending (up top). Shows steamid and the first name they joined the server as
* `sm_status2` - Same command, but allows /status2 in chat
### l4d2_ai_tweaks
Simply, prevents an idle bot (that is a bot for an idle player) from healing another player unless:
1. The target is black and white
2. The player has been idle for over **ALLOW_HEALING_MIN_IDLE_TIME** (a \#define) seconds (default is 3 minutes)
Requires recompile to change.

251
data/ftt_phrases.cfg Normal file
View file

@ -0,0 +1,251 @@
"Phrases"
{
"_Full Message Phrases"
{
"1" "I peed my pants"
"2" "I love peas"
"3" "I sure wish I was a zombie right now"
"4" "mexico menu"
"5" "Admin respect is essential"
"6" "I respect the admins of this server"
"7" "ok"
"8" "I think that you are all awesome"
"9" "You are all doing great!"
"10" "Honestly, I'm jealous of you all"
"11" "Pickles"
"12" "A chair is a piece of furniture with a raised surface supported by legs, commonly used to seat a single person."
"13" "meow"
"14" "honk"
"15" "Chairs are supported most often by four legs, and have a back; however, a chair can have three legs, or can have a different shape."
"16" "It's not admin abuse when the point of being an admin is to abuse"
"17" "Many are called but few are chosen"
"18" "Out of sight, out of mind"
"19" "Thou shalt not kill"
"20" "Life's not all beer and skittles"
"21" "Dollars to doughnuts"
"22" "I'll go to the foot of our stairs"
"23" "I could go for a BBQ bacon burger, and a large order of fries, and an orange soda with no ice, and a piece of hot apple pie."
"24" "I'll have two number 9s, a number 9 large, a number 6 with extra dip, a number 7, two number 45s, one with cheese, and a large soda."
"25" "Lightning Never Strikes The Same Place Twice"
"26" "In peace, vigilance. In war, victory. In death, sacrifice."
"27" "Slotted spoons don't hold much soup"
"28" "Have you ever been on a shrimp boat?"
"29" "I am a pretty pink princess"
"30" "Jimmy crack corn, and I don't care"
"31" "Penquins are practically chickens"
"32" "I don't know about you, but I find fire very dramatic!"
"33" "gabe newell"
"34" "9 years of development"
"35" "nothing worse than a case of the fanny fungus"
"36" "Sometimes, I dream about cheese."
"37" "STRIDER!!!"
"38" "I thought that he was invinsible!"
"39" "Yeah, Canadians are DICKS."
"40" "I ever tell you about the time Keith and I made fireworks?"
"41" "Hey. We need to talk. I've got a proposition that might be mutually advantageous."
"42" "Now, I didn't know shit about chemistry, but Keith figured Gasoline burns, doesn't it?"
"43" "Heh, third-degree burns on 95 percent of his body. Man, people in the next city over were calling to complain about the smell of burning skin"
"44" "Yahoo!"
"45" "I have possibly made an oopsie in my pants"
"46" "DAVY!"
"47" "I hate myself"
"48" "I'm not a fan of you"
"49" "MOMMY!"
"50" "Barry later returns to express his gratitude to Vanessa, breaking the sacred rule that bees are not to communicate with humans."
"51" "Barry becomes a member of the Pollen Jocks, and they fly off to a flower patch. Armed with the pollen of the last flowers,"
"52" "According to all known laws of aviation, there is no way a bee should be able to fly. Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway"
"53" "Barry, I'm going to make it with the power of my mind. With a little help from my friends. See if you can't get them to join in."
"54" "Please exit your residency by 8:59 PM, or we will be forced to take legal"
"55" "Ooh, black and yellow! Let's shake it up a little."
"56" "Yellow, black. Yellow, black. Yellow, black. Yellow, black."
"57" "because bees don't care what humans think is impossible."
"58" "No i wanna help please"
"59" "thankls guy youre super good at the game :)"
"60" "everything french people do is not special."
"61" "i bet rats in nyc cook the food all the time but nobody gives a shit cause theyre not french."
"62" "NOT FAIR! NOT FAIR!"
"63" "wahhhhhhhhhhhhhhh"
"64" "i stuffed shrimp inside of me once"
"65" "I stick fireworks up my ass so when i poop its a real explosion"
"66" "I ordered a hooker online once, she had three legs."
"67" "i like to breastfeed my cat on flights"
"68" "I swear im just above the rest"
"69" "I find it pretty hard to find love"
"70" "Seeing my team sitting back while i deal with the horde"
"71" "I love the dick sucking buisness too"
"72" "Until you finally wake up and realize that i was right"
}
"fuck"
{
"1" "fudge"
"2" "mars bar"
"3" "fiddlestick"
"4" "fiddle"
"5" "ok"
"6" "i love"
}
"shit"
{
"1" "oopsie"
"2" "ok"
"3" "woopsie"
"4" "ope"
}
"nigger"
{
"1" "nice lady"
"2" "friendly person"
"3" "ok"
"4" "honk"
"5" "my mom"
"6" "my dad"
"7" "my brother"
"8" "my sister"
}
"whore"
{
"1" "lady who I respect"
"2" "respectable woman"
"3" "ok"
}
"cunt"
{
"1" "pickle"
"2" "pineapple"
"3" "ok"
}
"bitch"
{
"1" "my dog"
"2" "their dog"
"3" "your dog"
"4" "our dog"
}
"ass"
{
"1" "has"
"2" "caboose"
"3" "fanny pants"
}
"salty"
{
"1" "peppery"
"2" "sweet"
"3" "honey"
}
"dead"
{
"1" "alive"
}
"alive"
{
"1" "dead"
}
"zombie"
{
"1" "shrimp"
"2" "pineapple"
}
"boomer"
{
"1" "hunter"
"2" "smoker"
"3" "jockey"
"4" "charger"
"5" "witch"
"6" "tank"
"7" "spitter"
}
"smoker"
{
"1" "hunter"
"2" "boomer"
"3" "jockey"
"4" "charger"
"5" "witch"
"6" "tank"
"7" "spitter"
}
"hunter"
{
"1" "boomer"
"2" "smoker"
"3" "jockey"
"4" "charger"
"5" "witch"
"6" "tank"
"7" "spitter"
}
"jockey"
{
"1" "hunter"
"2" "smoker"
"3" "boomer"
"4" "charger"
"5" "witch"
"6" "tank"
"7" "spitter"
}
"spitter"
{
"1" "hunter"
"2" "smoker"
"3" "jockey"
"4" "charger"
"5" "witch"
"6" "tank"
"7" "boomer"
}
"charger"
{
"1" "hunter"
"2" "smoker"
"3" "jockey"
"4" "boomer"
"5" "witch"
"6" "tank"
"7" "spitter"
}
"witch"
{
"1" "hunter"
"2" "smoker"
"3" "jockey"
"4" "charger"
"5" "boomer"
"6" "tank"
"7" "spitter"
}
"tank"
{
"1" "hunter"
"2" "smoker"
"3" "jockey"
"4" "charger"
"5" "witch"
"6" "boomer"
"7" "spitter"
}
"dickhead"
{
"1" "poopie"
"2" "quack"
"3" "big brain"
"4" "cactus"
"5" "friend"
"6" "mom"
"7" "mommie"
}
"cock"
{
"1" "foot"
}
"dick"
{
"1" "Canadian"
}
"dicks"
{
"1" "Canadians"
}
}

87
data/guesswho/config.cfg Normal file
View file

@ -0,0 +1,87 @@
"guesswho"
{
"c1m1_hotel"
{
"spawnpoint" "442.905334 5640.576660 2656.031250"
"ents"
{
"FENCE"
{
"origin" "1602.161499 5618.440917 2656.031250"
"rotation" "0.000000 -178.836151 0.000000"
"type" "prop_dynamic"
"model" "props_fortifications\barricade001_128_reference.mdl"
}
"VENDING"
{
"origin" "406.428405 5625.409667 2656.031250"
"rotation" "0.000000 90.238922 0.000000"
"type" "prop_dynamic"
"model" "props\cs_office\vending_machine.mdl"
}
}
}
"c8m5_rooftop"
{
"spawnpoint" "5386.052246 8413.505859 5536.031250"
}
"c2m2_fairgrounds"
{
"spawnpoint" "-3451.616943 -818.726989 128.031250"
"ents"
{
"DROP_BLOCK"
{
"origin" "-3073.630371 -910.963195 192.623626"
"scale" "30 260 100"
}
"ENTRANCE_BLOCK"
{
"origin" "-2826.833251 -1978.528808 -127.915451"
"rotation" "0.000000 -1.978949 0.000000"
"type" "prop_dynamic"
"model" "props_urban\wood_fence001_128.mdl"
}
"ENTRANCE_BLOCK_PROP"
{
"origin" "-2826.833251 -1978.528808 -127.915451"
"scale" "20 100 500"
}
"STAIR_BLOCK_PROP"
{
"origin" "-3241.681884 -1817.223266 256.031250"
"rotation" "0.000000 92.011253 0.000000"
"type" "prop_dynamic"
"model" "props_crates/static_crate_40.mdl"
}
"STAIR_BLOCK"
{
"origin" "-3321.681884 -1817.223266 300.031250"
"scale" "140 20 60"
}
}
}
"c11m4_terminal"
{
"spawnpoint" "3081.824951 4571.367187 152.031250"
"ents"
{
"ENTRANCE_BLOCKER"
{
"origin" "2700.844482 1865.502807 177.313140"
"scale" "200 100 200"
}
"fire"
{
"origin" "2700.844482 1865.502807 179.313140"
"type" "env_fire"
"scale" "1.0 256 8"
}
}
"inputs"
{
"checkpoint_entrance" "Kill"
}
}
}

2083
data/hideandseek.cfg Normal file

File diff suppressed because it is too large Load diff

28
data/prophunt/maps.cfg Normal file
View file

@ -0,0 +1,28 @@
"prophunt"
{
"c1m1_hotel"
{
"props"
{
"SOFA_1"
{
"model" "props_urban/hotel_chair001.mdl"
"origin" "1532.456787 4609 1184"
"rotation" "0 323.5 0"
}
"SOFA_2"
{
"origin" "1649 4529 1184"
"rotation" "0 170 0"
"model" "props_urban/hotel_chair001.mdl"
}
}
}
"c8m1_apartments"
{
"props"
{
}
}
}

23
data/prophunt/props.cfg Normal file
View file

@ -0,0 +1,23 @@
"props"
{
"props/cs_office/Fire_Extinguisher.mdl" "5"
"props_urban/ashtray_stand001.mdl" "5"
"props_furniture/hotel_chair.mdl" "10"
"props_urban/hotel_chair001.mdl" "20"
"props_interiors/tv.mdl" "10"
"props_downtown/ironing_board.mdl" "15"
"props_urban/hotel_lamp001.mdl" "10"
"props_windows/hotel_window_glass001.mdl" "30"
"props/cs_office/shelves_metal1.mdl" "50"
"props/cs_office/shelves_metal.mdl" "50"
"props_downtown/dresser.mdl" "50"
"props_interiors_Hotel_Cart.mdl" "40"
"props_downtown/side_table.mdl" "10"
"props_interiors/ac_wallunit.mdl" "30"
"props_downtown/bed_motel01.mdl" "50"
"props_interiors/coffee_table_oval.mdl" "20"
"props_downtown/mini_fridge.mdl" "10"
"props_interiors/fridge_mini.mdl" "10"
"props/cs_office/vending_machine.mdl" "50"
"props_interiors/toilet.mdl" "30"
}

View file

@ -0,0 +1,26 @@
{
"group1": {
"chance": 0.1,
"exclusions": ["group2"],
"variants": [
{
"weight": 1,
"entities": [
{
"origin": [1421.24, 5780.23, 2881.16],
"angles": [0.00, 0.00, 0.00],
"size": [5.00, 5.00, 5.00],
"model": "models/props/cs_assault/forklift.mdl"
},
{
"origin": [1139.59, 5685.23, 2883.25],
"angles": [0.00, 0.00, 0.00],
"size": [5.00, 5.00, 5.00],
"model": "models/props_unique/airportdeparturescreen01.mdl"
}
]
}
]
}
}

View file

@ -0,0 +1,123 @@
{
"alleyskip": {
"chance": 0.30,
"variants": [
{
"weight": 1,
"entities": [
{
"model": "models/props_urban/fire_escape_wide_lower.mdl",
"origin": [2203.81, 2381.96, 212.84],
"angles": [0.00, 1.07, 0.00],
"size": [181.27, 2.22, 132.22]
},
{
"model": "models/props_vehicles/ambulance.mdl",
"origin": [2317.06, 2282.30, 16.03],
"angles": [0.00, 270.39, 0.00],
"size": [90.09, 115.60, 109.48]
},
{
"model": "models/props/cs_militia/boxes_garage_lower.mdl",
"origin": [2265.46, 2308.65, 124.13],
"angles": [0.00, 92.14, 0.00],
"size": [37.36, 35.15, 65.06]
},
{
"model": "models/props_fortifications/barricade001_128_reference.mdl",
"origin": [2013.47, 2254.53, 15.83],
"angles": [0.00, 178.81, 0.00],
"size": [21.75, 48.25, 144.25]
},
{
"model": "models/props_fortifications/barricade001_64_reference.mdl",
"origin": [2001.55, 2345.92, 15.51],
"angles": [0.00, 177.42, 0.00],
"size": [24.25, 24.25, 144.25]
}
]
}
]
},
"mainblock": {
"chance": 0.5,
"variants": [
{
"weight": 1,
"entities": [
{
"model": "models/props_street/police_barricade2.mdl",
"origin": [2744.79, 3975.41, 16.03],
"angles": [0.00, 105.00, 0.00],
"size": [28.70, 71.14, 119.31]
},
{
"model": "models/props_street/police_barricade_496in.mdl",
"origin": [2428.55, 3960.12, 8.03],
"angles": [0.00, 89.61, 0.00],
"size": [28.77, 245.37, 119.31]
},
{
"model": "models/props_street/police_barricade2.mdl",
"origin": [2120.48, 3963.20, 16.03],
"angles": [0.00, 87.27, 0.00],
"size": [28.70, 71.14, 119.31]
}
]
}
]
},
"subwayblock": {
"chance": 0.2,
"variants": [
{
"entities": [
{
"model": "models/props_vehicles/hmmwv.mdl",
"origin": [2755.60, 4139.53, 12.72],
"angles": [0.00, -180.00, 0.00],
"size": [57.97, 105.86, 124.61]
}
]
},
{
"entities": [
{
"model": "models/props_vehicles/pickup_truck_78.mdl",
"origin": [2755.60, 4139.53, 12.72],
"angles": [0.00, -180.00, 0.00],
"size": [57.97, 105.86, 124.61]
}
]
}
]
},
"doorblock": {
"chance": 0.2,
"variants": [
{
"weight": 2,
"entities": [
{
"model": "models/props_junk/dumpster.mdl",
"origin": [1519.27, 2626.97, 55.79],
"angles": [0.00, -86.23, 90.00],
"size": [26.37, 40.17, 54.13]
}
]
},
{
"weight": 1,
"entities": [
{
"model": "models/props_junk/dumpster.mdl",
"origin": [1498.78, 2630.72, 16.03],
"angles": [0.00, 3.76, 0.00],
"size": [26.37, 40.17, 54.13]
}
]
}
]
}
}

50
data/walls_data.cfg Normal file
View file

@ -0,0 +1,50 @@
"WallData"
{
"Shelter Fence"
{
"sizes"
{
"Small (64u)"
{
"model" "models/props_urban/fence_cover001_64.mdl"
}
"Medium (128u)" "models/props_urban/fence_cover001_128.mdl"
"Large (256u)" "models/props_urban/fence_cover001_256.mdl"
}
}
"Chain Link"
{
"sizes"
{
"Small (64u)" "models/props_urban/fence001_64.mdl"
"Medium (128u)" "models/props_urban/fence002_128.mdl"
"Large (256u)" "models/props_urban/fence002_256.mdl"
}
}
"Crash Barrier"
{
"sizes"
{
"Small" "models/props_fortifications/concrete_barrier01.mdl"
"Medium (96u)" "models/props_fortifications/concrete_barrier001_96_reference.mdl"
"Large (128u)" "models/props_fortifications/concrete_barrier001_128_reference.mdl"
}
}
"Sandbags"
{
"sizes"
{
"Normal (6l)" "models/props_fortifications/sandbags_line2.mdl"
"Corner (4l)" "models/props_fortifications/sandbags_corner3.mdl"
"Large (6l)" "models/props_fortifications/sandbags_corner2.mdl"
}
}
"Wooden Wall"
{
"sizes"
{
"Medium (128u)" "models/props_update/wood_128.mdl"
"Large (128u)" "models/props_update/wood_256.mdl"
}
}
}

View file

@ -0,0 +1,16 @@
"Games"
{
"left4dead2"
{
"Signatures"
{
"WitchAttack::WitchAttack"
{
/* 55 8B EC 53 56 8B F1 C7 46 04 ? ? ? ? C7 46 2C 01 00 00 00 33 DB 33 C0 89 46 20 33 C9 89 4E 24 57 33 D2 89 56 28 33 FF 89 5E 0C 89 5E 10 89 5E 14 89 5E 18 89 5E 1C 89 5E 08 66 89 5E 30 89 7E 2C C7 06 ? ? ? ? C7 46 04 ? ? ? ? 53 */
"windows" "\x55\x8B\xEC\x53\x56\x8B\xF1\xC7\x46\x04\x2A\x2A\x2A\x2A\xC7\x46\x2C\x01\x00\x00\x00\x33\xDB\x33\xC0\x89\x46\x20\x33\xC9\x89\x4E\x24\x57\x33\xD2\x89\x56\x28\x33\xFF\x89\x5E\x0C\x89\x5E\x10\x89\x5E\x14\x89\x5E\x18\x89\x5E\x1C\x89\x5E\x08\x66\x89\x5E\x30\x89\x7E\x2C\xC7\x06\x2A\x2A\x2A\x2A\xC7\x46\x04\x2A\x2A\x2A\x2A\x53"
"linux" "@_ZN11WitchAttackC2EP11CBaseEntity"
}
}
}
}

31
gamedata/l4d2_turret.txt Normal file
View file

@ -0,0 +1,31 @@
"Games"
{
"left4dead2"
{
"Offsets"
{
"CBaseAnimating::StudioHdr"
{
"linux" "68"
}
}
"Signatures"
{
"CBaseAnimating::LookupPoseParameter"
{
"library" "server"
"linux" "@_ZN14CBaseAnimating19LookupPoseParameterEP10CStudioHdrPKc"
}
"ModelSoundsCache_LoadModel"
{
"library" "server"
"linux" "@_Z26ModelSoundsCache_LoadModelPKc"
}
"ModelSoundsCache_FinishModel"
{
"library" "server"
"linux" "@_Z28ModelSoundsCache_FinishModelP10CStudioHdr"
}
}
}
}

58
gamedata/l4d2tools.txt Normal file
View file

@ -0,0 +1,58 @@
"Games" {
"#default" {
"Offsets" {
"OS" { // Thank you Sammy-ROCK!
"windows" "1"
"linux" "0"
}
}
}
// Big thanks to cravenge and Spirit_12 on AlliedModders for being awesome :D
"left4dead2" {
"Signatures" {
"State_Transition" {
"library" "server"
"linux" "@_ZN9CCSPlayer16State_TransitionE13CSPlayerState"
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x8B\x86\x2A\x2A\x2A\x2A\x57\x8B\x7D\x2A\x85\xC0\x74\x2A\x83"
/* 55 8B EC 56 8B F1 8B 86 ? ? ? ? 57 8B 7D ? 85 C0 74 ? 83 */
}
"TakeOverZombieBot" {
"library" "server"
"linux" "@_ZN13CTerrorPlayer17TakeOverZombieBotEPS_"
"windows" "\x55\x8B\xEC\x81\xEC\x2A\x2A\x2A\x2A\xA1\xD8\x2A\x2A\x2A\x33\xC5\x89\x45\x2A\x53\x8B\x5D\x2A\x80"
/* 55 8B EC 81 EC ? ? ? ? ? D8 ? ? ? 33 C5 89 45 ? 53 8B 5D ? 80 */
}
"RoundRespawn" {
"library" "server"
"linux" "@_ZN13CTerrorPlayer12RoundRespawnEv"
"windows" "\x56\x8B\xF1\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x84\xC0\x75"
/* 56 8B F1 E8 ? ? ? ? E8 ? ? ? ? 84 C0 75 */
}
"SetHumanSpec" {
"library" "server"
"linux" "@_ZN11SurvivorBot17SetHumanSpectatorEP13CTerrorPlayer"
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x83\xBE\x2A\x2A\x2A\x2A\x00\x7E\x07\x32\xC0\x5E\x5D\xC2\x04\x00\x8B\x0D"
/* 55 8B EC 56 8B F1 83 BE ? ? ? ? 00 7E 07 32 C0 5E 5D C2 04 00 8B 0D */
}
"TakeOverBot" {
"library" "server"
"linux" "@_ZN13CTerrorPlayer11TakeOverBotEb"
"windows" "\x55\x8B\xEC\x81\xEC\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\xC5\x89\x45\xFC\x53\x56\x8D\x85"
/* 55 8B EC 81 EC ? ? ? ? A1 ? ? ? ? 33 C5 89 45 FC 53 56 8D 85 */
}
"GoAwayFromKeyboard"
{
"library" "server"
"linux" "@_ZN13CTerrorPlayer18GoAwayFromKeyboardEv"
"windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x53\x56\x57\x8B\xF1\x8B\x06\x8B\x90\xC8\x08\x00\x00"
/* ? ? ? ? ? ? 53 56 57 8B F1 8B 06 8B 90 C8 08 00 00 */
}
}
}
}

Binary file not shown.

BIN
plugins/AutoWarpBot.smx Normal file

Binary file not shown.

Binary file not shown.

BIN
plugins/Block3Person.smx Normal file

Binary file not shown.

BIN
plugins/BumpMineGiver.smx Normal file

Binary file not shown.

BIN
plugins/CSGOTroll.smx Normal file

Binary file not shown.

BIN
plugins/GrabEnt.smx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugins/L4D2Template.smx Normal file

Binary file not shown.

BIN
plugins/L4D2Tools.smx Normal file

Binary file not shown.

BIN
plugins/abm.smx Normal file

Binary file not shown.

BIN
plugins/activitymonitor.smx Normal file

Binary file not shown.

BIN
plugins/adminpanel.smx Normal file

Binary file not shown.

BIN
plugins/basechat.smx Normal file

Binary file not shown.

BIN
plugins/csgo-knifehp.smx Normal file

Binary file not shown.

BIN
plugins/csgo-misc.smx Normal file

Binary file not shown.

BIN
plugins/globalbans.smx Normal file

Binary file not shown.

BIN
plugins/jutils.smx Normal file

Binary file not shown.

BIN
plugins/l4d2-info-cmd.smx Normal file

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d2_TKStopper.smx Normal file

Binary file not shown.

BIN
plugins/l4d2_ai_minigun.smx Normal file

Binary file not shown.

BIN
plugins/l4d2_ai_tweaks.smx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d2_baseball.smx Normal file

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d2_detections.smx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d2_forceset.smx Normal file

Binary file not shown.

BIN
plugins/l4d2_guesswho.smx Normal file

Binary file not shown.

BIN
plugins/l4d2_hats.smx Normal file

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d2_perms.smx Normal file

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d2_prophunt.smx Normal file

Binary file not shown.

BIN
plugins/l4d2_randomizer.smx Normal file

Binary file not shown.

BIN
plugins/l4d2_rollback.smx Normal file

Binary file not shown.

BIN
plugins/l4d2_sb_fix.smx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d2_swarm.smx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d2_turret.smx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugins/l4d_anti_rush.smx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
plugins/left4dhooks.smx Normal file

Binary file not shown.

BIN
plugins/misc.smx Normal file

Binary file not shown.

BIN
plugins/sceneprocessor.smx Normal file

Binary file not shown.

Binary file not shown.

BIN
plugins/sm_player_notes.smx Normal file

Binary file not shown.

Binary file not shown.

BIN
plugins/spray_control.smx Normal file

Binary file not shown.

View file

@ -0,0 +1,202 @@
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.5"
#pragma newdecls required
#define MAX_TANK_DISTANCE_FROM_SURVIVOR 1000
#define MAX_TANK_DIST_SQUARED MAX_TANK_DISTANCE_FROM_SURVIVOR^2
//#define DEBUG
static bool bEscapeReady = false;
static int iAliveTanks;
static bool bIsTank[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "Fly You Fools",
author = "ConnerRia & Jackzmc",
description = "Survivor bots will retreat from tank. Improved version.",
version = PLUGIN_VERSION,
url = "N/A"
}
public void OnPluginStart()
{
EngineVersion g_Game = GetEngineVersion();
if(g_Game != Engine_Left4Dead && g_Game != Engine_Left4Dead2)
{
SetFailState("Plugin supports Left 4 Dead series only.");
}
CreateConVar("FlyYouFools_Version", PLUGIN_VERSION, "FlyYouFools Version", FCVAR_NOTIFY|FCVAR_REPLICATED|FCVAR_DONTRECORD);
HookEvent("map_transition", Event_RoundStart, EventHookMode_PostNoCopy);
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
HookEvent("tank_spawn", Event_TankSpawn);
HookEvent("tank_killed", Event_TankDeath);
HookEvent("finale_vehicle_incoming", Event_FinaleArriving, EventHookMode_PostNoCopy);
}
public void OnMapStart() {
resetPlugin();
}
public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) {
resetPlugin();
}
public void Event_TankSpawn(Event event, const char[] name, bool dontBroadcast) {
int userID = GetClientOfUserId(GetEventInt(event, "userid"));
bIsTank[userID] = true;
if(iAliveTanks == 0 && !bEscapeReady) {
CreateTimer(0.1, BotControlTimerV2, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
iAliveTanks++;
}
public void Event_TankDeath(Event event, const char[] name, bool dontBroadcast) {
int userID = GetClientOfUserId(GetEventInt(event, "userid"));
bIsTank[userID] = false;
iAliveTanks--;
}
public void Event_FinaleArriving(Event event, const char[] name, bool dontBroadcast) {
bEscapeReady = true;
}
/*
CommandABot:
0 -> ATTACK
1 -> MOVETO
2 -> RUN AWAY
3 -> RESET
New logic overview:
1. Loop all valid survivors
2. Loop all tanks per survivor
3. Find the closest tank
4. Retreat if in close range (~300 units)
*/
Action BotControlTimerV2(Handle timer)
{
//remove timer once tanks no longer exists/are all dead or finale escape vehicle arrived
if(bEscapeReady || iAliveTanks == 0) {
//Check if there is any existing bots, if escape NOT ready
if(!bEscapeReady) FindExistingTank();
return Plugin_Stop;
}
if(iAliveTanks == 0 || GetClientCount(true) == 0) return Plugin_Continue;
int botHealth, closestTank, tank_target;
float BotPosition[3], TankPosition[3], smallestDistance, distanceFromSurvivor;
//Loop all players, finding survivors. (survivor team, bots, not tank.)
for (int i = 1; i <= MaxClients; i++) {
if (IsClientInGame(i) && IsPlayerAlive(i) && IsFakeClient(i) && !bIsTank[i] && GetClientTeam(i) == 2) {
//Grab health of bot and current position
botHealth = GetClientHealth(i);
GetClientAbsOrigin(i, BotPosition);
smallestDistance = 0.0;
closestTank = -1;
//Loop all players, finding tanks (alive, bot, tank)
for(int tankID = 1; tankID <= MaxClients; tankID++) {
if (IsClientInGame(tankID) && IsPlayerAlive(tankID) && IsFakeClient(tankID) && bIsTank[tankID]) {
//Check if tank has a target. tank_target will be -1 if not activated
tank_target = GetEntPropEnt(tankID, Prop_Send, "m_lookatPlayer", 0);
if(tank_target > -1) {
//Fetch the tank's position
GetClientAbsOrigin(tankID, TankPosition);
//Get distance to survivor, and compare to get closest tank
distanceFromSurvivor = GetVectorDistance(BotPosition, TankPosition, true);
if(distanceFromSurvivor <= MAX_TANK_DIST_SQUARED && smallestDistance > distanceFromSurvivor || smallestDistance == 0.0) {
smallestDistance = distanceFromSurvivor;
closestTank = tankID;
}
}
}
}
//If the closest tank exists (-1 means no tank.) and is close, avoid.
if(closestTank > -1 && smallestDistance <= 300 && botHealth >= 40) {
//L4D2_RunScript("CommandABot({cmd=3,bot=GetPlayerFromUserID(%i)})", GetClientUserId(i));
L4D2_RunScript("CommandABot({cmd=2,bot=GetPlayerFromUserID(%i),target=GetPlayerFromUserID(%i)})", GetClientUserId(i), GetClientUserId(closestTank));
}
}
}
return Plugin_Continue;
}
void resetPlugin() {
bEscapeReady = false;
iAliveTanks = 0;
FindExistingTank();
}
void FindExistingTank() {
//Loop all valid clients, check if they a BOT and an infected. Check for a name that contains "Tank"
iAliveTanks = 0;
char name[16];
for (int i = 1; i < MaxClients+1 ;i++) {
if(IsClientInGame(i) && IsFakeClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3) {
GetClientName(i, name, sizeof(name));
if(StrContains(name, "Tank", true) > -1) {
bIsTank[i] = true;
//PrintToServer("Found existing tank: %N (%i)", i, i);
iAliveTanks++;
continue;
}
}
bIsTank[i] = false;
}
if(iAliveTanks > 0) {
CreateTimer(0.1, BotControlTimerV2, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
}
//Credits to Timocop for the stock :D
/**
* Runs a single line of vscript code.
* NOTE: Dont use the "script" console command, it starts a new instance and leaks memory. Use this instead!
*
* @param sCode The code to run.
* @noreturn
*/
stock void L4D2_RunScript(const char[] sCode, any ...) {
static int iScriptLogic = INVALID_ENT_REFERENCE;
if(iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic)) {
iScriptLogic = EntIndexToEntRef(CreateEntityByName("logic_script"));
if(iScriptLogic == INVALID_ENT_REFERENCE|| !IsValidEntity(iScriptLogic))
SetFailState("Could not create 'logic_script'");
DispatchSpawn(iScriptLogic);
}
static char sBuffer[512];
VFormat(sBuffer, sizeof(sBuffer), sCode, 2);
SetVariantString(sBuffer);
AcceptEntityInput(iScriptLogic, "RunScriptCode");
}
/**
* Get the classname of an item in a slot
*
* @param client The client to check inventory from
* @param slot The item slot index
* @param buffer The char[] buffer to set text to
* @param bufferSize The size of the buffer
* @return True if item, false if no item
*/
stock bool GetItemSlotClassName(int client, int slot, char[] buffer, int bufferSize) {
int item = GetPlayerWeaponSlot(client, slot);
if(item > -1) {
GetEdictClassname(item, buffer, bufferSize);
return true;
}else{
return false;
}
}

81
scripting/AutoWarpBot.sp Normal file
View file

@ -0,0 +1,81 @@
#pragma semicolon 1
#pragma newdecls required
#define DEBUG
#define PLUGIN_NAME "L4D2 Auto Warp Survivors"
#define PLUGIN_DESCRIPTION ""
#define PLUGIN_AUTHOR "jackzmc"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_URL ""
#include <sourcemod>
#include <sdktools>
//#include <sdkhooks>
#pragma newdecls required
public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
description = PLUGIN_DESCRIPTION,
version = PLUGIN_VERSION,
url = PLUGIN_URL
};
ConVar g_EnteredCheckpoint;
public void OnPluginStart()
{
EngineVersion g_Game = GetEngineVersion();
if(g_Game != Engine_Left4Dead && g_Game != Engine_Left4Dead2)
{
SetFailState("This plugin is for L4D/L4D2 only.");
}
HookEvent("player_entered_checkpoint", Event_PlayerEnteredCheckpoint);
HookEvent("player_left_start_area",Event_RoundStart);
g_EnteredCheckpoint = CreateConVar("awb_status", "0", "Get status of plugin", FCVAR_SPONLY | FCVAR_DONTRECORD, true, 0.0, true, 1.0);
}
public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) {
if(g_EnteredCheckpoint.BoolValue) g_EnteredCheckpoint.BoolValue = false;
}
public void Event_PlayerEnteredCheckpoint(Event event, const char[] name, bool dontBroadcast) {
PrintToChatAll("boolvalue %d | client %d", g_EnteredCheckpoint.BoolValue, GetClientOfUserId(event.GetInt("userid")));
if(!g_EnteredCheckpoint.BoolValue) {
int client = GetClientOfUserId(event.GetInt("userid"));
bool playersLeft = false;
for (int i = 1; i < MaxClients;i++) {
if (client == i) continue;
if (!IsClientInGame(i)) continue;
if (GetClientTeam(i) != 2) continue;
PrintToChatAll("playersLeft: %d . clientr %d", playersLeft, i);
if(!IsFakeClient(i)) {
playersLeft = true;
break;
}
}
if(!playersLeft) {
g_EnteredCheckpoint.BoolValue = true;
CheatCommand(client,"warp_all_survivors_to_checkpoint","","");
}
}
}
stock bool IsPlayerIncapped(int client)
{
if (GetEntProp(client, Prop_Send, "m_isIncapacitated", 1)) return true;
return false;
}
stock void CheatCommand(int client, char[] command, char[] argument1, char[] argument2)
{
int userFlags = GetUserFlagBits(client);
SetUserFlagBits(client, ADMFLAG_ROOT);
int flags = GetCommandFlags(command);
SetCommandFlags(command, flags & ~FCVAR_CHEAT);
FakeClientCommand(client, "%s %s %s", command, argument1, argument2);
SetCommandFlags(command, flags);
SetUserFlagBits(client, userFlags);
}

View file

@ -0,0 +1,126 @@
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_NAME "Better Witch Avoidance"
#define PLUGIN_DESCRIPTION "Makes bots avoid witches better"
#define PLUGIN_AUTHOR "jackzmc"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_URL ""
#include <sourcemod>
#include <sdktools>
//#include <sdkhooks>
public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
description = PLUGIN_DESCRIPTION,
version = PLUGIN_VERSION,
url = PLUGIN_URL
};
static int iWitchEntity = -1;
public void OnPluginStart()
{
EngineVersion g_Game = GetEngineVersion();
if(g_Game != Engine_Left4Dead && g_Game != Engine_Left4Dead2)
{
SetFailState("This plugin is for L4D/L4D2 only.");
}
HookEvent("witch_spawn", Event_WitchSpawn);
HookEvent("witch_killed", Event_WitchKilled, EventHookMode_PostNoCopy);
//todo: existing witch find
//m_rage
}
public void Event_WitchSpawn(Event event, const char[] name, bool dontBroadcast) {
iWitchEntity = GetEventInt(event, "witchid");
CreateTimer(0.1, BotControlTimer, _, TIMER_REPEAT);
}
public void Event_WitchKilled(Event event, const char[] name, bool dontBroadcast) {
iWitchEntity = -1;
}
public Action BotControlTimer(Handle timer)
{
//remove timer once witch is dead
if(iWitchEntity == -1 || !IsValidEntity(iWitchEntity)) {
//incase any other witches are available
//FindExistingWitch();
return Plugin_Stop;
}
if(HasEntProp(iWitchEntity,Prop_Send,"m_rage")) {
float witch_anger = GetEntPropFloat(iWitchEntity, Prop_Send, "m_rage", 0);
if(FloatCompare(witch_anger,0.4) == 1) {
float WitchPosition[3];
GetEntPropVector(iWitchEntity, Prop_Send, "m_vecOrigin", WitchPosition);
for (int i = 1; i < MaxClients; i++) {
if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2 && IsFakeClient(i)) {
float BotPosition[3];
GetClientAbsOrigin(i, BotPosition);
float distance = GetVectorDistance(BotPosition, WitchPosition);
if(distance <= 120 || (FloatCompare(witch_anger,0.6) == 1 && distance <= 220)) {
L4D2_RunScript("CommandABot({cmd=2,bot=GetPlayerFromUserID(%i),target=EntIndexToHScript(%d)})", GetClientUserId(i), iWitchEntity);
}
}
}
}
}
return Plugin_Handled;
}
public void FindExistingWitch() {
for (int i = MaxClients + 1; i < GetMaxEntities(); i++) {
if(IsValidEntity(i)) {
char name[16];
GetEntityClassname(i, name, sizeof(name));
if(StrContains(name,"Witch",true) > -1) {
PrintToServer("Found existing witch with id %d", i);
iWitchEntity = i;
CreateTimer(0.1, BotControlTimer, _, TIMER_REPEAT);
break;
}
}
}
}
//Credits to Timocop for the stock :D
/**
* Runs a single line of vscript code.
* NOTE: Dont use the "script" console command, it starts a new instance and leaks memory. Use this instead!
*
* @param sCode The code to run.
* @noreturn
*/
stock void L4D2_RunScript(const char[] sCode, any ...) {
static int iScriptLogic = INVALID_ENT_REFERENCE;
if(iScriptLogic == INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic)) {
iScriptLogic = EntIndexToEntRef(CreateEntityByName("logic_script"));
if(iScriptLogic == INVALID_ENT_REFERENCE|| !IsValidEntity(iScriptLogic))
SetFailState("Could not create 'logic_script'");
DispatchSpawn(iScriptLogic);
}
static char sBuffer[512];
VFormat(sBuffer, sizeof(sBuffer), sCode, 2);
SetVariantString(sBuffer);
AcceptEntityInput(iScriptLogic, "RunScriptCode");
}
stock void ShowHintToAll(const char[] format, any ...) {
char buffer[254];
VFormat(buffer, sizeof(buffer), format, 2);
static int hintInt = 0;
if(hintInt >= 9) {
PrintHintTextToAll("%s",buffer);
hintInt = 0;
}
hintInt++;
}

123
scripting/Block3Person.sp Normal file
View file

@ -0,0 +1,123 @@
#define PLUGIN_VERSION "1.1"
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
public Plugin myinfo =
{
name = "Block3person",
author = "Dragokas",
description = "Block 3-rd person view by creating blindness",
version = PLUGIN_VERSION,
url = "https://github.com/dragokas"
}
bool aBlinded[MAXPLAYERS];
UserMsg g_FadeUserMsgId;
static const int BLIND_DURATION = 50;
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
char sGameName[12];
GetGameFolderName(sGameName, sizeof(sGameName));
if( strcmp(sGameName, "left4dead", false) )
{
strcopy(error, err_max, "Plugin only supports Left 4 Dead 1.");
return APLRes_SilentFailure;
}
g_FadeUserMsgId = GetUserMessageId("Fade");
if (g_FadeUserMsgId == INVALID_MESSAGE_ID) {
strcopy(error, err_max, "Cannot find Fade user message ID.");
return APLRes_SilentFailure;
}
return APLRes_Success;
}
public void OnPluginStart()
{
LoadTranslations("Block3Person.phrases");
HookEvent("round_start", OnRoundStart, EventHookMode_PostNoCopy);
}
public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast)
{
CreateTimer(0.9, Timer_CheckClientViewState, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
return Plugin_Continue;
}
public Action Timer_CheckClientViewState(Handle timer)
{
for (int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && GetClientTeam(i) == 2 && !IsFakeClient(i) && IsPlayerAlive(i))
QueryClientConVar(i, "c_thirdpersonshoulder", QueryClientConVarCallback);
}
return Plugin_Continue;
}
public void QueryClientConVarCallback(QueryCookie cookie, int client, ConVarQueryResult result, const char[] sCvarName, const char[] bCvarValue)
{
if (StringToInt(bCvarValue) != 0) {
if (!aBlinded[client]) {
aBlinded[client] = true;
BlindClient(client, true);
PrintHintText(client, "%t", "Blind_Warning");
}
} else {
if (aBlinded[client]) {
aBlinded[client] = false;
PrintHintText(client, "%t", "Unblind_tip");
BlindClient(client, false);
}
}
}
void BlindClient(int target, bool bDoBlind = true)
{
int targets[2];
targets[0] = target;
int holdtime;
int flags;
if (!bDoBlind)
{
flags = (0x0001 | 0x0010);
holdtime = 10000;
}
else
{
flags = (0x0002 | 0x0008);
holdtime = 10;
}
int color[4] = { 0, 0, 0, 0 };
color[3] = 255;
Handle message = StartMessageEx(g_FadeUserMsgId, targets, 1);
if (GetUserMessageType() == UM_Protobuf)
{
Protobuf pb = UserMessageToProtobuf(message);
pb.SetInt("duration", BLIND_DURATION);
pb.SetInt("hold_time", holdtime);
pb.SetInt("flags", flags);
pb.SetColor("clr", color);
}
else
{
BfWrite bf = UserMessageToBfWrite(message);
bf.WriteShort(BLIND_DURATION);
bf.WriteShort(holdtime);
bf.WriteShort(flags);
bf.WriteByte(color[0]);
bf.WriteByte(color[1]);
bf.WriteByte(color[2]);
bf.WriteByte(color[3]);
}
EndMessage();
}

114
scripting/BumpMineGiver.sp Normal file
View file

@ -0,0 +1,114 @@
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"
#include <sourcemod>
#include <sdktools>
#include <cstrike>
//#include <sdkhooks>
#pragma newdecls required
ConVar g_bmgTTeam, g_bmgEnabled, g_bmgCmdLimit;
int g_bmgBumpsGiven[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "BumpMineGiver",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
EngineVersion g_Game = GetEngineVersion();
if(g_Game != Engine_CSGO && g_Game != Engine_CSS)
{
SetFailState("This plugin is for CSGO/CSS only.");
}
g_bmgEnabled = CreateConVar("bmg_enabled", "1", "Should BumpMineGiver be enabled?", FCVAR_NONE, true, 0.0, true, 1.0);
g_bmgTTeam = CreateConVar("bmg_restrict_team", "0", "Should BumpMineGiver be restricted to a team? 0 - All, 1 - Terrorists, 2 - CounterTerrorists", FCVAR_NONE, true, 0.0, true, 3.0);
g_bmgCmdLimit = CreateConVar("bmg_cmdlimit", "0", "Limit of amount of bumpmines to be given with !bmp. 0: Disabled, -1: Infinity", FCVAR_NONE);
HookEvent("round_start", Event_RoundStart);
HookEvent("player_spawn", Event_PlayerSpawn);
RegConsoleCmd("sm_bmp", Command_GiveBMP, "Give yourself a bump mine");
RegConsoleCmd("sm_bmg", Command_GiveBMP, "Give yourself a bump mine");
RegAdminCmd("sm_givebmp", Command_GiveOthersBMP, ADMFLAG_CHEATS, "Give someone x amount of bump mines. Usage: sm_givebmp <user>");
AutoExecConfig();
}
public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) {
for (int i = 0; i < sizeof(g_bmgBumpsGiven); i++) {
g_bmgBumpsGiven[i] = 0;
}
}
public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) {
if(g_bmgEnabled.BoolValue) {
int client = GetClientOfUserId(event.GetInt("userid"));
int wpn_id = GetPlayerWeaponSlot(client, 4);
int team = GetClientTeam(client);
if(g_bmgTTeam.IntValue > 0) { //1 or 2
if (team != g_bmgTTeam.IntValue) return;
}
if(wpn_id == -1) {
GivePlayerItem(client, "weapon_bumpmine");
}
}
}
public Action Command_GiveBMP(int client, int args) {
if(g_bmgCmdLimit.IntValue == 0) {
ReplyToCommand(client, "You have hit the limit of bumpmines");
return Plugin_Handled;
}
//limit is enabled, check
if(g_bmgCmdLimit.IntValue > 0) {
if(g_bmgBumpsGiven[client] > g_bmgCmdLimit.IntValue) {
ReplyToCommand(client, "You have hit the limit of bumpmines");
return Plugin_Handled;
}
}
GivePlayerItem(client, "weapon_bumpmine");
g_bmgBumpsGiven[client]++;
return Plugin_Handled;
}
public Action Command_GiveOthersBMP(int client, int args) {
if(args < 1) {
ReplyToCommand(client, "Usage: sm_givebmp <user>");
}else{
char arg1[32];
GetCmdArg(1, arg1, sizeof(arg1));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++)
{
GivePlayerItem(target_list[i], "weapon_bumpmine");
LogAction(client, target_list[i], "\"%L\" gave \"%L\" a bumpmine", client, target_list[i]);
}
}
return Plugin_Handled;
}

112
scripting/CSGOTroll.sp Normal file
View file

@ -0,0 +1,112 @@
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>
EngineVersion g_Game;
ConVar hTrollEnableState, hShotFailPercentage, hTrollTargets, hGunType;
bool TrollTargets[MAXPLAYERS+1], lateLoaded;
public Plugin myinfo =
{
name = "",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = ""
};
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) {
if(late) {
lateLoaded = true;
}
}
public OnPluginStart()
{
g_Game = GetEngineVersion();
if(g_Game != Engine_CSGO && g_Game != Engine_CSS)
{
SetFailState("This plugin is for CSGO/CSS only.");
}
//convars
hTrollEnableState = CreateConVar("troll_enable", "1.0", "Enable troll. 0 -> OFF, 1 -> Shots", FCVAR_NONE, true, 0.0, true, 1.0);
hShotFailPercentage = CreateConVar("troll_shot_fail_percentage", "0.4", "The percentage that the troll acts (shots fail). float 0-1", FCVAR_NONE, true, 0.0, true, 1.0);
hTrollTargets = CreateConVar("troll_targets", "", "comma seperated list of steamid64 targets (ex: STEAM_0:0:75141700)", FCVAR_NONE);
hGunType = CreateConVar("troll_shot_mode", "0", "0 -> ALL Weapons, 1 -> AWP", FCVAR_NONE, true, 0.0, true, 1.0);
if(lateLoaded) FindExistingVictims();
}
public void OnClientAuthorized(int client, const char[] auth) {
if(hTrollEnableState.IntValue > 0) {
if(StrContains(auth, "BOT", true) == -1) {
TestForTrollUser(client, auth);
}
}
}
public void OnClientPutInServer(int client) {
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public OnClientDisconnect(int client) {
TrollTargets[client] = false;
}
public void FindExistingVictims() {
for(int i = 1; i <= MaxClients; i++) {
if(IsClientInGame(i) && IsClientAuthorized(i)) {
if(!IsFakeClient(i)) {
char auth[64];
GetClientAuthId(i, AuthId_Steam2, auth, sizeof(auth));
TestForTrollUser(i, auth);
}
SDKHook(i, SDKHook_OnTakeDamage, OnTakeDamage);
}
}
}
public bool TestForTrollUser(int client, const char[] auth) {
char targets[32][8];
char raw_targets[64];
hTrollTargets.GetString(raw_targets, sizeof(raw_targets));
ExplodeString(raw_targets, ",", targets, 8, 32, false);
for(int i = 0; i < 8; i++) {
if(StrEqual(targets[i], auth, true)) {
PrintToServer("Troll victim detected with id %d and steamid %s", client, auth);
TrollTargets[client] = true;
return true;
}
}
return false;
}
public Action OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3]) {
if(hTrollEnableState.IntValue == 1) {
if(TrollTargets[attacker]) {
bool try_failure = false;
char weapon_name[64];
GetClientWeapon(victim, weapon_name, sizeof(weapon_name));
if(hGunType.IntValue == 0) {
try_failure = true;
}else{
if(StrEqual(weapon_name, "weapon_awp", true)) {
try_failure = true;
}
}
float random_float = GetURandomFloat();
if(try_failure) {
if(FloatCompare(random_float, hShotFailPercentage.FloatValue) == -1) {
damage = 0.0;
return Plugin_Handled;
}
}
}
}
return Plugin_Continue;
}

594
scripting/GrabEnt.sp Normal file
View file

@ -0,0 +1,594 @@
#define DEBUG
#define PLUGIN_AUTHOR "Stugger"
#define PLUGIN_VERSION "2.2"
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <smlib/effects>
public Plugin myinfo =
{
name = "GrabEnt",
author = PLUGIN_AUTHOR,
description = "Grab then Move, Push/Pull or Rotate the entity you're looking at until released",
version = PLUGIN_VERSION,
url = ""
};
int g_pGrabbedEnt[MAXPLAYERS + 1];
int g_eRotationAxis[MAXPLAYERS + 1] = { -1, ... };
int g_eOriginalColor[MAXPLAYERS + 1][4];
float g_pLastButtonPress[MAXPLAYERS + 1];
float g_fGrabOffset[MAXPLAYERS + 1][3];
float g_fGrabDistance[MAXPLAYERS + 1];
MoveType g_pLastMoveType[MAXPLAYERS + 1];
bool g_pInRotationMode[MAXPLAYERS + 1];
bool g_eReleaseFreeze[MAXPLAYERS + 1] = { true, ... };
bool g_bHighlightEntity[MAXPLAYERS+1];
Handle g_eGrabTimer[MAXPLAYERS+1];
int g_BeamSprite;
int g_HaloSprite;
int g_iLaserIndex;
#define MAX_FORBIDDEN_CLASSNAMES 9
static char FORBIDDEN_CLASSNAMES[MAX_FORBIDDEN_CLASSNAMES][] = {
// "env_physics_blocker",
// "env_player_blocker",
"func_brush",
"func_simpleladder",
"func_button",
"func_elevator",
"func_button_timed",
"func_movelinear",
"func_tracktrain",
// "infected",
"func_lod",
"prop_ragdoll"
};
#define MAX_FORBIDDEN_MODELS 1
char FORBIDDEN_MODELS[MAX_FORBIDDEN_MODELS][] = {
"models/props_vehicles/c130.mdl",
};
#define MAX_HIGHLIGHTED_CLASSNAMES 3
static char HIGHLIGHTED_CLASSNAMES[MAX_HIGHLIGHTED_CLASSNAMES][] = {
"env_physics_blocker",
"env_player_blocker",
"func_brush"
}
public void OnPluginStart()
{
RegAdminCmd("sm_grabent_freeze", Cmd_ReleaseFreeze, ADMFLAG_CHEATS, "<0/1> - Toggle entity freeze/unfreeze on release.");
RegAdminCmd("sm_grab", Cmd_Grab, ADMFLAG_CHEATS, "Toggle Grab the entity in your crosshair.");
RegAdminCmd("+grabent", Cmd_Grab, ADMFLAG_CHEATS, "Grab the entity in your crosshair.");
RegAdminCmd("-grabent", Cmd_Release, ADMFLAG_CHEATS, "Release the grabbed entity.");
}
public void OnMapStart()
{
g_iLaserIndex = PrecacheModel("materials/sprites/laserbeam.vmt");
g_BeamSprite = PrecacheModel("materials/sprites/laser.vmt", true);
g_HaloSprite = PrecacheModel("materials/sprites/halo01.vmt", true);
for (int i = 0; i < MAXPLAYERS; i++) {
g_pGrabbedEnt[i] = -1;
g_eRotationAxis[i] = -1;
g_pLastButtonPress[i] = 0.0;
g_pInRotationMode[i] = false;
g_eReleaseFreeze[i] = true;
g_eGrabTimer[i] = null;
}
}
public void OnClientDisconnect(client)
{
if (g_pGrabbedEnt[client] != -1 && IsValidEntity(g_pGrabbedEnt[client]))
Cmd_Release(client, 0);
g_eRotationAxis[client] = -1;
g_pLastButtonPress[client] = 0.0;
g_pInRotationMode[client] = false;
g_eReleaseFreeze[client] = true;
}
//============================================================================
// FREEZE SETTING COMMAND //
//============================================================================
public Action Cmd_ReleaseFreeze(client, args)
{
if (args < 1) {
ReplyToCommand(client, "\x04[SM]\x01 \x05sm_grabent_freeze <0/1>\x01 -- \x050\x01: Entity unfreeze on release, \x051\x01: Entity freeze on release");
return Plugin_Handled;
}
char sArg[16];
GetCmdArg(1, sArg, sizeof(sArg)); TrimString(sArg);
if (!StrEqual(sArg, "0") && !StrEqual(sArg, "1")) {
ReplyToCommand(client, "\x04[SM]\x01 ERROR: Value can only be either 0 or 1");
return Plugin_Handled;
}
g_eReleaseFreeze[client] = StrEqual(sArg, "1");
PrintToChat(client, "\x04[SM]\x01 Entities will now be \x05%s\x01 on Release!", g_eReleaseFreeze[client] == true ? "Frozen" : "Unfrozen");
return Plugin_Handled;
}
//============================================================================
// GRAB ENTITY COMMAND //
//============================================================================
public Action Cmd_Grab(client, args) {
if (client < 1 || client > MaxClients || !IsClientInGame(client))
return Plugin_Handled;
if (g_pGrabbedEnt[client] > 0 && IsValidEntity(g_pGrabbedEnt[client])) {
Cmd_Release(client, 0);
return Plugin_Handled;
}
// int ent = GetClientAimTarget(client, false);
int ent = GetLookingEntity(client, Filter_IgnoreForbidden);
if (ent == -1 || !IsValidEntity(ent))
return Plugin_Handled; //<-- timer to allow search for entity??
// Grab the parent
int parent = GetEntPropEnt(ent, Prop_Data, "m_hParent");
if(parent > 0) {
ent = parent;
}
if(!CheckBlacklist(ent)) {
return Plugin_Handled;
}
float entOrigin[3], playerGrabOrigin[3];
GetEntPropVector(ent, Prop_Send, "m_vecOrigin", entOrigin);
GetClientEyePosition(client, playerGrabOrigin);
g_pGrabbedEnt[client] = ent;
// Get the point at which the ray first hit the entity
float initialRay[3];
GetInitialRayPosition(client, initialRay);
// Calculate the offset between intitial ray hit and the entities origin
g_fGrabOffset[client][0] = entOrigin[0] - initialRay[0];
g_fGrabOffset[client][1] = entOrigin[1] - initialRay[1];
g_fGrabOffset[client][2] = entOrigin[2] - initialRay[2];
// Calculate the distance between ent and player
float xDis = Pow(initialRay[0]-(playerGrabOrigin[0]), 2.0);
float yDis = Pow(initialRay[1]-(playerGrabOrigin[1]), 2.0);
float zDis = Pow(initialRay[2]-(playerGrabOrigin[2]), 2.0);
g_fGrabDistance[client] = SquareRoot((xDis)+(yDis)+(zDis));
// Get and Store entities original color (useful if colored)
int entColor[4];
int colorOffset = GetEntSendPropOffs(ent, "m_clrRender");
if (colorOffset > 0)
{
entColor[0] = GetEntData(ent, colorOffset, 1);
entColor[1] = GetEntData(ent, colorOffset + 1, 1);
entColor[2] = GetEntData(ent, colorOffset + 2, 1);
entColor[3] = GetEntData(ent, colorOffset + 3, 1);
}
g_eOriginalColor[client][0] = entColor[0];
g_eOriginalColor[client][1] = entColor[1];
g_eOriginalColor[client][2] = entColor[2];
g_eOriginalColor[client][3] = entColor[3];
// Set entities color to grab color (green and semi-transparent)
SetEntityRenderMode(ent, RENDER_TRANSALPHA);
SetEntityRenderColor(ent, 0, 255, 0, 235);
// Freeze entity
char sClass[64];
GetEntityClassname(ent, sClass, sizeof(sClass)); TrimString(sClass);
if (StrEqual(sClass, "player", false)) {
g_pLastMoveType[ent] = GetEntityMoveType(ent);
SetEntityMoveType(ent, MOVETYPE_NONE);
} else
AcceptEntityInput(ent, "DisableMotion");
g_pLastMoveType[client] = GetEntityMoveType(client);
// Disable weapon prior to timer
SetWeaponDelay(client, 1.0);
// Make sure rotation mode can immediately be entered
g_pLastButtonPress[client] = GetGameTime() - 2.0;
g_pInRotationMode[client] = false;
g_bHighlightEntity[client] = false;
for(int i = 0; i < MAX_HIGHLIGHTED_CLASSNAMES; i++) {
if(StrEqual(HIGHLIGHTED_CLASSNAMES[i], sClass)) {
g_bHighlightEntity[client] = true;
break;
}
}
DataPack pack;
g_eGrabTimer[client] = CreateDataTimer(0.1, Timer_UpdateGrab, pack, TIMER_REPEAT);
pack.WriteCell(client);
return Plugin_Handled;
}
//============================================================================
// TIMER FOR GRAB ENTITY //
//============================================================================
public Action Timer_UpdateGrab(Handle timer, DataPack pack) {
int client;
pack.Reset();
client = pack.ReadCell();
if (!IsValidEntity(client) || client < 1 || client > MaxClients || !IsClientInGame(client))
return Plugin_Stop;
if (g_pGrabbedEnt[client] == -1 || !IsValidEntity(g_pGrabbedEnt[client]))
return Plugin_Stop;
// Continuously delay use of weapon, as to not fire any bullets when pushing/pulling/rotating
SetWeaponDelay(client, 1.0);
if(g_bHighlightEntity[client]) {
char targetname[64];
GetEntPropString(g_pGrabbedEnt[client], Prop_Data, "m_iName", targetname, sizeof(targetname));
PrintCenterText(client, "%s", targetname);
GlowEntity(client, g_pGrabbedEnt[client]);
}
// *** Enable/Disable Rotation Mode
if (GetClientButtons(client) & IN_RELOAD) {
// Avoid instant enable/disable of rotation mode by requiring a one second buffer
if (GetGameTime() - g_pLastButtonPress[client] >= 1.0) {
g_pLastButtonPress[client] = GetGameTime();
g_pInRotationMode[client] = g_pInRotationMode[client] == true ? false : true;
PrintToChat(client, "\x04[SM]\x01 Rotation Mode \x05%s\x01", g_pInRotationMode[client] == true ? "Enabled" : "Disabled");
// Restore the entities color and alpha if enabling
if(g_pInRotationMode[client]) {
SetEntityRenderColor(g_pGrabbedEnt[client], 255, 255, 255, 255);
PrintToChat(client, "\x05[A]\x01 RED \x05[S]\x01 GREEN \x05[D]\x01 BLUE \x05[W]\x01 SHOW RINGS");
}
// Change back to grabbed color if disabling
else
SetEntityRenderColor(g_pGrabbedEnt[client], 0, 255, 0, 235);
}
}
// ***In Rotation Mode
if (g_pInRotationMode[client]) {
SetEntityMoveType(client, MOVETYPE_NONE);
float ang[3], pos[3], mins[3], maxs[3];
GetEntPropVector(g_pGrabbedEnt[client], Prop_Send, "m_angRotation", ang);
GetEntPropVector(g_pGrabbedEnt[client], Prop_Send, "m_vecOrigin", pos);
GetEntPropVector(g_pGrabbedEnt[client], Prop_Send, "m_vecMins", mins);
GetEntPropVector(g_pGrabbedEnt[client], Prop_Send, "m_vecMaxs", maxs);
// If the entity is a child, it will have a null position, so we'll hesitantly use the parents position
int parent = GetEntPropEnt(g_pGrabbedEnt[client], Prop_Data, "m_hMoveParent");
if (parent > 0 && IsValidEntity(parent))
GetEntPropVector(parent, Prop_Send, "m_vecOrigin", pos);
// Get rotation axis from button press
int buttonPress = GetClientButtons(client);
switch(buttonPress) {
case IN_FORWARD: {
g_eRotationAxis[client] = -1; // [W] = Show Rings
PrintToChat(client, "\x04[SM]\x01 Show Rings \x05On\x01");
}
case IN_MOVELEFT: {
g_eRotationAxis[client] = 0; // [A] = x axis
PrintToChat(client, "\x04[SM]\x01 Rotation Axis \x05X\x01");
}
case IN_BACK: {
g_eRotationAxis[client] = 1; // [S] = y axis
PrintToChat(client, "\x04[SM]\x01 Rotation Axis \x05Y\x01");
}
case IN_MOVERIGHT: {
g_eRotationAxis[client] = 2; // [D] = z axis
PrintToChat(client, "\x04[SM]\x01 Rotation Axis \x05Z\x01");
}
}
// Reset angles when A+S+D is pressed
if((buttonPress & IN_MOVELEFT) && (buttonPress & IN_BACK) && (buttonPress & IN_MOVERIGHT)) {
ang[0] = 0.0; ang[1] = 0.0; ang[2] = 0.0;
g_eRotationAxis[client] = -1;
}
// Largest side should dictate the diameter of the rings
float diameter, sendAng[3];
diameter = (maxs[0] > maxs[1]) ? (maxs[0] + 10.0) : (maxs[1] + 10.0);
diameter = ((maxs[2] + 10.0) > diameter) ? (maxs[2] + 10.0) : diameter;
// Sending original ang will cause non-stop rotation issue
sendAng = ang;
// Draw rotation rings
switch(g_eRotationAxis[client]) {
case -1: CreateRing(client, sendAng, pos, diameter, 0, true); // all 3 rings
case 0: CreateRing(client, sendAng, pos, diameter, 0, false); // red (x)
case 1: CreateRing(client, sendAng, pos, diameter, 1, false); // green (y)
case 2: CreateRing(client, sendAng, pos, diameter, 2, false); // blue (z)
}
// Rotate with mouse if on a rotation axis (A,S,D)
if (g_eRotationAxis[client] != -1) {
// + Rotate
if (GetClientButtons(client) & IN_ATTACK)
ang[g_eRotationAxis[client]] += 10.0;
// - Rotate
else if (GetClientButtons(client) & IN_ATTACK2)
ang[g_eRotationAxis[client]] -= 10.0;
}
TeleportEntity(g_pGrabbedEnt[client], NULL_VECTOR, ang, NULL_VECTOR);
}
// ***Not in Rotation Mode
if (!g_pInRotationMode[client] || g_eRotationAxis[client] == -1) {
// Keep track of player noclip as to avoid forced enable/disable
if(!g_pInRotationMode[client]) {
SetEntityMoveType(client, g_pLastMoveType[client])
}
// Push entity (Allowed if we're in rotation mode, not on a rotation axis (-1))
if (GetClientButtons(client) & IN_ATTACK)
{
if (g_fGrabDistance[client] < 80)
g_fGrabDistance[client] += 10;
else
g_fGrabDistance[client] += g_fGrabDistance[client] / 25;
}
// Pull entity (Allowed if we're in rotation mode, not on a rotation axis (-1))
else if (GetClientButtons(client) & IN_ATTACK2 && g_fGrabDistance[client] > 25)
{
if (g_fGrabDistance[client] < 80)
g_fGrabDistance[client] -= 10;
else
g_fGrabDistance[client] -= g_fGrabDistance[client] / 25;
}
g_eRotationAxis[client] = -1;
}
// *** Runs whether in rotation mode or not
float entNewPos[3];
int buttons = GetClientButtons(client);
GetEntNewPosition(client, entNewPos, buttons & IN_SPEED == 0);
entNewPos[0] += g_fGrabOffset[client][0];
entNewPos[1] += g_fGrabOffset[client][1];
entNewPos[2] += g_fGrabOffset[client][2];
float mins[3];
GetEntPropVector(g_pGrabbedEnt[client], Prop_Data, "m_vecMins", mins);
entNewPos[2] -= mins[2];
TeleportEntity(g_pGrabbedEnt[client], entNewPos, NULL_VECTOR, NULL_VECTOR);
return Plugin_Handled;
}
//============================================================================
// RELEASE ENTITY COMMAND //
//============================================================================
public Action Cmd_Release(client, args) {
if (!IsValidEntity(client) || client < 1 || client > MaxClients || !IsClientInGame(client))
return Plugin_Handled;
if (g_pGrabbedEnt[client] == -1 || !IsValidEntity(g_pGrabbedEnt[client]))
return Plugin_Handled;
// Allow near-immediate use of weapon
SetWeaponDelay(client, 0.2);
SetEntityMoveType(client, g_pLastMoveType[client]);
// Unfreeze if target was a player and unfreeze if setting is set to 0
char sClass[64];
GetEntityClassname(g_pGrabbedEnt[client], sClass, sizeof(sClass)); TrimString(sClass);
if (StrEqual(sClass, "player", false))
SetEntityMoveType(g_pGrabbedEnt[client], g_pLastMoveType[g_pGrabbedEnt[client]]);
else if (g_eReleaseFreeze[client] == false)
AcceptEntityInput(g_pGrabbedEnt[client], "EnableMotion");
// Restore color and alpha to original prior to grab
SetEntityRenderColor(g_pGrabbedEnt[client], g_eOriginalColor[client][0], g_eOriginalColor[client][1], g_eOriginalColor[client][2], g_eOriginalColor[client][3]);
// Kill the grab timer and reset control values
if (IsValidHandle(g_eGrabTimer[client])) {
delete g_eGrabTimer[client];
}
g_pGrabbedEnt[client] = -1;
g_eRotationAxis[client] = -1;
g_pInRotationMode[client] = false;
return Plugin_Handled;
}
//============================================================================
// *** UTILITIES *** //
//============================================================================
int GetLookingEntity(int client, TraceEntityFilter filter) {
static float pos[3], ang[3];
GetClientEyePosition(client, pos);
GetClientEyeAngles(client, ang);
TR_TraceRayFilter(pos, ang, MASK_ALL, RayType_Infinite, filter, client);
if(TR_DidHit()) {
return TR_GetEntityIndex();
}
return -1;
}
stock bool GetEntNewPosition(int client, float endPos[3], bool doCollision = true)
{
if (client > 0 && client <= MaxClients && IsClientInGame(client)) {
float clientEye[3], clientAngle[3], direction[3];
GetClientEyePosition(client, clientEye);
GetClientEyeAngles(client, clientAngle);
GetAngleVectors(clientAngle, direction, NULL_VECTOR, NULL_VECTOR);
ScaleVector(direction, g_fGrabDistance[client]);
AddVectors(clientEye, direction, endPos);
if(doCollision) {
TR_TraceRayFilter(clientEye, endPos, MASK_OPAQUE, RayType_EndPoint, TraceRayFilterEnt, client);
if (TR_DidHit(INVALID_HANDLE)) {
TR_GetEndPosition(endPos);
}
}
return true;
}
return false;
}
/////
stock bool GetInitialRayPosition(int client, float endPos[3])
{
if (client > 0 && client <= MaxClients && IsClientInGame(client)) {
float clientEye[3], clientAngle[3];
GetClientEyePosition(client, clientEye);
GetClientEyeAngles(client, clientAngle);
TR_TraceRayFilter(clientEye, clientAngle, MASK_SOLID, RayType_Infinite, TraceRayFilterActivator, client);
if (TR_DidHit(INVALID_HANDLE))
TR_GetEndPosition(endPos);
return true;
}
return false;
}
/////
stock void SetWeaponDelay(int client, float delay)
{
if (IsValidEntity(client) && client > 0 && client <= MaxClients && IsClientInGame(client)) {
int pWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if (IsValidEntity(pWeapon) && pWeapon != -1) {
SetEntPropFloat(pWeapon, Prop_Send, "m_flNextPrimaryAttack", GetGameTime() + delay);
SetEntPropFloat(pWeapon, Prop_Send, "m_flNextSecondaryAttack", GetGameTime() + delay);
}
}
}
/////
stock void CreateRing(int client, float ang[3], float pos[3], float diameter, int axis, bool trio)
{
if (!IsValidEntity(client) || client < 1 || client > MaxClients || !IsClientInGame(client))
return;
float ringVecs[26][3];
int ringColor[3][4];
ringColor[0] = { 255, 0, 0, 255 };
ringColor[1] = { 0, 255, 0, 255 };
ringColor[2] = { 0, 0, 255, 255 };
int numSides = (!trio) ? 26 : 17;
float angIncrement = (!trio) ? 15.0 : 24.0;
for (int i = 1; i < numSides; i++) {
float direction[3], endPos[3];
switch(axis) {
case 0: GetAngleVectors(ang, direction, NULL_VECTOR, NULL_VECTOR);
case 1:
{
ang[2] = 0.0;
GetAngleVectors(ang, NULL_VECTOR, direction, NULL_VECTOR);
}
case 2: GetAngleVectors(ang, NULL_VECTOR, NULL_VECTOR, direction);
}
ScaleVector(direction, diameter);
AddVectors(pos, direction, endPos);
if (i == 1) ringVecs[0] = endPos;
ringVecs[i] = endPos;
ang[axis] += angIncrement;
TE_SetupBeamPoints(ringVecs[i-1], ringVecs[i], g_BeamSprite, g_HaloSprite, 0, 15, 0.2, 2.5, 2.5, 1, 0.0, ringColor[axis], 10);
TE_SendToClient(client, 0.0);
if(trio && i == numSides-1 && axis < 2) {
i = 0;
ang[axis] -= angIncrement * (numSides-1);
axis += 1;
}
}
}
void GlowEntity(int client, int entity) {
float pos[3], mins[3], maxs[3], angles[3];
GetEntPropVector(entity, Prop_Send, "m_angRotation", angles);
GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
GetEntPropVector(entity, Prop_Send, "m_vecMins", mins);
GetEntPropVector(entity, Prop_Send, "m_vecMaxs", maxs);
Effect_DrawBeamBoxRotatableToClient(client, pos, mins, maxs, angles, g_iLaserIndex, 0, 0, 30, 0.1, 0.4, 0.4, 0, 0.1, { 0, 255, 0, 235 }, 0);
}
//============================================================================
// *** FILTERS *** //
//============================================================================
public bool TraceRayFilterEnt(int entity, int mask, any:client)
{
if (entity == client || entity == g_pGrabbedEnt[client])
return false;
return true;
}
/////
public bool TraceRayFilterActivator(int entity, int mask, any:activator)
{
if (entity == activator)
return false;
return true;
}
bool Filter_IgnoreForbidden(int entity, int mask, int data) {
if(entity == data || entity == 0) return false;
if(entity <= MaxClients) return true;
return CheckBlacklist(entity);
}
bool CheckBlacklist(int entity) {
static char buffer[64];
GetEntityClassname(entity, buffer, sizeof(buffer));
for(int i = 0; i < MAX_FORBIDDEN_CLASSNAMES; i++) {
if(StrEqual(FORBIDDEN_CLASSNAMES[i], buffer)) {
return false;
}
}
if(StrContains(buffer, "prop_") > -1) {
GetEntPropString(entity, Prop_Data, "m_ModelName", buffer, sizeof(buffer));
for(int i = 0; i < MAX_FORBIDDEN_MODELS; i++) {
if(StrEqual(FORBIDDEN_MODELS[i], buffer)) {
return false;
}
}
}
GetEntPropString(entity, Prop_Data, "m_iName", buffer, sizeof(buffer));
if(StrEqual(buffer, "l4d2_randomizer")) {
return false;
}
return true;
}

View file

@ -0,0 +1,141 @@
#pragma semicolon 1
#pragma newdecls required
#define ANTI_ADMIN_KICK_MIN_TIME 120 // The number of seconds after joining where vote kicking an admin, kicks the caller
#define PLUGIN_VERSION "1.1"
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
static int disableFFClient = -1, ffDamageCount; //client to disable FF for
static ConVar forceKickFFThreshold;
public Plugin myinfo = {
name = "L4D2 FF Kick Protection",
author = "jackzmc",
description = "Prevents friendly firing from players being voted off and admins from being kicked",
version = PLUGIN_VERSION,
url = "https://github.com/Jackzmc/sourcemod-plugins"
};
public void OnPluginStart() {
EngineVersion g_Game = GetEngineVersion();
if(g_Game != Engine_Left4Dead && g_Game != Engine_Left4Dead2)
{
SetFailState("This plugin is for L4D/L4D2 only.");
}
AddCommandListener(VoteStart, "callvote");
HookUserMessage(GetUserMessageId("VotePass"), VotePassFail);
HookUserMessage(GetUserMessageId("VoteFail"), VotePassFail);
forceKickFFThreshold = CreateConVar("sm_votekick_force_threshold","30.0","The threshold of amount of FF to then automatically kick.\n0: Any attempted damage\n -1: No auto kick.\n>0: When FF count > this", FCVAR_NONE, true, -1.0);
}
int iJoinTime[MAXPLAYERS+1];
public void OnClientPutInServer(int client) {
int team = GetClientTeam(client);
if(team == 2) {
SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamage);
}
iJoinTime[client] = GetTime();
}
public void Event_PlayerTeam(Event event, const char[] name, bool dontBroadcast) {
if(!event.GetBool("disconnect")) {
int team = event.GetInt("team");
int userid = GetClientOfUserId(event.GetInt("userid"));
if(team == 2) {
SDKHook(userid, SDKHook_OnTakeDamageAlive, OnTakeDamage);
//add new hook
}else{
SDKUnhook(userid, SDKHook_OnTakeDamageAlive, OnTakeDamage);
}
}
}
public Action VoteStart(int client, const char[] command, int argc) {
if(!IsClientInGame(client)) {
PrintToServer("Preventing vote from user not in game: %N", client);
return Plugin_Handled;
}
if(GetClientCount(true) == 0 || client == 0 || client >= MaxClients) return Plugin_Handled; //prevent votes while server is empty or if server tries calling vote
if(argc >= 1) {
char issue[32];
GetCmdArg(1, issue, sizeof(issue));
if(StrEqual(issue, "Kick", false)) {
char option[32];
GetCmdArg(2, option, sizeof(option));
if(strlen(option) > 1) { //empty userid/console can't call votes
int target = GetClientOfUserId(StringToInt(option));
if(target <= 0 || target >= MaxClients || !IsClientInGame(target)) return Plugin_Continue; //invalid, pass it through
AdminId targetAdmin = GetUserAdmin(target);
bool isCallerAdmin = GetUserFlagBits(client) != 0;
bool isTargetAdmin = GetUserFlagBits(target) != 0;
PrintToServer("Caller Admin: %b | Target admin: %b", isCallerAdmin, isTargetAdmin);
//Only run if vote is against an admin
if(isTargetAdmin) {
for(int i = 1; i <= MaxClients; i++) {
if(target != i && IsClientInGame(i) && GetUserAdmin(i) != INVALID_ADMIN_ID) {
PrintToChat(i, "%N attempted to vote-kick admin %N", client, target);
}
}
// Kick player if they are not an admin and just recently joined.
// Else, just tell the target
if(!isCallerAdmin && GetTime() - iJoinTime[client] <= ANTI_ADMIN_KICK_MIN_TIME) {
if(GetClientTeam(target) >= 2) {
KickClient(client, "No.");
PrintToChat(target, "%N has attempted to vote kick you and was kicked.", client);
} else {
PrintToChat(client, "%N is an admin and cannot be vote kicked", target);
PrintToChat(target, "%N has attempted to kick you while you were afk.", client);
}
} else {
PrintToChat(target, "%N has attempted to vote kick you.", client);
}
// TODO: remove debug
targetAdmin.GetUsername(option, sizeof(option));
PrintToServer("debug: admin immunity is %d. username: %s", targetAdmin.ImmunityLevel, option);
PrintToServer("ADMIN VOTE KICK BLOCKED | Target=%N | Caller=%N", target, client);
return Plugin_Handled;
} else if(isCallerAdmin) {
PrintToServer("Vote kick by admin, instantly passing");
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && !IsFakeClient(i) && GetClientTeam(i) == GetClientTeam(target)) {
ClientCommand(i, "vote Yes");
}
}
}
if(GetClientTeam(target) == 2) {
disableFFClient = target;
ffDamageCount = 0;
}
PrintToServer("VOTE KICK STARTED | Target=%N | Caller=%N", target, client);
return Plugin_Continue;
}
}
}
return Plugin_Continue;
}
public Action VotePassFail(UserMsg msg_id, BfRead msg, const int[] players, int playersNum, bool reliable, bool init) {
disableFFClient = -1;
ffDamageCount = 0;
return Plugin_Continue;
}
public Action OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3]) {
if(disableFFClient == attacker && damage > 0.0 && victim > 0 && victim <= MaxClients && GetClientTeam(victim) == 2) {
if(forceKickFFThreshold.IntValue > -1 && ffDamageCount > 0.0) {
//auto kick
if(ffDamageCount > forceKickFFThreshold.FloatValue) {
BanClient(disableFFClient, 0, 0, "Kicked for excessive friendly fire", "Dick-Be-Gone", "noFF");
}
}
return Plugin_Handled;
}
return Plugin_Continue;
}

View file

@ -0,0 +1,57 @@
#pragma semicolon 1
#pragma newdecls required
//#define DEBUG
#define PLUGIN_NAME "L4D2 Prevent Bot Movement"
#define PLUGIN_DESCRIPTION "Prevents bots from moving in the beginning of the round for a set period of time."
#define PLUGIN_AUTHOR "jackzmc"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_URL ""
#include <sourcemod>
#include <sdktools>
//#include <sdkhooks>
public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
description = PLUGIN_DESCRIPTION,
version = PLUGIN_VERSION,
url = PLUGIN_URL
};
static ConVar hSBStop, hStopTime;
public void OnPluginStart()
{
EngineVersion g_Game = GetEngineVersion();
if(g_Game != Engine_Left4Dead && g_Game != Engine_Left4Dead2)
{
SetFailState("This plugin is for L4D/L4D2 only.");
}
HookEvent("round_start",Event_RoundStart);
hStopTime = CreateConVar("sm_freeze_bot_time","20.0","How long should the bots be frozen for on beginning of round? 0 to disable",FCVAR_NONE,true,0.0);
hSBStop = FindConVar("sb_stop");
}
public void OnMapStart() {
if(hStopTime.IntValue != 0) {
PrintToChatAll("round start");
hSBStop.BoolValue = true;
CreateTimer(hStopTime.FloatValue, ResumeBots);
}
}
public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) {
if(hStopTime.IntValue != 0) {
PrintToChatAll("round start");
hSBStop.BoolValue = true;
CreateTimer(hStopTime.FloatValue, ResumeBots);
}
}
public Action ResumeBots(Handle timer) {
PrintToChatAll("Resuming bots");
hSBStop.BoolValue = false;
}

836
scripting/L4D2Tools.sp Normal file
View file

@ -0,0 +1,836 @@
#pragma semicolon 1
#pragma newdecls required
#define DEBUG 1
#define PLUGIN_VERSION "1.0"
#define PRECACHE_SOUNDS_COUNT 5
char PRECACHE_SOUNDS[PRECACHE_SOUNDS_COUNT][] = {
"custom/meow1.mp3",
"custom/xen_teleport.mp3",
"custom/mariokartmusic.mp3",
"custom/spookyscaryskeletons.mp3",
"custom/wearenumberone2.mp3"
};
#include <sourcemod>
#include <sdkhooks>
#include <left4dhooks>
#include <jutils.inc>
#include <sceneprocessor>
#include <multicolors>
#include "l4d_survivor_identity_fix.inc"
char MODELS[8][] = {
"models/survivors/survivor_gambler.mdl",
"models/survivors/survivor_producer.mdl",
"models/survivors/survivor_mechanic.mdl",
"models/survivors/survivor_coach.mdl",
"models/survivors/survivor_namvet.mdl",
"models/survivors/survivor_teenangst.mdl",
"models/survivors/survivor_biker.mdl",
"models/survivors/survivor_manager.mdl"
};
enum L4DModelId {
Model_Nick,
Model_Rochelle,
Model_Ellis,
Model_Coach,
Model_Bill,
Model_Zoey,
Model_Francis,
Model_Louis
}
static ArrayList LasersUsed;
static ConVar hLaserNotice, hFinaleTimer, hFFNotice, hPingDropThres, hForceSurvivorSet, hPlayerLimit, hSVMaxPlayers, hHideMotd, hGamemode;
static int iFinaleStartTime, botDropMeleeWeapon[MAXPLAYERS+1], iHighPingCount[MAXPLAYERS+1];
static bool isHighPingIdle[MAXPLAYERS+1], isL4D1Survivors;
static Handle hGoAwayFromKeyboard;
static StringMap SteamIDs;
static char lastSound[MAXPLAYERS+1][64], gamemode[32];
static float OUT_OF_BOUNDS[3] = {0.0, -1000.0, 0.0};
public Plugin myinfo = {
name = "L4D2 Misc Tools",
author = "Includes: Notice on laser use, Timer for gauntlet runs",
description = "jackzmc",
version = PLUGIN_VERSION,
url = "https://github.com/Jackzmc/sourcemod-plugins"
};
//TODO: On pickup ammo pack, mark dropped kit/defib
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
MarkNativeAsOptional("IdentityFix_SetPlayerModel");
return APLRes_Success;
}
public void OnPluginStart() {
EngineVersion g_Game = GetEngineVersion();
if(g_Game != Engine_Left4Dead2) {
SetFailState("This plugin is for L4D2 only.");
}
LoadTranslations("common.phrases");
Handle hConfig = LoadGameConfigFile("l4d2tools");
if(hConfig == INVALID_HANDLE) SetFailState("Could not load l4d2tools gamedata.");
StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(hConfig, SDKConf_Signature, "GoAwayFromKeyboard");
hGoAwayFromKeyboard = EndPrepSDKCall();
delete hConfig;
if(hGoAwayFromKeyboard == INVALID_HANDLE) {
SetFailState("GoAwayFromKeyboard signature is invalid");
}
hLaserNotice = CreateConVar("sm_laser_use_notice", "1.0", "Enable notification of a laser box being used", FCVAR_NONE, true, 0.0, true, 1.0);
hFinaleTimer = CreateConVar("sm_time_finale", "0.0", "Record the time it takes to complete finale. 0 -> OFF, 1 -> Gauntlets Only, 2 -> All finales", FCVAR_NONE, true, 0.0, true, 2.0);
hFFNotice = CreateConVar("sm_ff_notice", "0.0", "Notify players if a FF occurs. 0 -> Disabled, 1 -> In chat, 2 -> In Hint text", FCVAR_NONE, true, 0.0, true, 2.0);
hPingDropThres = CreateConVar("sm_autoidle_ping_max", "0.0", "The highest ping a player can have until they will automatically go idle.\n0=OFF, Min is 30", FCVAR_NONE, true, 0.0, true, 1000.0);
hForceSurvivorSet = FindConVar("l4d_force_survivorset");
hHideMotd = CreateConVar("sm_hidemotd", "1", "Hide the MOTD when the server is running", FCVAR_NONE, true, 0.0, true, 1.0);
hSVMaxPlayers = FindConVar("sv_maxplayers");
if(hSVMaxPlayers != null) {
hPlayerLimit = CreateConVar("sm_player_limit", "0", "Overrides sv_maxplayers. 0 = off, > 0: limit", FCVAR_NONE, true, 0.0, false);
hPlayerLimit.AddChangeHook(Event_PlayerLimitChange);
hSVMaxPlayers.IntValue = hPlayerLimit.IntValue;
}
hFFNotice.AddChangeHook(CVC_FFNotice);
if(hFFNotice.IntValue > 0) {
HookEvent("player_hurt", Event_PlayerHurt);
}
LasersUsed = new ArrayList(1, 0);
SteamIDs = new StringMap();
hGamemode = FindConVar("mp_gamemode");
hGamemode.GetString(gamemode, sizeof(gamemode));
hGamemode.AddChangeHook(Event_GamemodeChange);
Event_GamemodeChange(hGamemode, gamemode, gamemode);
HookEvent("player_use", Event_PlayerUse);
HookEvent("round_end", Event_RoundEnd);
HookEvent("gauntlet_finale_start", Event_GauntletStart);
HookEvent("finale_start", Event_FinaleStart);
HookEvent("finale_vehicle_leaving", Event_FinaleEnd);
HookEvent("player_bot_replace", Event_BotPlayerSwap);
HookEvent("bot_player_replace", Event_BotPlayerSwap);
HookEvent("player_first_spawn", Event_PlayerFirstSpawn);
HookEvent("weapon_drop", Event_WeaponDrop);
HookEvent("player_disconnect", Event_PlayerDisconnect);
AutoExecConfig(true, "l4d2_tools");
for(int client = 1; client < MaxClients; client++) {
if(IsClientConnected(client) && IsClientInGame(client) && GetClientTeam(client) == 2) {
if(IsFakeClient(client)) {
SDKHook(client, SDKHook_OnTakeDamage, Event_OnTakeDamageBot);
SDKHook(client, SDKHook_WeaponDrop, Event_OnWeaponDrop);
} else {
SDKHook(client, SDKHook_WeaponEquip, Event_OnWeaponEquip);
}
}
}
HookUserMessage(GetUserMessageId("VGUIMenu"), VGUIMenu, true);
RegAdminCmd("sm_model", Command_SetClientModel, ADMFLAG_KICK);
RegAdminCmd("sm_surv", Cmd_SetSurvivor, ADMFLAG_KICK);
RegAdminCmd("sm_respawn_all", Command_RespawnAll, ADMFLAG_CHEATS, "Makes all dead players respawn in a closet");
RegAdminCmd("sm_playsound", Command_PlaySound, ADMFLAG_KICK, "Plays a gamesound for player");
RegAdminCmd("sm_stopsound", Command_StopSound, ADMFLAG_GENERIC, "Stops the last played gamesound for player");
RegAdminCmd("sm_swap", Command_SwapPlayer, ADMFLAG_KICK, "Swarms two player's locations");
RegConsoleCmd("sm_pmodels", Command_ListClientModels, "Lists all player's models");
RegAdminCmd("sm_skipoutro", Command_SkipOutro, ADMFLAG_KICK, "Skips the outro");
CreateTimer(8.0, Timer_CheckPlayerPings, _, TIMER_REPEAT);
}
void Event_GamemodeChange(ConVar cvar, const char[] oldValue, const char[] newValue) {
cvar.GetString(gamemode, sizeof(gamemode));
}
void Event_PlayerLimitChange(ConVar cvar, const char[] oldValue, const char[] newValue) {
if(cvar.IntValue > 0) {
hSVMaxPlayers.IntValue = cvar.IntValue;
}
}
Action Timer_CheckPlayerPings(Handle timer) {
if(StrEqual(gamemode, "hideandseek")) return Plugin_Continue;
if(hPingDropThres.IntValue != 0) {
for (int i = 1; i <= MaxClients; i++ ) {
if(IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i) && IsPlayerAlive(i) && GetClientTeam(i) > 1) {
int ping = GetEntProp(GetPlayerResourceEntity(), Prop_Send, "m_iPing", _, i);
if(isHighPingIdle[i] && ping <= hPingDropThres.IntValue) {
L4D_TakeOverBot(i);
isHighPingIdle[i] = false;
iHighPingCount[i] = 0;
}else if(ping > hPingDropThres.IntValue) {
if(iHighPingCount[i]++ > 2) {
PrintToChat(i, "Due to your high ping (%d ms) you have been moved to AFK.", ping);
PrintToChat(i, "You will be automatically switched back once your ping restores");
SDKCall(hGoAwayFromKeyboard, i);
//PrintToChat(i, "Type /pingignore to disable this feature.");
// L4D_ReplaceWithBot(i);
isHighPingIdle[i] = true;
iHighPingCount[i] = 0;
}
}
}
}
}
return Plugin_Continue;
}
void CVC_FFNotice(ConVar convar, const char[] oldValue, const char[] newValue) {
if(convar.IntValue > 0) {
HookEvent("player_hurt", Event_PlayerHurt);
} else {
UnhookEvent("player_hurt", Event_PlayerHurt);
}
}
public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) {
LasersUsed.Clear();
}
Action Command_RespawnAll(int client, int args) {
L4D_CreateRescuableSurvivors();
return Plugin_Handled;
}
Action Command_SwapPlayer(int client, int args) {
if(args < 1) {
ReplyToCommand(client, "Usage: sm_swap <player> [another player (default: self)] [\"silent\"]");
} else {
char arg1[64], arg2[64], arg3[8];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
GetCmdArg(3, arg3, sizeof(arg3));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
1,
COMMAND_FILTER_CONNECTED | COMMAND_FILTER_NO_IMMUNITY,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int target = target_list[0];
int target2 = client;
if(args == 2) {
if ((target_count = ProcessTargetString(
arg2,
client,
target_list,
1,
COMMAND_FILTER_CONNECTED | COMMAND_FILTER_NO_IMMUNITY,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
}
target2 = target_list[0];
}
float pos1[3], pos2[3];
float ang1[3], ang2[3];
GetClientAbsOrigin(target, pos1);
GetClientAbsOrigin(target2, pos2);
GetClientAbsAngles(target, ang1);
GetClientAbsAngles(target2, ang2);
TeleportEntity(target, pos2, ang2, NULL_VECTOR);
TeleportEntity(target2, pos1, ang1, NULL_VECTOR);
if(args < 3 || !StrEqual(arg3, "silent") && !StrEqual(arg2, "silent")) {
EmitSoundToClient(target, "custom/xen_teleport.mp3", target, 0);
EmitSoundToClient(target2, "custom/xen_teleport.mp3", target2);
}
}
return Plugin_Handled;
}
Action Command_SkipOutro(int client, int args) {
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i)) {
ClientCommand(i, "skipouttro");
}
}
return Plugin_Handled;
}
Action Command_ListClientModels(int client, int args) {
char model[64];
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && GetClientTeam(i) == 2) {
GetClientModel(i, model, sizeof(model));
ReplyToCommand(client, "%N's model: %s", i, model);
}
}
return Plugin_Handled;
}
Action Command_PlaySound(int client, int args) {
if(args < 2) {
ReplyToCommand(client, "Usage: sm_playsound <player> <soundpath>");
}else{
char arg1[32], arg2[64], arg3[16];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
GetCmdArg(3, arg3, sizeof(arg3));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_CONNECTED,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int target;
for (int i = 0; i < target_count; i++) {
target = target_list[i];
StopSound(target, 0, lastSound[target]);
}
PrecacheSound(arg2);
for (int i = 0; i < target_count; i++) {
target = target_list[i];
if(IsClientConnected(target) && IsClientInGame(target) && !IsFakeClient(target)) {
if(StrEqual(arg3, "direct"))
ClientCommand(target, "playgamesound %s", arg2);
else
EmitSoundToClient(target, arg2, target);
strcopy(lastSound[target], 64, arg2);
}
}
CShowActivity2(client, "[SM] ", "playing sound {olive}%s{default} to {yellow}%s", arg2, target_name);
}
return Plugin_Handled;
}
Action Command_StopSound(int client, int args) {
if(args < 2) {
ReplyToCommand(client, "Usage: sm_stopsound <player> [soundpath or leave blank for previous]");
} else {
char arg1[32], arg2[64];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_CONNECTED | COMMAND_FILTER_NO_IMMUNITY,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int target;
for (int i = 0; i < target_count; i++) {
target = target_list[i];
if(IsClientConnected(target) && IsClientInGame(target) && !IsFakeClient(target)) {
if(args < 2)
StopSound(target, 0, lastSound[target]);
else
StopSound(target, 0, arg2);
}
}
}
return Plugin_Handled;
}
Action Command_SetClientModel(int client, int args) {
if(args < 1) {
ReplyToCommand(client, "Usage: sm_model <model> [player] ['keep']");
} else {
char arg1[2], arg2[16], arg3[8];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
GetCmdArg(3, arg3, sizeof(arg3));
int survivorId;
L4DModelId modelId;
bool isL4D1 = isL4D1Survivors;
if(hForceSurvivorSet != null && hForceSurvivorSet.IntValue > 0) isL4D1 = hForceSurvivorSet.IntValue == 1;
char s = CharToLower(arg1[0]);
if(s == 'b') {
survivorId = isL4D1 ? 0 : 4;
modelId = Model_Bill;
} else if(s == 'z') {
survivorId = isL4D1 ? 1 : 5;
modelId = Model_Zoey;
} else if(s == 'l') {
survivorId = isL4D1 ? 2 : 7;
modelId = Model_Louis;
} else if(s == 'f') {
survivorId = isL4D1 ? 3 : 6;
modelId = Model_Francis;
} else if(s == 'n') {
survivorId = 0;
modelId = Model_Nick;
if(isL4D1) PrintToChat(client, "Note: Only models for L4D2 characters are supported in L4D1 maps.");
} else if(s == 'r') {
survivorId = 1;
modelId = Model_Rochelle;
if(isL4D1) PrintToChat(client, "Note: Only models for L4D2 characters are supported in L4D1 maps.");
} else if(s== 'e') {
survivorId = 3;
modelId = Model_Ellis;
if(isL4D1) PrintToChat(client, "Note: Only models for L4D2 characters are supported in L4D1 maps.");
} else if(s == 'c') {
survivorId = 2;
modelId = Model_Coach;
if(isL4D1) PrintToChat(client, "Note: Only models for L4D2 characters are supported in L4D1 maps.");
} else {
ReplyToCommand(client, "Unknown survivor \"%s\". Syntax changed: model <survivor> [player or none for self]", arg1);
return Plugin_Handled;
}
bool keep = StrEqual(arg2, "keep", false) || StrEqual(arg3, "keep", false);
if(args > 1) {
char target_name[1];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg2,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE | COMMAND_FILTER_NO_IMMUNITY,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
for (int i = 0; i < target_count; i++) {
int target = target_list[i];
int team = GetClientTeam(target);
if(team == 2 || team == 4) {
SetCharacter(target, survivorId, modelId, keep);
}
}
} else {
SetCharacter(client, survivorId, modelId, keep);
}
}
return Plugin_Handled;
}
void SetCharacter(int target, int survivorIndex, L4DModelId modelIndex, bool keepModel) {
SetEntProp(target, Prop_Send, "m_survivorCharacter", survivorIndex);
SetEntityModel(target, MODELS[view_as<int>(modelIndex)]);
if (IsFakeClient(target)) {
char name[32];
GetSurvivorName(target, name, sizeof(name));
SetClientInfo(target, "name", name);
}
UpdatePlayerIdentity(target, view_as<Character>(survivorIndex), keepModel);
DataPack pack = new DataPack();
pack.WriteCell(GetClientUserId(target));
bool dualWield = false;
for(int slot = 0; slot <= 4; slot++) {
int weapon = AddWeaponSlot(target, slot, pack);
if(weapon > 0) {
if(slot == 1 && HasEntProp(weapon, Prop_Send, "m_isDualWielding")) {
dualWield = GetEntProp(weapon, Prop_Send, "m_isDualWielding") == 1;
SetEntProp(weapon, Prop_Send, "m_isDualWielding", 0);
}
SDKHooks_DropWeapon(target, weapon, NULL_VECTOR);
}
}
pack.WriteCell(dualWield);
CreateTimer(0.1, Timer_RequipWeapon, pack);
}
int AddWeaponSlot(int target, int slot, DataPack pack) {
int weapon = GetPlayerWeaponSlot(target, slot);
if( weapon > 0 ) {
pack.WriteCell(EntIndexToEntRef(weapon)); // Save last held weapon to switch back
return weapon;
} else {
pack.WriteCell(-1); // Save last held weapon to switch back
return -1;
}
}
public Action Timer_RequipWeapon(Handle hdl, DataPack pack) {
pack.Reset();
int client = GetClientOfUserId(pack.ReadCell());
if(client == 0) return Plugin_Handled;
int weapon, pistolSlotItem = -1;
for(int slot = 0; slot <= 4; slot++) {
weapon = pack.ReadCell();
if(EntRefToEntIndex(weapon) != INVALID_ENT_REFERENCE) {
if(slot == 1) {
pistolSlotItem = weapon;
}
EquipPlayerWeapon(client, weapon);
}
}
bool isDualWield = pack.ReadCell() == 1;
if(isDualWield && pistolSlotItem != -1 && HasEntProp(pistolSlotItem, Prop_Send, "m_isDualWielding")) {
SetEntProp(pistolSlotItem, Prop_Send, "m_isDualWielding", 1);
}
return Plugin_Handled;
}
Action Cmd_SetSurvivor(int client, int args) {
if(args < 1) {
ReplyToCommand(client, "Usage: sm_surv <player> <survivor>");
} else {
char arg1[32], arg2[16];
GetCmdArg(1, arg1, sizeof(arg1));
GetCmdArg(2, arg2, sizeof(arg2));
int modelID = GetSurvivorId(arg2);
if(modelID == -1) {
ReplyToCommand(client, "Invalid survivor type entered. Case-sensitive, full name required.");
return Plugin_Handled;
}
char target_name[MAX_TARGET_LENGTH];
int target_list[MAXPLAYERS], target_count;
bool tn_is_ml;
if ((target_count = ProcessTargetString(
arg1,
client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_CONNECTED | COMMAND_FILTER_NO_IMMUNITY,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
/* This function replies to the admin with a failure message */
ReplyToTargetError(client, target_count);
return Plugin_Handled;
}
int target;
for (int i = 0; i < target_count; i++) {
target = target_list[i];
SetEntProp(target, Prop_Send, "m_survivorCharacter", modelID);
}
}
return Plugin_Handled;
}
// Hide MOTD
Action VGUIMenu(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init) {
if(!hHideMotd.BoolValue) return Plugin_Continue;
static char buffer[8];
// Show MOTD on versus games
hGamemode.GetString(buffer, sizeof(buffer));
if(StrEqual(buffer, "versus", false)) return Plugin_Continue;
BfReadString(bf, buffer, sizeof(buffer));
return strcmp(buffer, "info") == 0 ? Plugin_Handled : Plugin_Continue;
}
public void OnClientPutInServer(int client) {
if(!IsFakeClient(client))
SDKHook(client, SDKHook_WeaponEquip, Event_OnWeaponEquip);
else
SDKHook(client, SDKHook_OnTakeDamage, Event_OnTakeDamageBot);
}
public void OnClientDisconnect(int client) {
isHighPingIdle[client] = false;
iHighPingCount[client] = 0;
if(IsClientConnected(client) && IsClientInGame(client) && botDropMeleeWeapon[client] > -1 && IsValidEntity(botDropMeleeWeapon[client])) {
float pos[3];
GetClientAbsOrigin(client, pos);
TeleportEntity(botDropMeleeWeapon[client], pos, NULL_VECTOR, NULL_VECTOR);
botDropMeleeWeapon[client] = -1;
}
}
public void Event_PlayerDisconnect(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
if(client && !IsFakeClient(client)) {
char auth[32];
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
SteamIDs.Remove(auth);
}
}
int disabledItem[2048];
//Can also probably prevent kit drop to pick them up
public void Event_WeaponDrop(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
int weapon = event.GetInt("propid");
char newWpn[32];
GetEntityClassname(client, newWpn, sizeof(newWpn));
if(StrEqual(newWpn, "weapon_ammo_pack")) {
// prevent weapon from being picked up?
disabledItem[weapon] = client;
CreateTimer(10.0, Timer_AllowKitPickup, weapon);
}
}
public Action Event_OnWeaponEquip(int client, int weapon) {
if(disabledItem[weapon] > 0 && disabledItem[weapon] != client) return Plugin_Handled;
return Plugin_Continue;
}
public Action Timer_AllowKitPickup(Handle h, int entity) {
disabledItem[entity] = 0;
return Plugin_Handled;
}
public void OnMapStart() {
#if PRECACHE_SOUNDS_COUNT > 0
char buffer[128];
for(int i = 0; i < PRECACHE_SOUNDS_COUNT; i++) {
Format(buffer, sizeof(buffer), "sound/%s", PRECACHE_SOUNDS[i]);
AddFileToDownloadsTable(buffer);
PrecacheSound(PRECACHE_SOUNDS[i]);
}
#endif
HookEntityOutput("info_changelevel", "OnStartTouch", EntityOutput_OnStartTouchSaferoom);
HookEntityOutput("trigger_changelevel", "OnStartTouch", EntityOutput_OnStartTouchSaferoom);
}
public void OnConfigsExecuted() {
isL4D1Survivors = L4D2_GetSurvivorSetMap() == 1;
if(hSVMaxPlayers != null && hPlayerLimit.IntValue > 0) {
hSVMaxPlayers.IntValue = hPlayerLimit.IntValue;
}
}
public void OnSceneStageChanged(int scene, SceneStages stage) {
if(stage == SceneStage_Started) {
int activator = GetSceneInitiator(scene);
if(activator == 0) {
static char sceneFile[64];
GetSceneFile(scene, sceneFile, sizeof(sceneFile));
if(StrContains(sceneFile, "scenes/mechanic/dlc1_c6m1_initialmeeting") > -1 || StrEqual(sceneFile, "scenes/teengirl/dlc1_c6m1_initialmeeting07.vcd")) {
CancelScene(scene);
}else if(StrEqual(sceneFile, "scenes/teengirl/dlc1_c6m1_initialmeeting13.vcd") && activator == 0) {
CancelScene(scene);
}
}
}
}
///AFK BOT WEAPON FIX
public void Event_BotPlayerSwap(Event event, const char[] name, bool dontBroadcast) {
int bot = GetClientOfUserId(event.GetInt("bot"));
if(StrEqual(name, "player_bot_replace")) {
// Bot replaced player, hook any drop events
SDKHook(bot, SDKHook_WeaponDrop, Event_OnWeaponDrop);
} else {
// Player replaced a bot
int client = GetClientOfUserId(event.GetInt("player"));
if(client && botDropMeleeWeapon[bot] > 0) {
int meleeOwnerEnt = GetEntPropEnt(botDropMeleeWeapon[bot], Prop_Send, "m_hOwnerEntity");
if(meleeOwnerEnt == -1) {
int currentWeapon = GetPlayerWeaponSlot(client, 1);
if(currentWeapon > 0) {
char buffer[32];
GetEntityClassname(currentWeapon, buffer, sizeof(buffer));
// Only delete their duplicate pistols, let melees get thrown out (into the world)
if(!StrEqual(buffer, "weapon_melee"))
RemoveEntity(currentWeapon);
}
EquipPlayerWeapon(client, botDropMeleeWeapon[bot]);
botDropMeleeWeapon[bot] = -1;
}
}
SDKUnhook(bot, SDKHook_WeaponDrop, Event_OnWeaponDrop);
}
}
Action Event_OnWeaponDrop(int client, int weapon) {
if(!IsValidEntity(weapon) || !IsFakeClient(client)) return Plugin_Continue;
if(GetEntProp(client, Prop_Send, "m_humanSpectatorUserID") > 0) {
char wpn[32];
GetEdictClassname(weapon, wpn, sizeof(wpn));
if(StrEqual(wpn, "weapon_melee") || StrEqual(wpn, "weapon_pistol_magnum")) {
#if defined DEBUG
PrintToServer("Bot %N dropped melee weapon %s", client, wpn);
#endif
RequestFrame(Frame_HideEntity, weapon);
botDropMeleeWeapon[client] = weapon;
}
}
return Plugin_Continue;
}
void Frame_HideEntity(int entity) {
if(IsValidEntity(entity))
TeleportEntity(entity, OUT_OF_BOUNDS, NULL_VECTOR, NULL_VECTOR);
}
// Only called for bots, kills zombies behind bots, preventing them being stuck when their AI doesn't want to keep them alive
Action Event_OnTakeDamageBot(int victim, int& attacker, int& inflictor, float& damage, int& damagetype) {
if(attacker > MaxClients) {
static char name[16];
GetEdictClassname(attacker, name, sizeof(name));
if(!StrEqual(name, "infected", true)) {
return Plugin_Continue;
}
bool attackerVisible = IsEntityInSightRange(victim, attacker, 130.0, 10000.0);
if(!attackerVisible) {
//Zombie is behind the bot, reduce damage taken and slowly kill zombie (1/10 of default hp per hit)
damage /= 2.0;
SDKHooks_TakeDamage(attacker, victim, victim, 30.0);
return Plugin_Changed;
}
}
return Plugin_Continue;
}
//MINOR FIXES
void EntityOutput_OnStartTouchSaferoom(const char[] output, int caller, int client, float time) {
if(client > 0 && client <= MaxClients && IsValidClient(client) && GetClientTeam(client) == 2) {
if(StrEqual(gamemode, "coop", false)) {
if(botDropMeleeWeapon[client] > 0) {
PrintToServer("Giving melee weapon back to %N", client);
float pos[3];
GetClientAbsOrigin(client, pos);
TeleportEntity(botDropMeleeWeapon[client], pos, NULL_VECTOR, NULL_VECTOR);
EquipPlayerWeapon(client, botDropMeleeWeapon[client]);
botDropMeleeWeapon[client] = -1;
}
} else if(StrEqual(gamemode, "tankrun", false)) {
if(!IsFakeClient(client)) {
CreateTimer(1.0, Timer_TPBots, client, TIMER_FLAG_NO_MAPCHANGE);
}
}
}
}
Action Timer_TPBots(Handle timer, int user) {
float pos[3];
GetClientAbsOrigin(user, pos);
for(int i = 1; i < MaxClients + 1; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && IsFakeClient(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i)) {
TeleportEntity(i, pos, NULL_VECTOR, NULL_VECTOR);
L4D2_RunScript("CommandABot({cmd=1,bot=GetPlayerFromUserID(%i),pos=Vector(%f,%f,%f)})", GetClientUserId(i), pos[0], pos[1], pos[2]);
}
}
return Plugin_Handled;
}
//FRIENDLY FIRE NOTICE
public void Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast) {
if(hFFNotice.IntValue > 0) {
int victim = GetClientOfUserId(event.GetInt("userid"));
int attacker = GetClientOfUserId(event.GetInt("attacker"));
int dmg = event.GetInt("dmg_health");
if(dmg > 0) {
if(attacker > 0 && !IsFakeClient(attacker) && attacker != victim) {
if(GetClientTeam(attacker) == 2 && GetClientTeam(victim) == 2) {
if(hFFNotice.IntValue == 1) {
PrintHintTextToAll("%N has done %d HP of friendly fire damage to %N", attacker, dmg, victim);
}else{
PrintToChatAll("%N has done %d HP of friendly fire damage to %N", attacker, dmg, victim);
}
}
}
}
}
}
//LASER SIGHT NOTICE
void Event_PlayerUse(Event event, const char[] name, bool dontBroadcast) {
if(hLaserNotice.BoolValue) {
int client = GetClientOfUserId(event.GetInt("userid"));
int targetEntity = event.GetInt("targetid");
char classname[32];
GetEntityClassname(targetEntity, classname, sizeof(classname));
if(StrEqual(classname, "upgrade_laser_sight")) {
if(LasersUsed.FindValue(targetEntity) == -1) {
LasersUsed.Push(targetEntity);
PrintToChatAll("%N picked up laser sights", client);
}
}
}
}
//FINALE TIME INFO
void Event_GauntletStart(Event event, const char[] name, bool dontBroadcast) {
if(hFinaleTimer.IntValue > 0) {
iFinaleStartTime = GetTime();
}
}
void Event_FinaleStart(Event event, const char[] name, bool dontBroadcast) {
if(hFinaleTimer.IntValue == 2) {
iFinaleStartTime = GetTime();
}
}
void Event_FinaleEnd(Event event, const char[] name, bool dontBroadcast) {
if(hFinaleTimer.IntValue != 0) {
if(iFinaleStartTime != 0) {
int difference = GetTime() - iFinaleStartTime;
char time[32];
FormatSeconds(difference, time, sizeof(time));
PrintToChatAll("Finale took %s to complete", time);
iFinaleStartTime = 0;
}
}
}
//Give kits to bots that replace kicked player
void Event_PlayerFirstSpawn(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
if(client > 0 && IsFakeClient(client) && HasEntProp(client, Prop_Send, "m_humanSpectatorUserID") && GetEntProp(client, Prop_Send, "m_humanSpectatorUserID") < 0) {
int ent = GivePlayerItem(client, "weapon_first_aid_kit");
EquipPlayerWeapon(client, ent);
}
}
/**
* Prints human readable duration from milliseconds
*
* @param ms The duration in milliseconds
* @param str The char array to use for text
* @param strSize The size of the string
*/
stock void FormatSeconds(int raw_sec, char[] str, int strSize) {
int hours = raw_sec / 3600;
int minutes = (raw_sec -(3600*hours))/60;
int seconds = (raw_sec -(3600*hours)-(minutes*60));
if(hours >= 1) {
Format(str, strSize, "%d hours, %d.%d minutes", hours, minutes, seconds);
}else if(minutes >= 1) {
Format(str, strSize, "%d minutes and %d seconds", minutes, seconds);
}else {
Format(str, strSize, "%d seconds", seconds);
}
}

3774
scripting/abm.sp Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,305 @@
#pragma semicolon 1
#pragma newdecls required
//#define DEBUG
#define PUSH_TIMER 60.0
#define PLUGIN_VERSION "1.0"
#include <sourcemod>
#include <sdktools>
//#include <sdkhooks>
public Plugin myinfo =
{
name = "Admin Activity Log",
author = "jackzmc",
description = "",
version = PLUGIN_VERSION,
url = "https://github.com/Jackzmc/sourcemod-plugins"
};
enum struct Log {
char name[32];
char clientSteamID[32];
char targetSteamID[32];
char message[256];
int timestamp;
}
// Plugin data
static ArrayList logs;
static Database g_db;
static char serverID[64];
static Handle pushTimer;
static ConVar hLogCvarChanges;
static char lastMap[64];
//Plugin related
static bool lateLoaded;
static EngineVersion g_Game;
//L4d2 Specific
static char L4D2_ZDifficulty[16];
//Generic
static char currentGamemode[32];
char playerLastName[MAXPLAYERS+1][32];
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
CreateNative("ActivityMonitor_AddLog", Native_AddLog);
lateLoaded = late;
return APLRes_Success;
}
public void OnPluginStart() {
g_Game = GetEngineVersion();
logs = new ArrayList(sizeof(Log));
if(!SQL_CheckConfig("activitymonitor")) {
SetFailState("No database entry for 'activitymonitor'; no database to connect to.");
} else if(!ConnectDB()) {
SetFailState("Failed to connect to database.");
}
hLogCvarChanges = CreateConVar("sm_activitymonitor_log_cvar", "0", "Should this plugin log cvar changes (when using sm_cvar from console)");
ConVar hServerID = CreateConVar("sm_activitymonitor_id", "", "The name to use for the 'server' column", FCVAR_DONTRECORD);
hServerID.GetString(serverID, sizeof(serverID));
hServerID.AddChangeHook(CVAR_ServerIDChanged);
HookEvent("player_first_spawn", Event_Connection);
HookEvent("player_disconnect", Event_Connection);
if(g_Game == Engine_Left4Dead2 || g_Game == Engine_Left4Dead) {
HookEvent("player_incapacitated", Event_L4D2_Incapped);
HookEvent("player_death", Event_L4D2_Death);
ConVar zDifficulty = FindConVar("z_difficulty");
zDifficulty.GetString(L4D2_ZDifficulty, sizeof(L4D2_ZDifficulty));
CVAR_DifficultyChanged(zDifficulty, "", L4D2_ZDifficulty);
zDifficulty.AddChangeHook(CVAR_DifficultyChanged);
zDifficulty.GetString(L4D2_ZDifficulty, sizeof(L4D2_ZDifficulty));
CVAR_DifficultyChanged(zDifficulty, "", L4D2_ZDifficulty);
zDifficulty.AddChangeHook(CVAR_DifficultyChanged);
}
ConVar mpGamemode = FindConVar("mp_gamemode");
if(mpGamemode != null) {
mpGamemode.GetString(currentGamemode, sizeof(currentGamemode));
mpGamemode.AddChangeHook(CVAR_GamemodeChanged);
}
if(!lateLoaded) {
AddLog("INFO", "", "", "Server has started up");
}
pushTimer = CreateTimer(PUSH_TIMER, Timer_PushLogs, _, TIMER_REPEAT);
// AutoExecConfig(true, "activitymonitor");
}
public void OnPluginEnd() {
TriggerTimer(pushTimer, true);
}
public void OnMapEnd() {
TriggerTimer(pushTimer, true);
}
public void OnMapStart() {
static char curMap[64];
GetCurrentMap(curMap, sizeof(curMap));
if(!StrEqual(lastMap, curMap)) {
strcopy(lastMap, sizeof(lastMap), curMap);
if(g_Game == Engine_Left4Dead2 || g_Game == Engine_Left4Dead)
Format(curMap, sizeof(curMap), "Map changed to %s (%s %s)", curMap, L4D2_ZDifficulty, currentGamemode);
else
Format(curMap, sizeof(curMap), "Map changed to %s (%s)", curMap, currentGamemode);
AddLog("INFO", "", "", curMap);
}
TriggerTimer(pushTimer, true);
}
public void CVAR_GamemodeChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
strcopy(currentGamemode, sizeof(currentGamemode), newValue);
}
public void CVAR_ServerIDChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
strcopy(serverID, sizeof(serverID), newValue);
}
public void CVAR_DifficultyChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
if(StrEqual(newValue, "Hard", false)) strcopy(L4D2_ZDifficulty, sizeof(L4D2_ZDifficulty), "Advanced");
else if(StrEqual(newValue, "Impossible", false)) strcopy(L4D2_ZDifficulty, sizeof(L4D2_ZDifficulty), "Expert");
else {
strcopy(L4D2_ZDifficulty, sizeof(L4D2_ZDifficulty), newValue);
// CVAR value could be lowercase 'normal', convert to 'Normal'
L4D2_ZDifficulty[0] = CharToUpper(L4D2_ZDifficulty[0]);
}
}
bool ConnectDB() {
char error[255];
g_db = SQL_Connect("activitymonitor", true, error, sizeof(error));
if (g_db == null) {
LogError("Database error %s", error);
delete g_db;
return false;
} else {
PrintToServer("[ACTM] Connected to database \"activitymonitor\"");
SQL_LockDatabase(g_db);
SQL_FastQuery(g_db, "SET NAMES \"UTF8mb4\"");
SQL_UnlockDatabase(g_db);
g_db.SetCharset("utf8mb4");
return true;
}
}
public Action Timer_PushLogs(Handle h) {
static char query[1024];
static Log log;
int length = logs.Length;
if(length > 0) {
Transaction transaction = new Transaction();
for(int i = 0; i < length; i++) {
logs.GetArray(i, log, sizeof(log));
g_db.Format(query, sizeof(query), "INSERT INTO `activity_log` (`timestamp`, `server`, `type`, `client`, `target`, `message`) VALUES (%d, NULLIF('%s', ''), '%s', NULLIF('%s', ''), NULLIF('%s', ''), NULLIF('%s', ''))",
log.timestamp,
serverID,
log.name,
log.clientSteamID,
log.targetSteamID,
log.message
);
transaction.AddQuery(query);
}
logs.Resize(logs.Length - length);
g_db.Execute(transaction, _, SQL_TransactionFailed, length, DBPrio_Low);
}
return Plugin_Continue;
}
void SQL_TransactionFailed(Database db, any data, int numQueries, const char[] error, int failIndex, any[] queryData) {
LogError("Push transaction failed: %s at query %d/%d", error, failIndex, numQueries);
}
public void Event_Connection(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
if(client > 0 && !IsFakeClient(client)) {
static char clientName[32];
if(GetClientAuthId(client, AuthId_Steam2, clientName, sizeof(clientName))) {
if(name[7] == 'f') {
AddLog("JOIN", clientName, "", "");
GetClientName(client, playerLastName[client], 32);
} else {
static char reason[64];
event.GetString("reason", reason, sizeof(reason));
Format(reason, sizeof(reason), " left: \"%s\"", reason);
AddLog("QUIT", clientName, "", reason);
}
}
}
}
public void Event_PlayerInfo(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
if(client && !IsFakeClient(client) && GetUserAdmin(client) == INVALID_ADMIN_ID) {
char clientName[32];
if(GetClientAuthId(client, AuthId_Steam2, clientName, sizeof(clientName))) {
AddLogCustom("INFO", clientName, "", "\"%s\" changed their name to \"%L\"", playerLastName[client], client);
GetClientName(client, playerLastName[client], 32);
}
}
}
public Action OnLogAction(Handle source, Identity identity, int client, int target, const char[] message) {
// Ignore cvar changed msgs (from server.cfg)
if(client == 0 && !hLogCvarChanges.BoolValue && strcmp(message[31], "changed cvar") >= 0) return Plugin_Continue;
static char clientName[32], targetName[32];
if(client == 0) clientName = "Server";
else if(client > 0) GetClientAuthId(client, AuthId_Steam2, clientName, sizeof(clientName));
else clientName[0] = '\0';
if(target > 0 && !IsFakeClient(target)) GetClientAuthId(target, AuthId_Steam2, targetName, sizeof(targetName));
else targetName[0] = '\0';
AddLog("ACTION", clientName, targetName, message);
return Plugin_Continue;
}
public void OnClientSayCommand_Post(int client, const char[] command, const char[] sArgs) {
if(client > 0 && !IsFakeClient(client)) {
static char clientName[32];
GetClientAuthId(client, AuthId_Steam2, clientName, sizeof(clientName));
AddLog("CHAT", clientName, "", sArgs);
}
}
public void Event_L4D2_Death(Event event, const char[] name, bool dontBroadcast) {
int victim = GetClientOfUserId(event.GetInt("userid"));
int attacker = GetClientOfUserId(event.GetInt("attacker"));
if(victim > 0 && GetClientTeam(victim) == 2) { //victim is a survivor
static char victimName[32], attackerName[32];
if(IsFakeClient(victim)) GetClientName(victim, victimName, sizeof(victimName));
else GetClientAuthId(victim, AuthId_Steam2, victimName, sizeof(victimName));
if(attacker > 0 && attacker != victim) {
if(IsFakeClient(attacker)) GetClientName(attacker, attackerName, sizeof(attackerName));
else GetClientAuthId(attacker, AuthId_Steam2, attackerName, sizeof(attackerName));
AddLogCustom("STATE", attackerName, victimName, "\"%L\" killed \"%L\"", attacker, victim);
} else {
AddLogCustom("STATE", "", victimName, "\"%L\" died", victim);
}
}
}
//Player was incapped by Jockey
//Player was incapped (by world/zombie, no msg)
public void Event_L4D2_Incapped(Event event, const char[] name, bool dontBroadcast) {
int victim = GetClientOfUserId(event.GetInt("userid"));
int attacker = GetClientOfUserId(event.GetInt("attacker"));
if(victim > 0 && GetClientTeam(victim) == 2) {
static char victimName[32], attackerName[32];
if(IsFakeClient(victim)) GetClientName(victim, victimName, sizeof(victimName));
else GetClientAuthId(victim, AuthId_Steam2, victimName, sizeof(victimName));
if(attacker > 0 && attacker != victim) {
if(IsFakeClient(attacker)) GetClientName(attacker, attackerName, sizeof(attackerName));
else GetClientAuthId(attacker, AuthId_Steam2, attackerName, sizeof(attackerName));
AddLogCustom("STATE", attackerName, victimName, "\"%L\" incapped \"%L\"", attacker, victim);
} else {
AddLogCustom("STATE", "", victimName, "\"%L\" was incapped", victim);
}
}
}
void AddLog(const char[] type, const char[] clientName, const char[] targetName, const char[] message) {
if(StrEqual(clientName, "Bot")) return;
Log log;
strcopy(log.name, sizeof(log.name), type);
strcopy(log.clientSteamID, sizeof(log.clientSteamID), clientName);
strcopy(log.targetSteamID, sizeof(log.targetSteamID), targetName);
strcopy(log.message, sizeof(log.message), message);
log.timestamp = GetTime();
logs.PushArray(log);
}
void AddLogCustom(const char[] type, const char[] clientName, const char[] targetName, const char[] format, any ...) {
static char message[254];
if(StrEqual(clientName, "Bot")) return;
VFormat(message, sizeof(message), format, 5);
AddLog(type, clientName, targetName, message);
}
public any Native_AddLog(Handle plugin, int numParams) {
char type[32], clientName[32], targetName[32], message[256];
if(GetNativeString(1, type, sizeof(type)) != SP_ERROR_NONE) return false;
if(GetNativeString(2, clientName, sizeof(clientName)) != SP_ERROR_NONE) return false;
if(GetNativeString(3, targetName, sizeof(targetName)) != SP_ERROR_NONE) return false;
if(GetNativeString(4, message, sizeof(message)) != SP_ERROR_NONE) return false;
AddLog(type, clientName, targetName, message);
return true;
}

423
scripting/adminpanel.sp Normal file
View file

@ -0,0 +1,423 @@
#pragma semicolon 1
#define DEBUG
// Update intervals (only sends when > 0 players)
// The update interval when there are active viewers
#define UPDATE_INTERVAL 5.0
// The update interval when there are no viewers on.
// We still need to poll to know how many viewers are watching
#define UPDATE_INTERVAL_SLOW 20.0
#include <sourcemod>
#include <sdktools>
#include <ripext>
#include <left4dhooks>
#include <multicolors>
#include <jutils>
#pragma newdecls required
public Plugin myinfo =
{
name = "Admin Panel",
author = "Jackz",
description = "Plugin to integrate with admin panel",
version = "1.0.0",
url = "https://github.com/jackzmc/l4d2-admin-dash"
};
ConVar cvar_debug;
ConVar cvar_postAddress; char postAddress[128];
ConVar cvar_authKey; char authKey[512];
ConVar cvar_gamemode; char gamemode[32];
char currentMap[64];
int numberOfPlayers = 0;
int lastSuccessTime;
int campaignStartTime;
int lastErrorCode;
int uptime;
bool fastUpdateMode = false;
Handle updateTimer = null;
char steamidCache[MAXPLAYERS+1][32];
char nameCache[MAXPLAYERS+1][MAX_NAME_LENGTH];
int g_icBeingHealed[MAXPLAYERS+1];
int playerJoinTime[MAXPLAYERS+1];
public void OnPluginStart()
{
uptime = GetTime();
cvar_debug = CreateConVar("sm_adminpanel_debug", "0", "Turn on debug mode", FCVAR_DONTRECORD, true, 0.0, true, 1.0);
cvar_postAddress = CreateConVar("sm_adminpanel_url", "", "The base address to post updates to", FCVAR_NONE);
cvar_postAddress.AddChangeHook(OnCvarChanged);
cvar_postAddress.GetString(postAddress, sizeof(postAddress));
cvar_authKey = CreateConVar("sm_adminpanel_key", "", "The authentication key", FCVAR_NONE);
cvar_authKey.AddChangeHook(OnCvarChanged);
cvar_authKey.GetString(authKey, sizeof(authKey));
cvar_gamemode = FindConVar("mp_gamemode");
cvar_gamemode.AddChangeHook(OnCvarChanged);
cvar_gamemode.GetString(gamemode, sizeof(gamemode));
HookEvent("game_init", Event_GameStart);
HookEvent("heal_success", Event_HealStop);
HookEvent("heal_interrupted", Event_HealStop);
HookEvent("player_first_spawn", Event_PlayerFirstSpawn);
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i)) {
OnClientPutInServer(i);
}
}
TryStartTimer(true);
AutoExecConfig(true, "adminpanel");
RegAdminCmd("sm_panel_status", Command_PanelStatus, ADMFLAG_GENERIC);
}
#define DATE_FORMAT "%F at %I:%M %p"
Action Command_PanelStatus(int client, int args) {
ReplyToCommand(client, "Active: %b", updateTimer != null);
ReplyToCommand(client, "#Players: %d", numberOfPlayers);
ReplyToCommand(client, "Update Interval: %0f s", fastUpdateMode ? UPDATE_INTERVAL : UPDATE_INTERVAL_SLOW);
char buffer[32];
ReplyToCommand(client, "Last Error Code: %d", lastErrorCode);
if(lastSuccessTime > 0)
FormatTime(buffer, sizeof(buffer), DATE_FORMAT, lastSuccessTime);
else
Format(buffer, sizeof(buffer), "(none)");
ReplyToCommand(client, "Last Success: %s", buffer);
return Plugin_Handled;
}
void TryStartTimer(bool fast = true) {
if(numberOfPlayers > 0 && updateTimer == null && postAddress[0] != '\0' && authKey[0] != 0) {
fastUpdateMode = fast;
float interval = fast ? UPDATE_INTERVAL : UPDATE_INTERVAL_SLOW;
updateTimer = CreateTimer(interval, Timer_PostStatus, _, TIMER_REPEAT);
PrintToServer("[AdminPanel] Updating every %.1f seconds", interval);
}
}
void Event_GameStart(Event event, const char[] name, bool dontBroadcast) {
campaignStartTime = GetTime();
}
void Event_HealStart(Event event, const char[] name, bool dontBroadcast) {
int healing = GetClientOfUserId(event.GetInt("subject"));
g_icBeingHealed[healing] = true;
}
void Event_HealStop(Event event, const char[] name, bool dontBroadcast) {
int healing = GetClientOfUserId(event.GetInt("subject"));
g_icBeingHealed[healing] = false;
}
void Event_PlayerFirstSpawn(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
playerJoinTime[client] = GetTime();
RecalculatePlayerCount();
}
void RecalculatePlayerCount() {
int players = 0;
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient(i)) {
players++;
}
}
numberOfPlayers = players;
}
public void OnMapStart() {
GetCurrentMap(currentMap, sizeof(currentMap));
numberOfPlayers = 0;
}
// Player counts
public void OnClientPutInServer(int client) {
GetClientName(client, nameCache[client], MAX_NAME_LENGTH);
if(!IsFakeClient(client)) {
GetClientAuthId(client, AuthId_SteamID64, steamidCache[client], 32);
numberOfPlayers++;
TryStartTimer(true);
} else {
strcopy(steamidCache[client], 32, "BOT");
}
}
public void OnClientDisconnect(int client) {
steamidCache[client][0] = '\0';
nameCache[client][0] = '\0';
if(!IsFakeClient(client)) {
numberOfPlayers--;
// Incase somehow we lost track
if(numberOfPlayers < 0) {
numberOfPlayers = 0;
}
if(numberOfPlayers == 0 && updateTimer != null) {
delete updateTimer;
}
}
}
// Cvar updates
void OnCvarChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
if(cvar_postAddress == convar) {
strcopy(postAddress, sizeof(postAddress), newValue);
PrintToServer("[AdminPanel] Update Url has updated");
} else if(cvar_authKey == convar) {
strcopy(authKey, sizeof(authKey), newValue);
PrintToServer("[AdminPanel] Auth key has been updated");
} else if(cvar_gamemode == convar) {
strcopy(gamemode, sizeof(gamemode), newValue);
}
TryStartTimer(true);
}
bool isSubmitting;
Action Timer_PostStatus(Handle h) {
if(isSubmitting) return Plugin_Continue;
isSubmitting = true;
// TODO: optimize only if someone is requesting live
HTTPRequest req = new HTTPRequest(postAddress);
JSONObject obj = GetObject();
req.SetHeader("x-authtoken", authKey);
// req.AppendFormParam("playerCount", "%d", numberOfPlayers);
// req.AppendFormParam("map", currentMap);
if(cvar_debug.BoolValue) PrintToServer("[AdminPanel] Submitting");
req.Post(obj, Callback_PostStatus);
delete obj;
// req.PostForm(Callback_PostStatus);
return Plugin_Continue;
}
void Callback_PostStatus(HTTPResponse response, any value, const char[] error) {
isSubmitting = false;
if(response.Status == HTTPStatus_NoContent || response.Status == HTTPStatus_OK) {
lastErrorCode = 0;
lastSuccessTime = GetTime();
if(cvar_debug.BoolValue)
PrintToServer("[AdminPanel] Response: OK/204");
// We have subscribers, kill timer and recreate it in fast mode (if not already):
if(!fastUpdateMode) {
PrintToServer("[AdminPanel] Switching to fast update interval for active viewers.");
if(updateTimer != null)
delete updateTimer;
TryStartTimer(true);
}
} else if(response.Status == HTTPStatus_Gone) {
lastErrorCode = 0;
// We have no subscribers, kill timer and recreate it in slow mode (if not already):
if(fastUpdateMode) {
PrintToServer("[AdminPanel] Switching to slow update interval, no viewers");
if(updateTimer != null)
delete updateTimer;
TryStartTimer(false);
}
} else {
lastErrorCode = view_as<int>(response.Status);
lastSuccessTime = 0;
// TODO: backoff
PrintToServer("[AdminPanel] Getting response: %d", response.Status);
if(cvar_debug.BoolValue) {
char buffer[64];
JSONObject json = view_as<JSONObject>(response.Data);
if(false && json.GetString("error", buffer, sizeof(buffer))) {
PrintToServer("[AdminPanel] Got %d response from server: \"%s\"", view_as<int>(response.Status), buffer);
json.GetString("message", buffer, sizeof(buffer));
PrintToServer("[AdminPanel] Error message: \"%s\"", buffer);
} else {
PrintToServer("[AdminPanel] Got %d response from server: <unknown json>\n%s", view_as<int>(response.Status), error);
}
}
if(response.Status == HTTPStatus_Unauthorized || response.Status == HTTPStatus_Forbidden) {
PrintToServer("[AdminPanel] API Key seems to be invalid, killing timer.");
if(updateTimer != null)
delete updateTimer;
}
}
}
JSONObject GetObject() {
JSONObject obj = new JSONObject();
obj.SetInt("playerCount", numberOfPlayers);
obj.SetString("map", currentMap);
obj.SetString("gamemode", gamemode);
obj.SetInt("startTime", uptime);
obj.SetInt("commonsCount", L4D_GetCommonsCount());
obj.SetFloat("fps", 1.0 / GetGameFrameTime());
AddFinaleInfo(obj);
JSONArray players = GetPlayers();
obj.Set("players", players);
delete players;
obj.SetFloat("refreshInterval", UPDATE_INTERVAL);
obj.SetInt("lastUpdateTime", GetTime());
obj.SetInt("campaignStartTime", campaignStartTime);
return obj;
}
void AddFinaleInfo(JSONObject parentObj) {
if(L4D_IsMissionFinalMap()) {
JSONObject obj = new JSONObject();
obj.SetBool("escapeLeaving", L4D_IsFinaleEscapeInProgress());
obj.SetInt("finaleStage", L4D2_GetCurrentFinaleStage());
parentObj.Set("finaleInfo", obj);
delete obj;
}
}
JSONArray GetPlayers() {
JSONArray players = new JSONArray();
for(int i = 1; i <= MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i)) {
int team = GetClientTeam(i);
if( team == 2 || team == 3) {
JSONObject player = GetPlayer(i);
players.Push(player);
delete player;
}
}
}
return players;
}
enum {
Action_BeingHealed = -1,
Action_None = 0, // No use action active
Action_Healing = 1, // Includes healing yourself or a teammate.
Action_AmmoPack = 2, // When deploying the ammo pack that was never added into the game
Action_Defibing = 4, // When defib'ing a dead body.
Action_GettingDefibed = 5, // When comming back to life from a dead body.
Action_DeployIncendiary = 6, // When deploying Incendiary ammo
Action_DeployExplosive = 7, // When deploying Explosive ammo
Action_PouringGas = 8, // Pouring gas into a generator
Action_Cola = 9, // For Dead Center map 2 cola event, when handing over the cola to whitalker.
Action_Button = 10, // Such as buttons, timed buttons, generators, etc.
Action_UsePointScript = 11 // When using a "point_script_use_target" entity
}
int GetAction(int client) {
if(g_icBeingHealed[client]) return Action_BeingHealed;
return view_as<int>(L4D2_GetPlayerUseAction(client));
}
enum {
Move_UnderAttack = -3,
Move_Hanging = -2,
Move_Incapped = -1,
Move_Idle = 0,
Move_Walk = 1,
Move_Run = 2,
Move_Crouched = 3,
Move_Ladder = 4
}
stock float GetPlayerSpeed(int client) {
int iVelocity = FindSendPropInfo("CTerrorPlayer", "m_vecVelocity[0]");
float velocity[3];
GetEntDataVector(client, iVelocity, velocity);
return GetVectorLength(velocity, false);
}
int GetPlayerMovement(int client) {
MoveType moveType = GetEntityMoveType(client);
if(moveType == MOVETYPE_LADDER) return Move_Ladder;
else if(GetEntProp(client, Prop_Send, "m_bDucked", 1)) return Move_Crouched;
else if(GetEntProp(client, Prop_Send, "m_isIncapacitated", 1)) return Move_Incapped;
else if(GetEntProp(client, Prop_Send, "m_isHangingFromLedge", 1)) return Move_Hanging;
else if(L4D_GetPinnedSurvivor(client)) return Move_UnderAttack; // TODO: optimize for events
float velocity = GetPlayerSpeed(client);
if(velocity > 85.0) return Move_Run;
else if(velocity > 1.0) return Move_Walk;
return Move_Idle;
}
// TODO: pursued by witch
enum {
pState_BlackAndWhite = 1,
pState_InSaferoom = 2,
pState_IsCalm = 4,
pState_IsBoomed = 8
}
stock bool IsPlayerBoomed(int client) {
return (GetEntPropFloat(client, Prop_Send, "m_vomitStart") + 20.1) > GetGameTime();
}
int GetPlayerStates(int client) {
int state = 0;
if(L4D_IsInLastCheckpoint(client) || L4D_IsInFirstCheckpoint(client))
state |= pState_InSaferoom;
if(GetEntProp(client, Prop_Send, "m_bIsOnThirdStrike", 1)) state |= pState_BlackAndWhite;
if(GetEntProp(client, Prop_Send, "m_isCalm")) state |= pState_IsCalm;
if(IsPlayerBoomed(client)) state |= pState_IsBoomed;
return state;
}
JSONObject GetPlayer(int client) {
int team = GetClientTeam(client);
JSONObject player = new JSONObject();
player.SetString("steamid", steamidCache[client]);
player.SetInt("userId", GetClientUserId(client));
player.SetString("name", nameCache[client]);
player.SetInt("team", team);
player.SetBool("isAlive", IsPlayerAlive(client));
player.SetInt("joinTime", playerJoinTime[client]);
player.SetInt("permHealth", GetEntProp(client, Prop_Send, "m_iHealth"));
if(team == 2) {
// Include idle players (player here is their idle bot)
if(IsFakeClient(client)) {
int idlePlayer = L4D_GetIdlePlayerOfBot(client);
if(idlePlayer > 0) {
player.SetString("idlePlayerId", steamidCache[idlePlayer]);
if(IsClientInGame(idlePlayer)) {
JSONObject idlePlayerObj = GetPlayer(idlePlayer);
player.Set("idlePlayer", idlePlayerObj);
delete idlePlayerObj;
}
}
}
player.SetInt("action", GetAction(client));
player.SetInt("flowProgress", L4D2_GetVersusCompletionPlayer(client));
player.SetFloat("flow", L4D2Direct_GetFlowDistance(client));
player.SetBool("isPinned", L4D2_GetInfectedAttacker(client) > 0);
player.SetInt("tempHealth", L4D_GetPlayerTempHealth(client));
player.SetInt("states", GetPlayerStates(client));
player.SetInt("move", GetPlayerMovement(client));
player.SetInt("survivor", GetEntProp(client, Prop_Send, "m_survivorCharacter"));
JSONArray weapons = GetPlayerWeapons(client);
player.Set("weapons", weapons);
delete weapons;
} else if(team == 3) {
player.SetInt("class", L4D2_GetPlayerZombieClass(client));
player.SetInt("maxHealth", GetEntProp(client, Prop_Send, "m_iMaxHealth"));
int victim = L4D2_GetSurvivorVictim(client);
if(victim > 0)
player.SetString("pinnedSurvivorId", steamidCache[victim]);
}
return player;
}
JSONArray GetPlayerWeapons(int client) {
JSONArray weapons = new JSONArray();
static char buffer[64];
for(int slot = 0; slot < 6; slot++) {
if(GetClientWeaponNameSmart(client, slot, buffer, sizeof(buffer))) {
weapons.PushString(buffer);
} else {
weapons.PushNull();
}
}
return weapons;
}

441
scripting/basechat.sp Normal file
View file

@ -0,0 +1,441 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod Basic Chat Plugin
* Implements basic communication commands.
*
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
public Plugin myinfo =
{
name = "Basic Chat+",
author = "AlliedModders LLC",
description = "Basic Communication Commands",
version = SOURCEMOD_VERSION,
url = "http://www.sourcemod.net/"
};
#define CHAT_SYMBOL '@'
char g_ColorNames[13][10] = {"White", "Red", "Green", "Blue", "Yellow", "Purple", "Cyan", "Orange", "Pink", "Olive", "Lime", "Violet", "Lightblue"};
int g_Colors[13][3] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{255,0,255},{0,255,255},{255,128,0},{255,0,128},{128,255,0},{0,255,128},{128,0,255},{0,128,255}};
ConVar g_Cvar_Chatmode;
EngineVersion g_GameEngine = Engine_Unknown;
public void OnPluginStart()
{
LoadTranslations("common.phrases");
g_GameEngine = GetEngineVersion();
g_Cvar_Chatmode = CreateConVar("sm_chat_mode", "1", "Allows player's to send messages to admin chat.", 0, true, 0.0, true, 1.0);
RegAdminCmd("sm_say", Command_SmSay, ADMFLAG_CHAT, "sm_say <message> - sends message to all players");
RegAdminCmd("sm_csay", Command_SmCsay, ADMFLAG_CHAT, "sm_csay <message> - sends centered message to all players");
/* HintText does not work on Dark Messiah */
if (g_GameEngine != Engine_DarkMessiah)
{
RegAdminCmd("sm_hsay", Command_SmHsay, ADMFLAG_CHAT, "sm_hsay <message> - sends hint message to all players");
}
RegAdminCmd("sm_tsay", Command_SmTsay, ADMFLAG_CHAT, "sm_tsay [color] <message> - sends top-left message to all players");
RegAdminCmd("sm_chat", Command_SmChat, ADMFLAG_CHAT, "sm_chat <message> - sends message to admins");
RegAdminCmd("sm_psay", Command_SmPsay, ADMFLAG_CHAT, "sm_psay <name or #userid> <message> - sends private message");
RegAdminCmd("sm_msay", Command_SmMsay, ADMFLAG_CHAT, "sm_msay <message> - sends message as a menu panel");
}
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
{
int startidx;
if (sArgs[startidx] != CHAT_SYMBOL)
return Plugin_Continue;
startidx++;
if (strcmp(command, "say", false) == 0)
{
if (sArgs[startidx] != CHAT_SYMBOL) // sm_say alias
{
if (!CheckCommandAccess(client, "sm_chat", ADMFLAG_CHAT))
{
return Plugin_Continue;
}
SendChatToAdmins(client, sArgs[startidx]);
LogAction(client, -1, "\"%L\" triggered sm_say (text %s)", client, sArgs[startidx]);
return Plugin_Stop;
}
startidx++;
if (sArgs[startidx] != CHAT_SYMBOL) // sm_psay alias
{
if (!CheckCommandAccess(client, "sm_psay", ADMFLAG_CHAT))
{
return Plugin_Continue;
}
char arg[64];
int len = BreakString(sArgs[startidx], arg, sizeof(arg));
int target = FindTarget(client, arg, true, false);
if (target == -1 || len == -1) {
PrintToChat(client, "Cannot send a private msg: Invalid user specified.");
} else {
SendPrivateChat(client, target, sArgs[startidx+len]);
}
return Plugin_Stop;
}
startidx++;
// sm_csay alias
if (!CheckCommandAccess(client, "sm_csay", ADMFLAG_CHAT))
{
return Plugin_Continue;
}
DisplayCenterTextToAll(client, sArgs[startidx]);
LogAction(client, -1, "\"%L\" triggered sm_csay (text %s)", client, sArgs[startidx]);
return Plugin_Stop;
}
else if (strcmp(command, "say_team", false) == 0 || strcmp(command, "say_squad", false) == 0)
{
if (!CheckCommandAccess(client, "sm_chat", ADMFLAG_CHAT) && !g_Cvar_Chatmode.BoolValue)
{
return Plugin_Continue;
}
SendChatToAdmins(client, sArgs[startidx]);
LogAction(client, -1, "\"%L\" triggered sm_chat (text %s)", client, sArgs[startidx]);
return Plugin_Stop;
}
return Plugin_Continue;
}
public Action Command_SmSay(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_say <message>");
return Plugin_Handled;
}
char text[192];
GetCmdArgString(text, sizeof(text));
SendChatToAll(client, text);
LogAction(client, -1, "\"%L\" triggered sm_say (text %s)", client, text);
return Plugin_Handled;
}
public Action Command_SmCsay(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_csay <message>");
return Plugin_Handled;
}
char text[192];
GetCmdArgString(text, sizeof(text));
DisplayCenterTextToAll(client, text);
LogAction(client, -1, "\"%L\" triggered sm_csay (text %s)", client, text);
return Plugin_Handled;
}
public Action Command_SmHsay(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_hsay <message>");
return Plugin_Handled;
}
char text[192];
GetCmdArgString(text, sizeof(text));
char nameBuf[MAX_NAME_LENGTH];
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
{
continue;
}
FormatActivitySource(client, i, nameBuf, sizeof(nameBuf));
PrintHintText(i, "%s: %s", nameBuf, text);
}
LogAction(client, -1, "\"%L\" triggered sm_hsay (text %s)", client, text);
return Plugin_Handled;
}
public Action Command_SmTsay(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_tsay <message>");
return Plugin_Handled;
}
char text[192], colorStr[16];
GetCmdArgString(text, sizeof(text));
int len = BreakString(text, colorStr, 16);
int color = FindColor(colorStr);
char nameBuf[MAX_NAME_LENGTH];
if (color == -1)
{
color = 0;
len = 0;
}
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
{
continue;
}
FormatActivitySource(client, i, nameBuf, sizeof(nameBuf));
SendDialogToOne(i, color, "%s: %s", nameBuf, text[len]);
}
LogAction(client, -1, "\"%L\" triggered sm_tsay (text %s)", client, text);
return Plugin_Handled;
}
public Action Command_SmChat(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_chat <message>");
return Plugin_Handled;
}
char text[192];
GetCmdArgString(text, sizeof(text));
SendChatToAdmins(client, text);
LogAction(client, -1, "\"%L\" triggered sm_chat (text %s)", client, text);
return Plugin_Handled;
}
public Action Command_SmPsay(int client, int args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_psay <name or #userid> <message>");
return Plugin_Handled;
}
char text[192], arg[64];
GetCmdArgString(text, sizeof(text));
int len = BreakString(text, arg, sizeof(arg));
int target = FindTarget(client, arg, true, false);
if (target == -1)
return Plugin_Handled;
SendPrivateChat(client, target, text[len]);
return Plugin_Handled;
}
public Action Command_SmMsay(int client, int args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_msay <message>");
return Plugin_Handled;
}
char text[192];
GetCmdArgString(text, sizeof(text));
SendPanelToAll(client, text);
LogAction(client, -1, "\"%L\" triggered sm_msay (text %s)", client, text);
return Plugin_Handled;
}
int FindColor(const char[] color)
{
for (int i = 0; i < sizeof(g_ColorNames); i++)
{
if (strcmp(color, g_ColorNames[i], false) == 0)
return i;
}
return -1;
}
void SendChatToAll(int client, const char[] message)
{
char nameBuf[MAX_NAME_LENGTH];
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
{
continue;
}
FormatActivitySource(client, i, nameBuf, sizeof(nameBuf));
if (g_GameEngine == Engine_CSGO)
PrintToChat(i, " \x01\x0B\x04%t: \x01%s", "Say all", nameBuf, message);
else
PrintToChat(i, "\x04%t: \x01%s", "Say all", nameBuf, message);
}
}
void DisplayCenterTextToAll(int client, const char[] message)
{
char nameBuf[MAX_NAME_LENGTH];
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
{
continue;
}
FormatActivitySource(client, i, nameBuf, sizeof(nameBuf));
PrintCenterText(i, "%s: %s", nameBuf, message);
}
}
void SendChatToAdmins(int from, const char[] message)
{
int fromAdmin = CheckCommandAccess(from, "sm_chat", ADMFLAG_CHAT);
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && (from == i || CheckCommandAccess(i, "sm_chat", ADMFLAG_CHAT)))
{
if (g_GameEngine == Engine_CSGO)
PrintToChat(i, " \x01\x0B\x04%t: \x01%s", fromAdmin ? "Chat admins" : "Chat to admins", from, message);
else
PrintToChat(i, "\x04%t: \x01%s", fromAdmin ? "Chat admins" : "Chat to admins", from, message);
}
}
}
void SendDialogToOne(int client, int color, const char[] text, any ...)
{
char message[100];
VFormat(message, sizeof(message), text, 4);
KeyValues kv = new KeyValues("Stuff", "title", message);
kv.SetColor("color", g_Colors[color][0], g_Colors[color][1], g_Colors[color][2], 255);
kv.SetNum("level", 1);
kv.SetNum("time", 10);
CreateDialog(client, kv, DialogType_Msg);
delete kv;
}
void SendPrivateChat(int client, int target, const char[] message)
{
if (!client)
{
PrintToServer("(Private to %N) %N: %s", target, client, message);
}
else if (target != client)
{
if (g_GameEngine == Engine_CSGO)
PrintToChat(client, " \x01\x0B\x04%t: \x01%s", "Private say to", target, client, message);
else
PrintToChat(client, "\x04%t: \x01%s", "Private say to", target, client, message);
}
if (g_GameEngine == Engine_CSGO)
PrintToChat(target, " \x01\x0B\x04%t: \x01%s", "Private say to", target, client, message);
else
PrintToChat(target, "\x04%t: \x01%s", "Private say to", target, client, message);
LogAction(client, target, "\"%L\" triggered sm_psay to \"%L\" (text %s)", client, target, message);
}
void SendPanelToAll(int from, char[] message)
{
char title[100];
Format(title, 64, "%N:", from);
ReplaceString(message, 192, "\\n", "\n");
Panel mSayPanel = new Panel();
mSayPanel.SetTitle(title);
mSayPanel.DrawItem("", ITEMDRAW_SPACER);
mSayPanel.DrawText(message);
mSayPanel.DrawItem("", ITEMDRAW_SPACER);
mSayPanel.CurrentKey = GetMaxPageItems(mSayPanel.Style);
mSayPanel.DrawItem("Exit", ITEMDRAW_CONTROL);
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i) && !IsFakeClient(i))
{
mSayPanel.Send(i, Handler_DoNothing, 10);
}
}
delete mSayPanel;
}
public int Handler_DoNothing(Menu menu, MenuAction action, int param1, int param2)
{
return 0;
/* Do nothing */
}

68
scripting/csgo-knifehp.sp Normal file
View file

@ -0,0 +1,68 @@
#pragma semicolon 1
#define DEBUG
#define PLUGIN_NAME "CSGO Knife Regen"
#define PLUGIN_AUTHOR "jackzmc"
#define PLUGIN_VERSION "1.00"
#define PLUGIN_DESCRIPTION ""
#include <sourcemod>
#include <sdktools>
#include <cstrike>
//#include <sdkhooks>
EngineVersion g_Game;
public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
description = PLUGIN_DESCRIPTION,
version = PLUGIN_VERSION,
url = ""
};
ConVar g_bKnifeHPEnabled, g_iKnifeHPMax, g_iKnifeHPRegain;
public OnPluginStart()
{
g_Game = GetEngineVersion();
if (g_Game != Engine_CSGO && g_Game != Engine_CSS)
{
SetFailState("This plugin is for CSGO/CSS only.");
}
g_bKnifeHPEnabled = CreateConVar("knifehp_enable", "1", "Enable regaining health on knife kill", FCVAR_NONE, true, 0.0, true, 1.0);
g_iKnifeHPMax = CreateConVar("knifehp_max_health", "100", "Maximum health to set an attacker to", FCVAR_NONE, true, 0.0);
g_iKnifeHPRegain = CreateConVar("knifehp_amount", "100", "Amount of health to give attacker", FCVAR_NONE, true, 0.0);
HookEvent("player_death", Event_PlayerDeath);
AutoExecConfig(true, "csgo_knifehp");
}
public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
if (g_bKnifeHPEnabled.BoolValue) {
char weapon_name[64];
event.GetString("weapon", weapon_name, sizeof(weapon_name));
if (StrContains(weapon_name, "knife", false) > -1) {
int attacker = event.GetInt("attacker");
int client = GetClientOfUserId(attacker);
//get the new health value (current client hp + the regen amount)
int new_health = GetClientHealth(client) + g_iKnifeHPRegain.IntValue;
//50 + 20 <= max
if (IsClientInGame(client) && IsPlayerAlive(client) && !IsFakeClient(client)) {
if(new_health <= g_iKnifeHPMax.IntValue) { //if the new health is less than max, set it to it
SetEntityHealth(client, new_health);
}else{ //if > max, set it to max
SetEntityHealth(client, g_iKnifeHPMax.IntValue);
}
}
}
}
}

60
scripting/csgo-misc.sp Normal file
View file

@ -0,0 +1,60 @@
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"
#include <sourcemod>
#include <sdktools>
#include <cstrike>
//#include <sdkhooks>
#pragma newdecls required
public Plugin myinfo =
{
name = "",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
EngineVersion g_Game = GetEngineVersion();
if(g_Game != Engine_CSGO && g_Game != Engine_CSS)
{
SetFailState("This plugin is for CSGO/CSS only.");
}
RegConsoleCmd("sm_first", Command_FirstPov, "Go back to first person");
RegConsoleCmd("sm_third", Command_ThirdPov, "Go to third person");
}
public Action Command_FirstPov(int client, int args) {
if(client == 0) {
ReplyToCommand(client, "This command is for clients only");
return Plugin_Handled;
}
CheatCommand(client, "firstperson", "", "");
return Plugin_Handled;
}
public Action Command_ThirdPov(int client, int args) {
if(client == 0) {
ReplyToCommand(client, "This command is for clients only");
return Plugin_Handled;
}
CheatCommand(client, "thirdperson", "", "");
return Plugin_Handled;
}
stock void CheatCommand(int client, char[] command, char[] argument1, char[] argument2)
{
int userFlags = GetUserFlagBits(client);
SetUserFlagBits(client, ADMFLAG_ROOT);
int flags = GetCommandFlags(command);
SetCommandFlags(command, flags & ~FCVAR_CHEAT);
FakeClientCommand(client, "%s %s %s", command, argument1, argument2);
SetCommandFlags(command, flags);
SetUserFlagBits(client, userFlags);
}

View file

@ -0,0 +1,84 @@
#include <sourcemod>
#include <sdktools_functions>
#include <sdktools_entinput>
// Fixed issues:
// - Server crash when kicking a bot who have been an active target of camera (point_viewcontrol_survivor)
// - Multiple visual spectator bugs after team swap in finale
public void Event_round_start_pre_entity(Event event, const char[] name, bool dontBroadcast)
{
static char classes[][] = {
"point_viewcontrol",
"point_viewcontrol_survivor",
"point_viewcontrol_multiplayer",
};
for (int i = 0; i < sizeof(classes); i++) {
int entity = INVALID_ENT_REFERENCE;
while ((entity = FindEntityByClassname(entity, classes[i])) != INVALID_ENT_REFERENCE) {
// Invoke a "Disable" input on camera entities to free all players
// Doing so on round_start_pre_entity should help to not let map logic kick in too early
AcceptEntityInput(entity, "Disable");
}
}
}
public void OnClientDisconnect(int client)
{
if (!IsClientInGame(client)) {
return;
}
int viewEntity = GetEntPropEnt(client, Prop_Send, "m_hViewEntity");
if (!IsValidEdict(viewEntity)) {
return;
}
char cls[64];
GetEdictClassname(viewEntity, cls, sizeof(cls));
if (strncmp(cls, "point_viewcontrol", 17) != 0) {
return;
}
// Matches CSurvivorCamera, CTriggerCamera
if (strcmp(cls[17], "_survivor") == 0 || cls[17] == '\0') {
// Disable entity to prevent CMoveableCamera::FollowTarget to cause a crash
// m_hTargetEnt EHANDLE is not checked for existence and can be NULL
// CBaseEntity::GetAbsAngles being called on causing a crash
AcceptEntityInput(viewEntity, "Disable");
}
// Matches CTriggerCameraMultiplayer
if (strcmp(cls[17], "_multiplayer") == 0) {
AcceptEntityInput(viewEntity, "RemovePlayer", client);
}
}
public void OnPluginStart()
{
HookEvent("round_start_pre_entity", Event_round_start_pre_entity, EventHookMode_PostNoCopy);
}
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
switch (GetEngineVersion()) {
case Engine_Left4Dead2, Engine_Left4Dead:
{
return APLRes_Success;
}
}
strcopy(error, err_max, "Plugin only supports Left 4 Dead and Left 4 Dead 2.");
return APLRes_SilentFailure;
}
public Plugin myinfo =
{
name = "[L4D/2] Unlink Camera Entities",
author = "shqke",
description = "Frees cached players from camera entity",
version = "1.1",
url = "https://github.com/shqke/sp_public"
};

323
scripting/globalbans.sp Normal file
View file

@ -0,0 +1,323 @@
#pragma semicolon 1
#pragma newdecls required
#define DEBUG 0
#define PLUGIN_VERSION "1.0"
#define DB_NAME "globalbans"
#define BANFLAG_NONE 0
#define BANFLAG_IPBANNED 1
#define BANFLAG_SUSPENDED 2
#include <sourcemod>
#include <sdktools>
public Plugin myinfo =
{
name = "Global Bans",
author = "jackzmc",
description = "Manages bans via MySQL",
version = PLUGIN_VERSION,
url = "https://github.com/Jackzmc/sourcemod-plugins"
};
static Database g_db;
static ConVar hKickType;
static StringMap pendingInsertQueries;
static int iPendingCounter;
public void OnPluginStart() {
if(!SQL_CheckConfig(DB_NAME)) {
SetFailState("No database entry for " ... DB_NAME ... "; no database to connect to.");
}
if(!ConnectDB()) {
SetFailState("Failed to connect to database.");
}
pendingInsertQueries = new StringMap();
hKickType = CreateConVar("sm_globalbans_kick_type", "1", "0 = Do not kick, just notify\n1 = Kick if banned\n 2 = Kick if cannot reach database", FCVAR_NONE, true, 0.0, true, 2.0);
}
///////////////////////////////////////////////////////////////////////////////
// DB Connections
///////////////////////////////////////////////////////////////////////////////
bool ConnectDB() {
static char error[255];
g_db = SQL_Connect(DB_NAME, true, error, sizeof(error));
if (g_db == null) {
LogError("Database error %s", error);
delete g_db;
return false;
} else {
PrintToServer("Connected to sm database " ... DB_NAME);
SQL_LockDatabase(g_db);
SQL_FastQuery(g_db, "SET NAMES \"UTF8mb4\"");
SQL_UnlockDatabase(g_db);
g_db.SetCharset("utf8mb4");
return true;
}
}
///////////////////////////////////////////////////////////////////////////////
// EVENTS
///////////////////////////////////////////////////////////////////////////////
public void OnClientAuthorized(int client, const char[] auth) {
if(!StrEqual(auth, "BOT", true)) {
static char query[256], ip[32];
GetClientIP(client, ip, sizeof(ip));
g_db.Format(query, sizeof(query), "SELECT `reason`, `steamid`, `expired`, `public_message`, `flags`, `id` FROM `bans` WHERE `expired` = 0 AND `steamid` LIKE 'STEAM_%%:%%:%s' OR ip = '%s'", auth[10], ip);
g_db.Query(DB_OnConnectCheck, query, GetClientUserId(client), DBPrio_High);
}
}
public Action OnBanIdentity(const char[] identity, int time, int flags, const char[] reason, const char[] command, any source) {
if(flags == BANFLAG_AUTHID) {
char executor[32];
if(source > 0 && source <= MaxClients) {
GetClientAuthId(source, AuthId_Steam2, executor, sizeof(executor));
}else{
executor = "CONSOLE";
}
char query[512];
// Setup expiration date
char expiresDate[64];
if(time > 0) {
Format(expiresDate, sizeof(expiresDate), "%d", GetTime() + (time * 60000));
}else{
Format(expiresDate, sizeof(expiresDate), "NULL");
}
g_db.Format(query, sizeof(query), "INSERT INTO bans"
..."(steamid, reason, expires, executor, flags, timestamp)"
..."VALUES ('%s', '%s', %s, '%s', %d, UNIX_TIMESTAMP())",
identity,
reason,
expiresDate,
executor,
BANFLAG_NONE
);
static char strKey[8];
int key = ++iPendingCounter;
IntToString(key, strKey, sizeof(strKey));
pendingInsertQueries.SetString(strKey, query);
g_db.Format(query, sizeof(query), "SELECT `flags` FROM `bans` WHERE `expired` = 0 AND `steamid` LIKE 'STEAM_%%:%%:%s' OR ip = '%s'", identity[10], identity);
g_db.Query(DB_OnBanPreCheck, query, key);
PrintToServer("Adding %s to OnBanClient queue. Key: %d", identity, key);
}else if(flags == BANFLAG_IP) {
LogMessage("Cannot save IP without steamid: %s [Source: %s]", identity, source);
}
return Plugin_Continue;
}
public Action OnBanClient(int client, int time, int flags, const char[] reason, const char[] kick_message, const char[] command, any source) {
if(GetUserAdmin(client) != INVALID_ADMIN_ID) {
LogMessage("Ignoring OnBanClient with admin id as target");
return Plugin_Stop;
}
char executor[32], identity[32], ip[32];
GetClientAuthId(client, AuthId_Steam2, identity, sizeof(identity));
LogMessage("OnBanClient client=%d flags=%d source=%d, command=%s", client, flags, source, command);
DataPack pack;
if(source > 0 && source <= MaxClients && IsClientConnected(source) && GetClientAuthId(source, AuthId_Steam2, executor, sizeof(executor))) {
pack = new DataPack();
pack.WriteString(identity);
pack.WriteCell(source);
}else{
executor = "CONSOLE";
}
GetClientIP(client, ip, sizeof(ip));
char query[512];
char expiresDate[64];
if(time > 0) {
Format(expiresDate, sizeof(expiresDate), "%d", GetTime() + (time * 60));
} else {
Format(expiresDate, sizeof(expiresDate), "NULL");
}
g_db.Format(query, sizeof(query), "INSERT INTO bans"
..."(steamid, ip, reason, public_message, expires, executor, flags, timestamp)"
..."VALUES ('%s', '%s', '%s', '%s', %s, '%s', %d, UNIX_TIMESTAMP())",
identity,
ip,
reason,
kick_message,
expiresDate,
executor,
BANFLAG_NONE
);
static char strKey[8];
int key = ++iPendingCounter;
IntToString(key, strKey, sizeof(strKey));
pendingInsertQueries.SetString(strKey, query);
g_db.Format(query, sizeof(query), "SELECT `flags` FROM `bans` WHERE `expired` = 0 AND `steamid` LIKE 'STEAM_%%:%%:%s' OR ip = '%s'", identity[10], identity);
g_db.Query(DB_OnBanPreCheck, query, key);
PrintToServer("Adding %N to OnBanClient queue. Key: %d", client, key);
// TODO: REMOVE : FOR DEBUG
return Plugin_Handled;
return Plugin_Continue;
}
public Action OnRemoveBan(const char[] identity, int flags, const char[] command, any source) {
if(flags == BANFLAG_AUTHID) {
static char query[128];
g_db.Format(query, sizeof(query), "DELETE FROM `bans` WHERE steamid = '%s'", identity);
g_db.Query(DB_GenericCallback, query, flags);
}
return Plugin_Continue;
}
///////////////////////////////////////////////////////////////////////////////
// DB Callbacks
///////////////////////////////////////////////////////////////////////////////
//] DB_OnBanQuery returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
public void DB_OnBanPreCheck(Database db, DBResultSet results, const char[] error, int key) {
static char strKey[8];
IntToString(key, strKey, sizeof(strKey));
static char query[255];
pendingInsertQueries.GetString(strKey, query, sizeof(query));
if(results == null || db == INVALID_HANDLE) {
LogError("Ban Pre-check: Cannot check for existing ban, ignoring ban attempt. [Query: %s]", query);
} else {
if(results.FetchRow()) {
int flags = results.FetchInt(0);
if(~flags & BANFLAG_SUSPENDED) {
LogMessage("Ban Pre-check: Found existing non-suspended ban, ignoring ban attempt. [Query: %s]", query);
return;
}
}
g_db.Query(DB_OnBanQuery, query);
}
}
public void DB_OnConnectCheck(Database db, DBResultSet results, const char[] error, int user) {
int client = GetClientOfUserId(user);
if(db == INVALID_HANDLE || results == null) {
LogError("DB_OnConnectCheck returned error: %s", error);
if(client > 0 && hKickType.IntValue == 2) {
KickClient(client, "Could not authenticate at this time.");
LogMessage("Could not connect to database to authorize user '%N' (#%d)", client, user);
}
} else {
//No failure, check the data.
while(client > 0 && results.FetchRow()) { //Is there a ban found?
static char reason[255], steamid[64], public_message[255];
DBResult colResult;
results.FetchString(0, reason, sizeof(reason), colResult);
results.FetchString(1, steamid, sizeof(steamid));
if(colResult == DBVal_Null) {
reason[0] = '\0';
}
bool expired = results.FetchInt(2) == 1; //Check if computed column 'expired' is true
if(results.IsFieldNull(2)) { //If expired null, delete i guess. lol
DeleteBan(steamid);
} else {
int flags = results.FetchInt(4);
if(!expired && (~flags & BANFLAG_SUSPENDED)) {
LogAction(-1, client, "\"%L\" (%s), is banned from server: \"%s\"", client, steamid, reason);
// Fetch public message
results.FetchString(3, public_message, sizeof(public_message), colResult);
if(colResult == DBVal_Null || strlen(public_message) == 0) {
public_message = reason;
}
int id = results.FetchInt(5);
if(hKickType.IntValue > 0) {
if(public_message[0] != '\0')
KickClient(client, "Banned:\n%s\nAppeal at jackz.me/apl/%d", public_message, id);
else
KickClient(client, "You have been banned from this server.\nAppeal at jackz.me/apl/%d", id);
static char query[128];
g_db.Format(query, sizeof(query), "UPDATE bans SET times_tried=times_tried+1 WHERE steamid = '%s'", steamid);
g_db.Query(DB_GenericCallback, query);
} else {
PrintChatToAdmins("\"%L\" was banned from this server for: \"%s\"", client, reason);
}
static char query[128];
g_db.Format(query, sizeof(query), "UPDATE bans SET times_tried=times_tried+1 WHERE steamid = '%s'", steamid);
g_db.Query(DB_GenericCallback, query);
} else {
LogAction(-1, client, "\"%L\" was previously banned from server: \"%s\"", client, reason);
// User was previously banned
PrintChatToAdmins("%N (%s) has a previous suspended/expired ban of reason \"%s\"", client, steamid, reason);
}
}
}
}
}
void DeleteBan(const char[] steamid) {
static char query[128];
g_db.Format(query, sizeof(query), "DELETE FROM `bans` WHERE steamid = '%s'", steamid);
g_db.Query(DB_GenericCallback, query);
}
public void DB_OnBanQuery(Database db, DBResultSet results, const char[] error, any data) {
if(db == INVALID_HANDLE || results == null) {
LogError("DB_OnBanQuery returned error: %s", error);
DataPack pack = data;
if(pack != null) {
pack.Reset();
static char id[32];
pack.ReadString(id, sizeof(id));
int source = pack.ReadCell();
if(StrContains(error, "Duplicate entry") > 0) {
PrintToChat(source, "Could not ban \"%s\", as they were previously banned. Please edit the ban manually on the website (or yell at jackz).", id);
} else {
PrintToChat(source, "Could not ban \"%s\" due to an error: %s", id, error);
}
}
}
}
public void DB_GenericCallback(Database db, DBResultSet results, const char[] error, any data) {
if(db == INVALID_HANDLE || results == null) {
LogError("DB_OnRemoveBanQuery returned error: %s", error);
}
}
stock void PrintChatToAdmins(const char[] format, any ...) {
char buffer[254];
VFormat(buffer, sizeof(buffer), format, 2);
for(int i = 1; i < MaxClients; i++) {
if(IsClientConnected(i) && IsClientInGame(i)) {
AdminId admin = GetUserAdmin(i);
if(admin != INVALID_ADMIN_ID) {
PrintToChat(i, "%s", buffer);
}
}
}
PrintToServer("%s", buffer);
}

View file

@ -0,0 +1,43 @@
#if defined _CreateSurvivorBot_included
#endinput
#endif
#define _CreateSurvivorBot_included
native int NextBotCreatePlayerBotSurvivorBot(const char[] _szName = NULL_STRING);
native bool CTerrorPlayerRoundRespawn(int _iClientIndex);
stock int CreateSurvivorBot()
{
int bot = NextBotCreatePlayerBotSurvivorBot(NULL_STRING);
if( IsValidEntity(bot) )
{
ChangeClientTeam(bot, 2);
if( !IsPlayerAlive(bot) )
{
CTerrorPlayerRoundRespawn(bot);
}
return bot;
}
return -1;
}
public SharedPlugin __pl_shope =
{
name = "CreateSurvivorBot",
file = "CreateSurvivorBot.smx",
#if defined REQUIRE_PLUGIN
required = 1
#else
required = 0
#endif
};
#if !defined REQUIRE_PLUGIN
public void __pl_CreateSurvivorBot_SetNTVOptional()
{
MarkNativeAsOptional("NextBotCreatePlayerBotSurvivorBot");
MarkNativeAsOptional("CTerrorPlayerRoundRespawn");
}
#endif

View file

@ -0,0 +1,413 @@
#if defined _SteamWorks_Included
#endinput
#endif
#define _SteamWorks_Included
/* results from UserHasLicenseForApp */
enum EUserHasLicenseForAppResult
{
k_EUserHasLicenseResultHasLicense = 0, // User has a license for specified app
k_EUserHasLicenseResultDoesNotHaveLicense = 1, // User does not have a license for the specified app
k_EUserHasLicenseResultNoAuth = 2, // User has not been authenticated
};
/* General result codes */
enum EResult
{
k_EResultOK = 1, // success
k_EResultFail = 2, // generic failure
k_EResultNoConnection = 3, // no/failed network connection
// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
k_EResultInvalidPassword = 5, // password/ticket is invalid
k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere
k_EResultInvalidProtocolVer = 7, // protocol version is incorrect
k_EResultInvalidParam = 8, // a parameter is incorrect
k_EResultFileNotFound = 9, // file was not found
k_EResultBusy = 10, // called method busy - action not taken
k_EResultInvalidState = 11, // called object was in an invalid state
k_EResultInvalidName = 12, // name is invalid
k_EResultInvalidEmail = 13, // email is invalid
k_EResultDuplicateName = 14, // name is not unique
k_EResultAccessDenied = 15, // access is denied
k_EResultTimeout = 16, // operation timed out
k_EResultBanned = 17, // VAC2 banned
k_EResultAccountNotFound = 18, // account not found
k_EResultInvalidSteamID = 19, // steamID is invalid
k_EResultServiceUnavailable = 20, // The requested service is currently unavailable
k_EResultNotLoggedOn = 21, // The user is not logged on
k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party)
k_EResultEncryptionFailure = 23, // Encryption or Decryption failed
k_EResultInsufficientPrivilege = 24, // Insufficient privilege
k_EResultLimitExceeded = 25, // Too much of a good thing
k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes)
k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired
k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again
k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time
k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user
k_EResultIPNotFound = 31, // IP address not found
k_EResultPersistFailed = 32, // failed to write change to the data store
k_EResultLockingFailed = 33, // failed to acquire access lock for this operation
k_EResultLogonSessionReplaced = 34,
k_EResultConnectFailed = 35,
k_EResultHandshakeFailed = 36,
k_EResultIOFailure = 37,
k_EResultRemoteDisconnect = 38,
k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested
k_EResultBlocked = 40, // a user didn't allow it
k_EResultIgnored = 41, // target is ignoring sender
k_EResultNoMatch = 42, // nothing matching the request found
k_EResultAccountDisabled = 43,
k_EResultServiceReadOnly = 44, // this service is not accepting content changes right now
k_EResultAccountNotFeatured = 45, // account doesn't have value, so this feature isn't available
k_EResultAdministratorOK = 46, // allowed to take this action, but only because requester is admin
k_EResultContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol.
k_EResultTryAnotherCM = 48, // The current CM can't service the user making a request, user should try another.
k_EResultPasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed.
k_EResultAlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait
k_EResultSuspended = 51, // Long running operation (content download) suspended/paused
k_EResultCancelled = 52, // Operation canceled (typically by user: content download)
k_EResultDataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable
k_EResultDiskFull = 54, // Operation canceled - not enough disk space.
k_EResultRemoteCallFailed = 55, // an remote call or IPC call failed
k_EResultPasswordUnset = 56, // Password could not be verified as it's unset server side
k_EResultExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account
k_EResultPSNTicketInvalid = 58, // PSN ticket was invalid
k_EResultExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first
k_EResultRemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files
k_EResultIllegalPassword = 61, // The requested new password is not legal
k_EResultSameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer )
k_EResultAccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure
k_EResultCannotUseOldPassword = 64, // The requested new password is not legal
k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid
k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
k_EResultHardwareNotCapableOfIPT = 67, //
k_EResultIPTInitError = 68, //
k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
k_EResultFacebookQueryError = 70, // Facebook query returned an error
k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired
k_EResultIPLoginRestrictionFailed = 72,
k_EResultAccountLockedDown = 73,
k_EResultAccountLogonDeniedVerifiedEmailRequired = 74,
k_EResultNoMatchingURL = 75,
k_EResultBadResponse = 76, // parse failure, missing field, etc.
k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password
k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range
k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen
k_EResultDisabled = 80, // The requested service has been configured to be unavailable
k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid !
k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action
k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted
k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent
k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted
k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch
k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
k_EResultAccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners
k_EResultNotModified = 91, // data not modified
k_EResultNoMobileDevice = 92, // the account does not have a mobile device associated with it
k_EResultTimeNotSynced = 93, // the time presented is out of range or tolerance
k_EResultSmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.)
k_EResultAccountLimitExceeded = 95, // Too many accounts access this resource
k_EResultAccountActivityLimitExceeded = 96, // Too many changes to this account
k_EResultPhoneActivityLimitExceeded = 97, // Too many changes to this phone
k_EResultRefundToWallet = 98, // Cannot refund to payment method, must use wallet
k_EResultEmailSendFailure = 99, // Cannot send an email
k_EResultNotSettled = 100, // Can't perform operation till payment has settled
k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha
k_EResultGSLTDenied = 102, // a game server login token owned by this token's owner has been banned
k_EResultGSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone)
k_EResultInvalidItemType = 104 // the type of thing we were requested to act on is invalid
};
/* This enum is used in client API methods, do not re-number existing values. */
enum EHTTPMethod
{
k_EHTTPMethodInvalid = 0,
k_EHTTPMethodGET,
k_EHTTPMethodHEAD,
k_EHTTPMethodPOST,
k_EHTTPMethodPUT,
k_EHTTPMethodDELETE,
k_EHTTPMethodOPTIONS,
k_EHTTPMethodPATCH,
// The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for
// a compliant general purpose server. We'll likely add more as we find uses for them.
// k_EHTTPMethodTRACE,
// k_EHTTPMethodCONNECT
};
/* HTTP Status codes that the server can send in response to a request, see rfc2616 section 10.3 for descriptions
of each of these. */
enum EHTTPStatusCode
{
// Invalid status code (this isn't defined in HTTP, used to indicate unset in our code)
k_EHTTPStatusCodeInvalid = 0,
// Informational codes
k_EHTTPStatusCode100Continue = 100,
k_EHTTPStatusCode101SwitchingProtocols = 101,
// Success codes
k_EHTTPStatusCode200OK = 200,
k_EHTTPStatusCode201Created = 201,
k_EHTTPStatusCode202Accepted = 202,
k_EHTTPStatusCode203NonAuthoritative = 203,
k_EHTTPStatusCode204NoContent = 204,
k_EHTTPStatusCode205ResetContent = 205,
k_EHTTPStatusCode206PartialContent = 206,
// Redirection codes
k_EHTTPStatusCode300MultipleChoices = 300,
k_EHTTPStatusCode301MovedPermanently = 301,
k_EHTTPStatusCode302Found = 302,
k_EHTTPStatusCode303SeeOther = 303,
k_EHTTPStatusCode304NotModified = 304,
k_EHTTPStatusCode305UseProxy = 305,
//k_EHTTPStatusCode306Unused = 306, (used in old HTTP spec, now unused in 1.1)
k_EHTTPStatusCode307TemporaryRedirect = 307,
// Error codes
k_EHTTPStatusCode400BadRequest = 400,
k_EHTTPStatusCode401Unauthorized = 401, // You probably want 403 or something else. 401 implies you're sending a WWW-Authenticate header and the client can sent an Authorization header in response.
k_EHTTPStatusCode402PaymentRequired = 402, // This is reserved for future HTTP specs, not really supported by clients
k_EHTTPStatusCode403Forbidden = 403,
k_EHTTPStatusCode404NotFound = 404,
k_EHTTPStatusCode405MethodNotAllowed = 405,
k_EHTTPStatusCode406NotAcceptable = 406,
k_EHTTPStatusCode407ProxyAuthRequired = 407,
k_EHTTPStatusCode408RequestTimeout = 408,
k_EHTTPStatusCode409Conflict = 409,
k_EHTTPStatusCode410Gone = 410,
k_EHTTPStatusCode411LengthRequired = 411,
k_EHTTPStatusCode412PreconditionFailed = 412,
k_EHTTPStatusCode413RequestEntityTooLarge = 413,
k_EHTTPStatusCode414RequestURITooLong = 414,
k_EHTTPStatusCode415UnsupportedMediaType = 415,
k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416,
k_EHTTPStatusCode417ExpectationFailed = 417,
k_EHTTPStatusCode4xxUnknown = 418, // 418 is reserved, so we'll use it to mean unknown
k_EHTTPStatusCode429TooManyRequests = 429,
// Server error codes
k_EHTTPStatusCode500InternalServerError = 500,
k_EHTTPStatusCode501NotImplemented = 501,
k_EHTTPStatusCode502BadGateway = 502,
k_EHTTPStatusCode503ServiceUnavailable = 503,
k_EHTTPStatusCode504GatewayTimeout = 504,
k_EHTTPStatusCode505HTTPVersionNotSupported = 505,
k_EHTTPStatusCode5xxUnknown = 599,
};
/* list of possible return values from the ISteamGameCoordinator API */
enum EGCResults
{
k_EGCResultOK = 0,
k_EGCResultNoMessage = 1, // There is no message in the queue
k_EGCResultBufferTooSmall = 2, // The buffer is too small for the requested message
k_EGCResultNotLoggedOn = 3, // The client is not logged onto Steam
k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage
};
native bool SteamWorks_IsVACEnabled();
native bool SteamWorks_GetPublicIP(int ipaddr[4]);
native void SteamWorks_GetPublicIPCell();
native bool SteamWorks_IsLoaded();
native bool SteamWorks_SetGameData(const char[] sData);
native bool SteamWorks_SetGameDescription(const char[] sDesc);
native bool SteamWorks_SetMapName(const char[] sMapName);
native bool SteamWorks_IsConnected();
native bool SteamWorks_SetRule(const char[] sKey, const char[] sValue);
native bool SteamWorks_ClearRules();
native bool SteamWorks_ForceHeartbeat();
native bool SteamWorks_GetUserGroupStatus(int client, int groupid);
native bool SteamWorks_GetUserGroupStatusAuthID(int authid, int groupid);
native EUserHasLicenseForAppResult SteamWorks_HasLicenseForApp(int client, int app);
native EUserHasLicenseForAppResult SteamWorks_HasLicenseForAppId(int authid, int app);
native void SteamWorks_GetClientSteamID(int client, char[] sSteamID, int length);
native bool SteamWorks_RequestStatsAuthID(int authid, int appid);
native bool SteamWorks_RequestStats(int client, int appid);
native bool SteamWorks_GetStatCell(int client, const char[] sKey, int &value);
native bool SteamWorks_GetStatAuthIDCell(int authid, const char[] sKey, int &value);
native bool SteamWorks_GetStatFloat(int client, const char[] sKey, float &value);
native bool SteamWorks_GetStatAuthIDFloat(int authid, const char[] sKey, float &value);
native Handle SteamWorks_CreateHTTPRequest(EHTTPMethod method, const char[] sURL);
native bool SteamWorks_SetHTTPRequestContextValue(Handle hHandle, any data1, any data2 = 0);
native bool SteamWorks_SetHTTPRequestNetworkActivityTimeout(Handle hHandle, int timeout);
native bool SteamWorks_SetHTTPRequestHeaderValue(Handle hHandle, const char[] sName, const char[] sValue);
native bool SteamWorks_SetHTTPRequestGetOrPostParameter(Handle hHandle, const char[] sName, const char[] sValue);
native bool SteamWorks_SetHTTPRequestUserAgentInfo(Handle hHandle, const char[] sUserAgentInfo);
native bool SteamWorks_SetHTTPRequestRequiresVerifiedCertificate(Handle hHandle, bool bRequireVerifiedCertificate);
native bool SteamWorks_SetHTTPRequestAbsoluteTimeoutMS(Handle hHandle, int unMilliseconds);
#if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 9
typeset SteamWorksHTTPRequestCompleted
{
function void (Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode);
function void (Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode, any data1);
function void (Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode, any data1, any data2);
};
typeset SteamWorksHTTPHeadersReceived
{
function void (Handle hRequest, bool bFailure);
function void (Handle hRequest, bool bFailure, any data1);
function void (Handle hRequest, bool bFailure, any data1, any data2);
};
typeset SteamWorksHTTPDataReceived
{
function void (Handle hRequest, bool bFailure, int offset, int bytesreceived);
function void (Handle hRequest, bool bFailure, int offset, int bytesreceived, any data1);
function void (Handle hRequest, bool bFailure, int offset, int bytesreceived, any data1, any data2);
};
typeset SteamWorksHTTPBodyCallback
{
function void (const char[] sData);
function void (const char[] sData, any value);
function void (const int[] data, any value, int datalen);
};
#else
funcenum SteamWorksHTTPRequestCompleted
{
public(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode:eStatusCode),
public(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode:eStatusCode, any:data1),
public(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode:eStatusCode, any:data1, any:data2)
};
funcenum SteamWorksHTTPHeadersReceived
{
public(Handle hRequest, bool bFailure),
public(Handle hRequest, bool bFailure, any:data1),
public(Handle hRequest, bool bFailure, any:data1, any:data2)
};
funcenum SteamWorksHTTPDataReceived
{
public(Handle hRequest, bool bFailure, offset, bytesreceived),
public(Handle hRequest, bool bFailure, offset, bytesreceived, any:data1),
public(Handle hRequest, bool bFailure, offset, bytesreceived, any:data1, any:data2)
};
funcenum SteamWorksHTTPBodyCallback
{
public(const char sData[]),
public(const char sData[], any:value),
public(const data[], any:value, datalen)
};
#endif
native bool SteamWorks_SetHTTPCallbacks(Handle hHandle, SteamWorksHTTPRequestCompleted fCompleted = INVALID_FUNCTION, SteamWorksHTTPHeadersReceived fHeaders = INVALID_FUNCTION, SteamWorksHTTPDataReceived fData = INVALID_FUNCTION, Handle hCalling = INVALID_HANDLE);
native bool SteamWorks_SendHTTPRequest(Handle hRequest);
native bool SteamWorks_SendHTTPRequestAndStreamResponse(Handle hRequest);
native bool SteamWorks_DeferHTTPRequest(Handle hRequest);
native bool SteamWorks_PrioritizeHTTPRequest(Handle hRequest);
native bool SteamWorks_GetHTTPResponseHeaderSize(Handle hRequest, const char[] sHeader, int &size);
native bool SteamWorks_GetHTTPResponseHeaderValue(Handle hRequest, const char[] sHeader, char[] sValue, int size);
native bool SteamWorks_GetHTTPResponseBodySize(Handle hRequest, int &size);
native bool SteamWorks_GetHTTPResponseBodyData(Handle hRequest, char[] sBody, int length);
native bool SteamWorks_GetHTTPStreamingResponseBodyData(Handle hRequest, int cOffset, char[] sBody, int length);
native bool SteamWorks_GetHTTPDownloadProgressPct(Handle hRequest, float &percent);
native bool SteamWorks_GetHTTPRequestWasTimedOut(Handle hRequest, bool & bWasTimedOut);
native bool SteamWorks_SetHTTPRequestRawPostBody(Handle hRequest, const char[] sContentType, const char[] sBody, int bodylen);
native bool SteamWorks_SetHTTPRequestRawPostBodyFromFile(Handle hRequest, const char[] sContentType, const char[] sFileName);
native bool SteamWorks_GetHTTPResponseBodyCallback(Handle hRequest, SteamWorksHTTPBodyCallback fCallback, any data = 0, Handle hPlugin = INVALID_HANDLE); /* Look up, moved definition for 1.7+ compat. */
native bool SteamWorks_WriteHTTPResponseBodyToFile(Handle hRequest, const char[] sFileName);
forward void SW_OnValidateClient(int ownerauthid, int authid);
forward void SteamWorks_OnValidateClient(int ownerauthid, int authid);
forward void SteamWorks_SteamServersConnected();
forward void SteamWorks_SteamServersConnectFailure(EResult result);
forward void SteamWorks_SteamServersDisconnected(EResult result);
forward Action SteamWorks_RestartRequested();
forward void SteamWorks_TokenRequested(char[] sToken, int maxlen);
forward void SteamWorks_OnClientGroupStatus(int authid, int groupid, bool isMember, bool isOfficer);
forward EGCResults SteamWorks_GCSendMessage(int unMsgType, const char[] pubData, int cubData);
forward void SteamWorks_GCMsgAvailable(int cubData);
forward EGCResults SteamWorks_GCRetrieveMessage(int punMsgType, const char[] pubDest, int cubDest, int pcubMsgSize);
native EGCResults SteamWorks_SendMessageToGC(int unMsgType, const char[] pubData, int cubData);
public Extension __ext_SteamWorks =
{
name = "SteamWorks",
file = "SteamWorks.ext",
#if defined AUTOLOAD_EXTENSIONS
autoload = 1,
#else
autoload = 0,
#endif
#if defined REQUIRE_EXTENSIONS
required = 1,
#else
required = 0,
#endif
};
#if !defined REQUIRE_EXTENSIONS
public __ext_SteamWorks_SetNTVOptional()
{
MarkNativeAsOptional("SteamWorks_IsVACEnabled");
MarkNativeAsOptional("SteamWorks_GetPublicIP");
MarkNativeAsOptional("SteamWorks_GetPublicIPCell");
MarkNativeAsOptional("SteamWorks_IsLoaded");
MarkNativeAsOptional("SteamWorks_SetGameData");
MarkNativeAsOptional("SteamWorks_SetGameDescription");
MarkNativeAsOptional("SteamWorks_IsConnected");
MarkNativeAsOptional("SteamWorks_SetRule");
MarkNativeAsOptional("SteamWorks_ClearRules");
MarkNativeAsOptional("SteamWorks_ForceHeartbeat");
MarkNativeAsOptional("SteamWorks_GetUserGroupStatus");
MarkNativeAsOptional("SteamWorks_GetUserGroupStatusAuthID");
MarkNativeAsOptional("SteamWorks_HasLicenseForApp");
MarkNativeAsOptional("SteamWorks_HasLicenseForAppId");
MarkNativeAsOptional("SteamWorks_GetClientSteamID");
MarkNativeAsOptional("SteamWorks_RequestStatsAuthID");
MarkNativeAsOptional("SteamWorks_RequestStats");
MarkNativeAsOptional("SteamWorks_GetStatCell");
MarkNativeAsOptional("SteamWorks_GetStatAuthIDCell");
MarkNativeAsOptional("SteamWorks_GetStatFloat");
MarkNativeAsOptional("SteamWorks_GetStatAuthIDFloat");
MarkNativeAsOptional("SteamWorks_SendMessageToGC");
MarkNativeAsOptional("SteamWorks_CreateHTTPRequest");
MarkNativeAsOptional("SteamWorks_SetHTTPRequestContextValue");
MarkNativeAsOptional("SteamWorks_SetHTTPRequestNetworkActivityTimeout");
MarkNativeAsOptional("SteamWorks_SetHTTPRequestHeaderValue");
MarkNativeAsOptional("SteamWorks_SetHTTPRequestGetOrPostParameter");
MarkNativeAsOptional("SteamWorks_SetHTTPCallbacks");
MarkNativeAsOptional("SteamWorks_SendHTTPRequest");
MarkNativeAsOptional("SteamWorks_SendHTTPRequestAndStreamResponse");
MarkNativeAsOptional("SteamWorks_DeferHTTPRequest");
MarkNativeAsOptional("SteamWorks_PrioritizeHTTPRequest");
MarkNativeAsOptional("SteamWorks_GetHTTPResponseHeaderSize");
MarkNativeAsOptional("SteamWorks_GetHTTPResponseHeaderValue");
MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodySize");
MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodyData");
MarkNativeAsOptional("SteamWorks_GetHTTPStreamingResponseBodyData");
MarkNativeAsOptional("SteamWorks_GetHTTPDownloadProgressPct");
MarkNativeAsOptional("SteamWorks_SetHTTPRequestRawPostBody");
MarkNativeAsOptional("SteamWorks_SetHTTPRequestRawPostBodyFromFile");
MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodyCallback");
MarkNativeAsOptional("SteamWorks_WriteHTTPResponseBodyToFile");
}
#endif

View file

@ -0,0 +1,962 @@
#if defined _actions_included
#endinput
#endif
#define _actions_included
#define ACTION_NAME_LENGTH 32
enum ActionResultType
{
CONTINUE, // continue executing this action next frame - nothing has changed
CHANGE_TO, // change actions next frame
SUSPEND_FOR, // put the current action on hold for the new action
DONE, // this action has finished, resume suspended action
SUSTAIN, // for use with event handlers - a way to say "It's important to keep doing what I'm doing"
};
enum EventResultPriorityType
{
RESULT_NONE, // no result
RESULT_TRY, // use this result, or toss it out, either is ok
RESULT_IMPORTANT, // try extra-hard to use this result
RESULT_CRITICAL // this result must be used - emit an error if it can't be
};
enum BehaviorAction
{
INVALID_ACTION
};
/**
* @brief Callback called for every entity action.
*
* @param action Action address
*
* @noreturn
*/
typedef ActionsIteratorCallback = function void (BehaviorAction action);
/**
* @brief Called whenever action is created
*
* @param action Created action address
* @param actor Actor of the action
* @param name Name of the action
*
* @noreturn
*/
forward void OnActionCreated( BehaviorAction action, int actor, const char[] name );
/**
* @brief Called whenever action is destroyed
* @note You are in action destructor!
*
* @param action Destroyed action address
* @param actor Actor of the action
* @param name Name of the action
*
* @noreturn
*/
forward void OnActionDestroyed( BehaviorAction action, int actor, const char[] name );
methodmap ActionResult
{
/**
* @brief Gets action result reason
*
* @param destination Buffer to store reason
* @param maxlength Length of the buffer
*
* @noreturn
*/
public native void GetReason( char[] destination, int maxlength );
/**
* @brief Sets action result reason
*
* @param reason String with reason
*
* @noreturn
*/
public native void SetReason( const char[] reason );
/**
* @brief Property to get/set result type
*
* @return Result type (see ActionResultType)
*/
property ActionResultType type
{
public native get();
public native set(ActionResultType type);
}
/**
* @brief Property to get/set result action
*
* @return Result action
*/
property BehaviorAction action
{
public native get();
public native set(BehaviorAction action);
}
/**
* @brief Checks if result is requesting change
*
* @return true if it is requesting, false otherwise
*/
public bool IsRequestingChange()
{
ActionResultType type = this.type;
return (type == CHANGE_TO || type == SUSPEND_FOR || type == DONE);
}
}
methodmap ActionDesiredResult < ActionResult
{
/**
* @brief Property to get/set result priority
*
* @return Result priority
*/
property EventResultPriorityType priority
{
public native get();
public native set(EventResultPriorityType priority);
}
}
typeset ActionHandler
{
/* OnStart, OnSuspend, OnResume */
function Action (BehaviorAction action, int actor, BehaviorAction priorAction, ActionResult result);
/* OnUpdate */
function Action (BehaviorAction action, int actor, float interval, ActionResult result);
/* OnEnd */
function void (BehaviorAction action, int actor, BehaviorAction priorAction, ActionResult result);
/* InitialContainedAction */
function Action (BehaviorAction action, int actor, BehaviorAction& action);
/* OnLeaveGround, OnLandOnGround, OnDrop, OnShoved, OnBlinded, OnHitByVomitJar, OnCommandAttack */
function Action (BehaviorAction action, int actor, int entity, ActionDesiredResult result);
/* OnContact */
function Action (BehaviorAction action, int actor, int entity, Address trace, ActionDesiredResult result);
/* OnMoveToSuccess */
function Action (BehaviorAction action, int actor, Address path, ActionDesiredResult result);
/* OnMoveToFailure */
function Action (BehaviorAction action, int actor, Address path, any type, ActionDesiredResult result);
/* OnStuck, OnUnStuck, OnPostureChanged, OnIgnite, OnModelChanged, OnEnteredSpit, OnCommandAssault, OnCommandResume */
function Action (BehaviorAction action, int actor, ActionDesiredResult result);
/* OnAnimationActivityComplete, OnAnimationActivityInterrupted */
function Action (BehaviorAction action, int actor, int activity, ActionDesiredResult result);
/* OnAnimationEvent */
function Action (BehaviorAction action, int actor, Address animevent, ActionDesiredResult result);
/* OnInjured, OnKilled */
function Action (BehaviorAction action, int actor, Address takedamageinfo, ActionDesiredResult result);
/* OnOtherKilled */
function Action (BehaviorAction action, int actor, int other, Address takedamageinfo, ActionDesiredResult result);
/* OnSight, OnLostSight, OnThreatChanged */
function Action (BehaviorAction action, int actor, int entity, ActionDesiredResult result);
/* OnSound */
function Action (BehaviorAction action, int actor, int entity, const float pos[3], Address keyvalues, ActionDesiredResult result);
/* OnSpokeConcept */
function Action (BehaviorAction action, int actor, int who, Address concept, Address response, Address unknown, ActionDesiredResult result);
/* OnNavAreaChanged */
function Action (BehaviorAction action, int actor, Address newArea, Address oldArea, ActionDesiredResult result);
/* OnPickUp */
function Action (BehaviorAction action, int actor, int entity, int giver, ActionDesiredResult result);
/* OnCommandApproachVector */
function Action (BehaviorAction action, int actor, const float pos[3], float range, ActionDesiredResult result);
/* OnCommandApproachEntity */
function Action (BehaviorAction action, int actor, int goal, ActionDesiredResult result);
/* OnCommandRetreat */
function Action (BehaviorAction action, int actor, int threat, float range, ActionDesiredResult result);
/* OnCommandPause */
function Action (BehaviorAction action, int actor, float duration, ActionDesiredResult result);
/* OnCommandString */
function Action (BehaviorAction action, int actor, const char[] command, ActionDesiredResult result);
/* IsAbleToBlockMovementOf */
function Action (BehaviorAction action, int actor, Address nextbot, ActionDesiredResult result);
}
methodmap ActionsManager
{
/**
* @brief Creates action template with given name
* @note Use this to create your own actions
*
* @param name New action name
*
* @return Action address
*/
public static native BehaviorAction Create( const char[] name );
/**
* @brief Allocates memory with given size
* @note Use this with game action constructor to create game actions
*
* @param size Size to allocate
*
* @return Allocated memory start address
*/
public static native BehaviorAction Allocate( int size );
/**
* @brief Deallocates memory
* @note Actually used only for deallocating actions
*
* @param action Action to deallocate
*
* @noreturn
*/
public static native void Deallocate( BehaviorAction action );
/**
* @brief Used to iterate over all entity actions
*
* @param entity Entity index
* @param callback Iterator callback
*
* @return Number of actions entity has
*/
public static native int Iterator( int entity, ActionsIteratorCallback callback = INVALID_FUNCTION );
/**
* @brief Returns entity action with given name
*
* @param entity Entity index
* @param name Action name to find
*
* @return Action address, INVALID_ACTION if not found
*/
public static native BehaviorAction GetAction( int entity, const char[] name );
}
methodmap BehaviorAction
{
public BehaviorAction(any action)
{
return view_as<BehaviorAction>(action);
}
/**
* @brief Stores pending event result
* @note This is almost same as changing result via event handler but this one violates semantics
*
* @param type Result type (See ActionResultType)
* @param action Action
* @param priority Priority
* @param reason Reason
*
* @error Invalid action passed
* @noreturn
*/
public native void StorePendingEventResult( ActionResultType type = CONTINUE, BehaviorAction action = INVALID_ACTION, EventResultPriorityType priority = RESULT_TRY, const char[] reason = NULL_STRING );
/**
* @brief Gets action name
*
* @param destination Buffer to store name
* @param maxlength Buffer length
*
* @error Invalid action passed
* @return Number of bytes written?
*/
public native int GetName( char[] destination, int maxlength = ACTION_NAME_LENGTH );
/**
* @brief Simple wrapper to get action data
*
* @param int Offset to data
* @param type How many bytes read (See NumberType)
*
* @return Stored data
*/
public any Get( int offset, NumberType type = NumberType_Int32 )
{
return view_as<any>(LoadFromAddress(view_as<Address>(this) + view_as<Address>(offset), type));
}
/**
* @brief Simple wrapper to set action data
*
* @param int Offset to data
* @param data Data to set
* @param type How many bytes set (See NumberType)
*
* @noreturn
*/
#if SOURCEMOD_V_MINOR < 11
public void Set( int offset, any data, NumberType type = NumberType_Int32 )
{
StoreToAddress(view_as<Address>(this) + view_as<Address>(offset), data, type);
}
#else
public void Set( int offset, any data, NumberType type = NumberType_Int32, bool updateMemAccess = true )
{
StoreToAddress(view_as<Address>(this) + view_as<Address>(offset), data, type, updateMemAccess);
}
#endif
// ====================================================================================================
// ACTION PROPERTIES
// ====================================================================================================
/**
* @brief Property to get/set parent action
*
* @return Parent action
*/
property BehaviorAction Parent
{
public native get();
}
/**
* @brief Property to get/set child action
*
* @return Child action
*/
property BehaviorAction Child
{
public native get();
}
/**
* @brief Property to get/set "under" action
* @note if we are suspender then this will return a suspended action
*
* @return Under action
*/
property BehaviorAction Under
{
public native get();
}
/**
* @brief Property to get/set "above" action
* @note if we are suspended action then this will return a suspender
*
* @return Above action
*/
property BehaviorAction Above
{
public native get();
}
/**
* @brief Property to get actor of action
* @note returns 0 if action hasn't been started yet
*
* @return Action actor
*/
property int Actor
{
public native get();
}
/**
* @brief Property to get/set suspended state of action
*
* @return true if suspended, false otherwise
*/
property bool IsSuspended
{
public native get();
public native set(bool suspended);
}
/**
* @brief Property to get/set started state of action
* @note if this returns true then OnStart handled has already been called
*
* @return true if started, false otherwise
*/
property bool IsStarted
{
public native get();
public native set(bool started);
}
// ====================================================================================================
// ACTION PRE EVENT HANDLERS
// ====================================================================================================
property ActionHandler OnStart
{
public native set(ActionHandler func);
}
property ActionHandler OnUpdate
{
public native set(ActionHandler func);
}
property ActionHandler OnEnd
{
public native set(ActionHandler func);
}
property ActionHandler OnSuspend
{
public native set(ActionHandler func);
}
property ActionHandler OnResume
{
public native set(ActionHandler func);
}
property ActionHandler OnInitialContainedAction
{
public native set(ActionHandler func);
}
property ActionHandler OnLeaveGround
{
public native set(ActionHandler func);
}
property ActionHandler OnLandOnGround
{
public native set(ActionHandler func);
}
property ActionHandler OnContact
{
public native set(ActionHandler func);
}
property ActionHandler OnMoveToSuccess
{
public native set(ActionHandler func);
}
property ActionHandler OnMoveToFailure
{
public native set(ActionHandler func);
}
property ActionHandler OnStuck
{
public native set(ActionHandler func);
}
property ActionHandler OnUnStuck
{
public native set(ActionHandler func);
}
property ActionHandler OnPostureChanged
{
public native set(ActionHandler func);
}
property ActionHandler OnAnimationActivityComplete
{
public native set(ActionHandler func);
}
property ActionHandler OnAnimationActivityInterrupted
{
public native set(ActionHandler func);
}
property ActionHandler OnAnimationEvent
{
public native set(ActionHandler func);
}
property ActionHandler OnIgnite
{
public native set(ActionHandler func);
}
property ActionHandler OnInjured
{
public native set(ActionHandler func);
}
property ActionHandler OnKilled
{
public native set(ActionHandler func);
}
property ActionHandler OnOtherKilled
{
public native set(ActionHandler func);
}
property ActionHandler OnSight
{
public native set(ActionHandler func);
}
property ActionHandler OnLostSight
{
public native set(ActionHandler func);
}
property ActionHandler OnThreatChanged
{
public native set(ActionHandler func);
}
property ActionHandler OnSound
{
public native set(ActionHandler func);
}
property ActionHandler OnSpokeConcept
{
public native set(ActionHandler func);
}
property ActionHandler OnNavAreaChanged
{
public native set(ActionHandler func);
}
property ActionHandler OnModelChanged
{
public native set(ActionHandler func);
}
property ActionHandler OnPickUp
{
public native set(ActionHandler func);
}
property ActionHandler OnShoved
{
public native set(ActionHandler func);
}
property ActionHandler OnBlinded
{
public native set(ActionHandler func);
}
property ActionHandler OnEnteredSpit
{
public native set(ActionHandler func);
}
property ActionHandler OnHitByVomitJar
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandAttack
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandAssault
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandApproachV
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandApproachE
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandRetreat
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandPause
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandResume
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandString
{
public native set(ActionHandler func);
}
property ActionHandler IsAbleToBlockMovementOf
{
public native set(ActionHandler func);
}
// ====================================================================================================
// ACTION POST EVENT HANDLERS
// ====================================================================================================
property ActionHandler OnStartPost
{
public native set(ActionHandler func);
}
property ActionHandler OnUpdatePost
{
public native set(ActionHandler func);
}
property ActionHandler OnEndPost
{
public native set(ActionHandler func);
}
property ActionHandler OnSuspendPost
{
public native set(ActionHandler func);
}
property ActionHandler OnResumePost
{
public native set(ActionHandler func);
}
property ActionHandler OnInitialContainedActionPost
{
public native set(ActionHandler func);
}
property ActionHandler OnLeaveGroundPost
{
public native set(ActionHandler func);
}
property ActionHandler OnLandOnGroundPost
{
public native set(ActionHandler func);
}
property ActionHandler OnContactPost
{
public native set(ActionHandler func);
}
property ActionHandler OnMoveToSuccessPost
{
public native set(ActionHandler func);
}
property ActionHandler OnMoveToFailurePost
{
public native set(ActionHandler func);
}
property ActionHandler OnStuckPost
{
public native set(ActionHandler func);
}
property ActionHandler OnUnStuckPost
{
public native set(ActionHandler func);
}
property ActionHandler OnPostureChangedPost
{
public native set(ActionHandler func);
}
property ActionHandler OnAnimationActivityCompletePost
{
public native set(ActionHandler func);
}
property ActionHandler OnAnimationActivityInterruptedPost
{
public native set(ActionHandler func);
}
property ActionHandler OnAnimationEventPost
{
public native set(ActionHandler func);
}
property ActionHandler OnIgnitePost
{
public native set(ActionHandler func);
}
property ActionHandler OnInjuredPost
{
public native set(ActionHandler func);
}
property ActionHandler OnKilledPost
{
public native set(ActionHandler func);
}
property ActionHandler OnOtherKilledPost
{
public native set(ActionHandler func);
}
property ActionHandler OnSightPost
{
public native set(ActionHandler func);
}
property ActionHandler OnLostSightPost
{
public native set(ActionHandler func);
}
property ActionHandler OnThreatChangedPost
{
public native set(ActionHandler func);
}
property ActionHandler OnSoundPost
{
public native set(ActionHandler func);
}
property ActionHandler OnSpokeConceptPost
{
public native set(ActionHandler func);
}
property ActionHandler OnNavAreaChangedPost
{
public native set(ActionHandler func);
}
property ActionHandler OnModelChangedPost
{
public native set(ActionHandler func);
}
property ActionHandler OnPickUpPost
{
public native set(ActionHandler func);
}
property ActionHandler OnShovedPost
{
public native set(ActionHandler func);
}
property ActionHandler OnBlindedPost
{
public native set(ActionHandler func);
}
property ActionHandler OnEnteredSpitPost
{
public native set(ActionHandler func);
}
property ActionHandler OnHitByVomitJarPost
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandAttackPost
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandAssaultPost
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandApproachVPost
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandApproachEPost
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandRetreatPost
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandPausePost
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandResumePost
{
public native set(ActionHandler func);
}
property ActionHandler OnCommandStringPost
{
public native set(ActionHandler func);
}
property ActionHandler IsAbleToBlockMovementOfPost
{
public native set(ActionHandler func);
}
};
// ====================================================================================================
// PL NTV
// ====================================================================================================
public Extension __ext_actions =
{
name = "Actions",
file = "actions.ext",
autoload = 1,
#if defined REQUIRE_EXTENSIONS
required = 1,
#else
required = 0,
#endif
};
#if !defined REQUIRE_EXTENSIONS
public void __ext_actions_SetNTVOptional()
{
MarkNativeAsOptional("ActionResult.GetReason");
MarkNativeAsOptional("ActionResult.SetReason");
MarkNativeAsOptional("ActionResult.type.get");
MarkNativeAsOptional("ActionResult.type.set");
MarkNativeAsOptional("ActionResult.action.get");
MarkNativeAsOptional("ActionResult.action.set");
MarkNativeAsOptional("ActionDesiredResult.priority.get");
MarkNativeAsOptional("ActionDesiredResult.priority.set");
MarkNativeAsOptional("ActionsManager.Create");
MarkNativeAsOptional("ActionsManager.Allocate");
MarkNativeAsOptional("ActionsManager.Deallocate");
MarkNativeAsOptional("ActionsManager.Iterator");
MarkNativeAsOptional("ActionsManager.GetAction");
MarkNativeAsOptional("BehaviorAction.StorePendingEventResult");
MarkNativeAsOptional("BehaviorAction.GetName");
MarkNativeAsOptional("BehaviorAction.Parent.get");
MarkNativeAsOptional("BehaviorAction.Child.get");
MarkNativeAsOptional("BehaviorAction.Under.get");
MarkNativeAsOptional("BehaviorAction.Above.get");
MarkNativeAsOptional("BehaviorAction.Actor.get");
MarkNativeAsOptional("BehaviorAction.IsSuspended.get");
MarkNativeAsOptional("BehaviorAction.IsSuspended.set");
MarkNativeAsOptional("BehaviorAction.IsStarted.get");
MarkNativeAsOptional("BehaviorAction.IsStarted.set");
MarkNativeAsOptional("BehaviorAction.OnStart.set");
MarkNativeAsOptional("BehaviorAction.OnUpdate.set");
MarkNativeAsOptional("BehaviorAction.OnEnd.set");
MarkNativeAsOptional("BehaviorAction.OnSuspend.set");
MarkNativeAsOptional("BehaviorAction.OnResume.set");
MarkNativeAsOptional("BehaviorAction.OnInitialContainedAction.set");
MarkNativeAsOptional("BehaviorAction.OnLeaveGround.set");
MarkNativeAsOptional("BehaviorAction.OnLandOnGround.set");
MarkNativeAsOptional("BehaviorAction.OnContact.set");
MarkNativeAsOptional("BehaviorAction.OnMoveToSuccess.set");
MarkNativeAsOptional("BehaviorAction.OnMoveToFailure.set");
MarkNativeAsOptional("BehaviorAction.OnStuck.set");
MarkNativeAsOptional("BehaviorAction.OnUnStuck.set");
MarkNativeAsOptional("BehaviorAction.OnPostureChanged.set");
MarkNativeAsOptional("BehaviorAction.OnAnimationActivityComplete.set");
MarkNativeAsOptional("BehaviorAction.OnAnimationActivityInterrupted.set");
MarkNativeAsOptional("BehaviorAction.OnAnimationEvent.set");
MarkNativeAsOptional("BehaviorAction.OnIgnite.set");
MarkNativeAsOptional("BehaviorAction.OnInjured.set");
MarkNativeAsOptional("BehaviorAction.OnKilled.set");
MarkNativeAsOptional("BehaviorAction.OnOtherKilled.set");
MarkNativeAsOptional("BehaviorAction.OnSight.set");
MarkNativeAsOptional("BehaviorAction.OnLostSight.set");
MarkNativeAsOptional("BehaviorAction.OnThreatChanged.set");
MarkNativeAsOptional("BehaviorAction.OnSound.set");
MarkNativeAsOptional("BehaviorAction.OnSpokeConcept.set");
MarkNativeAsOptional("BehaviorAction.OnNavAreaChanged.set");
MarkNativeAsOptional("BehaviorAction.OnModelChanged.set");
MarkNativeAsOptional("BehaviorAction.OnPickUp.set");
MarkNativeAsOptional("BehaviorAction.OnShoved.set");
MarkNativeAsOptional("BehaviorAction.OnBlinded.set");
MarkNativeAsOptional("BehaviorAction.OnEnteredSpit.set");
MarkNativeAsOptional("BehaviorAction.OnHitByVomitJar.set");
MarkNativeAsOptional("BehaviorAction.OnCommandAttack.set");
MarkNativeAsOptional("BehaviorAction.OnCommandAssault.set");
MarkNativeAsOptional("BehaviorAction.OnCommandApproachV.set");
MarkNativeAsOptional("BehaviorAction.OnCommandApproachE.set");
MarkNativeAsOptional("BehaviorAction.OnCommandRetreat.set");
MarkNativeAsOptional("BehaviorAction.OnCommandPause.set");
MarkNativeAsOptional("BehaviorAction.OnCommandResume.set");
MarkNativeAsOptional("BehaviorAction.OnCommandString.set");
MarkNativeAsOptional("BehaviorAction.IsAbleToBlockMovementOf.set");
MarkNativeAsOptional("BehaviorAction.OnStartPost.set");
MarkNativeAsOptional("BehaviorAction.OnUpdatePost.set");
MarkNativeAsOptional("BehaviorAction.OnEndPost.set");
MarkNativeAsOptional("BehaviorAction.OnSuspendPost.set");
MarkNativeAsOptional("BehaviorAction.OnResumePost.set");
MarkNativeAsOptional("BehaviorAction.OnInitialContainedActionPost.set");
MarkNativeAsOptional("BehaviorAction.OnLeaveGroundPost.set");
MarkNativeAsOptional("BehaviorAction.OnLandOnGroundPost.set");
MarkNativeAsOptional("BehaviorAction.OnContactPost.set");
MarkNativeAsOptional("BehaviorAction.OnMoveToSuccessPost.set");
MarkNativeAsOptional("BehaviorAction.OnMoveToFailurePost.set");
MarkNativeAsOptional("BehaviorAction.OnStuckPost.set");
MarkNativeAsOptional("BehaviorAction.OnUnStuckPost.set");
MarkNativeAsOptional("BehaviorAction.OnPostureChangedPost.set");
MarkNativeAsOptional("BehaviorAction.OnAnimationActivityCompletePost.set");
MarkNativeAsOptional("BehaviorAction.OnAnimationActivityInterruptedPost.set");
MarkNativeAsOptional("BehaviorAction.OnAnimationEventPost.set");
MarkNativeAsOptional("BehaviorAction.OnIgnitePost.set");
MarkNativeAsOptional("BehaviorAction.OnInjuredPost.set");
MarkNativeAsOptional("BehaviorAction.OnKilledPost.set");
MarkNativeAsOptional("BehaviorAction.OnOtherKilledPost.set");
MarkNativeAsOptional("BehaviorAction.OnSightPost.set");
MarkNativeAsOptional("BehaviorAction.OnLostSightPost.set");
MarkNativeAsOptional("BehaviorAction.OnThreatChangedPost.set");
MarkNativeAsOptional("BehaviorAction.OnSoundPost.set");
MarkNativeAsOptional("BehaviorAction.OnSpokeConceptPost.set");
MarkNativeAsOptional("BehaviorAction.OnNavAreaChangedPost.set");
MarkNativeAsOptional("BehaviorAction.OnModelChangedPost.set");
MarkNativeAsOptional("BehaviorAction.OnPickUpPost.set");
MarkNativeAsOptional("BehaviorAction.OnShovedPost.set");
MarkNativeAsOptional("BehaviorAction.OnBlindedPost.set");
MarkNativeAsOptional("BehaviorAction.OnEnteredSpitPost.set");
MarkNativeAsOptional("BehaviorAction.OnHitByVomitJarPost.set");
MarkNativeAsOptional("BehaviorAction.OnCommandAttackPost.set");
MarkNativeAsOptional("BehaviorAction.OnCommandAssaultPost.set");
MarkNativeAsOptional("BehaviorAction.OnCommandApproachVPost.set");
MarkNativeAsOptional("BehaviorAction.OnCommandApproachEPost.set");
MarkNativeAsOptional("BehaviorAction.OnCommandRetreatPost.set");
MarkNativeAsOptional("BehaviorAction.OnCommandPausePost.set");
MarkNativeAsOptional("BehaviorAction.OnCommandResumePost.set");
MarkNativeAsOptional("BehaviorAction.IsAbleToBlockMovementOfPost.set");
}
#endif

Some files were not shown because too many files have changed in this diff Show more