├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── build.yml │ └── release.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── addons └── sourcemod │ ├── configs │ └── hextags.cfg │ └── scripting │ ├── hextags.sp │ └── include │ ├── SteamWorks.inc │ ├── chat-processor.inc │ ├── hexstocks.inc │ ├── hextags.inc │ ├── hl_gangs.inc │ ├── kento_rankme │ ├── cmds.inc │ ├── cvars.inc │ ├── natives.inc │ └── rankme.inc │ ├── logger.inc │ ├── mostactive.inc │ ├── myjbwarden.inc │ └── warden.inc └── builds.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: hexah 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the Bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. When the map changes. 13 | 2. After running `sm_reloadtags`. 14 | 3 ... 15 | 16 | **To Fix** 17 | Write it you have found a workaround to temporary fix this. 18 | 19 | **Expected Behavior** 20 | A clear and concise description of what you expected to happen. 21 | 22 | **Screenshots** 23 | If applicable, add screenshots to help explain your problem. 24 | 25 | **System Details** 26 | - **OS:** [e.g. Ubuntu] 27 | - **Game:** [e.g. CSGO] 28 | - **Sourcemod Version:** *(Send **`sm version`** reply from *server* console.)* 29 | - **Sourcemod Plugins List:** *(Send **`sm plugins list`** reply from *server* console, if too long use services like [gists](https://gist.github.com).)* 30 | - **Your hextags.cfg:** 31 | 32 | **Additional Context** 33 | Add any other context about the problem here. 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **System Details** 17 | - **OS:** [e.g. Ubuntu] 18 | - **Game:** [e.g. CSGO] 19 | - **Sourcemod Version:** *(Send **`sm version`** reply from *server* console)* 20 | - **Sourcemod Plugins List:** *(Send **`sm plugins list`** reply from *server* console, if too long use services like [gists](https://gist.github.com)* - Not required. 21 | 22 | **Additional context** 23 | Add any other context or screenshots about the feature request here. 24 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Compile with SourceMod 2 | 3 | on: 4 | push: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | strategy: 10 | fail-fast: false 11 | matrix: 12 | SM_VERSION: ["1.10", "1.11"] 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - name: Install dependencies 18 | run: sudo apt install curl p7zip-full p7zip-rar 19 | 20 | - name: Set environment variables 21 | run: | 22 | git fetch --unshallow 23 | VERSION=$(git rev-list --count HEAD) 24 | SHORT=$(git describe --always --long --dirty) 25 | SOURCEMOD_PATH=$GITHUB_WORKSPACE/addons/sourcemod 26 | echo "GIT_COMMIT=$VERSION" >> $GITHUB_ENV 27 | echo "PLUGIN_VERSION=${{ matrix.SM_VERSION }}.$VERSION.$SHORT" >> $GITHUB_ENV 28 | echo "SOURCEMOD_PATH=$SOURCEMOD_PATH" >> $GITHUB_ENV 29 | echo "SCRIPTS_PATH=$SOURCEMOD_PATH/scripting" >> $GITHUB_ENV 30 | echo "PLUGINS_PATH=$SOURCEMOD_PATH/plugins" >> $GITHUB_ENV 31 | echo "CONFIGS_PATH=$SOURCEMOD_PATH/configs" >> $GITHUB_ENV 32 | 33 | - name: Setup SourcePawn Compiler ${{ matrix.SM_VERSION }} 34 | uses: rumblefrog/setup-sp@master 35 | with: 36 | version: ${{ matrix.SM_VERSION }} 37 | 38 | - name: Set HexTags version 39 | run: | 40 | sed -i "s//$PLUGIN_VERSION/g" $SCRIPTS_PATH/hextags.sp 41 | 42 | - name: Compile HexTags 43 | run: | 44 | spcomp -i $includePath -i $SCRIPTS_PATH/include hextags.sp 45 | working-directory: ${{ env.SCRIPTS_PATH }}/ 46 | 47 | - name: Move compiled plugins 48 | run: | 49 | rm -rf $PLUGINS_PATH 50 | mkdir -p $PLUGINS_PATH/ 51 | rsync -av --include='*/' --include="*.smx" --exclude="*" --prune-empty-dirs --remove-source-files $SCRIPTS_PATH/ $PLUGINS_PATH/ 52 | 53 | - name: Move addons to build 54 | run: | 55 | mkdir build 56 | mv ./addons build/ 57 | 58 | - name: Add LICENSE to build package 59 | run: | 60 | mv $GITHUB_WORKSPACE/LICENSE . 61 | working-directory: ./build 62 | 63 | - name: Remove unnecessary files and folders from build 64 | run: | 65 | rm -rf addons/sourcemod/scripting 66 | working-directory: ./build 67 | 68 | - name: Upload artifact 69 | uses: actions/upload-artifact@v3 70 | with: 71 | name: HexTags-${{ matrix.SM_VERSION }} 72 | path: build/ 73 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release new version 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | contents: write 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | SM_VERSION: ["1.10", "1.11"] 17 | 18 | steps: 19 | - uses: actions/checkout@v2 20 | 21 | - name: Install dependencies 22 | run: sudo apt install curl p7zip-full p7zip-rar 23 | 24 | - name: Set environment variables 25 | run: | 26 | git fetch --unshallow 27 | VERSION=$(git describe --tags --abbrev=0) 28 | SOURCEMOD_PATH=$GITHUB_WORKSPACE/addons/sourcemod 29 | echo "PLUGIN_VERSION=$VERSION" >> $GITHUB_ENV 30 | echo "SOURCEMOD_PATH=$SOURCEMOD_PATH" >> $GITHUB_ENV 31 | echo "SCRIPTS_PATH=$SOURCEMOD_PATH/scripting" >> $GITHUB_ENV 32 | echo "PLUGINS_PATH=$SOURCEMOD_PATH/plugins" >> $GITHUB_ENV 33 | echo "CONFIGS_PATH=$SOURCEMOD_PATH/configs" >> $GITHUB_ENV 34 | 35 | - name: Setup SourcePawn Compiler ${{ matrix.SM_VERSION }} 36 | uses: rumblefrog/setup-sp@master 37 | with: 38 | version: ${{ matrix.SM_VERSION }} 39 | 40 | - name: Set HexTags version 41 | run: | 42 | sed -i "s//$PLUGIN_VERSION/g" $SCRIPTS_PATH/hextags.sp 43 | 44 | - name: Compile HexTags 45 | run: | 46 | spcomp -i $includePath -i $SCRIPTS_PATH/include hextags.sp 47 | working-directory: ${{ env.SCRIPTS_PATH }}/ 48 | 49 | - name: Move compiled plugins 50 | run: | 51 | rm -rf $PLUGINS_PATH 52 | mkdir -p $PLUGINS_PATH/ 53 | rsync -av --include='*/' --include="*.smx" --exclude="*" --prune-empty-dirs --remove-source-files $SCRIPTS_PATH/ $PLUGINS_PATH/ 54 | 55 | - name: Move addons to build 56 | run: | 57 | mkdir build 58 | mv ./addons build/ 59 | 60 | - name: Add LICENSE to build package 61 | run: | 62 | mv $GITHUB_WORKSPACE/LICENSE . 63 | working-directory: ./build 64 | 65 | - name: Remove unnecessary files and folders from build 66 | run: | 67 | rm -rf addons/sourcemod/scripting 68 | working-directory: ./build 69 | 70 | - name: Compress package 71 | run: | 72 | zip -9rq ../HexTags-${{ matrix.SM_VERSION }}.zip * 73 | working-directory: ./build 74 | 75 | - name: Create release 76 | uses: ncipollo/release-action@v1 77 | with: 78 | allowUpdates: true 79 | artifacts: "HexTags-${{ matrix.SM_VERSION }}.zip" 80 | token: ${{ secrets.GITHUB_TOKEN }} 81 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | .vscode 3 | *.smx 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hexer504@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HexTags 2 | All info in the am thread!: https://forums.alliedmods.net/showthread.php?p=2566623 3 | -------------------------------------------------------------------------------- /addons/sourcemod/configs/hextags.cfg: -------------------------------------------------------------------------------- 1 | // 2 | // HexTags Configuration file. 3 | // by: Hexah 4 | // https://github.com/Hexer10/HexTags 5 | // 6 | // Copyright (C) 2017-2020 Mattia (Hexah|Hexer10|Papero) 7 | // 8 | // This file is part of the HexTags SourceMod Plugin. 9 | // 10 | // This program is free software; you can redistribute it and/or modify it under 11 | // the terms of the GNU General Public License, version 3.0, as published by the 12 | // Free Software Foundation. 13 | // 14 | // This program is distributed in the hope that it will be useful, but WITHOUT 15 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 | // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 | // details. 18 | // 19 | // You should have received a copy of the GNU General Public License along with 20 | // this program. If not, see . 21 | // 22 | // 23 | // HexTags - Hexah 24 | // Configuration file. 25 | // 26 | // All the avaible colors are: https://goo.gl/VgAHbK (colorvariables supported). 27 | // Custom colors(DON'T MIX THEM): 28 | // Put them at the "key" start. 29 | // 1. {rainbow} -> Make every character follow the rainbow colors. Must be the only color and at the start of the string. 30 | // 2. {random} -> Make every character random colored. Must be the only color and at the start of the string. 31 | // 32 | // NOTE: Using Custom colors the max message length is gonna be half (from 128 to 64) 33 | // 34 | // Every tag is selected with insertion order; for example if you place the "Default" selector before the "z" selector, even the players with the "z" flag will get the default tags. Nested tags have the same behavoir. 35 | // STEAM ID (SteamID) --> Can be STEAM_0 or STEAM_1 . 36 | // Gang --> Just put Gang as selector, this will target all the players with a gang ( https://goo.gl/YNY5YY ). 37 | // ADMIN GROUP (AdminGroup) --> It is selected only the first client group. It is required a '@' before the group name. 38 | // ADMIN FLAGS (AdminFlags) --> Allowed only if the client has any of the tags. It a '&' before the group name, or the selector length must be 1. 39 | // Warden --> A player is warden. - Warden( https://goo.gl/rXhZCt )/ MyJailBreak( https://goo.gl/NMvq2J ) 40 | // Deputy --> A player is deputy. - MyJailBreak ( https://goo.gl/NMvq2J ) 41 | // (TOTAL)ONLINE TIME (ActiveTime) --> This need mostactive( https://goo.gl/Jk4PWn ) to work. Required time in seconds to get the tags. The '#' before the time is needed. 42 | // RankMe --> Support for KentoRankme( https://goo.gl/UW6x81 ). Required score to get this tag. The '!' before the time is needed. 43 | // TEAM (Team) --> Tag for a certain team name. CSGO Team names: CT, Terrorist, Spectator. Get the current team name with: /getteam . 44 | // NoPrime --> Need to SteamWorks to work ( https://goo.gl/hben3h ). Select only player that have not PrimeStatus in CSGO. 45 | // Bots/Humans -> "bot" to target only bots and "human" to target only bot players. 46 | // Default --> All players who don't match any other section. 47 | // 48 | // Params (only works from chat tags/colors): 49 | // 1. {time} --> Replaced with current time, format: HH:MM. This works only with ChatTags 50 | // 2. {country} --> Replaced with player's country: XX (Country code 2 ex: IT, EN, US, ...). This work both with Score/Chat Tags. 51 | // 3. {gang} --> Replaced with player's gang. ( https://goo.gl/YNY5YY ) 52 | // 4. {rmPoints} --> Replaced with player's rankme points. ( https://goo.gl/UW6x81 ) 53 | // 5. {rmRank} --> Replaced with player's rankme rank. ( https://goo.gl/UW6x81 ) 54 | // 55 | // 56 | // Every entry can be removed if for example you want only the 'ScoreTag'. 57 | // 58 | // Examples: 59 | // 60 | // 61 | // "TagName" "Default" //The tagname (will appear only in the tagslist command) 62 | // "ScoreTag" "[Default]" //The scoreboard-tag 63 | // "ChatTag" "{darkblue}[Default]" //The chat-tag with the colors 64 | // "ChatColor" "{purple}" //The chat color 65 | // "NameColor" "{orchid}" //The name color 66 | // "Force" "1" //If equal to 1(default if ommited), the tag will be forced, and setted to the hextags' one when another plugin changes the tag, put anyother value to disable di behavoir. 67 | // 68 | // "@Admin" //@Admin -> Only players in the admin group will have these tags. 69 | // { 70 | // "ScoreTag" "[Admin]" //The scoreboard-tag 71 | // "ChatTag" "{rainbow}[Admin]" //The chat-tag 72 | // "ChatColor" "{darkblue}" //The chat color 73 | // "NameColor" "{grey2}" //The name color 74 | // } 75 | // "a" //a -> Only players with the a flag will have these tags. 76 | // { 77 | // "ScoreTag" "[Res]" //The scoreboard-tag 78 | // "ChatTag" "{red}[Res]" //The chat-tag 79 | // "ChatColor" "{rainbow}" //The chat color 80 | // "NameColor" "{grey}" //The name color 81 | // } 82 | // "#43200" //#43200 -> Only players with 12 hours (43200 seconds) will have these tags. 83 | // { 84 | // "ScoreTag" "[Senior]" //The scoreboard-tag 85 | // "ChatTag" "{red}[Senior]" //The chat-tag 86 | // "ChatColor" "{random}" //The chat color 87 | // "NameColor" "{grey}" //The name color 88 | // } 89 | // "Terrorist" //Terrorist -> Only players in the terrorist team will have these tags. 90 | // { 91 | // "ScoreTag" "[Terrorist]" //The scoreboard-tag 92 | // "Force" "0" //Don't force the tag 93 | // } 94 | // 95 | // Start editing down this line! Inside the "HexTags" section (without removing it). 96 | "HexTags" 97 | { 98 | 99 | } -------------------------------------------------------------------------------- /addons/sourcemod/scripting/hextags.sp: -------------------------------------------------------------------------------- 1 | /* 2 | * HexTags Plugin. 3 | * by: Hexah 4 | * https://github.com/Hexer10/HexTags 5 | * 6 | * Copyright (C) 2017-2022 Mattia (Hexah|Hexer10|Papero) 7 | * 8 | * This file is part of the HexTags SourceMod Plugin. 9 | * 10 | * This program is free software; you can redistribute it and/or modify it under 11 | * the terms of the GNU General Public License, version 3.0, as published by the 12 | * Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, but WITHOUT 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 | * details. 18 | * 19 | * You should have received a copy of the GNU General Public License along with 20 | * this program. If not, see . 21 | */ 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #undef REQUIRE_EXTENSIONS 32 | #undef REQUIRE_PLUGIN 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #define REQUIRE_EXTENSIONS 41 | #define REQUIRE_PLUGIN 42 | 43 | #define PLUGIN_AUTHOR "Hexah" 44 | #define PLUGIN_VERSION "" 45 | 46 | #pragma semicolon 1 47 | #pragma newdecls required 48 | 49 | 50 | // EVENTS 51 | PrivateForward pfCustomSelector; 52 | 53 | Handle fTagsUpdated; 54 | Handle fMessageProcess; 55 | Handle fMessageProcessed; 56 | Handle fMessagePreProcess; 57 | 58 | // COOKIES 59 | Handle hVibilityCookie; 60 | Handle hSelTagCookie; 61 | Handle hVibilityAdminsCookie; 62 | Handle hIsAnonymousCookie; 63 | 64 | 65 | ConVar cv_sDefaultGang; 66 | ConVar cv_bParseRoundEnd; 67 | ConVar cv_bEnableTagsList; 68 | ConVar cv_fForceTimerInterval; 69 | ConVar cv_iLogLevel; 70 | 71 | bool bCSGO; 72 | bool bLate; 73 | bool bMostActive; 74 | bool bRankme; 75 | bool bWarden; 76 | bool bMyJBWarden; 77 | bool bGangs; 78 | bool bSteamWorks = true; 79 | bool bHideTag[MAXPLAYERS + 1]; 80 | bool bHasRoundEnded; 81 | bool bIsAnonymous[MAXPLAYERS + 1]; 82 | 83 | int iRank[MAXPLAYERS + 1] = { -1, ... }; 84 | int iNextDefTag; 85 | int iSelTagId[MAXPLAYERS + 1]; 86 | 87 | char sUserTag[MAXPLAYERS + 1][64]; 88 | char sTagConf[PLATFORM_MAX_PATH]; 89 | 90 | ArrayList userTags[MAXPLAYERS + 1]; 91 | CustomTags selectedTags[MAXPLAYERS + 1]; 92 | KeyValues tagsKv; 93 | 94 | Handle forceTimer; 95 | Handle roundStatusTimer; 96 | 97 | Logger logger; 98 | 99 | 100 | //Plugin info 101 | public Plugin myinfo = 102 | { 103 | name = "hextags", 104 | author = PLUGIN_AUTHOR, 105 | description = "Edit Tags & Colors!", 106 | version = PLUGIN_VERSION, 107 | url = "github.com/Hexer10/HexTags" 108 | }; 109 | 110 | //Startup 111 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 112 | { 113 | //API 114 | RegPluginLibrary("hextags"); 115 | 116 | CreateNative("HexTags_GetClientTag", Native_GetClientTag); 117 | CreateNative("HexTags_SetClientTag", Native_SetClientTag); 118 | CreateNative("HexTags_ResetClientTag", Native_ResetClientTags); 119 | CreateNative("HexTags_AddCustomSelector", Native_AddCustomSelector); 120 | CreateNative("HexTags_RemoveCustomSelector", Native_RemoveCustomSelector); 121 | 122 | fTagsUpdated = new GlobalForward("HexTags_OnTagsUpdated", ET_Ignore, Param_Cell); 123 | 124 | fMessageProcess = new GlobalForward("HexTags_OnMessageProcess", ET_Single, Param_Cell, Param_String, Param_String); 125 | fMessageProcessed = new GlobalForward("HexTags_OnMessageProcessed", ET_Ignore, Param_Cell, Param_String, Param_String); 126 | fMessagePreProcess = new GlobalForward("HexTags_OnMessagePreProcess", ET_Single, Param_Cell, Param_String, Param_String); 127 | 128 | pfCustomSelector = new PrivateForward(ET_Single, Param_Cell, Param_String); 129 | 130 | EngineVersion engine = GetEngineVersion(); 131 | bCSGO = (engine == Engine_CSGO || engine == Engine_CSS); 132 | 133 | //LateLoad 134 | bLate = late; 135 | return APLRes_Success; 136 | } 137 | 138 | public void OnPluginStart() 139 | { 140 | //ConVars 141 | CreateConVar("sm_hextags_version", PLUGIN_VERSION, "HexTags plugin version", FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); 142 | cv_sDefaultGang = CreateConVar("sm_hextags_nogang", "", "Text to use if user has no tag - needs hl_gangs."); 143 | cv_bParseRoundEnd = CreateConVar("sm_hextags_roundend", "0", "If 1 the tags will be reloaded even on round end - Suggested to be used with plugins like mostactive or rankme."); 144 | cv_bEnableTagsList = CreateConVar("sm_hextags_enable_tagslist", "0", "Set to 1 to enable the sm_tagslist command."); 145 | cv_fForceTimerInterval = CreateConVar("sm_hextags_timer_interval", "5.0", "How often should the user tags be checked if the match the config ones. Set to 0 to disable", _, true, 0.0); 146 | cv_iLogLevel = CreateConVar("sm_hextags_loglevel", "0", "Set the plugin loglevel: 0: No logs, 1: Info, 2: Debug", _, true, 0.0, true, 2.0); 147 | 148 | AutoExecConfig(); 149 | 150 | cv_iLogLevel.AddChangeHook(ConVar_LogLevelHook); 151 | cv_fForceTimerInterval.AddChangeHook(ConVar_ForceTimerHook); 152 | 153 | //Reg Cmds 154 | RegAdminCmd("sm_reloadtags", Cmd_ReloadTags, ADMFLAG_GENERIC, "Reload HexTags plugin config."); 155 | RegAdminCmd("sm_toggletags", Cmd_ToggleTags, ADMFLAG_GENERIC, "Toggle the visibility of your tags."); 156 | RegAdminCmd("sm_anonymous", Cmd_Anonymous, ADMFLAG_GENERIC, "Toggle the user-specific tags (SteamID, admin groups/flags will be ignored)."); 157 | 158 | RegConsoleCmd("sm_tagslist", Cmd_TagsList, "Select your tag!"); 159 | RegConsoleCmd("sm_getteam", Cmd_GetTeam, "Get current team name"); 160 | 161 | //Event hooks 162 | if (!HookEventEx("round_end", Event_RoundEnd)) 163 | LogError("Failed to hook \"round_end\", \"sm_hextags_roundend\" won't produce any effect."); 164 | 165 | HookEvent("round_start", Event_RoundStart); 166 | 167 | hVibilityCookie = RegClientCookie("HexTags_Visibility", "Show or hide the tags.", CookieAccess_Private); 168 | hSelTagCookie = RegClientCookie("HexTags_SelectedTag", "Selected Tag", CookieAccess_Private); 169 | hVibilityAdminsCookie = RegClientCookie("HexTags_Visibility_Admins", "Show or hide the admin tags.", CookieAccess_Private); 170 | hIsAnonymousCookie = RegClientCookie("HexTags_AnonymousCookie", "Plugin that defines wether or not an admin is anonymous.", CookieAccess_Protected); 171 | 172 | } 173 | 174 | public void OnConfigsExecuted() { 175 | logger.level = view_as(cv_iLogLevel.IntValue); 176 | 177 | if (bCSGO) 178 | { 179 | delete forceTimer; 180 | if (cv_fForceTimerInterval.FloatValue > 0) 181 | forceTimer = CreateTimer(cv_fForceTimerInterval.FloatValue, Timer_ForceTag, _, TIMER_REPEAT); 182 | } 183 | } 184 | 185 | public void ConVar_LogLevelHook(ConVar convar, const char[] oldValue, const char[] newValue) 186 | { 187 | logger.level = view_as(StringToInt(newValue)); 188 | } 189 | 190 | public void ConVar_ForceTimerHook(ConVar convar, const char[] oldValue, const char[] newValue) 191 | { 192 | if (bCSGO) 193 | { 194 | delete forceTimer; 195 | if (cv_fForceTimerInterval.FloatValue > 0) 196 | forceTimer = CreateTimer(cv_fForceTimerInterval.FloatValue, Timer_ForceTag, _, TIMER_REPEAT); 197 | } 198 | } 199 | 200 | public void OnAllPluginsLoaded() 201 | { 202 | logger.debug("Called OnAllPlugins!"); 203 | 204 | if (FindPluginByFile("custom-chatcolors-cp.smx") || LibraryExists("ccc")) 205 | LogMessage("[HexTags] Found Custom Chat Colors running!\n Please avoid running it with this plugin!"); 206 | 207 | bMostActive = LibraryExists("mostactive"); 208 | bRankme = LibraryExists("rankme"); 209 | bWarden = LibraryExists("warden"); 210 | bMyJBWarden = LibraryExists("myjbwarden"); 211 | bGangs = LibraryExists("hl_gangs"); 212 | bSteamWorks = LibraryExists("SteamWorks"); 213 | 214 | LoadKv(); 215 | if (bLate)for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i)) 216 | { 217 | OnClientPutInServer(i); 218 | if (AreClientCookiesCached(i)) 219 | OnClientCookiesCached(i); 220 | 221 | LoadTags(i, "load tags: late load"); 222 | } 223 | } 224 | 225 | public void OnLibraryAdded(const char[] name) 226 | { 227 | logger.debug("Called OnLibraryAdded %s", name); 228 | if (StrEqual(name, "mostactive")) 229 | { 230 | bMostActive = true; 231 | } 232 | else if (StrEqual(name, "rankme")) 233 | { 234 | bRankme = true; 235 | } 236 | else if (StrEqual(name, "warden")) 237 | { 238 | bWarden = true; 239 | } 240 | else if (StrEqual(name, "myjbwarden")) 241 | { 242 | bMyJBWarden = true; 243 | } 244 | else if (StrEqual(name, "hl_gangs")) 245 | { 246 | bGangs = true; 247 | } 248 | else if (StrEqual(name, "SteamWorks", false)) 249 | { 250 | bSteamWorks = true; 251 | } 252 | } 253 | 254 | 255 | public void OnLibraryRemoved(const char[] name) 256 | { 257 | logger.debug("Called OnLibraryRemoved %s", name); 258 | if (StrEqual(name, "mostactive")) 259 | { 260 | bMostActive = false; 261 | LoadKv(); 262 | } 263 | else if (StrEqual(name, "rankme")) 264 | { 265 | bRankme = false; 266 | LoadKv(); 267 | } 268 | else if (StrEqual(name, "warden")) 269 | { 270 | bWarden = false; 271 | LoadKv(); 272 | } 273 | else if (StrEqual(name, "myjbwarden")) 274 | { 275 | bMyJBWarden = false; 276 | LoadKv(); 277 | } 278 | else if (StrEqual(name, "hl_gangs")) 279 | { 280 | bGangs = false; 281 | LoadKv(); 282 | } 283 | else if (StrEqual(name, "SteamWorks", false)) 284 | { 285 | bSteamWorks = false; 286 | LoadKv(); 287 | } 288 | } 289 | 290 | //Commands 291 | public Action Cmd_ReloadTags(int client, int args) 292 | { 293 | LoadKv(); 294 | for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i)) LoadTags(i, "load tags: reload tags"); 295 | 296 | ReplyToCommand(client, "[SM] Tags succesfully reloaded!"); 297 | return Plugin_Handled; 298 | } 299 | 300 | public Action Cmd_ToggleTags(int client, int args) 301 | { 302 | if (bHideTag[client]) 303 | { 304 | bHideTag[client] = false; 305 | LoadTags(client, "load tags: toggle tags"); 306 | ReplyToCommand(client, "[SM] Your tags are visible again."); 307 | } 308 | else 309 | { 310 | bHideTag[client] = true; 311 | SetClientClanTag(client, sUserTag[client], "toggle tags"); 312 | ReplyToCommand(client, "[SM] Your tags are no longer visible."); 313 | } 314 | 315 | SetClientCookie(client, hVibilityCookie, bHideTag[client] ? "0" : "1"); 316 | return Plugin_Handled; 317 | } 318 | 319 | public Action Cmd_TagsList(int client, int args) 320 | { 321 | if (!client) 322 | { 323 | ReplyToCommand(client, "[SM] In-game only command."); 324 | return Plugin_Handled; 325 | } 326 | 327 | if (userTags[client] == null) 328 | { 329 | ReplyToCommand(client, "[SM] Tags not yet loaded."); 330 | return Plugin_Handled; 331 | } 332 | 333 | if (!cv_bEnableTagsList.BoolValue) 334 | { 335 | ReplyToCommand(client, "[SM] This feature is not enabled."); 336 | return Plugin_Handled; 337 | } 338 | 339 | if (userTags[client].Length == 0) 340 | { 341 | ReplyToCommand(client, "[SM] No tags available."); 342 | return Plugin_Handled; 343 | } 344 | 345 | Menu menu = new Menu(Handler_TagsMenu); 346 | menu.SetTitle("Choose your tag:"); 347 | static char sIndex[16]; 348 | int len = userTags[client].Length; 349 | CustomTags tags; 350 | for (int i = 0; i < len; i++) 351 | { 352 | userTags[client].GetArray(i, tags, sizeof(tags)); 353 | IntToString(i, sIndex, sizeof(sIndex)); 354 | menu.AddItem(sIndex, tags.TagName); 355 | } 356 | menu.Display(client, MENU_TIME_FOREVER); 357 | return Plugin_Handled; 358 | } 359 | 360 | public Action Cmd_GetTeam(int client, int args) 361 | { 362 | if (!client) 363 | { 364 | ReplyToCommand(client, "[SM] In-game only command."); 365 | return Plugin_Handled; 366 | } 367 | 368 | char sTeam[32]; 369 | GetTeamName(GetClientTeam(client), sTeam, sizeof(sTeam)); 370 | ReplyToCommand(client, "[SM] Current team name: %s", sTeam); 371 | return Plugin_Handled; 372 | } 373 | 374 | public Action Cmd_Anonymous(int client, int args) 375 | { 376 | if (!AreClientCookiesCached(client)) 377 | { 378 | ReplyToCommand(client, "[SM] The cookies are not loaded yet! Please try again in a few seconds."); 379 | return Plugin_Handled; 380 | } 381 | 382 | bIsAnonymous[client] = !bIsAnonymous[client]; 383 | 384 | char sCookieValue[4]; 385 | IntToString(bIsAnonymous[client], sCookieValue, sizeof(sCookieValue)); 386 | SetClientCookie(client, hVibilityAdminsCookie, sCookieValue); 387 | LoadTags(client, "load tags: cmd anonymous"); 388 | 389 | 390 | if (bIsAnonymous[client]) 391 | { 392 | ReplyToCommand(client, "[SM] You are now anonymous. Your score-tag is %s", selectedTags[client].ScoreTag); 393 | } 394 | else 395 | { 396 | ReplyToCommand(client, "[SM] You are no longer anonymous. Your score-tag is %s", selectedTags[client].ScoreTag); 397 | } 398 | 399 | return Plugin_Handled; 400 | } 401 | 402 | // Menu 403 | public int Handler_TagsMenu(Menu menu, MenuAction action, int param1, int param2) 404 | { 405 | if (action == MenuAction_End) 406 | { 407 | delete menu; 408 | } 409 | else if (action == MenuAction_Select) 410 | { 411 | static char sIndex[16]; 412 | menu.GetItem(param2, sIndex, sizeof(sIndex)); 413 | userTags[param1].GetArray(StringToInt(sIndex), selectedTags[param1], sizeof(CustomTags)); 414 | if (selectedTags[param1].ScoreTag[0] != '\0') 415 | { 416 | SetClientClanTag(param1, selectedTags[param1].ScoreTag, "tags menu"); 417 | } 418 | iSelTagId[param1] = selectedTags[param1].SectionId; 419 | 420 | static char sValue[32]; 421 | IntToString(iSelTagId[param1], sValue, sizeof(sValue)); 422 | SetClientCookie(param1, hSelTagCookie, sValue); 423 | PrintToChat(param1, "[SM] Setted %s tags", selectedTags[param1].TagName); 424 | } 425 | return 0; 426 | } 427 | 428 | // Events 429 | public void OnMapEnd() 430 | { 431 | delete roundStatusTimer; 432 | delete forceTimer; 433 | } 434 | 435 | // Events: client 436 | public void OnClientPutInServer(int client) 437 | { 438 | delete userTags[client]; 439 | userTags[client] = new ArrayList(sizeof(CustomTags)); 440 | } 441 | 442 | public void OnClientPostAdminCheck(int client) 443 | { 444 | LoadTags(client, "load tags: post admin check"); 445 | } 446 | 447 | public void OnClientCookiesCached(int client) 448 | { 449 | if (!IsValidClient(client)) 450 | return; 451 | 452 | // HideTag cookie 453 | static char sValue[32]; 454 | GetClientCookie(client, hVibilityCookie, sValue, sizeof(sValue)); 455 | 456 | bHideTag[client] = sValue[0] == '\0' ? false : !StringToInt(sValue); 457 | 458 | // Selected tag Cookie 459 | GetClientCookie(client, hSelTagCookie, sValue, sizeof(sValue)); 460 | if (sValue[0] != '\0') 461 | { 462 | int id = StringToInt(sValue); 463 | if (!id) 464 | { 465 | LogError("Invalid id: %s", sValue); 466 | } 467 | iSelTagId[client] = id; 468 | } 469 | 470 | 471 | // Anonymous cookie 472 | GetClientCookie(client, hVibilityAdminsCookie, sValue, sizeof(sValue)); 473 | int cookieValue = StringToInt(sValue); 474 | if (cookieValue == 1) 475 | { 476 | bIsAnonymous[client] = true; 477 | 478 | LoadTags(client, "load tags: anonymous cookie"); 479 | SetClientClanTag(client, selectedTags[client].ScoreTag, "anonymous cookie"); 480 | } 481 | return; 482 | } 483 | 484 | //Thanks to https://forums.alliedmods.net/showpost.php?p=2573907&postcount=6 485 | public Action OnClientCommandKeyValues(int client, KeyValues kv) 486 | { 487 | if (bHideTag[client]) 488 | return Plugin_Continue; 489 | 490 | char sKey[64]; 491 | 492 | if (!bCSGO || !kv.GetSectionName(sKey, sizeof(sKey))) 493 | return Plugin_Continue; 494 | 495 | #if defined DEBUG 496 | char sKV[256]; 497 | kv.ExportToString(sKV, sizeof(sKV)); 498 | logger.debug("Called ClientCmdKv: %s\n%s\n", sKey, sKV); 499 | #endif 500 | 501 | if (StrEqual(sKey, "ClanTagChanged")) 502 | { 503 | kv.GetString("tag", sUserTag[client], sizeof(sUserTag[])); 504 | LoadTags(client, "load tags: command keyvalues"); 505 | 506 | if (selectedTags[client].ScoreTag[0] == '\0') 507 | return Plugin_Continue; 508 | 509 | kv.SetString("tag", selectedTags[client].ScoreTag); 510 | logger.debug("[ClanTagChanged] Setted tag: %s ", selectedTags[client].ScoreTag); 511 | return Plugin_Changed; 512 | } 513 | 514 | return Plugin_Continue; 515 | } 516 | 517 | public void OnClientDisconnect(int client) 518 | { 519 | ResetTags(client); 520 | iRank[client] = -1; 521 | bHideTag[client] = false; 522 | sUserTag[client][0] = '\0'; 523 | delete userTags[client]; 524 | } 525 | 526 | public void warden_OnWardenCreated(int client) 527 | { 528 | RequestFrame(Frame_LoadTag, client); 529 | } 530 | 531 | public void warden_OnWardenRemoved(int client) 532 | { 533 | SetClientClanTag(client, sUserTag[client], "warden removed"); 534 | 535 | RequestFrame(Frame_LoadTag, client); 536 | 537 | } 538 | 539 | public void warden_OnDeputyCreated(int client) 540 | { 541 | RequestFrame(Frame_LoadTag, client); 542 | } 543 | 544 | public void warden_OnDeputyRemoved(int client) 545 | { 546 | SetClientClanTag(client, sUserTag[client], "deputy removed"); 547 | RequestFrame(Frame_LoadTag, client); 548 | } 549 | 550 | public Action CP_OnChatMessage(int & author, ArrayList recipients, char[] flagstring, char[] name, char[] message, bool & processcolors, bool & removecolors) 551 | { 552 | if (bHideTag[author]) 553 | { 554 | return Plugin_Continue; 555 | } 556 | 557 | Action result = Plugin_Continue; 558 | //Call the forward 559 | Call_StartForward(fMessagePreProcess); 560 | Call_PushCell(author); 561 | Call_PushStringEx(name, MAXLENGTH_NAME, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); 562 | Call_PushStringEx(message, MAXLENGTH_MESSAGE, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); 563 | Call_Finish(result); 564 | 565 | if (result >= Plugin_Handled) 566 | { 567 | return Plugin_Continue; 568 | } 569 | 570 | //Add colors & tags 571 | char sNewName[MAXLENGTH_NAME]; 572 | char sNewMessage[MAXLENGTH_MESSAGE]; 573 | // Rainbow name 574 | if (StrEqual(selectedTags[author].NameColor, "{rainbow}")) 575 | { 576 | logger.debug("Rainbow name"); 577 | char sTemp[MAXLENGTH_MESSAGE]; 578 | 579 | int color; 580 | int len = strlen(name); 581 | for (int i = 0; i < len; i++) 582 | { 583 | if (IsCharSpace(name[i])) 584 | { 585 | Format(sTemp, sizeof(sTemp), "%s%c", sTemp, name[i]); 586 | continue; 587 | } 588 | 589 | int bytes = GetCharBytes(name[i]) + 1; 590 | char[] c = new char[bytes]; 591 | strcopy(c, bytes, name[i]); 592 | Format(sTemp, sizeof(sTemp), "%s%c%s", sTemp, GetColor(++color), c); 593 | if (IsCharMB(name[i])) 594 | i += bytes - 2; 595 | } 596 | Format(sNewName, MAXLENGTH_NAME, "%s%s{default}", selectedTags[author].ChatTag, sTemp); 597 | } 598 | else if (StrEqual(selectedTags[author].NameColor, "{random}")) //Random name 599 | { 600 | logger.debug("Random name"); 601 | char sTemp[MAXLENGTH_MESSAGE]; 602 | 603 | int len = strlen(name); 604 | for (int i = 0; i < len; i++) 605 | { 606 | if (IsCharSpace(name[i])) 607 | { 608 | Format(sTemp, sizeof(sTemp), "%s%c", sTemp, name[i]); 609 | continue; 610 | } 611 | 612 | int bytes = GetCharBytes(name[i]) + 1; 613 | char[] c = new char[bytes]; 614 | strcopy(c, bytes, name[i]); 615 | Format(sTemp, sizeof(sTemp), "%s%c%s", sTemp, GetRandomColor(), c); 616 | if (IsCharMB(name[i])) 617 | i += bytes - 2; 618 | } 619 | Format(sNewName, MAXLENGTH_NAME, "%s%s{default}", selectedTags[author].ChatTag, sTemp); 620 | } 621 | else 622 | { 623 | logger.debug("Default name"); 624 | Format(sNewName, MAXLENGTH_NAME, "%s%s%s{default}", selectedTags[author].ChatTag, selectedTags[author].NameColor, name); 625 | } 626 | Format(sNewMessage, MAXLENGTH_MESSAGE, "%s%s", selectedTags[author].ChatColor, message); 627 | 628 | //Update the params 629 | static char sTime[16]; 630 | FormatTime(sTime, sizeof(sTime), "%H:%M"); 631 | ReplaceString(sNewName, sizeof(sNewName), "{time}", sTime); 632 | ReplaceString(sNewMessage, sizeof(sNewMessage), "{time}", sTime); 633 | 634 | 635 | static char sIP[32]; 636 | static char sCountry[3]; 637 | GetClientIP(author, sIP, sizeof(sIP)); 638 | GeoipCode2(sIP, sCountry); 639 | ReplaceString(sNewName, sizeof(sNewName), "{country}", sCountry); 640 | ReplaceString(sNewMessage, sizeof(sNewMessage), "{country}", sCountry); 641 | 642 | if (bGangs) 643 | { 644 | logger.debug("Apply gans"); 645 | static char sGang[32]; 646 | Gangs_HasGang(author) ? Gangs_GetGangName(author, sGang, sizeof(sGang)) : cv_sDefaultGang.GetString(sGang, sizeof(sGang)); 647 | 648 | ReplaceString(sNewName, sizeof(sNewName), "{gang}", sGang); 649 | ReplaceString(sNewMessage, sizeof(sNewMessage), "{gang}", sGang); 650 | } 651 | 652 | if (bRankme) 653 | { 654 | logger.debug("Apply rankme"); 655 | static char sPoints[16]; 656 | IntToString(RankMe_GetPoints(author), sPoints, sizeof(sPoints)); 657 | ReplaceString(sNewName, sizeof(sNewName), "{rmPoints}", sPoints); 658 | ReplaceString(sNewMessage, sizeof(sNewMessage), "{rmPoints}", sPoints); 659 | 660 | static char sRank[16]; 661 | IntToString(iRank[author], sRank, sizeof(sRank)); 662 | ReplaceString(sNewName, sizeof(sNewName), "{rmRank}", sRank); 663 | ReplaceString(sNewMessage, sizeof(sNewMessage), "{rmRank}", sRank); 664 | } 665 | 666 | //Rainbow Chat 667 | if (StrEqual(selectedTags[author].ChatColor, "{rainbow}", false)) 668 | { 669 | logger.debug("Rainbow chat"); 670 | ReplaceString(sNewMessage, sizeof(sNewMessage), "{rainbow}", ""); 671 | char sTemp[MAXLENGTH_MESSAGE]; 672 | 673 | int color; 674 | int len = strlen(sNewMessage); 675 | for (int i = 0; i < len; i++) 676 | { 677 | if (IsCharSpace(sNewMessage[i])) 678 | { 679 | Format(sTemp, sizeof(sTemp), "%s%c", sTemp, sNewMessage[i]); 680 | continue; 681 | } 682 | 683 | int bytes = GetCharBytes(sNewMessage[i]) + 1; 684 | char[] c = new char[bytes]; 685 | strcopy(c, bytes, sNewMessage[i]); 686 | Format(sTemp, sizeof(sTemp), "%s%c%s", sTemp, GetColor(++color), c); 687 | if (IsCharMB(sNewMessage[i])) 688 | i += bytes - 2; 689 | } 690 | Format(sNewMessage, MAXLENGTH_MESSAGE, "%s", sTemp); 691 | } 692 | 693 | //Random Chat 694 | if (StrEqual(selectedTags[author].ChatColor, "{random}", false)) 695 | { 696 | logger.debug("Random chat"); 697 | ReplaceString(sNewMessage, sizeof(sNewMessage), "{random}", ""); 698 | char sTemp[MAXLENGTH_MESSAGE]; 699 | 700 | int len = strlen(sNewMessage); 701 | for (int i = 0; i < len; i++) 702 | { 703 | if (IsCharSpace(sNewMessage[i])) 704 | { 705 | Format(sTemp, sizeof(sTemp), "%s%c", sTemp, sNewMessage[i]); 706 | continue; 707 | } 708 | 709 | int bytes = GetCharBytes(sNewMessage[i]) + 1; 710 | char[] c = new char[bytes]; 711 | strcopy(c, bytes, sNewMessage[i]); 712 | Format(sTemp, sizeof(sTemp), "%s%c%s", sTemp, GetRandomColor(), c); 713 | if (IsCharMB(sNewMessage[i])) 714 | i += bytes - 2; 715 | } 716 | Format(sNewMessage, MAXLENGTH_MESSAGE, "%s", sTemp); 717 | } 718 | 719 | static char sPassedName[MAXLENGTH_NAME]; 720 | static char sPassedMessage[MAXLENGTH_NAME]; 721 | sPassedName = sNewName; 722 | sPassedMessage = sNewMessage; 723 | 724 | 725 | result = Plugin_Continue; 726 | //Call the forward 727 | Call_StartForward(fMessageProcess); 728 | Call_PushCell(author); 729 | Call_PushStringEx(sPassedName, sizeof(sPassedName), SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); 730 | Call_PushStringEx(sPassedMessage, sizeof(sPassedMessage), SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); 731 | Call_Finish(result); 732 | 733 | if (result == Plugin_Continue) 734 | { 735 | //Update the name & message 736 | strcopy(name, MAXLENGTH_NAME, sNewName); 737 | strcopy(message, MAXLENGTH_MESSAGE, sNewMessage); 738 | } 739 | else if (result == Plugin_Changed) 740 | { 741 | //Update the name & message 742 | strcopy(name, MAXLENGTH_NAME, sPassedName); 743 | strcopy(message, MAXLENGTH_MESSAGE, sPassedMessage); 744 | } 745 | else 746 | { 747 | return Plugin_Continue; 748 | } 749 | 750 | processcolors = true; 751 | removecolors = false; 752 | 753 | //Call the (post)forward 754 | Call_StartForward(fMessageProcessed); 755 | Call_PushCell(author); 756 | Call_PushString(sPassedName); 757 | Call_PushString(sPassedMessage); 758 | Call_Finish(); 759 | 760 | 761 | logger.debug("Message sent"); 762 | return Plugin_Changed; 763 | } 764 | 765 | 766 | // Events: rankme 767 | public Action RankMe_OnPlayerLoaded(int client) 768 | { 769 | RankMe_GetRank(client, RankMe_LoadTags); 770 | return Plugin_Continue; 771 | } 772 | 773 | public Action RankMe_OnPlayerSaved(int client) 774 | { 775 | RankMe_GetRank(client, RankMe_LoadTags); 776 | return Plugin_Continue; 777 | } 778 | 779 | public Action RankMe_LoadTags(int client, int rank, any data) 780 | { 781 | logger.debug("Callback load rankme-tags"); 782 | if (IsValidClient(client, true, true)) 783 | { 784 | iRank[client] = rank; 785 | logger.debug("Callback valid rank %L - %i", client, rank); 786 | char sRank[16]; 787 | IntToString(iRank[client], sRank, sizeof(sRank)); 788 | 789 | if (selectedTags[client].ScoreTag[0] == '\0') 790 | return Plugin_Continue; 791 | 792 | ReplaceString(selectedTags[client].ScoreTag, sizeof(CustomTags::ScoreTag), "{rmRank}", sRank); 793 | SetClientClanTag(client, selectedTags[client].ScoreTag, "rankme load"); //Instantly load the score-tag 794 | } 795 | return Plugin_Continue; 796 | } 797 | 798 | // Events: hooks 799 | public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast) 800 | { 801 | delete roundStatusTimer; 802 | roundStatusTimer = CreateTimer(5.0, Timer_RoundStart); 803 | } 804 | 805 | public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) 806 | { 807 | bHasRoundEnded = true; 808 | if (!cv_bParseRoundEnd.BoolValue) 809 | return; 810 | 811 | for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i)) LoadTags(i, "load tags: round end"); 812 | } 813 | 814 | //Functions 815 | void LoadKv() 816 | { 817 | static char sConfig[PLATFORM_MAX_PATH]; 818 | BuildPath(Path_SM, sConfig, sizeof(sConfig), "configs/hextags.cfg"); //Get cfg file 819 | 820 | if (OpenFile(sConfig, "rt") == null) 821 | SetFailState("Couldn't find: \"%s\"", sConfig); //Check if cfg exist 822 | 823 | KeyValues kv = new KeyValues("HexTags"); //Create the kv 824 | 825 | if (!kv.ImportFromFile(sConfig)) 826 | SetFailState("Couldn't import: \"%s\"", sConfig); //Check if file was imported properly 827 | 828 | if (!kv.GotoFirstSubKey()) 829 | LogMessage("No entries found in: \"%s\"", sConfig); //Notify that there aren't any entries 830 | 831 | delete kv; 832 | strcopy(sTagConf, sizeof(sTagConf), sConfig); 833 | delete tagsKv; 834 | } 835 | 836 | void LoadTags(int client, const char[] reason) 837 | { 838 | if (bHideTag[client]) 839 | return; 840 | 841 | if (!IsValidClient(client, true, true)) 842 | return; 843 | 844 | //Clear the tags when re-checking 845 | ResetTags(client); 846 | 847 | if (tagsKv == null) 848 | { 849 | tagsKv = new KeyValues("HexTags"); 850 | tagsKv.ImportFromFile(sTagConf); 851 | logger.debug("KeyValue handle: %i", tagsKv); 852 | } 853 | tagsKv.Rewind(); 854 | if (userTags[client] == null) 855 | { 856 | userTags[client] = new ArrayList(sizeof(CustomTags)); 857 | } 858 | ParseConfig(tagsKv, client, reason); 859 | 860 | if (userTags[client].Length > 0) 861 | { 862 | if (iSelTagId[client] == 0 || !cv_bEnableTagsList.BoolValue) 863 | { 864 | userTags[client].GetArray(0, selectedTags[client], sizeof(CustomTags)); 865 | return; 866 | } 867 | tagsKv.Rewind(); 868 | if (!tagsKv.JumpToKeySymbol(iSelTagId[client])) 869 | { 870 | SetClientCookie(client, hSelTagCookie, ""); 871 | userTags[client].GetArray(0, selectedTags[client], sizeof(CustomTags)); 872 | return; 873 | } 874 | // Key found 875 | int len = userTags[client].Length; 876 | CustomTags tags; 877 | 878 | for (int i = 0; i < len; i++) 879 | { 880 | userTags[client].GetArray(i, tags, sizeof(CustomTags)); 881 | if (tags.SectionId == iSelTagId[client]) 882 | { 883 | selectedTags[client] = tags; 884 | if (selectedTags[client].ScoreTag[0] == '\0') 885 | return; 886 | 887 | SetClientClanTag(client, selectedTags[client].ScoreTag, reason); 888 | return; 889 | } 890 | } 891 | } 892 | } 893 | 894 | void ParseConfig(KeyValues kv, int client, const char[] reason) 895 | { 896 | userTags[client].Clear(); 897 | static char sSectionName[64]; 898 | do 899 | { 900 | if (kv.GotoFirstSubKey()) 901 | { 902 | kv.GetSectionName(sSectionName, sizeof(sSectionName)); 903 | logger.debug("Current key: %s", sSectionName); 904 | 905 | if (CheckSelector(sSectionName, client)) 906 | { 907 | logger.debug("*******FOUND VALID SELECTOR -> %s.", sSectionName); 908 | ParseConfig(kv, client, reason); 909 | } 910 | } 911 | else 912 | { 913 | kv.GetSectionName(sSectionName, sizeof(sSectionName)); 914 | if (!CheckSelector(sSectionName, client)) 915 | { 916 | continue; 917 | } 918 | logger.debug("***********SETTINGS TAGS", sSectionName); 919 | char reason2[128]; 920 | Format(reason2, sizeof(reason2), "get tags, parse config: %s", reason); 921 | GetTags(client, kv, reason2); 922 | } 923 | } while (kv.GotoNextKey()); 924 | logger.debug("-- Section end --"); 925 | } 926 | 927 | bool CheckSelector(const char[] selector, int client) 928 | { 929 | char sCookieValue[12]; 930 | GetClientCookie(client, hIsAnonymousCookie, sCookieValue, sizeof(sCookieValue)); 931 | int cookieValue = StringToInt(sCookieValue); 932 | /* CHECK DEFAULT */ 933 | if (StrEqual(selector, "default", false)) 934 | { 935 | return true; 936 | } 937 | 938 | /* CHECK HUMAN */ 939 | if (StrEqual(selector, "human", false) && !IsFakeClient(client)) 940 | { 941 | return true; 942 | } 943 | 944 | /* CHECK BOT */ 945 | if (StrEqual(selector, "bot", false) && IsFakeClient(client)) 946 | { 947 | return true; 948 | } 949 | 950 | /* CHECK STEAMID */ 951 | if (strlen(selector) > 11 && StrContains(selector, "STEAM_", true) == 0 && !bIsAnonymous[client]) 952 | { 953 | char steamid[32]; 954 | if ((!GetClientAuthId(client, AuthId_Steam2, steamid, sizeof(steamid))) || (cookieValue == 1)) 955 | return false; 956 | 957 | if (StrEqual(steamid, selector)) 958 | { 959 | return true; 960 | } 961 | 962 | //Replace the STEAM_1 to STEAM_0 or viceversa 963 | (steamid[6] == '1') ? (steamid[6] = '0') : (steamid[6] = '1'); 964 | if (StrEqual(steamid, selector)) 965 | { 966 | return true; 967 | } 968 | } 969 | 970 | 971 | /* PERMISSIONS RELATED CHECKS */ 972 | AdminId admin = GetUserAdmin(client); 973 | if (admin != INVALID_ADMIN_ID) 974 | { 975 | logger.debug("Found as admin! %N", client); 976 | /* CHECK ADMIN GROUP */ 977 | if (selector[0] == '@' && !bIsAnonymous[client]) 978 | { 979 | logger.debug("Check group: %s", selector); 980 | static char sGroup[32]; 981 | 982 | GroupId group = admin.GetGroup(0, sGroup, sizeof(sGroup)); 983 | if (group != INVALID_GROUP_ID) 984 | { 985 | if (cookieValue == 1) 986 | { 987 | return false; 988 | } 989 | if (StrEqual(selector[1], sGroup)) 990 | { 991 | return true; 992 | } 993 | } 994 | } 995 | 996 | /* CHECK ADMIN FLAGS (1)*/ 997 | if (strlen(selector) == 1 && !bIsAnonymous[client]) 998 | { 999 | logger.debug("Check for flag (1char): ", selector); 1000 | AdminFlag flag; 1001 | if (FindFlagByChar(CharToLower(selector[0]), flag)) 1002 | { 1003 | if (cookieValue == 1) 1004 | { 1005 | return false; 1006 | } 1007 | if (admin.HasFlag(flag)) 1008 | { 1009 | return true; 1010 | } 1011 | } 1012 | } 1013 | 1014 | /* CHECK ADMIN FLAGS (2)*/ 1015 | if (selector[0] == '&' && !bIsAnonymous[client]) 1016 | { 1017 | logger.debug("Check group: %s", selector); 1018 | for (int i = 1; i < strlen(selector); i++) 1019 | { 1020 | AdminFlag flag; 1021 | if (FindFlagByChar(selector[i], flag)) 1022 | { 1023 | 1024 | if (cookieValue == 1) 1025 | { 1026 | return false; 1027 | } 1028 | if (admin.HasFlag(flag)) 1029 | { 1030 | return true; 1031 | } 1032 | } 1033 | } 1034 | } 1035 | logger.debug("Unmatched admin: %s", selector); 1036 | } 1037 | 1038 | /* CHECK PLAYER TEAM */ 1039 | int team = GetClientTeam(client); 1040 | static char sTeam[32]; 1041 | 1042 | GetTeamName(team, sTeam, sizeof(sTeam)); 1043 | if (StrEqual(sTeam, selector)) 1044 | { 1045 | return true; 1046 | } 1047 | 1048 | /* CHECK TIME */ 1049 | if (bMostActive && selector[0] == '#') 1050 | { 1051 | int iPlayTime = MostActive_GetPlayTimeTotal(client); 1052 | if (iPlayTime >= StringToInt(selector[1])) 1053 | { 1054 | return true; 1055 | } 1056 | } 1057 | 1058 | /* CHECK WARDEN */ 1059 | if (bWarden && StrEqual(selector, "warden", false) && warden_iswarden(client)) 1060 | { 1061 | return true; 1062 | } 1063 | 1064 | /* CHECK DEPUTY */ 1065 | if (bMyJBWarden && StrEqual(selector, "deputy", false) && warden_deputy_isdeputy(client)) 1066 | { 1067 | return true; 1068 | } 1069 | 1070 | /* CHECK PRIME */ 1071 | if (bSteamWorks && StrEqual(selector, "NoPrime", false)) 1072 | { 1073 | if (k_EUserHasLicenseResultDoesNotHaveLicense == SteamWorks_HasLicenseForApp(client, 624820)) 1074 | { 1075 | return true; 1076 | } 1077 | } 1078 | 1079 | /* CHECK GANG */ 1080 | if (bGangs && StrEqual(selector, "Gang", false) && Gangs_HasGang(client)) 1081 | { 1082 | return true; 1083 | } 1084 | 1085 | /* CHECK RANKME */ 1086 | if (bRankme && selector[0] == '!') 1087 | { 1088 | int iPoints = RankMe_GetPoints(client); 1089 | if (iPoints >= StringToInt(selector[1])) 1090 | { 1091 | return true; 1092 | } 1093 | } 1094 | 1095 | /* CHECK STEAM GROUP */ 1096 | if (bSteamWorks && selector[0] == '$') 1097 | { 1098 | if (SteamWorks_GetUserGroupStatus(client, selector[1])) 1099 | { 1100 | return true; 1101 | } 1102 | } 1103 | 1104 | 1105 | bool res = false; 1106 | 1107 | Call_StartForward(pfCustomSelector); 1108 | Call_PushCell(client); 1109 | Call_PushString(selector); 1110 | Call_Finish(res); 1111 | 1112 | return res; 1113 | } 1114 | 1115 | //Timers 1116 | public Action Timer_ForceTag(Handle timer) 1117 | { 1118 | if (!bCSGO) 1119 | return Plugin_Stop; 1120 | 1121 | logger.debug("Force timer"); 1122 | 1123 | for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i) && selectedTags[i].ForceTag && selectedTags[i].ScoreTag[0] != '\0' && !bHideTag[i]) 1124 | { 1125 | char sTag[32]; 1126 | CS_GetClientClanTag(i, sTag, sizeof(sTag)); 1127 | if (StrEqual(sTag, selectedTags[i].ScoreTag)) 1128 | continue; 1129 | 1130 | if (!bHasRoundEnded) { 1131 | logger.info("%L is not the HexTags' one, should be '%s' but is '%s'", i, selectedTags[i].ScoreTag, sTag); 1132 | SetClientClanTag(i, selectedTags[i].ScoreTag, "timer forcetag"); 1133 | } 1134 | 1135 | } 1136 | return Plugin_Continue; 1137 | } 1138 | 1139 | public Action Timer_RoundStart(Handle timer) 1140 | { 1141 | bHasRoundEnded = false; 1142 | roundStatusTimer = null; 1143 | return Plugin_Continue; 1144 | } 1145 | 1146 | 1147 | //Frames 1148 | public void Frame_LoadTag(any client) 1149 | { 1150 | LoadTags(client, "load tags: frame load"); 1151 | } 1152 | 1153 | //Stocks 1154 | void GetTags(int client, KeyValues kv, const char[] reason) 1155 | { 1156 | static char sSection[64]; 1157 | static char sDef[8]; 1158 | IntToString(iNextDefTag++, sDef, sizeof(sDef)); 1159 | 1160 | kv.GetSectionName(sSection, sizeof(sSection)); 1161 | logger.debug("Section: %s", sSection); 1162 | int id; 1163 | if (!kv.GetSectionSymbol(id)) 1164 | { 1165 | LogError("Unable to get section symbol."); 1166 | } 1167 | 1168 | CustomTags tags; 1169 | 1170 | tags.SectionId = id; 1171 | kv.GetString("TagName", tags.TagName, sizeof(CustomTags::TagName), sDef); 1172 | kv.GetString("ScoreTag", tags.ScoreTag, sizeof(CustomTags::ScoreTag), ""); 1173 | kv.GetString("ChatTag", tags.ChatTag, sizeof(CustomTags::ChatTag), ""); 1174 | kv.GetString("ChatColor", tags.ChatColor, sizeof(CustomTags::ChatColor), ""); 1175 | kv.GetString("NameColor", tags.NameColor, sizeof(CustomTags::NameColor), "{teamcolor}"); 1176 | tags.ForceTag = kv.GetNum("ForceTag", 1) == 1; 1177 | 1178 | 1179 | Call_StartForward(fTagsUpdated); 1180 | Call_PushCell(client); 1181 | Call_Finish(); 1182 | 1183 | if (tags.ScoreTag[0] != '\0' && bCSGO) 1184 | { 1185 | //Update params 1186 | if (StrContains(tags.ScoreTag, "{country}") != -1) 1187 | { 1188 | static char sIP[32]; 1189 | static char sCountry[3]; 1190 | if (!GetClientIP(client, sIP, sizeof(sIP))) 1191 | LogError("Unable to get %L ip!", client); 1192 | GeoipCode2(sIP, sCountry); 1193 | ReplaceString(tags.ScoreTag, sizeof(CustomTags::ScoreTag), "{country}", sCountry); 1194 | } 1195 | if (bGangs && StrContains(tags.ScoreTag, "{gang}") != -1) 1196 | { 1197 | static char sGang[32]; 1198 | Gangs_HasGang(client) ? Gangs_GetGangName(client, sGang, sizeof(sGang)) : cv_sDefaultGang.GetString(sGang, sizeof(sGang)); 1199 | ReplaceString(tags.ScoreTag, sizeof(CustomTags::ScoreTag), "{gang}", sGang); 1200 | } 1201 | if (bRankme && StrContains(tags.ScoreTag, "{rmPoints}") != -1) 1202 | { 1203 | static char sPoints[16]; 1204 | IntToString(RankMe_GetPoints(client), sPoints, sizeof(sPoints)); 1205 | ReplaceString(tags.ScoreTag, sizeof(CustomTags::ScoreTag), "{rmPoints}", sPoints); 1206 | } 1207 | if (bRankme && StrContains(tags.ScoreTag, "{rmRank}") != -1) 1208 | { 1209 | logger.debug("Contains rmRank"); 1210 | RankMe_GetRank(client, RankMe_LoadTags); 1211 | } 1212 | 1213 | logger.debug("Setted tag: %s", tags.ScoreTag); 1214 | if (userTags[client].Length == 0) 1215 | SetClientClanTag(client, tags.ScoreTag, reason); //Instantly load the score-tag 1216 | } 1217 | if (StrContains(tags.ChatTag, "{rainbow}") == 0) 1218 | { 1219 | logger.debug("Found {rainbow} in ChatTag"); 1220 | ReplaceString(tags.ChatTag, sizeof(CustomTags::ChatTag), "{rainbow}", ""); 1221 | char sTemp[MAXLENGTH_MESSAGE]; 1222 | 1223 | int color; 1224 | int len = strlen(tags.ChatTag); 1225 | for (int i = 0; i < len; i++) 1226 | { 1227 | if (IsCharSpace(tags.ChatTag[i])) 1228 | { 1229 | Format(sTemp, sizeof(sTemp), "%s%c", sTemp, tags.ChatTag[i]); 1230 | continue; 1231 | } 1232 | 1233 | int bytes = GetCharBytes(tags.ChatTag[i]) + 1; 1234 | char[] c = new char[bytes]; 1235 | strcopy(c, bytes, tags.ChatTag[i]); 1236 | Format(sTemp, sizeof(sTemp), "%s%c%s", sTemp, GetColor(++color), c); 1237 | if (IsCharMB(tags.ChatTag[i])) 1238 | i += bytes - 2; 1239 | } 1240 | strcopy(tags.ChatTag, sizeof(CustomTags::ChatTag), sTemp); 1241 | logger.debug("Replaced ChatTag with %s", tags.ChatTag); 1242 | } 1243 | if (StrContains(tags.ChatTag, "{random}") == 0) 1244 | { 1245 | ReplaceString(tags.ChatTag, sizeof(CustomTags::ChatTag), "{random}", ""); 1246 | char sTemp[MAXLENGTH_MESSAGE]; 1247 | int len = strlen(tags.ChatTag); 1248 | for (int i = 0; i < len; i++) 1249 | { 1250 | if (IsCharSpace(tags.ChatTag[i])) 1251 | { 1252 | Format(sTemp, sizeof(sTemp), "%s%c", sTemp, tags.ChatTag[i]); 1253 | continue; 1254 | } 1255 | 1256 | int bytes = GetCharBytes(tags.ChatTag[i]) + 1; 1257 | char[] c = new char[bytes]; 1258 | strcopy(c, bytes, tags.ChatTag[i]); 1259 | Format(sTemp, sizeof(sTemp), "%s%c%s", sTemp, GetRandomColor(), c); 1260 | if (IsCharMB(tags.ChatTag[i])) 1261 | i += bytes - 2; 1262 | } 1263 | strcopy(tags.ChatTag, sizeof(CustomTags::ChatTag), sTemp); 1264 | } 1265 | logger.debug("Succesfully setted tags"); 1266 | userTags[client].PushArray(tags, sizeof(tags)); 1267 | } 1268 | 1269 | void ResetTags(int client) 1270 | { 1271 | strcopy(selectedTags[client].ScoreTag, sizeof(CustomTags::ScoreTag), ""); 1272 | strcopy(selectedTags[client].ChatTag, sizeof(CustomTags::ChatTag), ""); 1273 | strcopy(selectedTags[client].ChatColor, sizeof(CustomTags::ChatColor), ""); 1274 | strcopy(selectedTags[client].NameColor, sizeof(CustomTags::NameColor), ""); 1275 | selectedTags[client].ForceTag = true; 1276 | } 1277 | 1278 | int GetRandomColor() 1279 | { 1280 | switch (GetRandomInt(1, 16)) 1281 | { 1282 | case 1:return '\x01'; 1283 | case 2:return '\x02'; 1284 | case 3:return '\x03'; 1285 | case 4:return '\x03'; 1286 | case 5:return '\x04'; 1287 | case 6:return '\x05'; 1288 | case 7:return '\x06'; 1289 | case 8:return '\x07'; 1290 | case 9:return '\x08'; 1291 | case 10:return '\x09'; 1292 | case 11:return '\x10'; 1293 | case 12:return '\x0A'; 1294 | case 13:return '\x0B'; 1295 | case 14:return '\x0C'; 1296 | case 15:return '\x0E'; 1297 | case 16:return '\x0F'; 1298 | } 1299 | return '\x01'; 1300 | } 1301 | 1302 | int GetColor(int color) 1303 | { 1304 | switch (color % 7) 1305 | { 1306 | case 0:return '\x02'; 1307 | case 1:return '\x10'; 1308 | case 2:return '\x09'; 1309 | case 3:return '\x06'; 1310 | case 4:return '\x0B'; 1311 | case 5:return '\x0C'; 1312 | case 6:return '\x0E'; 1313 | } 1314 | return '\x01'; 1315 | } 1316 | 1317 | void SetClientClanTag(int client, const char[] tag, const char[] reason) 1318 | { 1319 | if (!bCSGO) 1320 | return; 1321 | 1322 | logger.info("Changed tag of %N to %s, reason: %s", client, tag, reason); 1323 | CS_SetClientClanTag(client, tag); 1324 | } 1325 | 1326 | //API 1327 | public int Native_GetClientTag(Handle plugin, int numParams) 1328 | { 1329 | int client = GetNativeCell(1); 1330 | 1331 | if (client < 1 || client > MaxClients) 1332 | { 1333 | return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index (%d)", client); 1334 | } 1335 | if (!IsClientConnected(client)) 1336 | { 1337 | return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not connected", client); 1338 | } 1339 | 1340 | eTags tag = view_as(GetNativeCell(2)); 1341 | switch (tag) 1342 | { 1343 | case (ScoreTag): 1344 | { 1345 | SetNativeString(3, selectedTags[client].ScoreTag, GetNativeCell(4)); 1346 | } 1347 | case (ChatTag): 1348 | { 1349 | SetNativeString(3, selectedTags[client].ChatTag, GetNativeCell(4)); 1350 | } 1351 | case (ChatColor): 1352 | { 1353 | SetNativeString(3, selectedTags[client].ChatColor, GetNativeCell(4)); 1354 | } 1355 | case (NameColor): 1356 | { 1357 | SetNativeString(3, selectedTags[client].NameColor, GetNativeCell(4)); 1358 | } 1359 | } 1360 | return 0; 1361 | } 1362 | 1363 | public int Native_SetClientTag(Handle plugin, int numParams) 1364 | { 1365 | int client = GetNativeCell(1); 1366 | 1367 | if (client < 1 || client > MaxClients) 1368 | { 1369 | return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index (%d)", client); 1370 | } 1371 | if (!IsClientConnected(client)) 1372 | { 1373 | return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not connected", client); 1374 | } 1375 | 1376 | char sTag[64]; 1377 | eTags tag = view_as(GetNativeCell(2)); 1378 | 1379 | GetNativeString(3, sTag, sizeof(sTag)); 1380 | ReplaceString(sTag, sizeof(sTag), "{darkgray}", "{gray2}"); 1381 | 1382 | switch (tag) 1383 | { 1384 | case (ScoreTag): 1385 | { 1386 | strcopy(selectedTags[client].ScoreTag, sizeof(CustomTags::ScoreTag), sTag); 1387 | } 1388 | case (ChatTag): 1389 | { 1390 | strcopy(selectedTags[client].ChatTag, sizeof(CustomTags::ChatTag), sTag); 1391 | } 1392 | case (ChatColor): 1393 | { 1394 | strcopy(selectedTags[client].ChatColor, sizeof(CustomTags::ChatColor), sTag); 1395 | } 1396 | case (NameColor): 1397 | { 1398 | strcopy(selectedTags[client].NameColor, sizeof(CustomTags::NameColor), sTag); 1399 | } 1400 | } 1401 | 1402 | 1403 | logger.debug("Called Native_SetClientTag(%i, %i, %s)", client, tag, sTag); 1404 | 1405 | // strcopy(selectedTags[client][Tag], sizeof(sTags[][]), sTag); 1406 | return 0; 1407 | } 1408 | 1409 | public int Native_ResetClientTags(Handle plugin, int numParams) 1410 | { 1411 | int client = GetNativeCell(1); 1412 | 1413 | if (client < 1 || client > MaxClients) 1414 | { 1415 | return ThrowNativeError(SP_ERROR_NATIVE, "Invalid client index (%d)", client); 1416 | } 1417 | if (!IsClientConnected(client)) 1418 | { 1419 | return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not connected", client); 1420 | } 1421 | 1422 | LoadTags(client, "load tags: native reset"); 1423 | return 0; 1424 | } 1425 | 1426 | public int Native_AddCustomSelector(Handle plugin, int numParams) 1427 | { 1428 | return pfCustomSelector.AddFunction(plugin, GetNativeFunction(1)); 1429 | } 1430 | 1431 | public int Native_RemoveCustomSelector(Handle plugin, int numParams) 1432 | { 1433 | return pfCustomSelector.RemoveFunction(plugin, GetNativeFunction(1)); 1434 | } 1435 | 1436 | 1437 | /* From smlib */ 1438 | stock void String_ToLower(const char[] input, char[] output, int size) 1439 | { 1440 | size--; 1441 | 1442 | int x = 0; 1443 | while (input[x] != '\0' && x < size) { 1444 | 1445 | output[x] = CharToLower(input[x]); 1446 | 1447 | x++; 1448 | } 1449 | 1450 | output[x] = '\0'; 1451 | } 1452 | -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/SteamWorks.inc: -------------------------------------------------------------------------------- 1 | #if defined _SteamWorks_Included 2 | #endinput 3 | #endif 4 | #define _SteamWorks_Included 5 | 6 | /* results from UserHasLicenseForApp */ 7 | enum EUserHasLicenseForAppResult 8 | { 9 | k_EUserHasLicenseResultHasLicense = 0, // User has a license for specified app 10 | k_EUserHasLicenseResultDoesNotHaveLicense = 1, // User does not have a license for the specified app 11 | k_EUserHasLicenseResultNoAuth = 2, // User has not been authenticated 12 | }; 13 | 14 | /* General result codes */ 15 | enum EResult 16 | { 17 | k_EResultOK = 1, // success 18 | k_EResultFail = 2, // generic failure 19 | k_EResultNoConnection = 3, // no/failed network connection 20 | // k_EResultNoConnectionRetry = 4, // OBSOLETE - removed 21 | k_EResultInvalidPassword = 5, // password/ticket is invalid 22 | k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere 23 | k_EResultInvalidProtocolVer = 7, // protocol version is incorrect 24 | k_EResultInvalidParam = 8, // a parameter is incorrect 25 | k_EResultFileNotFound = 9, // file was not found 26 | k_EResultBusy = 10, // called method busy - action not taken 27 | k_EResultInvalidState = 11, // called object was in an invalid state 28 | k_EResultInvalidName = 12, // name is invalid 29 | k_EResultInvalidEmail = 13, // email is invalid 30 | k_EResultDuplicateName = 14, // name is not unique 31 | k_EResultAccessDenied = 15, // access is denied 32 | k_EResultTimeout = 16, // operation timed out 33 | k_EResultBanned = 17, // VAC2 banned 34 | k_EResultAccountNotFound = 18, // account not found 35 | k_EResultInvalidSteamID = 19, // steamID is invalid 36 | k_EResultServiceUnavailable = 20, // The requested service is currently unavailable 37 | k_EResultNotLoggedOn = 21, // The user is not logged on 38 | k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party) 39 | k_EResultEncryptionFailure = 23, // Encryption or Decryption failed 40 | k_EResultInsufficientPrivilege = 24, // Insufficient privilege 41 | k_EResultLimitExceeded = 25, // Too much of a good thing 42 | k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes) 43 | k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired 44 | k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again 45 | k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time 46 | k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user 47 | k_EResultIPNotFound = 31, // IP address not found 48 | k_EResultPersistFailed = 32, // failed to write change to the data store 49 | k_EResultLockingFailed = 33, // failed to acquire access lock for this operation 50 | k_EResultLogonSessionReplaced = 34, 51 | k_EResultConnectFailed = 35, 52 | k_EResultHandshakeFailed = 36, 53 | k_EResultIOFailure = 37, 54 | k_EResultRemoteDisconnect = 38, 55 | k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested 56 | k_EResultBlocked = 40, // a user didn't allow it 57 | k_EResultIgnored = 41, // target is ignoring sender 58 | k_EResultNoMatch = 42, // nothing matching the request found 59 | k_EResultAccountDisabled = 43, 60 | k_EResultServiceReadOnly = 44, // this service is not accepting content changes right now 61 | k_EResultAccountNotFeatured = 45, // account doesn't have value, so this feature isn't available 62 | k_EResultAdministratorOK = 46, // allowed to take this action, but only because requester is admin 63 | k_EResultContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol. 64 | k_EResultTryAnotherCM = 48, // The current CM can't service the user making a request, user should try another. 65 | k_EResultPasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed. 66 | k_EResultAlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait 67 | k_EResultSuspended = 51, // Long running operation (content download) suspended/paused 68 | k_EResultCancelled = 52, // Operation canceled (typically by user: content download) 69 | k_EResultDataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable 70 | k_EResultDiskFull = 54, // Operation canceled - not enough disk space. 71 | k_EResultRemoteCallFailed = 55, // an remote call or IPC call failed 72 | k_EResultPasswordUnset = 56, // Password could not be verified as it's unset server side 73 | k_EResultExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account 74 | k_EResultPSNTicketInvalid = 58, // PSN ticket was invalid 75 | k_EResultExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first 76 | k_EResultRemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files 77 | k_EResultIllegalPassword = 61, // The requested new password is not legal 78 | k_EResultSameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer ) 79 | k_EResultAccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure 80 | k_EResultCannotUseOldPassword = 64, // The requested new password is not legal 81 | k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid 82 | k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent 83 | k_EResultHardwareNotCapableOfIPT = 67, // 84 | k_EResultIPTInitError = 68, // 85 | k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user 86 | k_EResultFacebookQueryError = 70, // Facebook query returned an error 87 | k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired 88 | k_EResultIPLoginRestrictionFailed = 72, 89 | k_EResultAccountLockedDown = 73, 90 | k_EResultAccountLogonDeniedVerifiedEmailRequired = 74, 91 | k_EResultNoMatchingURL = 75, 92 | k_EResultBadResponse = 76, // parse failure, missing field, etc. 93 | k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password 94 | k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range 95 | k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen 96 | k_EResultDisabled = 80, // The requested service has been configured to be unavailable 97 | k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid ! 98 | k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action 99 | k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted 100 | k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent 101 | k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login 102 | k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted 103 | k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker 104 | k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch 105 | k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match 106 | k_EResultAccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners 107 | k_EResultNotModified = 91, // data not modified 108 | k_EResultNoMobileDevice = 92, // the account does not have a mobile device associated with it 109 | k_EResultTimeNotSynced = 93, // the time presented is out of range or tolerance 110 | k_EResultSmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.) 111 | k_EResultAccountLimitExceeded = 95, // Too many accounts access this resource 112 | k_EResultAccountActivityLimitExceeded = 96, // Too many changes to this account 113 | k_EResultPhoneActivityLimitExceeded = 97, // Too many changes to this phone 114 | k_EResultRefundToWallet = 98, // Cannot refund to payment method, must use wallet 115 | k_EResultEmailSendFailure = 99, // Cannot send an email 116 | k_EResultNotSettled = 100, // Can't perform operation till payment has settled 117 | k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha 118 | k_EResultGSLTDenied = 102, // a game server login token owned by this token's owner has been banned 119 | k_EResultGSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone) 120 | k_EResultInvalidItemType = 104 // the type of thing we were requested to act on is invalid 121 | }; 122 | 123 | /* This enum is used in client API methods, do not re-number existing values. */ 124 | enum EHTTPMethod 125 | { 126 | k_EHTTPMethodInvalid = 0, 127 | k_EHTTPMethodGET, 128 | k_EHTTPMethodHEAD, 129 | k_EHTTPMethodPOST, 130 | k_EHTTPMethodPUT, 131 | k_EHTTPMethodDELETE, 132 | k_EHTTPMethodOPTIONS, 133 | k_EHTTPMethodPATCH, 134 | 135 | // The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for 136 | // a compliant general purpose server. We'll likely add more as we find uses for them. 137 | 138 | // k_EHTTPMethodTRACE, 139 | // k_EHTTPMethodCONNECT 140 | }; 141 | 142 | 143 | /* HTTP Status codes that the server can send in response to a request, see rfc2616 section 10.3 for descriptions 144 | of each of these. */ 145 | enum EHTTPStatusCode 146 | { 147 | // Invalid status code (this isn't defined in HTTP, used to indicate unset in our code) 148 | k_EHTTPStatusCodeInvalid = 0, 149 | 150 | // Informational codes 151 | k_EHTTPStatusCode100Continue = 100, 152 | k_EHTTPStatusCode101SwitchingProtocols = 101, 153 | 154 | // Success codes 155 | k_EHTTPStatusCode200OK = 200, 156 | k_EHTTPStatusCode201Created = 201, 157 | k_EHTTPStatusCode202Accepted = 202, 158 | k_EHTTPStatusCode203NonAuthoritative = 203, 159 | k_EHTTPStatusCode204NoContent = 204, 160 | k_EHTTPStatusCode205ResetContent = 205, 161 | k_EHTTPStatusCode206PartialContent = 206, 162 | 163 | // Redirection codes 164 | k_EHTTPStatusCode300MultipleChoices = 300, 165 | k_EHTTPStatusCode301MovedPermanently = 301, 166 | k_EHTTPStatusCode302Found = 302, 167 | k_EHTTPStatusCode303SeeOther = 303, 168 | k_EHTTPStatusCode304NotModified = 304, 169 | k_EHTTPStatusCode305UseProxy = 305, 170 | //k_EHTTPStatusCode306Unused = 306, (used in old HTTP spec, now unused in 1.1) 171 | k_EHTTPStatusCode307TemporaryRedirect = 307, 172 | 173 | // Error codes 174 | k_EHTTPStatusCode400BadRequest = 400, 175 | 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. 176 | k_EHTTPStatusCode402PaymentRequired = 402, // This is reserved for future HTTP specs, not really supported by clients 177 | k_EHTTPStatusCode403Forbidden = 403, 178 | k_EHTTPStatusCode404NotFound = 404, 179 | k_EHTTPStatusCode405MethodNotAllowed = 405, 180 | k_EHTTPStatusCode406NotAcceptable = 406, 181 | k_EHTTPStatusCode407ProxyAuthRequired = 407, 182 | k_EHTTPStatusCode408RequestTimeout = 408, 183 | k_EHTTPStatusCode409Conflict = 409, 184 | k_EHTTPStatusCode410Gone = 410, 185 | k_EHTTPStatusCode411LengthRequired = 411, 186 | k_EHTTPStatusCode412PreconditionFailed = 412, 187 | k_EHTTPStatusCode413RequestEntityTooLarge = 413, 188 | k_EHTTPStatusCode414RequestURITooLong = 414, 189 | k_EHTTPStatusCode415UnsupportedMediaType = 415, 190 | k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416, 191 | k_EHTTPStatusCode417ExpectationFailed = 417, 192 | k_EHTTPStatusCode4xxUnknown = 418, // 418 is reserved, so we'll use it to mean unknown 193 | k_EHTTPStatusCode429TooManyRequests = 429, 194 | 195 | // Server error codes 196 | k_EHTTPStatusCode500InternalServerError = 500, 197 | k_EHTTPStatusCode501NotImplemented = 501, 198 | k_EHTTPStatusCode502BadGateway = 502, 199 | k_EHTTPStatusCode503ServiceUnavailable = 503, 200 | k_EHTTPStatusCode504GatewayTimeout = 504, 201 | k_EHTTPStatusCode505HTTPVersionNotSupported = 505, 202 | k_EHTTPStatusCode5xxUnknown = 599, 203 | }; 204 | 205 | /* list of possible return values from the ISteamGameCoordinator API */ 206 | enum EGCResults 207 | { 208 | k_EGCResultOK = 0, 209 | k_EGCResultNoMessage = 1, // There is no message in the queue 210 | k_EGCResultBufferTooSmall = 2, // The buffer is too small for the requested message 211 | k_EGCResultNotLoggedOn = 3, // The client is not logged onto Steam 212 | k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage 213 | }; 214 | 215 | native bool:SteamWorks_IsVACEnabled(); 216 | native bool:SteamWorks_GetPublicIP(ipaddr[4]); 217 | native SteamWorks_GetPublicIPCell(); 218 | native bool:SteamWorks_IsLoaded(); 219 | native bool:SteamWorks_SetGameData(const String:sData[]); 220 | native bool:SteamWorks_SetGameDescription(const String:sDesc[]); 221 | native bool:SteamWorks_SetMapName(const String:sMapName[]); 222 | native bool:SteamWorks_IsConnected(); 223 | native bool:SteamWorks_SetRule(const String:sKey[], const String:sValue[]); 224 | native bool:SteamWorks_ClearRules(); 225 | native bool:SteamWorks_ForceHeartbeat(); 226 | native bool:SteamWorks_GetUserGroupStatus(client, groupid); 227 | native bool:SteamWorks_GetUserGroupStatusAuthID(authid, groupid); 228 | 229 | native EUserHasLicenseForAppResult:SteamWorks_HasLicenseForApp(client, app); 230 | native EUserHasLicenseForAppResult:SteamWorks_HasLicenseForAppId(authid, app); 231 | native SteamWorks_GetClientSteamID(client, String:sSteamID[], length); 232 | 233 | native bool:SteamWorks_RequestStatsAuthID(authid, appid); 234 | native bool:SteamWorks_RequestStats(client, appid); 235 | native bool:SteamWorks_GetStatCell(client, const String:sKey[], &value); 236 | native bool:SteamWorks_GetStatAuthIDCell(authid, const String:sKey[], &value); 237 | native bool:SteamWorks_GetStatFloat(client, const String:sKey[], &Float:value); 238 | native bool:SteamWorks_GetStatAuthIDFloat(authid, const String:sKey[], &Float:value); 239 | 240 | native Handle:SteamWorks_CreateHTTPRequest(EHTTPMethod:method, const String:sURL[]); 241 | native bool:SteamWorks_SetHTTPRequestContextValue(Handle:hHandle, any:data1, any:data2=0); 242 | native bool:SteamWorks_SetHTTPRequestNetworkActivityTimeout(Handle:hHandle, timeout); 243 | native bool:SteamWorks_SetHTTPRequestHeaderValue(Handle:hHandle, const String:sName[], const String:sValue[]); 244 | native bool:SteamWorks_SetHTTPRequestGetOrPostParameter(Handle:hHandle, const String:sName[], const String:sValue[]); 245 | native bool:SteamWorks_SetHTTPRequestUserAgentInfo(Handle:hHandle, const String:sUserAgentInfo[]); 246 | native bool:SteamWorks_SetHTTPRequestRequiresVerifiedCertificate(Handle:hHandle, bool:bRequireVerifiedCertificate); 247 | native bool:SteamWorks_SetHTTPRequestAbsoluteTimeoutMS(Handle:hHandle, unMilliseconds); 248 | 249 | #if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 9 250 | typeset SteamWorksHTTPRequestCompleted 251 | { 252 | function void (Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode); 253 | function void (Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode, any data1); 254 | function void (Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode, any data1, any data2); 255 | }; 256 | 257 | typeset SteamWorksHTTPHeadersReceived 258 | { 259 | function void (Handle hRequest, bool bFailure); 260 | function void (Handle hRequest, bool bFailure, any data1); 261 | function void (Handle hRequest, bool bFailure, any data1, any data2); 262 | }; 263 | 264 | typeset SteamWorksHTTPDataReceived 265 | { 266 | function void (Handle hRequest, bool bFailure, int offset, int bytesreceived); 267 | function void (Handle hRequest, bool bFailure, int offset, int bytesreceived, any data1); 268 | function void (Handle hRequest, bool bFailure, int offset, int bytesreceived, any data1, any data2); 269 | }; 270 | 271 | typeset SteamWorksHTTPBodyCallback 272 | { 273 | function void (const char[] sData); 274 | function void (const char[] sData, any value); 275 | function void (const int[] data, any value, int datalen); 276 | }; 277 | 278 | #else 279 | 280 | funcenum SteamWorksHTTPRequestCompleted 281 | { 282 | public(Handle:hRequest, bool:bFailure, bool:bRequestSuccessful, EHTTPStatusCode:eStatusCode), 283 | public(Handle:hRequest, bool:bFailure, bool:bRequestSuccessful, EHTTPStatusCode:eStatusCode, any:data1), 284 | public(Handle:hRequest, bool:bFailure, bool:bRequestSuccessful, EHTTPStatusCode:eStatusCode, any:data1, any:data2) 285 | }; 286 | 287 | funcenum SteamWorksHTTPHeadersReceived 288 | { 289 | public(Handle:hRequest, bool:bFailure), 290 | public(Handle:hRequest, bool:bFailure, any:data1), 291 | public(Handle:hRequest, bool:bFailure, any:data1, any:data2) 292 | }; 293 | 294 | funcenum SteamWorksHTTPDataReceived 295 | { 296 | public(Handle:hRequest, bool:bFailure, offset, bytesreceived), 297 | public(Handle:hRequest, bool:bFailure, offset, bytesreceived, any:data1), 298 | public(Handle:hRequest, bool:bFailure, offset, bytesreceived, any:data1, any:data2) 299 | }; 300 | 301 | funcenum SteamWorksHTTPBodyCallback 302 | { 303 | public(const String:sData[]), 304 | public(const String:sData[], any:value), 305 | public(const data[], any:value, datalen) 306 | }; 307 | 308 | #endif 309 | 310 | native bool:SteamWorks_SetHTTPCallbacks(Handle:hHandle, SteamWorksHTTPRequestCompleted:fCompleted = INVALID_FUNCTION, SteamWorksHTTPHeadersReceived:fHeaders = INVALID_FUNCTION, SteamWorksHTTPDataReceived:fData = INVALID_FUNCTION, Handle:hCalling = INVALID_HANDLE); 311 | native bool:SteamWorks_SendHTTPRequest(Handle:hRequest); 312 | native bool:SteamWorks_SendHTTPRequestAndStreamResponse(Handle:hRequest); 313 | native bool:SteamWorks_DeferHTTPRequest(Handle:hRequest); 314 | native bool:SteamWorks_PrioritizeHTTPRequest(Handle:hRequest); 315 | native bool:SteamWorks_GetHTTPResponseHeaderSize(Handle:hRequest, const String:sHeader[], &size); 316 | native bool:SteamWorks_GetHTTPResponseHeaderValue(Handle:hRequest, const String:sHeader[], String:sValue[], size); 317 | native bool:SteamWorks_GetHTTPResponseBodySize(Handle:hRequest, &size); 318 | native bool:SteamWorks_GetHTTPResponseBodyData(Handle:hRequest, String:sBody[], length); 319 | native bool:SteamWorks_GetHTTPStreamingResponseBodyData(Handle:hRequest, cOffset, String:sBody[], length); 320 | native bool:SteamWorks_GetHTTPDownloadProgressPct(Handle:hRequest, &Float:percent); 321 | native bool:SteamWorks_GetHTTPRequestWasTimedOut(Handle:hRequest, &bool:bWasTimedOut); 322 | native bool:SteamWorks_SetHTTPRequestRawPostBody(Handle:hRequest, const String:sContentType[], const String:sBody[], bodylen); 323 | native bool:SteamWorks_SetHTTPRequestRawPostBodyFromFile(Handle:hRequest, const String:sContentType[], const String:sFileName[]); 324 | 325 | native bool:SteamWorks_GetHTTPResponseBodyCallback(Handle:hRequest, SteamWorksHTTPBodyCallback:fCallback, any:data = 0, Handle:hPlugin = INVALID_HANDLE); /* Look up, moved definition for 1.7+ compat. */ 326 | native bool:SteamWorks_WriteHTTPResponseBodyToFile(Handle:hRequest, const String:sFileName[]); 327 | 328 | forward SW_OnValidateClient(ownerauthid, authid); 329 | forward SteamWorks_OnValidateClient(ownerauthid, authid); 330 | forward SteamWorks_SteamServersConnected(); 331 | forward SteamWorks_SteamServersConnectFailure(EResult:result); 332 | forward SteamWorks_SteamServersDisconnected(EResult:result); 333 | 334 | forward Action:SteamWorks_RestartRequested(); 335 | forward SteamWorks_TokenRequested(String:sToken[], maxlen); 336 | 337 | forward SteamWorks_OnClientGroupStatus(authid, groupid, bool:isMember, bool:isOfficer); 338 | 339 | forward EGCResults:SteamWorks_GCSendMessage(unMsgType, const String:pubData[], cubData); 340 | forward SteamWorks_GCMsgAvailable(cubData); 341 | forward EGCResults:SteamWorks_GCRetrieveMessage(punMsgType, const String:pubDest[], cubDest, pcubMsgSize); 342 | 343 | native EGCResults:SteamWorks_SendMessageToGC(unMsgType, const String:pubData[], cubData); 344 | 345 | public Extension:__ext_SteamWorks = 346 | { 347 | name = "SteamWorks", 348 | file = "SteamWorks.ext", 349 | #if defined AUTOLOAD_EXTENSIONS 350 | autoload = 1, 351 | #else 352 | autoload = 0, 353 | #endif 354 | #if defined REQUIRE_EXTENSIONS 355 | required = 1, 356 | #else 357 | required = 0, 358 | #endif 359 | }; 360 | 361 | #if !defined REQUIRE_EXTENSIONS 362 | public __ext_SteamWorks_SetNTVOptional() 363 | { 364 | MarkNativeAsOptional("SteamWorks_IsVACEnabled"); 365 | MarkNativeAsOptional("SteamWorks_GetPublicIP"); 366 | MarkNativeAsOptional("SteamWorks_GetPublicIPCell"); 367 | MarkNativeAsOptional("SteamWorks_IsLoaded"); 368 | MarkNativeAsOptional("SteamWorks_SetGameData"); 369 | MarkNativeAsOptional("SteamWorks_SetGameDescription"); 370 | MarkNativeAsOptional("SteamWorks_IsConnected"); 371 | MarkNativeAsOptional("SteamWorks_SetRule"); 372 | MarkNativeAsOptional("SteamWorks_ClearRules"); 373 | MarkNativeAsOptional("SteamWorks_ForceHeartbeat"); 374 | MarkNativeAsOptional("SteamWorks_GetUserGroupStatus"); 375 | MarkNativeAsOptional("SteamWorks_GetUserGroupStatusAuthID"); 376 | 377 | MarkNativeAsOptional("SteamWorks_HasLicenseForApp"); 378 | MarkNativeAsOptional("SteamWorks_HasLicenseForAppId"); 379 | MarkNativeAsOptional("SteamWorks_GetClientSteamID"); 380 | 381 | MarkNativeAsOptional("SteamWorks_RequestStatsAuthID"); 382 | MarkNativeAsOptional("SteamWorks_RequestStats"); 383 | MarkNativeAsOptional("SteamWorks_GetStatCell"); 384 | MarkNativeAsOptional("SteamWorks_GetStatAuthIDCell"); 385 | MarkNativeAsOptional("SteamWorks_GetStatFloat"); 386 | MarkNativeAsOptional("SteamWorks_GetStatAuthIDFloat"); 387 | 388 | MarkNativeAsOptional("SteamWorks_SendMessageToGC"); 389 | 390 | MarkNativeAsOptional("SteamWorks_CreateHTTPRequest"); 391 | MarkNativeAsOptional("SteamWorks_SetHTTPRequestContextValue"); 392 | MarkNativeAsOptional("SteamWorks_SetHTTPRequestNetworkActivityTimeout"); 393 | MarkNativeAsOptional("SteamWorks_SetHTTPRequestHeaderValue"); 394 | MarkNativeAsOptional("SteamWorks_SetHTTPRequestGetOrPostParameter"); 395 | 396 | MarkNativeAsOptional("SteamWorks_SetHTTPCallbacks"); 397 | MarkNativeAsOptional("SteamWorks_SendHTTPRequest"); 398 | MarkNativeAsOptional("SteamWorks_SendHTTPRequestAndStreamResponse"); 399 | MarkNativeAsOptional("SteamWorks_DeferHTTPRequest"); 400 | MarkNativeAsOptional("SteamWorks_PrioritizeHTTPRequest"); 401 | MarkNativeAsOptional("SteamWorks_GetHTTPResponseHeaderSize"); 402 | MarkNativeAsOptional("SteamWorks_GetHTTPResponseHeaderValue"); 403 | MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodySize"); 404 | MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodyData"); 405 | MarkNativeAsOptional("SteamWorks_GetHTTPStreamingResponseBodyData"); 406 | MarkNativeAsOptional("SteamWorks_GetHTTPDownloadProgressPct"); 407 | MarkNativeAsOptional("SteamWorks_SetHTTPRequestRawPostBody"); 408 | MarkNativeAsOptional("SteamWorks_SetHTTPRequestRawPostBodyFromFile"); 409 | 410 | MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodyCallback"); 411 | MarkNativeAsOptional("SteamWorks_WriteHTTPResponseBodyToFile"); 412 | } 413 | #endif -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/chat-processor.inc: -------------------------------------------------------------------------------- 1 | #if defined _chat_processor_included 2 | #endinput 3 | #endif 4 | #define _chat_processor_included 5 | 6 | //Globals 7 | #define MAXLENGTH_FLAG 32 8 | #define MAXLENGTH_NAME 128 9 | #define MAXLENGTH_MESSAGE 128 10 | #define MAXLENGTH_BUFFER 255 11 | 12 | //Natives 13 | /** 14 | * Retrieves the current format string assigned from a flag string. 15 | * Example: "Cstrike_Chat_All" = "{1} : {2}" 16 | * You can find the config formats in either the translations or the configs. 17 | * 18 | * param sFlag Flag string to retrieve the format string from. 19 | * param sBuffer Format string from the flag string. 20 | * param iSize Size of the format string buffer. 21 | * 22 | * noreturn 23 | **/ 24 | native void ChatProcessor_GetFlagFormatString(const char[] sFlag, char[] sBuffer, int iSize); 25 | 26 | //Forwards 27 | /** 28 | * Called while sending a chat message before It's sent. 29 | * Limits on the name and message strings can be found above. 30 | * 31 | * param author Author that created the message. 32 | * param recipients Array of clients who will receive the message. 33 | * param flagstring Flag string to determine the type of message. 34 | * param name Name string of the author to be pushed. 35 | * param message Message string from the author to be pushed. 36 | * param processcolors Toggle to process colors in the buffer strings. 37 | * param removecolors Toggle to remove colors in the buffer strings. (Requires bProcessColors = true) 38 | * 39 | * return types 40 | * - Plugin_Continue Stops the message. 41 | * - Plugin_Stop Stops the message. 42 | * - Plugin_Changed Fires the post-forward below and prints out a message. 43 | * - Plugin_Handled Fires the post-forward below but doesn't print a message. 44 | **/ 45 | forward Action CP_OnChatMessage(int& author, ArrayList recipients, char[] flagstring, char[] name, char[] message, bool& processcolors, bool& removecolors); 46 | 47 | /** 48 | * Called after the chat message is sent to the designated clients by the author. 49 | * 50 | * param author Author that sent the message. 51 | * param recipients Array of clients who received the message. 52 | * param flagstring Flag string to determine the type of message. 53 | * param formatstring Format string used in the message based on the flag string. 54 | * param name Name string of the author. 55 | * param message Message string from the author. 56 | * param processcolors Check if colors were processed in the buffer strings. 57 | * param removecolors Check if colors were removed from the buffer strings. 58 | * 59 | * noreturn 60 | **/ 61 | forward void CP_OnChatMessagePost(int author, ArrayList recipients, const char[] flagstring, const char[] formatstring, const char[] name, const char[] message, bool processcolors, bool removecolors); 62 | 63 | #if !defined REQUIRE_PLUGIN 64 | public void __pl_chat_processor_SetNTVOptional() 65 | { 66 | MarkNativeAsOptional("ChatProcessor_GetFlagFormatString"); 67 | } 68 | #endif 69 | 70 | public SharedPlugin __pl_chat_processor = 71 | { 72 | name = "chat-processor", 73 | file = "chat-processor.smx", 74 | #if defined REQUIRE_PLUGIN 75 | required = 1 76 | #else 77 | required = 0 78 | #endif 79 | }; 80 | -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/hexstocks.inc: -------------------------------------------------------------------------------- 1 | #if defined _hexstocks_included 2 | #endinput 3 | #endif 4 | #define _hexstocks_included 5 | 6 | #define MAX_ENTITIES 2048 7 | 8 | #include 9 | #include 10 | 11 | #undef REQUIRE_EXTENSIONS 12 | #include 13 | #define REQUIRE_EXTENSIONS 14 | 15 | /* 16 | INCLUDE MERGE OF MYSTOCKS(shanpu)teamgames-stocks/menu-stocks(KissLick) & some other! 17 | */ 18 | 19 | //Easy loops 20 | #pragma deprecated Dont use macro loops 21 | #define LoopClients(%1) for (int %1 = 1; %1 <= MaxClients; %1++) if (IsClientInGame(%1)) 22 | #pragma deprecated Dont use macro loops 23 | #define LoopValidClients(%1,%2,%3) for (int %1 = 1; %1 <= MaxClients; %1++) if (IsValidClient(%1,%2,%3)) 24 | 25 | /*************************************** CLIENT ***************************/ 26 | 27 | 28 | /** 29 | * Check if for a valid client 30 | * 31 | * 32 | * @param client Client Index 33 | * @param AllowBots Allow Bots? 34 | * @param AllowDead Allow Dead players? 35 | * @noreturn 36 | */ 37 | stock bool IsValidClient(int client, bool AllowBots = false, bool AllowDead = false) 38 | { 39 | if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !AllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!AllowDead && !IsPlayerAlive(client))) 40 | { 41 | return false; 42 | } 43 | return true; 44 | } 45 | 46 | /** 47 | * Checks if user flags (Root is always true) 48 | * 49 | * 50 | * @param client Client Index 51 | * @param flags Flags to check, enter comma to separate flags. 52 | * @return True if client has the flags, false otherwise. 53 | */ 54 | stock bool CheckAdminFlag(int client, const char[] flags) 55 | { 56 | int iCount = 0; 57 | char sflagNeed[22][8], sflagFormat[64]; 58 | bool bEntitled = false; 59 | 60 | Format(sflagFormat, sizeof(sflagFormat), flags); 61 | ReplaceString(sflagFormat, sizeof(sflagFormat), " ", ""); 62 | iCount = ExplodeString(sflagFormat, ",", sflagNeed, sizeof(sflagNeed), sizeof(sflagNeed[])); 63 | 64 | for (int i = 0; i < iCount; i++) 65 | { 66 | if ((GetUserFlagBits(client) & ReadFlagString(sflagNeed[i])) || (GetUserFlagBits(client) & ADMFLAG_ROOT)) 67 | { 68 | bEntitled = true; 69 | break; 70 | } 71 | } 72 | 73 | return bEntitled; 74 | } 75 | 76 | /** 77 | * Checks if user flags 78 | * 79 | * 80 | * @param client Client Index 81 | * @param flags Flags to check, enter comma to separate flags. 82 | * @return True if client has the flags, false otherwise. 83 | */ 84 | stock bool CheckAdminFlagEx(int client, const char[] flags) 85 | { 86 | int iCount = 0; 87 | char sflagNeed[22][8], sflagFormat[64]; 88 | bool bEntitled = false; 89 | 90 | Format(sflagFormat, sizeof(sflagFormat), flags); 91 | ReplaceString(sflagFormat, sizeof(sflagFormat), " ", ""); 92 | iCount = ExplodeString(sflagFormat, ",", sflagNeed, sizeof(sflagNeed), sizeof(sflagNeed[])); 93 | 94 | for (int i = 0; i < iCount; i++) 95 | { 96 | if ((GetUserFlagBits(client) & ReadFlagString(sflagNeed[i]) == ReadFlagString(sflagNeed[i]))) 97 | { 98 | bEntitled = true; 99 | break; 100 | } 101 | } 102 | 103 | return bEntitled; 104 | } 105 | 106 | 107 | 108 | /** 109 | * Returs the client's current weapon 110 | * 111 | * @param client Client Index 112 | * @return Weapon Index or -1 if not found 113 | */ 114 | stock int GetClientActiveWeapon(int client) 115 | { 116 | return GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); 117 | } 118 | 119 | 120 | /** 121 | * Get the target client 122 | * 123 | * @param client Client Index 124 | * @param argnum Number of the arg 125 | * @return Client Index or -1 on failure. 126 | */ 127 | stock int GetTarget(int client, int argnum) 128 | { 129 | char sTarget[32]; 130 | 131 | GetCmdArg(argnum, sTarget, sizeof(sTarget)); 132 | return FindTarget(client, sTarget); 133 | } 134 | 135 | 136 | /** 137 | * Get player count of a team 138 | * 139 | * @param team Team (-1 for total) 140 | * @param alive Count only alive players? 141 | * @return Team Count 142 | */ 143 | stock int GetAliveTeamCount(int team = -1, bool alive = true) 144 | { 145 | int count = 0; 146 | for (int i = 1; i <= MaxClients; i++)if (IsClientInGame(i) && (IsPlayerAlive(i) || !alive) && (GetClientTeam(i) == team || team == -1)) 147 | count++; 148 | 149 | return count; 150 | } 151 | 152 | 153 | 154 | /** 155 | * Get random player of a team 156 | * 157 | * 158 | * @param team Team, -1 for any. 159 | * @param True True to include only alive players. 160 | * @return A random client index. 161 | */ 162 | stock int GetRandomPlayer(int team = -1, bool OnlyAlive = true) 163 | { 164 | int[] clients = new int[MaxClients]; 165 | int clientCount; 166 | for (int i = 1; i <= MaxClients; i++) 167 | { 168 | if (IsClientInGame(i) && (team == -1 || GetClientTeam(i) == team) && (!OnlyAlive || !IsPlayerAlive(i))) 169 | { 170 | clients[clientCount++] = i; 171 | } 172 | } 173 | return (clientCount == 0) ? -1 : clients[GetRandomInt(0, clientCount - 1)]; 174 | 175 | } 176 | 177 | /** 178 | * Set a client player model and arms. 179 | * This functions precaches the models. 180 | * 181 | * @param model Model path. 182 | * @param arms Arms path. 183 | * @noreturn 184 | */ 185 | stock void SetPlayerModelAndArms(int client, const char model[PLATFORM_MAX_PATH], const char arms[PLATFORM_MAX_PATH]) 186 | { 187 | if (!IsModelPrecached(model)) 188 | PrecacheModel(model); 189 | 190 | if (!IsModelPrecached(arms)) 191 | PrecacheModel(arms) 192 | 193 | SetEntPropString(client, Prop_Send, "m_szArmsModel", arms); 194 | 195 | DataPack data = new DataPack(); 196 | data.WriteCell(GetClientUserId(client)); 197 | data.WriteString(model); 198 | RequestFrame(Frame_SetModel, data); 199 | } 200 | 201 | #define DEFAULT_MODEL "models/player/tm_anarchist.mdl" 202 | 203 | /** 204 | * Set a client player arms. 205 | * This functions precaches the models. 206 | * 207 | * @param model Model path. 208 | * @param arms Arms path. 209 | * @noreturn 210 | */ 211 | stock void SetPlayerArms(int client, const char arms[PLATFORM_MAX_PATH]) 212 | { 213 | if (!IsModelPrecached(DEFAULT_MODEL)) 214 | PrecacheModel(DEFAULT_MODEL); 215 | 216 | if (!IsModelPrecached(arms)) 217 | PrecacheModel(arms); 218 | 219 | char sOldModel[PLATFORM_MAX_PATH]; 220 | GetEntityModel(client, sOldModel); 221 | 222 | SetEntityModel(client, DEFAULT_MODEL); 223 | SetEntPropString(client, Prop_Send, "m_szArmsModel", arms); 224 | 225 | DataPack data = new DataPack(); 226 | data.WriteCell(GetClientUserId(client)); 227 | data.WriteString(sOldModel); 228 | RequestFrame(Frame_SetModel, data); 229 | } 230 | 231 | static stock void Frame_SetModel(DataPack data) 232 | { 233 | data.Reset(); 234 | char sModel[PLATFORM_MAX_PATH]; 235 | int client = GetClientOfUserId(data.ReadCell()); 236 | if (!client) 237 | { 238 | delete data; 239 | return; 240 | } 241 | data.ReadString(sModel, sizeof sModel); 242 | SetEntityModel(client, sModel); 243 | delete data; 244 | } 245 | 246 | stock int GetFov(int client) 247 | { 248 | return GetEntProp(client, Prop_Send, "m_iFOV"); 249 | } 250 | 251 | stock void SetFov(int client, int fov) 252 | { 253 | SetEntProp(client, Prop_Send, "m_iFOV", fov); 254 | } 255 | /*********************************** NUMBERS *****************************/ 256 | 257 | /** 258 | * Checks if an number is even 259 | * 260 | * 261 | * @param num Number to check 262 | * @return True if number is even, false otherwise. 263 | */ 264 | stock bool IsEven(int num) 265 | { 266 | return (num & 1) == 0; 267 | } 268 | 269 | /** 270 | * Checks if an number is odd 271 | * 272 | * 273 | * @param num Number to check 274 | * @return True if number is odd, false otherwise. 275 | */ 276 | stock bool IsOdd(int num) 277 | { 278 | return (num & 1) == 1; 279 | } 280 | 281 | /** 282 | * Get the client aim position. 283 | * 284 | * 285 | * @param client Client Index 286 | * @param pos Position vector 287 | * @param mask Custom TraceRay mask 288 | * 289 | * @return True if the trace did it, false otherwise. 290 | */ 291 | stock bool GetClientAimPosition(int client, float pos[3], int mask = MASK_SOLID) 292 | { 293 | float vPos[3]; 294 | float vAng[3]; 295 | 296 | GetClientEyePosition(client, vPos); 297 | GetClientEyeAngles(client, vAng); 298 | 299 | TR_TraceRayFilter(vPos, vAng, mask, RayType_Infinite, Filter_NoSelf, client); 300 | if (!TR_DidHit()) 301 | return false; 302 | 303 | TR_GetEndPosition(pos); 304 | return true; 305 | } 306 | 307 | /** 308 | * Get the client aim target. 309 | * 310 | * 311 | * @param client Client Index 312 | * @param mask Custom TraceRay mask 313 | * 314 | * @return The entity index or -1 if none is found. 315 | */ 316 | stock int GetClientAimTarget2(int client, int mask = MASK_SOLID) 317 | { 318 | float vPos[3]; 319 | float vAng[3]; 320 | 321 | GetClientEyePosition(client, vPos); 322 | GetClientEyeAngles(client, vAng); 323 | 324 | TR_TraceRayFilter(vPos, vAng, mask, RayType_Infinite, Filter_NoSelf, client); 325 | 326 | return TR_GetEntityIndex(); 327 | } 328 | 329 | public bool Filter_NoSelf(int entity, int contentsMask, any data) 330 | { 331 | return entity != data; 332 | } 333 | 334 | stock bool IsClientInView(int viewer, int target, float fMaxDistance=0.0, float fThreshold=0.73) 335 | { 336 | // Retrieve view and target eyes position 337 | float fViewPos[3]; 338 | float fViewAng[3]; 339 | float fViewDir[3]; 340 | 341 | float fTargetPos[3]; 342 | float fTargetDir[3]; 343 | float fDistance[3]; 344 | 345 | GetClientEyePosition(viewer, fViewPos); 346 | GetClientEyeAngles(viewer, fViewAng); 347 | GetClientEyePosition(target, fTargetPos); 348 | 349 | // Calculate view direction 350 | fViewAng[0] = fViewAng[2] = 0.0; 351 | GetAngleVectors(fViewAng, fViewDir, NULL_VECTOR, NULL_VECTOR); 352 | 353 | // Calculate distance to viewer to see if it can be seen. 354 | fDistance[0] = fTargetPos[0]-fViewPos[0]; 355 | fDistance[1] = fTargetPos[1]-fViewPos[1]; 356 | fDistance[2] = 0.0; 357 | if (fMaxDistance != 0.0) 358 | { 359 | if (((fDistance[0]*fDistance[0])+(fDistance[1]*fDistance[1])) >= (fMaxDistance*fMaxDistance)) 360 | return false; 361 | } 362 | 363 | // Check dot product. If it's negative, that means the viewer is facing 364 | // backwards to the target. 365 | NormalizeVector(fDistance, fTargetDir); 366 | if (GetVectorDotProduct(fViewDir, fTargetDir) < fThreshold) 367 | return false; 368 | 369 | // Now check if there are no obstacles in between through raycasting 370 | Handle trace = TR_TraceRayFilterEx(fViewPos, fTargetPos, MASK_PLAYERSOLID_BRUSHONLY, RayType_EndPoint, ClientViewsFilter); 371 | if (TR_DidHit(trace)) 372 | { 373 | delete trace; 374 | return false; 375 | } 376 | delete trace; 377 | 378 | // Done, it's visible 379 | return true; 380 | } 381 | 382 | stock bool ClientViewsFilter(int entity, int mask, any junk) 383 | { 384 | if (entity >= 1 && entity <= MaxClients) 385 | return false; 386 | 387 | return true; 388 | } 389 | /********************************** WEAPONS ********************************/ 390 | 391 | 392 | /** 393 | * Strip All Weapons & the knife slot twice for taser 394 | * 395 | * 396 | * @param client Client Index 397 | * @noreturn 398 | */ 399 | stock void StripAllPlayerWeapons(int client) 400 | { 401 | int weapon; 402 | int index; 403 | 404 | while((weapon = GetNextWeapon(client, index)) != -1) 405 | { 406 | CS_DropWeapon(client, weapon, false, true); 407 | RemoveEdict(weapon); 408 | } 409 | } 410 | 411 | /** 412 | * Gives an Item to a client with custom ammos 413 | * 414 | * @param client Client Index 415 | * @param weapon Weapon Name 416 | * @param clip Ammo ammount in the clip 417 | * @param ammo Total ammo ammount 418 | * @return Entity Index 419 | */ 420 | stock int GivePlayerItemAmmo(int client, const char[] weapon, int clip = -1, int ammo = -1) 421 | { 422 | int weaponEnt = GivePlayerItem(client, weapon); 423 | 424 | SetPlayerWeaponAmmo(client, weaponEnt, clip, ammo); 425 | 426 | return weaponEnt; 427 | } 428 | 429 | /** 430 | * Set ammo account for a weapon 431 | * 432 | * @param client Client Index 433 | * @param weapon Weapon Index 434 | * @param clip Ammo ammount in the clip 435 | * @param ammo Total ammo ammount 436 | * @noreturn 437 | */ 438 | stock void SetPlayerWeaponAmmo(int client, int weaponEnt, int clip = -1, int ammo = -1) 439 | { 440 | if (weaponEnt == INVALID_ENT_REFERENCE || !IsValidEdict(weaponEnt)) 441 | return; 442 | 443 | if (clip != -1) 444 | SetEntProp(weaponEnt, Prop_Data, "m_iClip1", clip); 445 | 446 | //TODO FIXED GIVEN AMMOS 447 | if (ammo != -1) 448 | { 449 | SetEntProp(weaponEnt, Prop_Send, "m_iPrimaryReserveAmmoCount", ammo); 450 | SetEntProp(weaponEnt, Prop_Send, "m_iSecondaryReserveAmmoCount", ammo); 451 | } 452 | } 453 | 454 | /** 455 | * Gives an Item to a client removing the current weapon 456 | * 457 | * @param client Client Index 458 | * @param weapon 459 | * @return Item Index 460 | */ 461 | stock int GivePlayerItemRemove(int client, const char[] weapon, int slot) 462 | { 463 | int current = -1; 464 | if ((current = GetPlayerWeaponSlot(client, slot)) != -1) 465 | { 466 | RemovePlayerItem(client, current); 467 | AcceptEntityInput(current, "Kill"); 468 | } 469 | return GivePlayerItem(client, weapon); 470 | } 471 | 472 | 473 | 474 | // Easy precache & prepare download for models (icons) 475 | stock void PrecacheModelAnyDownload(char[] sModel) 476 | { 477 | if (strlen(sModel) == 0) 478 | return; 479 | 480 | #if defined _smartdm_include 481 | Downloader_AddFileToDownloadsTable(sModel); 482 | #else 483 | AddFileToDownloadsTable(sModel); 484 | #endif 485 | PrecacheModel(sModel, true); 486 | } 487 | 488 | //Adaption for smlib 489 | stock int GetNextWeapon(int client, int &weaponIndex) 490 | { 491 | static int weaponsOffset = -1; 492 | if (weaponsOffset == -1) 493 | weaponsOffset = FindDataMapInfo(client, "m_hMyWeapons"); 494 | 495 | int offset = weaponsOffset + (weaponIndex * 4); 496 | 497 | int weapon; 498 | while (weaponIndex < 48) 499 | { 500 | weaponIndex++; 501 | 502 | weapon = GetEntDataEnt2(client, offset); 503 | 504 | if (IsValidEdict(weapon)) 505 | return weapon; 506 | 507 | offset += 4; 508 | } 509 | 510 | return -1; 511 | } 512 | 513 | stock bool HasWeapon(int client, const char[] classname) 514 | { 515 | int index; 516 | int weapon; 517 | char sName[64]; 518 | 519 | while((weapon = GetNextWeapon(client, index)) != -1) 520 | { 521 | GetEdictClassname(weapon, sName, sizeof(sName)); 522 | if (StrEqual(sName, classname)) 523 | return true; 524 | } 525 | return false; 526 | } 527 | 528 | stock int GetWeaponByClassname(int client, const char[] classname) 529 | { 530 | int index; 531 | int weapon; 532 | char sName[64]; 533 | 534 | while((weapon = GetNextWeapon(client, index)) != -1) 535 | { 536 | GetEdictClassname(weapon, sName, sizeof(sName)); 537 | if (StrEqual(sName, classname)) 538 | return weapon; 539 | } 540 | return -1; 541 | } 542 | /****************************** COMMAND ARGS **************************/ 543 | 544 | 545 | /** 546 | * Retrives a command argument given its index as int, from the console or server command 547 | * 548 | * @param argnum Arg number 549 | * @return Int Value of Arg 550 | */ 551 | #if SOURCEMOD_V_MINOR < 11 552 | stock int GetCmdArgInt(int argnum) 553 | { 554 | char value[256]; 555 | GetCmdArg(argnum, value, sizeof(value)); 556 | return StringToInt(value); 557 | } 558 | 559 | /** 560 | * Retrives a command argument given its index as float, from the console or server command 561 | * 562 | * @param argnum Arg number 563 | * @return Float Value of Arg 564 | */ 565 | stock float GetCmdArgFloat(int argnum) 566 | { 567 | char value[256]; 568 | GetCmdArg(argnum, value, sizeof(value)); 569 | return StringToFloat(value); 570 | } 571 | #endif 572 | 573 | /** 574 | * Retrives a command argument given its index as bool, from the console or server command 575 | * 576 | * @param argnum Arg number 577 | * @return Bool Value of Arg 578 | */ 579 | stock bool GetCmdArgBool(int argnum) 580 | { 581 | char value[256]; 582 | GetCmdArg(argnum, value, sizeof(value)); 583 | return view_as(StringToInt(value)); 584 | } 585 | 586 | /********************************** CVARS **************************************/ 587 | 588 | /** 589 | * Easy silent change of ConVars - Boolean 590 | * 591 | * 592 | * @param cvarName Name of cvar 593 | * @param value New value of cvar 594 | * @noreturn 595 | */ 596 | stock void SetCvar(char[] cvarName, int value) 597 | { 598 | ConVar IntCvar = FindConVar(cvarName); 599 | if (IntCvar == null)return; 600 | 601 | int flags = IntCvar.Flags; 602 | flags &= ~FCVAR_NOTIFY; 603 | IntCvar.Flags = flags; 604 | IntCvar.IntValue = value; 605 | 606 | flags |= FCVAR_NOTIFY; 607 | IntCvar.Flags = flags; 608 | } 609 | 610 | 611 | 612 | /** 613 | * Easy silent change of ConVars - Floats 614 | * 615 | * 616 | * @param cvarName Name of cvar 617 | * @param value New value of cvar 618 | * @noreturn 619 | */ 620 | stock void SetCvarFloat(char[] cvarName, float value) 621 | { 622 | ConVar FloatCvar = FindConVar(cvarName); 623 | if (FloatCvar == null)return; 624 | 625 | int flags = FloatCvar.Flags; 626 | flags &= ~FCVAR_NOTIFY; 627 | FloatCvar.Flags = flags; 628 | FloatCvar.FloatValue = value; 629 | 630 | flags |= FCVAR_NOTIFY; 631 | FloatCvar.Flags = flags; 632 | } 633 | 634 | 635 | 636 | /** 637 | * Easy silent change of ConVars - Strings 638 | * 639 | * 640 | * @param cvarName Name of cvar 641 | * @param value New value of cvar 642 | * @noreturn 643 | */ 644 | stock void SetCvarString(char[] cvarName, char[] value) 645 | { 646 | ConVar StringCvar = FindConVar(cvarName); 647 | if (StringCvar == null)return; 648 | 649 | int flags = StringCvar.Flags; 650 | flags &= ~FCVAR_NOTIFY; 651 | StringCvar.Flags = flags; 652 | StringCvar.SetString(value) 653 | 654 | flags |= FCVAR_NOTIFY; 655 | StringCvar.Flags = flags; 656 | } 657 | 658 | 659 | /********************************************** ENTITIES *********************************************/ 660 | 661 | 662 | /** 663 | * Checks if a entity or edict is valid and not a client 664 | * 665 | * 666 | * @param cvarName Name of cvar 667 | * @param value New value of cvar 668 | * @noreturn 669 | */ 670 | stock bool IsValidEnt(int ent) 671 | { 672 | if (ent == INVALID_ENT_REFERENCE || ent <= MaxClients || !IsValidEntity(ent) || !IsValidEdict(ent)) 673 | { 674 | return false; 675 | } 676 | return true; 677 | } 678 | 679 | /** 680 | * Sets an entity's speed 681 | * 682 | * @param entity Entity Index 683 | * @param speed Speed to set 684 | * @noreturn 685 | */ 686 | stock void SetEntitySpeed(int entity, float speed = 1.0) 687 | { 688 | SetEntPropFloat(entity, Prop_Data, "m_flLaggedMovementValue", speed); 689 | } 690 | 691 | /** 692 | * Gets an entity's Speed 693 | * 694 | * @param entity Entity Index 695 | * @return Amount of Speed 696 | */ 697 | stock float GetEntitySpeed(int entity) 698 | { 699 | return GetEntPropFloat(entity, Prop_Data, "m_flLaggedMovementValue"); 700 | } 701 | 702 | /** 703 | * Gets an entity's name 704 | * 705 | * @param entity Entity Index 706 | * 707 | * @noreturn 708 | */ 709 | stock void GetEntityName(int entity, char[] name, int maxlen) 710 | { 711 | GetEntPropString(entity, Prop_Data, "m_iName", name, maxlen); 712 | } 713 | 714 | /** 715 | * Sets an entity's name 716 | * 717 | * @param entity Entity Index 718 | * @param format Formatting rules. 719 | * @param ... Variable number of format parameters. 720 | * @noreturn 721 | */ 722 | stock void SetEntityName(int entity, char[] format, any...) 723 | { 724 | char sName[128]; 725 | VFormat(sName, sizeof(sName), format, 3); 726 | 727 | SetEntPropString(entity, Prop_Data, "m_iName", sName); 728 | } 729 | 730 | /** 731 | * Get an entity origin 732 | * 733 | * @param entity Entity index. 734 | * @param origin Vector to store origin. 735 | * @noreturn 736 | */ 737 | stock void GetEntityOrigin(int entity, float origin[3]) 738 | { 739 | GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin); 740 | } 741 | 742 | /** 743 | * Get an entity angles 744 | * 745 | * @param entity Entity index. 746 | * @param origin Vector to store origin. 747 | * @noreturn 748 | */ 749 | stock void GetEntityAngles(int entity, float angles[3]) 750 | { 751 | GetEntPropVector(entity, Prop_Data, "m_angRotation", angles); 752 | } 753 | 754 | /** 755 | * Get an entity model 756 | * 757 | * @param entity Entity index. 758 | * @param origin String to store model. 759 | * @noreturn 760 | */ 761 | stock void GetEntityModel(int entity, char model[PLATFORM_MAX_PATH]) 762 | { 763 | GetEntPropString(entity, Prop_Data, "m_ModelName", model, sizeof(model)); 764 | } 765 | 766 | /********************************** MISC *********************************/ 767 | 768 | /** Reset client Render Color 769 | * 770 | * @param client Client Index 771 | * @noreturn 772 | */ 773 | stock void ResetRenderColor(int client) 774 | { 775 | SetEntityRenderColor(client, 255, 255, 255, 255); 776 | } 777 | 778 | 779 | /** 780 | * Appends a new item to the end of a menu with a format. 781 | * 782 | * @param menu Menu Handle. 783 | * @param info Item information string. 784 | * @param display Default item display string. 785 | * @param style Drawing style flags. Anything other than DEFAULT or 786 | * @param format Formatting rules 787 | * @param ... Variable number of format parameters 788 | * @return True on success, false on failure. 789 | * @error Invalid Handle or item limit reached. 790 | */ 791 | stock bool AddMenuItemFormat(Handle menu, const char[] info, int style = ITEMDRAW_DEFAULT, const char[] format, any...) 792 | { 793 | char display[128]; 794 | VFormat(display, sizeof(display), format, 5); 795 | 796 | return AddMenuItem(menu, info, display, style); 797 | } 798 | 799 | 800 | /** 801 | * 802 | * @param LogFile Buffer to store the path 803 | * @param FileName File to write the log in 804 | * @param FolderName Directory/Folder to write the logs in 805 | * @noreturn 806 | */ 807 | stock void SetLogFile(char LogFile[PLATFORM_MAX_PATH], char[] FileName, char[] FolderName) 808 | { 809 | char sDate[12]; 810 | FormatTime(sDate, sizeof(sDate), "%y-%m-%d"); 811 | Format(LogFile, sizeof(LogFile), "logs/%s/%s-%s.log", FolderName, FileName, sDate); 812 | 813 | BuildPath(Path_SM, LogFile, sizeof(LogFile), LogFile); 814 | } 815 | 816 | 817 | /** 818 | * Same as OpenFile but if the file does not exist is before created. 819 | * 820 | * @param file File to open. 821 | * @param mode Open mode. 822 | * @param use_valve_fs If true, the Valve file system will be used instead. 823 | * This can be used to find files existing in valve 824 | * search paths, rather than solely files existing directly 825 | * in the gamedir. 826 | * @param valve_path_id If use_valve_fs, a search path from gameinfo or NULL_STRING for all search paths. 827 | * @return A File handle, or null if the file could not be opened. 828 | */ 829 | stock File OpenFileEx(const char[] file, const char[] mode, bool use_valve_fs = false, const char[] valve_path_id = "GAME") 830 | { 831 | if (!FileExists(file)) 832 | { 833 | File hFile = OpenFile(file, "w"); 834 | hFile.Close(); 835 | } 836 | return OpenFile(file, mode, use_valve_fs, valve_path_id); 837 | } 838 | 839 | /** 840 | * Creates a directry if it doesn't exists with 509(775) permissions. 841 | * 842 | * @param path Directory path 843 | * 844 | * @return true if the directory was created, false otherwise. 845 | */ 846 | stock bool CreateDirectoryEx(const char[] path) 847 | { 848 | if (DirExists(path)) 849 | return false; 850 | 851 | return CreateDirectory(path, 509); 852 | } 853 | 854 | /** 855 | * Kills a Timer and reset its Handle to null 856 | * 857 | * @param timer Timer Handle to kill 858 | * @noreturn 859 | */ 860 | #pragma deprecated Use `delete timer` instead 861 | stock void StopTimer(Handle &timer) 862 | { 863 | if (timer != null) 864 | { 865 | timer.Close(); 866 | timer = null; 867 | } 868 | } 869 | 870 | /** 871 | * Returns if warmup is in progress 872 | * 873 | * @return True if it is, false otherwise 874 | */ 875 | stock bool IsWarmup() 876 | { 877 | return (GameRules_GetProp("m_bWarmupPeriod") == 1); 878 | } 879 | 880 | 881 | // Easy precache & prepare download for sounds 882 | stock void PrecacheSoundAnyDownload(const char[] sSound) 883 | { 884 | char sBuffer[256]; 885 | PrecacheSound(sSound); 886 | Format(sBuffer, sizeof(sBuffer), "sound/%s", sSound); 887 | AddFileToDownloadsTable(sBuffer); 888 | } 889 | 890 | /** 891 | * Spawn a particle effect. 892 | * 893 | * @param effect Effect name 894 | * @return Particle entity index. 895 | */ 896 | stock int CreateParticle(const char[] effect, float pos[3]) 897 | { 898 | int ent = CreateEntityByName("info_particle_system"); 899 | if (ent == -1) 900 | { 901 | LogError("Failed to create info_particle_system"); 902 | return -1; 903 | } 904 | 905 | TeleportEntity(ent, pos, NULL_VECTOR, NULL_VECTOR); 906 | DispatchKeyValue(ent, "effect_name", effect); 907 | SetVariantString("!activator"); 908 | DispatchSpawn(ent); 909 | ActivateEntity(ent); 910 | AcceptEntityInput(ent, "Start"); 911 | 912 | 913 | SetParticleFlags(ent); 914 | return ent; 915 | } 916 | 917 | /** 918 | * Spawn a particle effect parented with the client index. 919 | * 920 | * @param client Client index. 921 | * @param effect Effect name 922 | * @return Particle entity index. 923 | */ 924 | stock int AddParticlesToPlayer(int client, const char[] effect) 925 | { 926 | int ent = CreateEntityByName("info_particle_system"); 927 | if (ent == -1) 928 | { 929 | LogError("Failed to create info_particle_system"); 930 | return -1; 931 | } 932 | float vPos[3]; 933 | GetEntityOrigin(client, vPos); 934 | TeleportEntity(ent, vPos, NULL_VECTOR, NULL_VECTOR); 935 | 936 | DispatchKeyValue(ent, "effect_name", effect); 937 | SetVariantString("!activator"); 938 | AcceptEntityInput(ent, "SetParent", client, ent); 939 | DispatchSpawn(ent); 940 | ActivateEntity(ent); 941 | AcceptEntityInput(ent, "Start"); 942 | 943 | SetEntPropEnt(ent, Prop_Send, "m_hOwnerEntity", client); 944 | SetParticleFlags(ent); 945 | return ent; 946 | } 947 | 948 | /** 949 | * Precache a particle system. (.pcf file without particles/) 950 | * 951 | * @param particleSytem Particle System. 952 | * @return Particle system index. 953 | */ 954 | stock int PrecacheParticleSystem(const char[] particleSystem) 955 | { 956 | static int particleEffectNames = INVALID_STRING_TABLE; 957 | 958 | if (particleEffectNames == INVALID_STRING_TABLE) 959 | { 960 | particleEffectNames = FindStringTable("ParticleEffectNames") 961 | if (particleEffectNames == INVALID_STRING_TABLE) 962 | { 963 | LogError("Unable to find `ParticleEffectNames` string table"); 964 | return -1; 965 | } 966 | } 967 | 968 | int index = FindStringIndex2(particleEffectNames, particleSystem); 969 | if (index == INVALID_STRING_INDEX) 970 | { 971 | int numStrings = GetStringTableNumStrings(particleEffectNames); 972 | if (numStrings >= GetStringTableMaxStrings(particleEffectNames)) 973 | { 974 | LogError("`ParticleEffectNames` max size exceeded"); 975 | return -1; 976 | } 977 | 978 | AddToStringTable(particleEffectNames, particleSystem); 979 | index = numStrings; 980 | } 981 | 982 | return index; 983 | } 984 | 985 | 986 | /** 987 | * Returns the index of a text in a string table. 988 | * 989 | * @param tableidx String table id. 990 | * @param str String to find. 991 | * @return The index of the matched string or if none -1. 992 | */ 993 | stock int FindStringIndex2(int tableidx, const char[] str) 994 | { 995 | char buf[1024]; 996 | 997 | int numStrings = GetStringTableNumStrings(tableidx); 998 | for (int i=0; i < numStrings; i++) 999 | { 1000 | ReadStringTable(tableidx, i, buf, sizeof(buf)); 1001 | 1002 | if (StrEqual(buf, str)) { 1003 | return i; 1004 | } 1005 | } 1006 | 1007 | return INVALID_STRING_INDEX; 1008 | } 1009 | 1010 | public void SetParticleFlags(int edict) 1011 | { 1012 | if (GetEdictFlags(edict) & FL_EDICT_ALWAYS) 1013 | { 1014 | SetEdictFlags(edict, (GetEdictFlags(edict) ^ FL_EDICT_ALWAYS)); 1015 | } 1016 | } 1017 | -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/hextags.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * HexTags Inc File. 3 | * by: Hexah 4 | * https://github.com/Hexer10/HexTags 5 | * 6 | * Copyright (C) 2017-2020 Mattia (Hexah|Hexer10|Papero) 7 | * 8 | * This file is part of the HexTags SourceMod Plugin. 9 | * 10 | * This program is free software; you can redistribute it and/or modify it under 11 | * the terms of the GNU General Public License, version 3.0, as published by the 12 | * Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, but WITHOUT 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 | * details. 18 | * 19 | * You should have received a copy of the GNU General Public License along with 20 | * this program. If not, see . 21 | */ 22 | #if defined _hextags_included 23 | #endinput 24 | #endif 25 | #define _hextags_included 26 | 27 | //Allow plugins to use chat-processor defines 28 | #if !defined _chat_processor_included 29 | #define MAXLENGTH_FLAG 32 30 | #define MAXLENGTH_NAME 128 31 | #define MAXLENGTH_MESSAGE 128 32 | #define MAXLENGTH_BUFFER 255 33 | #endif 34 | 35 | public SharedPlugin __pl_hextags = 36 | { 37 | name = "hextags", 38 | file = "hextags.smx", 39 | #if defined REQUIRE_PLUGIN 40 | required = 1, 41 | #else 42 | required = 0, 43 | #endif 44 | }; 45 | 46 | 47 | #if !defined REQUIRE_PLUGIN 48 | public void __pl_hextags_SetNTVOptional() 49 | { 50 | MarkNativeAsOptional("HexTags_GetClientTag"); 51 | MarkNativeAsOptional("HexTags_SetClientTag"); 52 | MarkNativeAsOptional("HexTags_ResetClientTag"); 53 | MarkNativeAsOptional("HexTags_AddCustomSelector"); 54 | MarkNativeAsOptional("HexTags_RemoveCustomSelector"); 55 | } 56 | #endif 57 | 58 | enum struct CustomTags 59 | { 60 | char TagName[32]; 61 | char ScoreTag[32]; 62 | char ChatTag[MAXLENGTH_NAME]; 63 | char ChatColor[32]; 64 | char NameColor[32]; 65 | bool ForceTag; 66 | int SectionId; 67 | } 68 | 69 | enum eTags 70 | { 71 | ScoreTag, 72 | ChatTag, 73 | ChatColor, 74 | NameColor 75 | } 76 | 77 | typedef SelectorCallback = function bool(int client, const char[] selector); 78 | 79 | /** 80 | * Returns an HexTags client tag. 81 | * 82 | * @param Client Index. 83 | * @TagType Tag type. 84 | * @buffer String to store the tag in. 85 | * @maxlength Maximum size of string buffer. 86 | * 87 | * @error Invalid client index, or not connected. 88 | */ 89 | native void HexTags_GetClientTag(int client, eTags TagType, char[] buffer, int maxlength); 90 | 91 | /** 92 | * Sets an HexTags client tag. 93 | * This is resetted everytime that "HexTags_OnTagsUpdated" is called. 94 | * 95 | * @param Client Index. 96 | * @TagType Tag type. 97 | * @Tag New client tag. 98 | * 99 | * @error Invalid client index, or not connected. 100 | */ 101 | native void HexTags_SetClientTag(int client, eTags TagType, char[] Tag); 102 | 103 | /** 104 | * Update the client tags to its default (from config). 105 | * 106 | * @param Client Index. 107 | * 108 | * @error Invalid client index, or not connected. 109 | */ 110 | native void HexTags_ResetClientTag(int client); 111 | 112 | /** 113 | * Called when the client tags gets updated. 114 | * 115 | * @param client Client Index. 116 | */ 117 | forward void HexTags_OnTagsUpdated(int client); 118 | 119 | /** 120 | * Called when the message is processed. 121 | * 122 | * @param client Client Index. 123 | * @param name Player's name. 124 | * @param message Player's message. 125 | * 126 | * @return Plugin_Continue to pass or Plugin_Handled or higher to block the processing. 127 | */ 128 | forward Action HexTags_OnMessagePreProcess(int client, char name[MAXLENGTH_NAME], char message[MAXLENGTH_MESSAGE]); 129 | 130 | /** 131 | * Called when the message is processed. 132 | * 133 | * @param client Client Index. 134 | * @param name Player's name. 135 | * @param message Player's message. 136 | 137 | * @return Plugin_Continue to pass the event without edits, Plugin_Changed 138 | * To pass edits or Plugin_Handled or greter to stop the event. 139 | */ 140 | forward Action HexTags_OnMessageProcess(int client, char name[MAXLENGTH_NAME], char message[MAXLENGTH_MESSAGE]); 141 | 142 | /** 143 | * Called after the message is processed. 144 | * 145 | * @param client Client Index. 146 | * @param name Player's name. 147 | * @param message Player's message. 148 | * 149 | * @noreturn 150 | */ 151 | forward void HexTags_OnMessageProcessed(int client, const char[] name, const char[] message); 152 | 153 | 154 | /** 155 | * Adds a Custom Selector callback. 156 | * The callback is fired every time a selector is parsed and does not match any other selector. 157 | * 158 | * @return True on success, false otherwise. 159 | */ 160 | native bool HexTags_AddCustomSelector(SelectorCallback callback); 161 | 162 | /** 163 | * Removes a Custom Selector hook. 164 | * 165 | * @return True on success, false otherwise. 166 | */ 167 | native bool HexTags_RemoveCustomSelector(SelectorCallback callback); -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/hl_gangs.inc: -------------------------------------------------------------------------------- 1 | #if defined hl_gangs_include 2 | #endinput 3 | #endif 4 | #define hl_gangs_include 5 | 6 | 7 | #define GANGS_VERSION "1.1.9.1" 8 | 9 | /* Gang Ranks */ 10 | enum GangRank 11 | { 12 | Rank_Invalid = -1, 13 | Rank_Normal, 14 | Rank_Admin, 15 | Rank_Owner 16 | } 17 | 18 | /** 19 | * Outputs a formatted message to the client 20 | * 21 | * @param client client index 22 | * @return int gang size 23 | */ 24 | native void Gangs_Message(int client, const char[] format, any ...); 25 | 26 | /** 27 | * Outputs a formatted message to all clients 28 | * 29 | * @param client client index 30 | * @return int gang size 31 | */ 32 | native void Gangs_MessageToAll(int client, const char[] format, any ...); 33 | 34 | /** 35 | * Returns the size of a client's gang 36 | * 37 | * @param client client index 38 | * @return int gang size 39 | */ 40 | native int Gangs_GetGangSize(int client); 41 | 42 | /** 43 | * Returns if a client is a member of a gang 44 | * 45 | * @param client client index 46 | * @return bool gang status 47 | */ 48 | native bool Gangs_HasGang(int client); 49 | 50 | /** 51 | * Get a client's gang rank 52 | * 53 | * @param client client index 54 | * @return GangRank gang rank 55 | */ 56 | native GangRank Gangs_GetGangRank(int client); 57 | 58 | /** 59 | * Get a client's gang name 60 | * 61 | * @param client client index 62 | * @return no return 63 | */ 64 | native void Gangs_GetGangName(int client, char[] buffer, int maxlength); 65 | 66 | /** 67 | * Returns a client's damage modifier 68 | * 69 | * @param client client index 70 | * @return float damage modifier 71 | */ 72 | native float Gangs_GetDamageModifier(int client); 73 | 74 | /** 75 | * Called after the main menu is built, but before it's displayed. 76 | * @param client Player's index. 77 | * @param menu Menu being displayed to the client. 78 | * @noreturn 79 | */ 80 | forward void Gangs_OnMenuCreated(int client, Menu menu); 81 | 82 | /** 83 | * Called once a main menu item has been selected 84 | * @param menu Menu displayed 85 | * @param action Menu Action 86 | * @param param1 client index 87 | * @param param2 88 | * @noreturn 89 | */ 90 | forward void Gangs_OnMenuCallback(Menu menu, MenuAction action, int param1, int param2); 91 | 92 | /** 93 | * Called after the perk menu is built, but before it's displayed. 94 | * This is where you can add custom perks. See Gangs_OnPerkMenuCallback 95 | * 96 | * @param client Player's index. 97 | * @param menu Menu being displayed to the client. 98 | * @noreturn 99 | */ 100 | forward void Gangs_OnPerkMenuCreated(int client, Menu menu); 101 | 102 | /** 103 | * Called once a perk menu item has been selected 104 | * @param menu Menu displayed 105 | * @param action Menu Action 106 | * @param param1 client index 107 | * @param param2 108 | * @noreturn 109 | */ 110 | forward void Gangs_OnPerkMenuCallback(Menu menu, MenuAction action, int param1, int param2); 111 | 112 | 113 | /** 114 | * Called immediately before perks are given. Set shouldGive to false in order to skip giving perks. 115 | 116 | * @param int client index 117 | * @param &bool shouldGive 118 | * @noreturn 119 | */ 120 | forward void Gangs_OnPerksSetPre(int client, bool &shouldGive); 121 | 122 | public SharedPlugin __pl_hl_gangs = 123 | { 124 | name = "hl_gangs", 125 | file = "hl_gangs.smx", 126 | #if defined REQUIRE_PLUGIN 127 | required = 1 128 | #else 129 | required = 0 130 | #endif 131 | }; 132 | 133 | #if !defined REQUIRE_PLUGIN 134 | public __pl_hl_gangs_SetNTVOptional() 135 | { 136 | MarkNativeAsOptional("Gangs_GetDamageModifier"); 137 | MarkNativeAsOptional("Gangs_GetGangName"); 138 | MarkNativeAsOptional("Gangs_GetGangRank"); 139 | MarkNativeAsOptional("Gangs_HasGang"); 140 | MarkNativeAsOptional("Gangs_GetGangSize"); 141 | MarkNativeAsOptional("Gangs_Message"); 142 | MarkNativeAsOptional("Gangs_MessageToAll"); 143 | } 144 | #endif -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/kento_rankme/cvars.inc: -------------------------------------------------------------------------------- 1 | ConVar g_cvarAnnounceAdmin; 2 | ConVar g_cvarAnnounceConnect; 3 | ConVar g_cvarAnnounceConnectChat; 4 | ConVar g_cvarAnnounceConnectHint; 5 | ConVar g_cvarAnnounceDisconnect; 6 | ConVar g_cvarAnnounceTopConnect; 7 | ConVar g_cvarAnnounceTopConnectChat; 8 | ConVar g_cvarAnnounceTopConnectHint; 9 | ConVar g_cvarAnnounceTopPosConnect; 10 | ConVar g_cvarAutopurge; 11 | ConVar g_cvarChatChange; 12 | ConVar g_cvarChatTriggers; 13 | ConVar g_cvarDaysToNotShowOnRank; 14 | ConVar g_cvarDumpDB; 15 | ConVar g_cvarEnabled; 16 | ConVar g_cvarFfa; 17 | ConVar g_cvarGatherStats; 18 | ConVar g_cvarGatherStatsWarmup; 19 | ConVar g_cvarMinimalKills; 20 | ConVar g_cvarMinimumPlayers; 21 | ConVar g_cvarMysql; 22 | ConVar g_cvarNSAllSnipers; 23 | ConVar g_cvarPercentPointsLose; 24 | ConVar g_cvarPointsAssistKill; 25 | ConVar g_cvarPointsBombDefusedPlayer; 26 | ConVar g_cvarPointsBombDefusedTeam; 27 | ConVar g_cvarPointsBombDropped; 28 | ConVar g_cvarPointsBombExplodePlayer; 29 | ConVar g_cvarPointsBombExplodeTeam; 30 | ConVar g_cvarPointsBombPickup; 31 | ConVar g_cvarPointsBombPlantedPlayer; 32 | ConVar g_cvarPointsBombPlantedTeam; 33 | ConVar g_cvarPointsCtRoundLose; 34 | ConVar g_cvarPointsCtRoundWin; 35 | ConVar g_cvarPointsFb; 36 | ConVar g_cvarPointsHostageRescPlayer; 37 | ConVar g_cvarPointsHostageRescTeam; 38 | ConVar g_cvarPointsHs; 39 | ConVar g_cvarPointsKillBonusCt; 40 | ConVar g_cvarPointsKillBonusDifCt; 41 | ConVar g_cvarPointsKillBonusDifTr; 42 | ConVar g_cvarPointsKillBonusTr; 43 | ConVar g_cvarPointsKillCt; 44 | ConVar g_cvarPointsKillTr; 45 | ConVar g_cvarPointsKnifeMultiplier; 46 | ConVar g_cvarPointsLoseRoundCeil; 47 | ConVar g_cvarPointsLoseSuicide; 48 | ConVar g_cvarPointsLoseTk; 49 | ConVar g_cvarPointsMatchDraw; 50 | ConVar g_cvarPointsMatchLose; 51 | ConVar g_cvarPointsMatchWin; 52 | ConVar g_cvarPointsMin; 53 | ConVar g_cvarPointsMinEnabled; 54 | ConVar g_cvarPointsMvpCt; 55 | ConVar g_cvarPointsMvpTr; 56 | ConVar g_cvarPointsNS; 57 | ConVar g_cvarPointsStart; 58 | ConVar g_cvarPointsTaserMultiplier; 59 | ConVar g_cvarPointsTrRoundLose; 60 | ConVar g_cvarPointsTrRoundWin; 61 | ConVar g_cvarPointsVipEscapedPlayer; 62 | ConVar g_cvarPointsVipEscapedTeam; 63 | ConVar g_cvarPointsVipKilledPlayer; 64 | ConVar g_cvarPointsVipKilledTeam; 65 | ConVar g_cvarRankAllTimer; 66 | ConVar g_cvarRankBy; 67 | ConVar g_cvarRankCache; 68 | ConVar g_cvarRankMode; 69 | ConVar g_cvarRankbots; 70 | ConVar g_cvarResetOwnRank; 71 | ConVar g_cvarSQLTable; 72 | ConVar g_cvarShowBotsOnRank; 73 | ConVar g_cvarShowRankAll; 74 | ConVar g_cvarVipEnabled; 75 | 76 | Handle g_arrayRankCache[3]; 77 | bool firstblood = false; 78 | bool g_bAnnounceConnect; 79 | bool g_bAnnounceConnectChat; 80 | bool g_bAnnounceConnectHint; 81 | bool g_bAnnounceDisconnect; 82 | bool g_bAnnounceTopConnect; 83 | bool g_bAnnounceTopConnectChat; 84 | bool g_bAnnounceTopConnectHint; 85 | bool g_bChatChange; 86 | bool g_bChatTriggers; 87 | bool g_bDumpDB; 88 | bool g_bEnabled; 89 | bool g_bFfa; 90 | bool g_bGatherStats; 91 | bool g_bGatherStatsWarmup; 92 | bool g_bMysql; 93 | bool g_bNSAllSnipers; 94 | bool g_bPointsLoseRoundCeil; 95 | bool g_bPointsMinEnabled; 96 | bool g_bRankBots; 97 | bool g_bRankCache; 98 | bool g_bResetOwnRank; 99 | bool g_bShowBotsOnRank; 100 | bool g_bShowRankAll; 101 | bool g_bVipEnabled; 102 | char g_sAnnounceAdmin[AdminFlags_TOTAL]; 103 | char g_sBufferClientName[MAXPLAYERS+1][MAX_NAME_LENGTH]; 104 | float g_fPercentPointsLose; 105 | float g_fPointsKnifeMultiplier; 106 | float g_fPointsTaserMultiplier; 107 | float g_fRankAllTimer; 108 | int g_AnnounceTopPosConnect; 109 | int g_DaysToNotShowOnRank; 110 | int g_MinimalKills; 111 | int g_MinimumPlayers; 112 | int g_PointsAssistKill; 113 | int g_PointsBombDefusedPlayer; 114 | int g_PointsBombDefusedTeam; 115 | int g_PointsBombDropped; 116 | int g_PointsBombExplodePlayer; 117 | int g_PointsBombExplodeTeam; 118 | int g_PointsBombPickup; 119 | int g_PointsBombPlantedPlayer; 120 | int g_PointsBombPlantedTeam; 121 | int g_PointsFb; 122 | int g_PointsHostageRescPlayer; 123 | int g_PointsHostageRescTeam; 124 | int g_PointsHs; 125 | int g_PointsKillBonusDif[4]; 126 | int g_PointsKillBonus[4]; 127 | int g_PointsKill[4]; 128 | int g_PointsLoseSuicide; 129 | int g_PointsLoseTk; 130 | int g_PointsMatchDraw; 131 | int g_PointsMatchLose; 132 | int g_PointsMatchWin; 133 | int g_PointsMin; 134 | int g_PointsMvpCt; 135 | int g_PointsMvpTr; 136 | int g_PointsNS; 137 | int g_PointsRoundLose[4]; 138 | int g_PointsRoundWin[4]; 139 | int g_PointsStart; 140 | int g_PointsVipEscapedPlayer; 141 | int g_PointsVipEscapedTeam; 142 | int g_PointsVipKilledPlayer; 143 | int g_PointsVipKilledTeam; 144 | int g_RankBy; 145 | int g_RankMode; 146 | int g_aPointsOnConnect[MAXPLAYERS+1]; 147 | int g_aPointsOnDisconnect[MAXPLAYERS+1]; 148 | int g_aRankOnConnect[MAXPLAYERS+1]; 149 | 150 | void CreateCvars() 151 | { 152 | g_cvarEnabled = CreateConVar("rankme_enabled", "1", "Is RankMe enabled? 1 = true 0 = false", _, true, 0.0, true, 1.0); 153 | g_cvarRankbots = CreateConVar("rankme_rankbots", "0", "Rank bots? 1 = true 0 = false", _, true, 0.0, true, 1.0); 154 | g_cvarAutopurge = CreateConVar("rankme_autopurge", "0", "Auto-Purge inactive players? X = Days 0 = Off", _, true, 0.0); 155 | g_cvarPointsBombDefusedTeam = CreateConVar("rankme_points_bomb_defused_team", "2", "How many points CTs got for defusing the C4?", _, true, 0.0); 156 | g_cvarPointsBombDefusedPlayer = CreateConVar("rankme_points_bomb_defused_player", "2", "How many points the CT who defused got additional?", _, true, 0.0); 157 | g_cvarPointsBombPlantedTeam = CreateConVar("rankme_points_bomb_planted_team", "2", "How many points TRs got for planting the C4?", _, true, 0.0); 158 | g_cvarPointsBombPlantedPlayer = CreateConVar("rankme_points_bomb_planted_player", "2", "How many points the TR who planted got additional?", _, true, 0.0); 159 | g_cvarPointsBombExplodeTeam = CreateConVar("rankme_points_bomb_exploded_team", "2", "How many points TRs got for exploding the C4?", _, true, 0.0); 160 | g_cvarPointsBombExplodePlayer = CreateConVar("rankme_points_bomb_exploded_player", "2", "How many points the TR who planted got additional?", _, true, 0.0); 161 | g_cvarPointsHostageRescTeam = CreateConVar("rankme_points_hostage_rescued_team", "2", "How many points CTs got for rescuing the hostage?", _, true, 0.0); 162 | g_cvarPointsHostageRescPlayer = CreateConVar("rankme_points_hostage_rescued_player", "2", "How many points the CT who rescued got additional?", _, true, 0.0); 163 | g_cvarPointsHs = CreateConVar("rankme_points_hs", "1", "How many additional points a player got for a HeadShot?", _, true, 0.0); 164 | g_cvarPointsKillCt = CreateConVar("rankme_points_kill_ct", "2", "How many points a CT got for killing?", _, true, 0.0); 165 | g_cvarPointsKillTr = CreateConVar("rankme_points_kill_tr", "2", "How many points a TR got for killing?", _, true, 0.0); 166 | g_cvarPointsKillBonusCt = CreateConVar("rankme_points_kill_bonus_ct", "1", "How many points a CT got for killing additional by the diffrence of points?", _, true, 0.0); 167 | g_cvarPointsKillBonusTr = CreateConVar("rankme_points_kill_bonus_tr", "1", "How many points a TR got for killing additional by the diffrence of points?", _, true, 0.0); 168 | g_cvarPointsKillBonusDifCt = CreateConVar("rankme_points_kill_bonus_dif_ct", "100", "How many points of diffrence is needed for a CT to got the bonus?", _, true, 0.0); 169 | g_cvarPointsKillBonusDifTr = CreateConVar("rankme_points_kill_bonus_dif_tr", "100", "How many points of diffrence is needed for a TR to got the bonus?", _, true, 0.0); 170 | g_cvarPointsCtRoundWin = CreateConVar("rankme_points_ct_round_win", "0", "How many points CT got for winning the round?", _, true, 0.0); 171 | g_cvarPointsTrRoundWin = CreateConVar("rankme_points_tr_round_win", "0", "How many points TR got for winning the round?", _, true, 0.0); 172 | g_cvarPointsCtRoundLose = CreateConVar("rankme_points_ct_round_lose", "0", "How many points CT lost for losing the round?", _, true, 0.0); 173 | g_cvarPointsTrRoundLose = CreateConVar("rankme_points_tr_round_lose", "0", "How many points TR lost for losing the round?", _, true, 0.0); 174 | g_cvarPointsKnifeMultiplier = CreateConVar("rankme_points_knife_multiplier", "2.0", "Multiplier of points by knife", _, true, 0.0); 175 | g_cvarPointsTaserMultiplier = CreateConVar("rankme_points_taser_multiplier", "2.0", "Multiplier of points by taser", _, true, 0.0); 176 | g_cvarPointsStart = CreateConVar("rankme_points_start", "1000", "Starting points", _, true, 0.0); 177 | g_cvarMinimalKills = CreateConVar("rankme_minimal_kills", "0", "Minimal kills for entering the rank", _, true, 0.0); 178 | g_cvarPercentPointsLose = CreateConVar("rankme_percent_points_lose", "1.0", "Multiplier of losing points. (WARNING: MAKE SURE TO INPUT IT AS FLOAT) 1.0 equals lose same amount as won by the killer, 0.0 equals no lose", _, true, 0.0); 179 | g_cvarPointsLoseRoundCeil = CreateConVar("rankme_points_lose_round_ceil", "1", "If the points is f1oat, round it to next the highest or lowest? 1 = highest 0 = lowest", _, true, 0.0, true, 1.0); 180 | g_cvarChatChange = CreateConVar("rankme_changes_chat", "1", "Show points changes on chat? 1 = true 0 = false", _, true, 0.0, true, 1.0); 181 | g_cvarShowRankAll = CreateConVar("rankme_show_rank_all", "0", "When rank command is used, show for all the rank of the player? 1 = true 0 = false", _, true, 0.0, true, 1.0); 182 | g_cvarRankAllTimer = CreateConVar("rankme_rank_all_timer", "30.0", "Cooldown timer to prevent rank command spam.\n0.0 = disabled", _, true, 0.0); 183 | g_cvarShowBotsOnRank = CreateConVar("rankme_show_bots_on_rank", "0", "Show bots on rank/top/etc? 1 = true 0 = false", _, true, 0.0, true, 1.0); 184 | g_cvarResetOwnRank = CreateConVar("rankme_resetownrank", "0", "Allow player to reset his own rank? 1 = true 0 = false", _, true, 0.0, true, 1.0); 185 | g_cvarMinimumPlayers = CreateConVar("rankme_minimumplayers", "2", "Minimum players to start giving points", _, true, 0.0); 186 | g_cvarVipEnabled = CreateConVar("rankme_vip_enabled", "0", "Show AS_ maps statiscs (VIP mod) on statsme and session?", _, true, 0.0, true, 1.0); 187 | g_cvarPointsVipEscapedTeam = CreateConVar("rankme_points_vip_escaped_team", "2", "How many points CTs got helping the VIP to escaping?", _, true, 0.0); 188 | g_cvarPointsVipEscapedPlayer = CreateConVar("rankme_points_vip_escaped_player", "2", "How many points the VIP got for escaping?", _, true, 0.0); 189 | g_cvarPointsVipKilledTeam = CreateConVar("rankme_points_vip_killed_team", "2", "How many points TRs got for killing the VIP?", _, true, 0.0); 190 | g_cvarPointsVipKilledPlayer = CreateConVar("rankme_points_vip_killed_player", "2", "How many points the TR who killed the VIP got additional?", _, true, 0.0); 191 | g_cvarPointsLoseTk = CreateConVar("rankme_points_lose_tk", "0", "How many points a player lose for Team Killing?", _, true, 0.0); 192 | g_cvarPointsLoseSuicide = CreateConVar("rankme_points_lose_suicide", "0", "How many points a player lose for Suiciding?", _, true, 0.0); 193 | g_cvarPointsFb = CreateConVar("rankme_points_fb", "1", "How many additional points a player got for a First Blood?", _, true, 0.0); 194 | g_cvarPointsNS = CreateConVar("rankme_points_ns", "1", "How many additional points a player got for a no scope kill?", _, true, 0.0); 195 | g_cvarNSAllSnipers = CreateConVar("rankme_points_ns_allsnipers", "0", "0: ssg08 and awp only, 1: ssg08, awp, g3sg1, scar20", _, true, 0.0, true, 1.0); 196 | g_cvarRankBy = CreateConVar("rankme_rank_by", "0", "Rank players by? 0 = STEAM:ID 1 = Name 2 = IP", _, true, 0.0, true, 2.0); 197 | g_cvarFfa = CreateConVar("rankme_ffa", "0", "Free-For-All (FFA) mode? 1 = true 0 = false", _, true, 0.0, true, 1.0); 198 | g_cvarMysql = CreateConVar("rankme_mysql", "0", "Using MySQL? 1 = true 0 = false (SQLite)", _, true, 0.0, true, 1.0); 199 | g_cvarDumpDB = CreateConVar("rankme_dump_db", "0", "Dump the Database to SQL file? (required to be 1 if using the web interface and SQLite, case MySQL, it won't be dumped) 1 = true 0 = false", _, true, 0.0, true, 1.0); 200 | g_cvarGatherStats = CreateConVar("rankme_gather_stats", "1", "Gather Statistics (a.k.a count points)? (turning this off won't disallow to see the stats already gathered) 1 = true 0 = false", _, true, 0.0, true, 1.0); 201 | g_cvarDaysToNotShowOnRank = CreateConVar("rankme_days_to_not_show_on_rank", "0", "Days inactive to not be shown on rank? X = days 0 = off", _, true, 0.0); 202 | g_cvarRankMode = CreateConVar("rankme_rank_mode", "1", "Rank by what? 1 = by points 2 = by KDR ", _, true, 1.0, true, 2.0); 203 | g_cvarSQLTable = CreateConVar("rankme_sql_table", "rankme", "The name of the table that will be used. (Max: 100)"); 204 | g_cvarChatTriggers = CreateConVar("rankme_chat_triggers", "1", "Enable (non-command) chat triggers. (e.g: rank, statsme, top) Recommended to be set to 0 when running with EventScripts for avoiding double responses. 1 = true 0 = false", _, true, 0.0, true, 1.0); 205 | g_cvarPointsMvpCt = CreateConVar("rankme_points_mvp_ct", "1", "How many points a CT got for being the MVP?", _, true, 0.0); 206 | g_cvarPointsMvpTr = CreateConVar("rankme_points_mvp_tr", "1", "How many points a TR got for being the MVP?", _, true, 0.0); 207 | g_cvarPointsBombPickup = CreateConVar("rankme_points_bomb_pickup", "0", "How many points a player gets for picking up the bomb?", _, true, 0.0); 208 | g_cvarPointsBombDropped = CreateConVar("rankme_points_bomb_dropped", "0", "How many points a player loess for dropping the bomb?", _, true, 0.0); 209 | g_cvarPointsMatchWin = CreateConVar("rankme_points_match_win", "2", "How many points a player win for winning the match?", _, true, 0.0); 210 | g_cvarPointsMatchLose = CreateConVar("rankme_points_match_lose", "2", "How many points a player loess for losing the match?", _, true, 0.0); 211 | g_cvarPointsMatchDraw = CreateConVar("rankme_points_match_draw", "0", "How many points a player win when match draw?", _, true, 0.0); 212 | g_cvarPointsAssistKill = CreateConVar("rankme_points_assiist_kill","1","How many points a player gets for assist kill?",_,true,0.0); 213 | g_cvarGatherStatsWarmup = CreateConVar("rankme_gather_stats_warmup","1","Gather Statistics In Warmup?", _, true, 0.0, true, 1.0); 214 | g_cvarPointsMinEnabled = CreateConVar("rankme_points_min_enabled", "1", "Is minimum points enabled? 1 = true 0 = false", _, true, 0.0, true, 1.0); 215 | g_cvarPointsMin = CreateConVar("rankme_points_min", "0", "Minimum points", _, true, 0.0); 216 | g_cvarRankCache = CreateConVar("rankme_rank_cache", "0", "Get player rank via cache, auto build cache on every OnMapStart.", _, true, 0.0, true, 1.0); 217 | g_arrayRankCache[0] = CreateArray(ByteCountToCells(128)); 218 | g_arrayRankCache[1] = CreateArray(ByteCountToCells(128)); 219 | g_arrayRankCache[2] = CreateArray(ByteCountToCells(128)); 220 | g_cvarAnnounceConnect = CreateConVar("rankme_announcer_player_connect","1","Announce when a player connect with position and points?",_,true,0.0,true,1.0); 221 | g_cvarAnnounceConnectChat = CreateConVar("rankme_announcer_player_connect_chat","1","Announce when a player connect at chat?",_,true,0.0,true,1.0); 222 | g_cvarAnnounceConnectHint = CreateConVar("rankme_announcer_player_connect_hint","0","Announce when a player connect at hintbox?",_,true,0.0,true,1.0); 223 | g_cvarAnnounceDisconnect = CreateConVar("rankme_announcer_player_disconnect","1","Announce when a player disconnect with position and points?",_,true,0.0,true,1.0); 224 | g_cvarAnnounceTopConnect = CreateConVar("rankme_announcer_top_player_connect","1","Announce when a top player connect?",_,true,0.0,true,1.0); 225 | g_cvarAnnounceTopPosConnect = CreateConVar("rankme_announcer_top_pos_player_connect","10","Max position to announce that a top player connect?",_,true,0.0); 226 | g_cvarAnnounceTopConnectChat = CreateConVar("rankme_announcer_top_player_connect_chat","1","Announce when a top player connect at chat?",_,true,0.0,true,1.0); 227 | g_cvarAnnounceTopConnectHint = CreateConVar("rankme_announcer_top_player_connect_hint","0","Announce when a top player connect at hintbox?",_,true,0.0,true,1.0); 228 | g_cvarAnnounceAdmin = CreateConVar("rankme_announcer_admin","","Admin flag to disable announce. blank = disabled"); 229 | 230 | // CVAR HOOK 231 | g_cvarEnabled.AddChangeHook(OnConVarChanged); 232 | g_cvarChatChange.AddChangeHook(OnConVarChanged); 233 | g_cvarShowBotsOnRank.AddChangeHook(OnConVarChanged); 234 | g_cvarShowRankAll.AddChangeHook(OnConVarChanged); 235 | g_cvarRankAllTimer.AddChangeHook(OnConVarChanged); 236 | g_cvarResetOwnRank.AddChangeHook(OnConVarChanged); 237 | g_cvarMinimumPlayers.AddChangeHook(OnConVarChanged); 238 | g_cvarRankbots.AddChangeHook(OnConVarChanged); 239 | g_cvarAutopurge.AddChangeHook(OnConVarChanged); 240 | g_cvarPointsBombDefusedTeam.AddChangeHook(OnConVarChanged); 241 | g_cvarPointsBombDefusedPlayer.AddChangeHook(OnConVarChanged); 242 | g_cvarPointsBombPlantedTeam.AddChangeHook(OnConVarChanged); 243 | g_cvarPointsBombPlantedPlayer.AddChangeHook(OnConVarChanged); 244 | g_cvarPointsBombExplodeTeam.AddChangeHook(OnConVarChanged); 245 | g_cvarPointsBombExplodePlayer.AddChangeHook(OnConVarChanged); 246 | g_cvarPointsHostageRescTeam.AddChangeHook(OnConVarChanged); 247 | g_cvarPointsHostageRescPlayer.AddChangeHook(OnConVarChanged); 248 | g_cvarPointsHs.AddChangeHook(OnConVarChanged); 249 | g_cvarPointsKillCt.AddChangeHook(OnConVarChanged); 250 | g_cvarPointsKillTr.AddChangeHook(OnConVarChanged); 251 | g_cvarPointsKillBonusCt.AddChangeHook(OnConVarChanged); 252 | g_cvarPointsKillBonusTr.AddChangeHook(OnConVarChanged); 253 | g_cvarPointsKillBonusDifCt.AddChangeHook(OnConVarChanged); 254 | g_cvarPointsKillBonusDifTr.AddChangeHook(OnConVarChanged); 255 | g_cvarPointsCtRoundWin.AddChangeHook(OnConVarChanged); 256 | g_cvarPointsTrRoundWin.AddChangeHook(OnConVarChanged); 257 | g_cvarPointsCtRoundLose.AddChangeHook(OnConVarChanged); 258 | g_cvarPointsTrRoundLose.AddChangeHook(OnConVarChanged); 259 | g_cvarPointsKnifeMultiplier.AddChangeHook(OnConVarChanged); 260 | g_cvarPointsTaserMultiplier.AddChangeHook(OnConVarChanged); 261 | g_cvarPointsStart.AddChangeHook(OnConVarChanged); 262 | g_cvarMinimalKills.AddChangeHook(OnConVarChanged); 263 | g_cvarPercentPointsLose.AddChangeHook(OnConVarChanged); 264 | g_cvarPointsLoseRoundCeil.AddChangeHook(OnConVarChanged); 265 | g_cvarVipEnabled.AddChangeHook(OnConVarChanged); 266 | g_cvarPointsVipEscapedTeam.AddChangeHook(OnConVarChanged); 267 | g_cvarPointsVipEscapedPlayer.AddChangeHook(OnConVarChanged); 268 | g_cvarPointsVipKilledTeam.AddChangeHook(OnConVarChanged); 269 | g_cvarPointsVipKilledPlayer.AddChangeHook(OnConVarChanged); 270 | g_cvarPointsLoseTk.AddChangeHook(OnConVarChanged); 271 | g_cvarPointsLoseSuicide.AddChangeHook(OnConVarChanged); 272 | g_cvarRankBy.AddChangeHook(OnConVarChanged); 273 | g_cvarFfa.AddChangeHook(OnConVarChanged); 274 | g_cvarDumpDB.AddChangeHook(OnConVarChanged); 275 | g_cvarGatherStats.AddChangeHook(OnConVarChanged); 276 | g_cvarDaysToNotShowOnRank.AddChangeHook(OnConVarChanged); 277 | g_cvarRankMode.AddChangeHook(OnConVarChanged); 278 | g_cvarMysql.AddChangeHook(OnConVarChanged_MySQL); 279 | g_cvarSQLTable.AddChangeHook(OnConVarChanged_SQLTable); 280 | g_cvarChatTriggers.AddChangeHook(OnConVarChanged); 281 | g_cvarPointsMvpCt.AddChangeHook(OnConVarChanged); 282 | g_cvarPointsMvpTr.AddChangeHook(OnConVarChanged); 283 | g_cvarPointsBombPickup.AddChangeHook(OnConVarChanged); 284 | g_cvarPointsBombDropped.AddChangeHook(OnConVarChanged); 285 | g_cvarPointsMatchWin.AddChangeHook(OnConVarChanged); 286 | g_cvarPointsMatchDraw.AddChangeHook(OnConVarChanged); 287 | g_cvarPointsMatchLose.AddChangeHook(OnConVarChanged); 288 | g_cvarPointsFb.AddChangeHook(OnConVarChanged); 289 | g_cvarPointsNS.AddChangeHook(OnConVarChanged); 290 | g_cvarNSAllSnipers.AddChangeHook(OnConVarChanged); 291 | g_cvarPointsAssistKill.AddChangeHook(OnConVarChanged); 292 | g_cvarGatherStatsWarmup.AddChangeHook(OnConVarChanged); 293 | g_cvarPointsMinEnabled.AddChangeHook(OnConVarChanged); 294 | g_cvarPointsMin.AddChangeHook(OnConVarChanged); 295 | g_cvarAnnounceConnect.AddChangeHook(OnConVarChanged); 296 | g_cvarAnnounceConnectChat.AddChangeHook(OnConVarChanged); 297 | g_cvarAnnounceConnectHint.AddChangeHook(OnConVarChanged); 298 | g_cvarAnnounceDisconnect.AddChangeHook(OnConVarChanged); 299 | g_cvarAnnounceTopConnect.AddChangeHook(OnConVarChanged); 300 | g_cvarAnnounceTopPosConnect.AddChangeHook(OnConVarChanged); 301 | g_cvarAnnounceTopConnectChat.AddChangeHook(OnConVarChanged); 302 | g_cvarAnnounceTopConnectHint.AddChangeHook(OnConVarChanged); 303 | g_cvarAnnounceAdmin.AddChangeHook(OnConVarChanged); 304 | } 305 | 306 | void GetCvarValues() 307 | { 308 | g_bShowBotsOnRank = g_cvarShowBotsOnRank.BoolValue; 309 | g_RankBy = g_cvarRankBy.IntValue; 310 | g_bEnabled = g_cvarEnabled.BoolValue; 311 | g_bChatChange = g_cvarChatChange.BoolValue; 312 | g_bShowRankAll = g_cvarShowRankAll.BoolValue; 313 | g_fRankAllTimer = g_cvarRankAllTimer.FloatValue; 314 | g_bRankBots = g_cvarRankbots.BoolValue; 315 | g_bFfa = g_cvarFfa.BoolValue; 316 | g_bDumpDB = g_cvarDumpDB.BoolValue; 317 | g_PointsBombDefusedTeam = g_cvarPointsBombDefusedTeam.IntValue; 318 | g_PointsBombDefusedPlayer = g_cvarPointsBombDefusedPlayer.IntValue; 319 | g_PointsBombPlantedTeam = g_cvarPointsBombPlantedTeam.IntValue; 320 | g_PointsBombPlantedPlayer = g_cvarPointsBombPlantedPlayer.IntValue; 321 | g_PointsBombExplodeTeam = g_cvarPointsBombExplodeTeam.IntValue; 322 | g_PointsBombExplodePlayer = g_cvarPointsBombExplodePlayer.IntValue; 323 | g_PointsHostageRescTeam = g_cvarPointsHostageRescTeam.IntValue; 324 | g_PointsHostageRescPlayer = g_cvarPointsHostageRescPlayer.IntValue; 325 | g_PointsHs = g_cvarPointsHs.IntValue; 326 | g_PointsKill[CT] = g_cvarPointsKillCt.IntValue; 327 | g_PointsKill[TR] = g_cvarPointsKillTr.IntValue; 328 | g_PointsKillBonus[CT] = g_cvarPointsKillBonusCt.IntValue; 329 | g_PointsKillBonus[TR] = g_cvarPointsKillBonusTr.IntValue; 330 | g_PointsKillBonusDif[CT] = g_cvarPointsKillBonusDifCt.IntValue; 331 | g_PointsKillBonusDif[TR] = g_cvarPointsKillBonusDifTr.IntValue; 332 | g_PointsStart = g_cvarPointsStart.IntValue; 333 | g_fPointsKnifeMultiplier = g_cvarPointsKnifeMultiplier.FloatValue; 334 | g_fPointsTaserMultiplier = g_cvarPointsTaserMultiplier.FloatValue; 335 | g_PointsRoundWin[TR] = g_cvarPointsTrRoundWin.IntValue; 336 | g_PointsRoundWin[CT] = g_cvarPointsCtRoundWin.IntValue; 337 | g_PointsRoundLose[TR] = g_cvarPointsTrRoundLose.IntValue; 338 | g_PointsRoundLose[CT] = g_cvarPointsCtRoundLose.IntValue; 339 | g_MinimalKills = g_cvarMinimalKills.IntValue; 340 | g_fPercentPointsLose = g_cvarPercentPointsLose.FloatValue; 341 | g_bPointsLoseRoundCeil = g_cvarPointsLoseRoundCeil.BoolValue; 342 | g_MinimumPlayers = g_cvarMinimumPlayers.IntValue; 343 | g_bResetOwnRank = g_cvarResetOwnRank.BoolValue; 344 | g_PointsVipEscapedTeam = g_cvarPointsVipEscapedTeam.IntValue; 345 | g_PointsVipEscapedPlayer = g_cvarPointsVipEscapedPlayer.IntValue; 346 | g_PointsVipKilledTeam = g_cvarPointsVipKilledTeam.IntValue; 347 | g_PointsVipKilledPlayer = g_cvarPointsVipKilledPlayer.IntValue; 348 | g_bVipEnabled = g_cvarVipEnabled.BoolValue; 349 | g_PointsLoseTk = g_cvarPointsLoseTk.IntValue; 350 | g_PointsLoseSuicide = g_cvarPointsLoseSuicide.IntValue; 351 | g_DaysToNotShowOnRank = g_cvarDaysToNotShowOnRank.IntValue; 352 | g_bGatherStats = g_cvarGatherStats.BoolValue; 353 | g_RankMode = g_cvarRankMode.IntValue; 354 | g_bChatTriggers = g_cvarChatTriggers.BoolValue; 355 | g_PointsMvpCt = g_cvarPointsMvpCt.IntValue; 356 | g_PointsMvpTr = g_cvarPointsMvpTr.IntValue; 357 | g_PointsBombDropped = g_cvarPointsBombDropped.IntValue; 358 | g_PointsBombPickup = g_cvarPointsBombPickup.IntValue; 359 | g_PointsMatchWin = g_cvarPointsMatchWin.IntValue; 360 | g_PointsMatchDraw = g_cvarPointsMatchDraw.IntValue; 361 | g_PointsMatchLose = g_cvarPointsMatchLose.IntValue; 362 | g_PointsFb = g_cvarPointsFb.IntValue; 363 | g_PointsNS = g_cvarPointsNS.IntValue; 364 | g_bNSAllSnipers = g_cvarNSAllSnipers.BoolValue; 365 | 366 | /* Assist */ 367 | g_PointsAssistKill = g_cvarPointsAssistKill.IntValue; 368 | 369 | /* Enable Or Disable Points In Warmup */ 370 | g_bGatherStatsWarmup = g_cvarGatherStatsWarmup.BoolValue; 371 | 372 | /* Min points */ 373 | g_PointsMin = g_cvarPointsMin.IntValue; 374 | g_bPointsMinEnabled = g_cvarPointsMin.BoolValue; 375 | 376 | /*RankMe Connect Announcer*/ 377 | g_bAnnounceConnect = g_cvarAnnounceConnect.BoolValue; 378 | g_bAnnounceConnectChat = g_cvarAnnounceConnectChat.BoolValue; 379 | g_bAnnounceConnectHint = g_cvarAnnounceConnectHint.BoolValue; 380 | g_bAnnounceDisconnect = g_cvarAnnounceDisconnect.BoolValue; 381 | g_bAnnounceTopConnect = g_cvarAnnounceTopConnect.BoolValue; 382 | g_AnnounceTopPosConnect = g_cvarAnnounceTopPosConnect.BoolValue; 383 | g_bAnnounceTopConnectChat = g_cvarAnnounceTopConnectChat.BoolValue; 384 | g_bAnnounceTopConnectHint = g_cvarAnnounceTopConnectHint.BoolValue; 385 | g_cvarAnnounceAdmin.GetString(g_sAnnounceAdmin, sizeof(g_sAnnounceAdmin)); 386 | } 387 | 388 | public void OnConVarChanged(Handle convar, const char[] oldValue, const char[] newValue) { 389 | int g_bQueryPlayerCount; 390 | 391 | if (convar == g_cvarShowBotsOnRank) { 392 | g_bShowBotsOnRank = g_cvarShowBotsOnRank.BoolValue; 393 | g_bQueryPlayerCount = true; 394 | } 395 | else if (convar == g_cvarRankBy) { 396 | g_RankBy = g_cvarRankBy.IntValue; 397 | } 398 | else if (convar == g_cvarEnabled) { 399 | g_bEnabled = g_cvarEnabled.BoolValue; 400 | } 401 | else if (convar == g_cvarShowRankAll) { 402 | g_bShowRankAll = g_cvarShowRankAll.BoolValue; 403 | } 404 | else if (convar == g_cvarRankAllTimer) { 405 | g_fRankAllTimer = g_cvarRankAllTimer.FloatValue; 406 | } 407 | else if (convar == g_cvarChatChange) { 408 | g_bChatChange = g_cvarChatChange.BoolValue; 409 | } 410 | else if (convar == g_cvarRankbots) { 411 | g_bRankBots = g_cvarRankbots.BoolValue; 412 | g_bQueryPlayerCount = true; 413 | CheckUnique(); 414 | } 415 | else if (convar == g_cvarFfa) { 416 | g_bFfa = g_cvarFfa.BoolValue; 417 | } 418 | else if (convar == g_cvarDumpDB) { 419 | g_bDumpDB = g_cvarDumpDB.BoolValue; 420 | } 421 | else if (convar == g_cvarPointsBombDefusedTeam) { 422 | g_PointsBombDefusedTeam = g_cvarPointsBombDefusedTeam.IntValue; 423 | } 424 | else if (convar == g_cvarPointsBombDefusedPlayer) { 425 | g_PointsBombDefusedPlayer = g_cvarPointsBombDefusedPlayer.IntValue; 426 | } 427 | else if (convar == g_cvarPointsBombPlantedTeam) { 428 | g_PointsBombPlantedTeam = g_cvarPointsBombPlantedTeam.IntValue; 429 | } 430 | else if (convar == g_cvarPointsBombPlantedPlayer) { 431 | g_PointsBombPlantedPlayer = g_cvarPointsBombPlantedPlayer.IntValue; 432 | } 433 | else if (convar == g_cvarPointsBombExplodeTeam) { 434 | g_PointsBombExplodeTeam = g_cvarPointsBombExplodeTeam.IntValue; 435 | } 436 | else if (convar == g_cvarPointsBombExplodePlayer) { 437 | g_PointsBombExplodePlayer = g_cvarPointsBombExplodePlayer.IntValue; 438 | } 439 | else if (convar == g_cvarPointsHostageRescTeam) { 440 | g_PointsHostageRescTeam = g_cvarPointsHostageRescTeam.IntValue; 441 | } 442 | else if (convar == g_cvarPointsHostageRescPlayer) { 443 | g_PointsHostageRescPlayer = g_cvarPointsHostageRescPlayer.IntValue; 444 | } 445 | else if (convar == g_cvarPointsHs) { 446 | g_PointsHs = g_cvarPointsHs.IntValue; 447 | } 448 | else if (convar == g_cvarPointsKillCt) { 449 | g_PointsKill[CT] = g_cvarPointsKillCt.IntValue; 450 | } 451 | else if (convar == g_cvarPointsKillTr) { 452 | g_PointsKill[TR] = g_cvarPointsKillTr.IntValue; 453 | } 454 | else if (convar == g_cvarPointsKillBonusCt) { 455 | g_PointsKillBonus[CT] = g_cvarPointsKillBonusCt.IntValue; 456 | } 457 | else if (convar == g_cvarPointsKillBonusTr) { 458 | g_PointsKillBonus[TR] = g_cvarPointsKillBonusTr.IntValue; 459 | } 460 | else if (convar == g_cvarPointsKillBonusDifCt) { 461 | g_PointsKillBonusDif[CT] = g_cvarPointsKillBonusDifCt.IntValue; 462 | } 463 | else if (convar == g_cvarPointsKillBonusDifTr) { 464 | g_PointsKillBonusDif[TR] = g_cvarPointsKillBonusDifTr.IntValue; 465 | } 466 | else if (convar == g_cvarPointsStart) { 467 | g_PointsStart = g_cvarPointsStart.IntValue; 468 | } 469 | else if (convar == g_cvarPointsKnifeMultiplier) { 470 | g_fPointsKnifeMultiplier = g_cvarPointsKnifeMultiplier.FloatValue; 471 | } 472 | else if (convar == g_cvarPointsTaserMultiplier) { 473 | g_fPointsTaserMultiplier = g_cvarPointsTaserMultiplier.FloatValue; 474 | } 475 | else if (convar == g_cvarPointsTrRoundWin) { 476 | g_PointsRoundWin[TR] = g_cvarPointsTrRoundWin.IntValue; 477 | } 478 | else if (convar == g_cvarPointsCtRoundWin) { 479 | g_PointsRoundWin[CT] = g_cvarPointsCtRoundWin.IntValue; 480 | } 481 | else if (convar == g_cvarPointsTrRoundLose) { 482 | g_PointsRoundLose[TR] = g_cvarPointsTrRoundLose.IntValue; 483 | } 484 | else if (convar == g_cvarPointsCtRoundLose) { 485 | g_PointsRoundLose[CT] = g_cvarPointsCtRoundLose.IntValue; 486 | } 487 | else if (convar == g_cvarMinimalKills) { 488 | g_MinimalKills = g_cvarMinimalKills.IntValue; 489 | } 490 | else if (convar == g_cvarPercentPointsLose) { 491 | g_fPercentPointsLose = g_cvarPercentPointsLose.FloatValue; 492 | } 493 | else if (convar == g_cvarPointsLoseRoundCeil) { 494 | g_bPointsLoseRoundCeil = g_cvarPointsLoseRoundCeil.BoolValue; 495 | } 496 | else if (convar == g_cvarMinimumPlayers) { 497 | g_MinimumPlayers = g_cvarMinimumPlayers.IntValue; 498 | } 499 | else if (convar == g_cvarResetOwnRank) { 500 | g_bResetOwnRank = g_cvarResetOwnRank.BoolValue; 501 | } 502 | else if (convar == g_cvarPointsVipEscapedTeam) { 503 | g_PointsVipEscapedTeam = g_cvarPointsVipEscapedTeam.IntValue; 504 | } 505 | else if (convar == g_cvarPointsVipEscapedPlayer) { 506 | g_PointsVipEscapedPlayer = g_cvarPointsVipEscapedPlayer.IntValue; 507 | } 508 | else if (convar == g_cvarPointsVipKilledTeam) { 509 | g_PointsVipKilledTeam = g_cvarPointsVipKilledTeam.IntValue; 510 | } 511 | else if (convar == g_cvarPointsVipKilledPlayer) { 512 | g_PointsVipKilledPlayer = g_cvarPointsVipKilledPlayer.IntValue; 513 | } 514 | else if (convar == g_cvarVipEnabled) { 515 | g_bVipEnabled = g_cvarVipEnabled.BoolValue; 516 | } 517 | else if (convar == g_cvarDaysToNotShowOnRank) { 518 | g_DaysToNotShowOnRank = g_cvarDaysToNotShowOnRank.IntValue; 519 | g_bQueryPlayerCount = true; 520 | } 521 | else if (convar == g_cvarGatherStats) { 522 | g_bGatherStats = g_cvarGatherStats.BoolValue; 523 | } 524 | else if (convar == g_cvarRankMode) { 525 | g_RankMode = g_cvarRankMode.IntValue; 526 | BuildRankCache(); 527 | } 528 | else if (convar == g_cvarChatTriggers) { 529 | g_bChatTriggers = g_cvarChatTriggers.BoolValue; 530 | } 531 | else if (convar == g_cvarPointsMvpCt) { 532 | g_PointsMvpCt = g_cvarPointsMvpCt.IntValue; 533 | } 534 | else if (convar == g_cvarPointsMvpTr) { 535 | g_PointsMvpTr = g_cvarPointsMvpTr.IntValue; 536 | } 537 | else if (convar == g_cvarPointsBombPickup) { 538 | g_PointsBombDropped = g_cvarPointsBombPickup.IntValue; 539 | } 540 | else if (convar == g_cvarPointsBombDropped) { 541 | g_PointsBombDropped = g_cvarPointsBombDropped.IntValue; 542 | } 543 | 544 | /*RankMe Connect Announcer*/ 545 | else if(convar == g_cvarAnnounceConnect) { 546 | g_bAnnounceConnect = g_cvarAnnounceConnect.BoolValue; 547 | } 548 | 549 | else if(convar == g_cvarAnnounceConnectChat) { 550 | g_bAnnounceConnectChat = g_cvarAnnounceConnectChat.BoolValue; 551 | } 552 | 553 | else if(convar == g_cvarAnnounceConnectHint) { 554 | g_bAnnounceConnectHint = g_cvarAnnounceConnectHint.BoolValue; 555 | } 556 | 557 | else if(convar == g_cvarAnnounceDisconnect) { 558 | g_bAnnounceDisconnect = g_cvarAnnounceDisconnect.BoolValue; 559 | } 560 | 561 | else if(convar == g_cvarAnnounceTopConnect) { 562 | g_bAnnounceTopConnect = g_cvarAnnounceTopConnect.BoolValue; 563 | } 564 | 565 | else if(convar == g_cvarAnnounceTopPosConnect) { 566 | g_AnnounceTopPosConnect = g_cvarAnnounceTopPosConnect.IntValue; 567 | } 568 | 569 | else if(convar == g_cvarAnnounceTopConnectChat) { 570 | g_bAnnounceTopConnectChat = g_cvarAnnounceTopConnectChat.BoolValue; 571 | } 572 | 573 | else if(convar == g_cvarAnnounceTopConnectHint) { 574 | g_bAnnounceTopConnectHint = g_cvarAnnounceTopConnectHint.BoolValue; 575 | } 576 | 577 | else if(convar == g_cvarAnnounceAdmin) { 578 | g_cvarAnnounceAdmin.GetString(g_sAnnounceAdmin, sizeof(g_sAnnounceAdmin)); 579 | } 580 | 581 | /* Assist */ 582 | else if (convar == g_cvarPointsAssistKill){ 583 | g_PointsAssistKill = g_cvarPointsAssistKill.IntValue; 584 | } 585 | 586 | /* Enable Or Disable Points In Warmup */ 587 | else if (convar == g_cvarGatherStatsWarmup){ 588 | g_bGatherStatsWarmup = g_cvarGatherStatsWarmup.BoolValue; 589 | } 590 | 591 | /* Min points */ 592 | else if (convar == g_cvarPointsMin){ 593 | g_PointsMin = g_cvarPointsMin.IntValue; 594 | } 595 | 596 | else if (convar == g_cvarPointsMinEnabled){ 597 | g_bPointsMinEnabled = g_cvarPointsMinEnabled.BoolValue; 598 | } 599 | 600 | /* Rank Cache */ 601 | else if (convar == g_cvarRankCache) { 602 | g_bRankCache = g_cvarRankCache.BoolValue; 603 | } 604 | 605 | else if (convar == g_cvarPointsMatchWin) { 606 | g_PointsMatchWin = g_cvarPointsMatchWin.IntValue; 607 | } 608 | 609 | else if (convar == g_cvarPointsMatchDraw) { 610 | g_PointsMatchDraw = g_cvarPointsMatchDraw.IntValue; 611 | } 612 | 613 | else if (convar == g_cvarPointsMatchLose) { 614 | g_PointsMatchLose = g_cvarPointsMatchLose.IntValue; 615 | } 616 | 617 | else if (convar == g_cvarPointsFb) { 618 | g_PointsFb = g_cvarPointsFb.IntValue; 619 | } 620 | 621 | else if (convar == g_cvarPointsNS) { 622 | g_PointsNS = g_cvarPointsNS.IntValue; 623 | } 624 | 625 | else if (convar == g_cvarNSAllSnipers) { 626 | g_bNSAllSnipers = g_cvarNSAllSnipers.BoolValue; 627 | } 628 | 629 | if (g_bQueryPlayerCount && g_hStatsDb != INVALID_HANDLE) { 630 | char query[10000]; 631 | MakeSelectQuery(query, sizeof(query)); 632 | SQL_TQuery(g_hStatsDb, SQL_GetPlayersCallback, query); 633 | } 634 | } -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/kento_rankme/natives.inc: -------------------------------------------------------------------------------- 1 | public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) 2 | { 3 | CreateNative("RankMe_GivePoint", Native_GivePoint); 4 | CreateNative("RankMe_GetRank", Native_GetRank); 5 | CreateNative("RankMe_GetPoints", Native_GetPoints); 6 | CreateNative("RankMe_GetStats", Native_GetStats); 7 | CreateNative("RankMe_GetSession", Native_GetSession); 8 | CreateNative("RankMe_GetWeaponStats", Native_GetWeaponStats); 9 | CreateNative("RankMe_GetHitbox", Native_GetHitbox); 10 | CreateNative("RankMe_IsPlayerLoaded", Native_IsPlayerLoaded); 11 | 12 | RegPluginLibrary("rankme"); 13 | 14 | return APLRes_Success; 15 | } 16 | public int Native_GivePoint(Handle plugin, int numParams) 17 | { 18 | int iClient = GetNativeCell(1); 19 | int iPoints = GetNativeCell(2); 20 | 21 | int len; 22 | GetNativeStringLength(3, len); 23 | 24 | if (len <= 0) 25 | { 26 | return; 27 | } 28 | 29 | 30 | char[] Reason = new char[len + 1]; 31 | char Name[MAX_NAME_LENGTH]; 32 | GetNativeString(3, Reason, len + 1); 33 | int iPrintToPlayer = GetNativeCell(4); 34 | int iPrintToAll = GetNativeCell(5); 35 | g_aStats[iClient][SCORE] += iPoints; 36 | g_aSession[iClient][SCORE] += iPoints; 37 | GetClientName(iClient, Name, sizeof(Name)); 38 | if (!g_bChatChange) 39 | return; 40 | if (iPrintToAll == 1) { 41 | for (int i = 1; i <= MaxClients; i++) 42 | if (IsClientInGame(i)) 43 | //CPrintToChatEx(i,i,"%s %T",MSG,"GotPointsBy",Name,g_aStats[iClient][SCORE],iPoints,Reason); 44 | if(!hidechat[i]) CPrintToChat(i, "%s %T", MSG, "GotPointsBy", i, Name, g_aStats[iClient][SCORE], iPoints, Reason); 45 | } else if (iPrintToPlayer == 1) { 46 | //CPrintToChatEx(iClient,iClient,"%s %T",MSG,"GotPointsBy",Name,g_aStats[iClient][SCORE],iPoints,Reason); 47 | if(!hidechat[iClient]) CPrintToChat(iClient, "%s %T", MSG, "GotPointsBy", iClient, Name, g_aStats[iClient][SCORE], iPoints, Reason); 48 | } 49 | } 50 | 51 | public int Native_GetRank(Handle plugin, int numParams) 52 | { 53 | int client = GetNativeCell(1); 54 | Function callback = GetNativeCell(2); 55 | any data = GetNativeCell(3); 56 | 57 | Handle pack = CreateDataPack(); 58 | 59 | WritePackCell(pack, client); 60 | WritePackFunction(pack, callback); 61 | WritePackCell(pack, data); 62 | WritePackCell(pack, view_as(plugin)); 63 | 64 | if(g_bRankCache) 65 | { 66 | GetClientRank(pack); 67 | return; 68 | } 69 | 70 | char query[10000]; 71 | MakeSelectQuery(query, sizeof(query)); 72 | 73 | if (g_RankMode == 1) 74 | Format(query, sizeof(query), "%s ORDER BY score DESC", query); 75 | else if (g_RankMode == 2) 76 | Format(query, sizeof(query), "%s ORDER BY CAST(CAST(kills as float)/CAST (deaths as float) as float) DESC", query); 77 | 78 | SQL_TQuery(g_hStatsDb, SQL_GetRankCallback, query, pack); 79 | } 80 | 81 | void GetClientRank(Handle pack) 82 | { 83 | ResetPack(pack); 84 | int client = ReadPackCell(pack); 85 | Function callback = ReadPackFunction(pack); 86 | any args = ReadPackCell(pack); 87 | Handle plugin = ReadPackCell(pack); 88 | CloseHandle(pack); 89 | 90 | int rank; 91 | switch(g_RankBy) 92 | { 93 | case 0: 94 | { 95 | char steamid[32]; 96 | GetClientAuthId(client, AuthId_Steam2, steamid, 32, true); 97 | rank = FindStringInArray(g_arrayRankCache[0], steamid); 98 | } 99 | case 1: 100 | { 101 | char name[128]; 102 | GetClientName(client, name, 128); 103 | rank = FindStringInArray(g_arrayRankCache[1], name); 104 | } 105 | case 2: 106 | { 107 | char ip[128]; 108 | GetClientIP(client, ip, 128); 109 | rank = FindStringInArray(g_arrayRankCache[2], ip); 110 | } 111 | } 112 | 113 | if(rank > 0) 114 | CallRankCallback(client, rank, callback, args, plugin); 115 | else 116 | CallRankCallback(client, 0, callback, args, plugin); 117 | } 118 | 119 | public void SQL_GetRankCallback(Handle owner, Handle hndl, const char[] error, any data) 120 | { 121 | Handle pack = data; 122 | ResetPack(pack); 123 | int client = ReadPackCell(pack); 124 | Function callback = ReadPackFunction(pack); 125 | any args = ReadPackCell(pack); 126 | Handle plugin = ReadPackCell(pack); 127 | CloseHandle(pack); 128 | 129 | if (hndl == INVALID_HANDLE) 130 | { 131 | LogError("[RankMe] Query Fail: %s", error); 132 | CallRankCallback(0, 0, callback, 0, plugin); 133 | return; 134 | } 135 | int i; 136 | g_TotalPlayers = SQL_GetRowCount(hndl); 137 | 138 | char Receive[64]; 139 | 140 | while (SQL_HasResultSet(hndl) && SQL_FetchRow(hndl)) 141 | { 142 | i++; 143 | 144 | if (g_RankBy == 0) { 145 | SQL_FetchString(hndl, 1, Receive, sizeof(Receive)); 146 | if (StrEqual(Receive, g_aClientSteam[client], false)) 147 | { 148 | CallRankCallback(client, i, callback, args, plugin); 149 | break; 150 | } 151 | } else if (g_RankBy == 1) { 152 | SQL_FetchString(hndl, 2, Receive, sizeof(Receive)); 153 | if (StrEqual(Receive, g_aClientName[client], false)) 154 | { 155 | CallRankCallback(client, i, callback, args, plugin); 156 | break; 157 | } 158 | } else if (g_RankBy == 2) { 159 | SQL_FetchString(hndl, 3, Receive, sizeof(Receive)); 160 | if (StrEqual(Receive, g_aClientIp[client], false)) 161 | { 162 | CallRankCallback(client, i, callback, args, plugin); 163 | break; 164 | } 165 | } 166 | } 167 | } 168 | 169 | void CallRankCallback(int client, int rank, Function callback, any data, Handle plugin) 170 | { 171 | Call_StartFunction(plugin, callback); 172 | Call_PushCell(client); 173 | Call_PushCell(rank); 174 | Call_PushCell(data); 175 | Call_Finish(); 176 | CloseHandle(plugin); 177 | } 178 | 179 | public int Native_GetPoints(Handle plugin, int numParams) 180 | { 181 | int Client = GetNativeCell(1); 182 | return g_aStats[Client][SCORE]; 183 | } 184 | 185 | public int Native_GetStats(Handle plugin, int numParams) 186 | { 187 | int iClient = GetNativeCell(1); 188 | int array[20]; 189 | for (int i = 0; i < 20; i++) 190 | array[i] = g_aStats[iClient][i]; 191 | 192 | SetNativeArray(2, array, 20); 193 | } 194 | 195 | public int Native_GetSession(Handle plugin, int numParams) 196 | { 197 | int iClient = GetNativeCell(1); 198 | int array[20]; 199 | for (int i = 0; i < 20; i++) 200 | array[i] = g_aSession[iClient][i]; 201 | 202 | SetNativeArray(2, array, 20); 203 | } 204 | 205 | public int Native_GetWeaponStats(Handle plugin, int numParams) 206 | { 207 | int iClient = GetNativeCell(1); 208 | int array[42]; 209 | for (int i = 0; i < 42; i++) 210 | array[i] = g_aWeapons[iClient][i]; 211 | 212 | SetNativeArray(2, array, 42); 213 | } 214 | 215 | public int Native_GetHitbox(Handle plugin, int numParams) 216 | { 217 | int iClient = GetNativeCell(1); 218 | int array[8]; 219 | for (int i = 0; i < 8; i++) 220 | array[i] = g_aHitBox[iClient][i]; 221 | 222 | SetNativeArray(2, array, 8); 223 | } 224 | 225 | public int Native_IsPlayerLoaded(Handle plugin, int numParams) 226 | { 227 | int iClient = GetNativeCell(1); 228 | return OnDB[iClient]; 229 | } -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/kento_rankme/rankme.inc: -------------------------------------------------------------------------------- 1 | #if defined _rankme_included 2 | #endinput 3 | #endif 4 | #define _rankme_included 5 | 6 | enum WEAPONS_ENUM{ 7 | KNIFE, 8 | GLOCK, 9 | HKP2000, 10 | USP_SILENCER, 11 | P250, 12 | DEAGLE, 13 | ELITE, 14 | FIVESEVEN, 15 | TEC9, 16 | CZ75A, 17 | REVOLVER, 18 | NOVA, 19 | XM1014, 20 | MAG7, 21 | SAWEDOFF, 22 | BIZON, 23 | MAC10, 24 | MP9, 25 | MP7, 26 | UMP45, 27 | P90, 28 | GALILAR, 29 | AK47, 30 | SCAR20, 31 | FAMAS, 32 | M4A1, 33 | M4A1_SILENCER, 34 | AUG, 35 | SSG08, 36 | SG556, 37 | AWP, 38 | G3SG1, 39 | M249, 40 | NEGEV, 41 | HEGRENADE, 42 | FLASHBANG, 43 | SMOKEGRENADE, 44 | INFERNO, 45 | DECOY, 46 | TASER, 47 | MP5SD, 48 | BREACHCHARGE, 49 | } 50 | 51 | enum STATS_NAMES{ 52 | SCORE, 53 | KILLS, 54 | DEATHS, 55 | ASSISTS, 56 | SUICIDES, 57 | TK, 58 | SHOTS, 59 | HITS, 60 | HEADSHOTS, 61 | CONNECTED, 62 | ROUNDS_TR, 63 | ROUNDS_CT, 64 | C4_PLANTED, 65 | C4_EXPLODED, 66 | C4_DEFUSED, 67 | CT_WIN, 68 | TR_WIN, 69 | HOSTAGES_RESCUED, 70 | VIP_KILLED, 71 | VIP_ESCAPED, 72 | VIP_PLAYED, 73 | MVP, 74 | DAMAGE, 75 | MATCH_WIN, 76 | MATCH_DRAW, 77 | MATCH_LOSE, 78 | FB, 79 | NS, 80 | NSD 81 | } 82 | 83 | enum HITBOXES{ 84 | NULL_HITBOX, 85 | HEAD, 86 | CHEST, 87 | STOMACH, 88 | LEFT_ARM, 89 | RIGHT_ARM, 90 | LEFT_LEG, 91 | RIGHT_LEG 92 | } 93 | 94 | 95 | public SharedPlugin __pl_rankme= 96 | { 97 | name = "rankme", 98 | file = "kento_rankme.smx", 99 | #if defined REQUIRE_PLUGIN 100 | required = 1 101 | #else 102 | required = 0 103 | #endif 104 | } 105 | 106 | typedef RankCallback = function Action(int client, int rank, any data); 107 | 108 | public void __pl_rankme_SetNTVOptional() 109 | { 110 | MarkNativeAsOptional("RankMe_GivePoint"); 111 | MarkNativeAsOptional("RankMe_GetRank"); 112 | MarkNativeAsOptional("RankMe_GetPoints"); 113 | MarkNativeAsOptional("RankMe_GetStats"); 114 | MarkNativeAsOptional("RankMe_GetSession"); 115 | MarkNativeAsOptional("RankMe_GetWeaponStats"); 116 | MarkNativeAsOptional("RankMe_GetHitbox"); 117 | MarkNativeAsOptional("RankMe_IsPlayerLoaded"); 118 | } 119 | 120 | /********************************************************* 121 | * Give point(s) to a player on the server 122 | * 123 | * @param client The client index of the player to receive the points 124 | * @param points Points to be given to the player 125 | * @param reason The reason to be given the points 126 | * @param printtoplayer Print the change to the player 127 | * @param printtoall Print the change to the everyone 128 | * @noreturn 129 | *********************************************************/ 130 | native void RankMe_GivePoint(int client, int points, char[] reason, int printtoplayer, int printtoall); 131 | 132 | /********************************************************* 133 | * Get rank of a player on the server 134 | * 135 | * @param client The client index of the player to get the rank 136 | * @param callback The return Callback 137 | * @param data Any data you would like that return on the callback 138 | * @noreturn 139 | *********************************************************/ 140 | native void RankMe_GetRank(int client, RankCallback callback, any data = 0); 141 | 142 | /********************************************************* 143 | * Get the score (points) of a player on the server 144 | * 145 | * @param client The client index of the player to get the rank 146 | * @param data Any data you would like that return on the callback 147 | * @return The score of the client 148 | *********************************************************/ 149 | native int RankMe_GetPoints(int client); 150 | 151 | /********************************************************* 152 | * Get stats of a player on the server 153 | * 154 | * @param client The client index of the player to get the stats 155 | * @param stats_return The array that will return the data following the ENUM STATS_NAME; 156 | * @noreturn 157 | *********************************************************/ 158 | native void RankMe_GetStats(int client, int[] stats_return); 159 | 160 | /********************************************************* 161 | * Get session of a player on the server 162 | * 163 | * @param client The client index of the player to get the session 164 | * @param session_return The array that will return the data following the ENUM STATS_NAME; 165 | * @noreturn 166 | *********************************************************/ 167 | native void RankMe_GetSession(int client,int[] session_return); 168 | 169 | /********************************************************* 170 | * Get weapon stats of a player on the server 171 | * 172 | * @param client The client index of the player to get the session 173 | * @param session_return The array that will return the data following the ENUM WEAPONS_ENUM; 174 | * @noreturn 175 | *********************************************************/ 176 | native void RankMe_GetWeaponStats(int client, int[] weapons_return); 177 | 178 | /********************************************************* 179 | * Get hitbox stats of a player on the server 180 | * 181 | * @param client The client index of the player to get the session 182 | * @param session_return The array that will return the data following the ENUM HITBOXES; 183 | * @noreturn 184 | *********************************************************/ 185 | native void RankMe_GetHitbox(int client, int[] hitbox_return); 186 | 187 | /********************************************************* 188 | * Get if player is loaded 189 | * 190 | * @param client Client index 191 | * @return If the client is loaded 192 | *********************************************************/ 193 | native void RankMe_IsPlayerLoaded(int client); 194 | 195 | /********************************************************************** 196 | * When a player has been loaded 197 | * * 198 | * @param client The client index of the player that has been loaded 199 | * @noreturn 200 | **********************************************************************/ 201 | forward Action RankMe_OnPlayerLoaded(int client); 202 | 203 | /********************************************************************** 204 | * When a player has been saved 205 | * * 206 | * @param client The client index of the player that has been saved 207 | * @noreturn 208 | **********************************************************************/ 209 | forward Action RankMe_OnPlayerSaved(int client); -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/logger.inc: -------------------------------------------------------------------------------- 1 | enum LogLevel { 2 | NONE = 0, 3 | INFO = 1, 4 | DEBUG = 2 5 | } 6 | 7 | static LogLevel _level; 8 | 9 | methodmap Logger { 10 | 11 | property LogLevel level 12 | { 13 | public get() { return _level; } 14 | public set(LogLevel level) { _level = level; } 15 | } 16 | 17 | public void debug(const char[] format, any ...) 18 | { 19 | if (this.level < DEBUG) 20 | return; 21 | 22 | char buffer[512]; 23 | VFormat(buffer, sizeof(buffer), format, 3); 24 | StrCat("DEBUG: ", sizeof(buffer), buffer); 25 | 26 | LogMessage(buffer); 27 | } 28 | 29 | public void info(const char[] format, any ...) 30 | { 31 | if (this.level < INFO) 32 | return; 33 | 34 | char buffer[512]; 35 | VFormat(buffer, sizeof(buffer), format, 3); 36 | StrCat("INFO: ", sizeof(buffer), buffer); 37 | 38 | LogMessage(buffer); 39 | } 40 | } -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/mostactive.inc: -------------------------------------------------------------------------------- 1 | #if defined _mostactive_included_ 2 | #endinput 3 | #endif 4 | #define _mostactive_included_ 5 | 6 | 7 | public SharedPlugin __pl_mostactive = 8 | { 9 | name = "mostactive", 10 | file = "mostactive.smx", 11 | 12 | #if defined REQUIRE_PLUGIN 13 | required = 1, 14 | #else 15 | required = 0, 16 | #endif 17 | }; 18 | 19 | 20 | #if !defined REQUIRE_PLUGIN 21 | public void __pl_mostactive_SetNTVOptional() 22 | { 23 | MarkNativeAsOptional("MostActive_GetPlayTimeT"); 24 | MarkNativeAsOptional("MostActive_GetPlayTimeCT"); 25 | MarkNativeAsOptional("MostActive_GetPlayTimeSpec"); 26 | MarkNativeAsOptional("MostActive_GetPlayTimeTotal"); 27 | } 28 | #endif 29 | 30 | 31 | /********************************************************* 32 | * Called when a new player will be written to db 33 | * 34 | * @param client the new client that will be added 35 | * @NoReturn 36 | *********************************************************/ 37 | forward void MostActive_OnInsertNewPlayer(int client); 38 | 39 | 40 | /********************************************************* 41 | * Return the playtime of the client in a team 42 | * 43 | * @Return PlayTime as CT in seconds 44 | *********************************************************/ 45 | native int MostActive_GetPlayTimeCT(int client); 46 | 47 | 48 | /********************************************************* 49 | * Return the playtime of the client in a team 50 | * 51 | * @Return PlayTime as T in seconds 52 | *********************************************************/ 53 | native int MostActive_GetPlayTimeT(int client); 54 | 55 | 56 | /********************************************************* 57 | * Return the playtime of the client in a team 58 | * 59 | * @Return PlayTime as Spec in seconds 60 | *********************************************************/ 61 | native int MostActive_GetPlayTimeSpec(int client); 62 | 63 | 64 | /********************************************************* 65 | * Return the playtime of the client in all teams 66 | * 67 | * @Return Total PlayTime as CT, T & Spec in seconds 68 | *********************************************************/ 69 | native int MostActive_GetPlayTimeTotal(int client); -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/myjbwarden.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * MyJailbreak - Warden Include File. 3 | * by: shanapu 4 | * https://github.com/shanapu/MyJailbreak/ 5 | * 6 | * This file is part of the MyJailbreak SourceMod Plugin. 7 | * 8 | * Copyright (C) 2016-2017 Thomas Schmidt (shanapu) 9 | * 10 | * This program is free software; you can redistribute it and/or modify it under 11 | * the terms of the GNU General Public License, version 3.0, as published by the 12 | * Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, but WITHOUT 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 | * details. 18 | * 19 | * You should have received a copy of the GNU General Public License along with 20 | * this program. If not, see . 21 | */ 22 | 23 | #if defined _myjbwarden_included 24 | #endinput 25 | #endif 26 | #define _myjbwarden_included 27 | 28 | 29 | public SharedPlugin __pl_myjbwarden = 30 | { 31 | name = "warden", 32 | file = "warden.smx", 33 | 34 | #if defined REQUIRE_PLUGIN 35 | required = 1, 36 | #else 37 | required = 0, 38 | #endif 39 | }; 40 | 41 | 42 | #if !defined REQUIRE_PLUGIN 43 | public __pl_myjbwarden_SetNTVOptional() 44 | { 45 | MarkNativeAsOptional("warden_enable"); 46 | MarkNativeAsOptional("warden_isenabled"); 47 | 48 | MarkNativeAsOptional("warden_get"); 49 | MarkNativeAsOptional("warden_getlast"); 50 | 51 | MarkNativeAsOptional("warden_deputy_exist"); 52 | MarkNativeAsOptional("warden_deputy_isdeputy"); 53 | MarkNativeAsOptional("warden_deputy_set"); 54 | MarkNativeAsOptional("warden_deputy_remove"); 55 | MarkNativeAsOptional("warden_deputy_get"); 56 | MarkNativeAsOptional("warden_deputy_getlast"); 57 | 58 | MarkNativeAsOptional("warden_handcuffs_givepaperclip"); 59 | MarkNativeAsOptional("warden_handcuffs_iscuffed"); 60 | 61 | MarkNativeAsOptional("warden_freeday_set"); 62 | MarkNativeAsOptional("warden_freeday_has"); 63 | } 64 | #endif 65 | 66 | 67 | 68 | /********************************************************* 69 | * Called when a client trys to set/become warden 70 | * By player, admin, randomchoose... 71 | * 72 | * @param client The client who try to become warden 73 | * @param caller The client who called the set or become warden command 74 | * @return Return Plugin_Handled to block & Plugin_Continue to pass the client. 75 | *********************************************************/ 76 | forward Action warden_OnWardenCreate(int client, int caller); 77 | 78 | 79 | /********************************************************* 80 | * Called when a client become new warden 81 | * 82 | * @param client The client who is new warden 83 | * @NoReturn 84 | *********************************************************/ 85 | forward void warden_OnWardenCreatedByUser(int client); 86 | 87 | 88 | /********************************************************* 89 | * Called when a admin set a new warden 90 | * 91 | * @param client The client is new warden 92 | * @NoReturn 93 | *********************************************************/ 94 | forward void warden_OnWardenCreatedByAdmin(int client); 95 | 96 | 97 | /********************************************************* 98 | * Called when a the warden was removed by an admin 99 | * 100 | * @param client The admin who removed the warden 101 | * @NoReturn 102 | *********************************************************/ 103 | forward void warden_OnWardenRemovedByAdmin(int client); 104 | 105 | 106 | /********************************************************* 107 | * Called when a the warden retire hisself 108 | * 109 | * @param client The client who was warden 110 | * @NoReturn 111 | *********************************************************/ 112 | forward void warden_OnWardenRemovedBySelf(int client); 113 | 114 | 115 | /********************************************************* 116 | * Called when a the warden disconnect 117 | * 118 | * @param client The client who disconnected 119 | * @NoReturn 120 | *********************************************************/ 121 | forward void warden_OnWardenDisconnected(int client); 122 | 123 | 124 | /********************************************************* 125 | * Called when a the warden dies 126 | * 127 | * @param client The client who was warden 128 | * @NoReturn 129 | *********************************************************/ 130 | forward void warden_OnWardenDeath(int client); 131 | 132 | 133 | 134 | /********************************************************* 135 | * Called everytime the deputy position become free. 136 | * On depury dead, disconnect, removed, move to warden... 137 | * 138 | * @param client The client who was deputy 139 | * @NoReturn 140 | *********************************************************/ 141 | forward void warden_OnDeputyRemoved(int client); 142 | 143 | 144 | /********************************************************* 145 | * Called when a client trys to become deputy 146 | * By player, admin, randomchoose... 147 | * 148 | * @param client The client who try to become deputy 149 | * @NoReturn 150 | *********************************************************/ 151 | forward void warden_OnDeputyCreated(int client); 152 | 153 | 154 | 155 | /********************************************************* 156 | * Disable & enable warden plugin 157 | * 158 | * @param status true = enabled, false = disabled 159 | * @Return 160 | *********************************************************/ 161 | native void warden_enable(bool status); 162 | 163 | 164 | /********************************************************* 165 | * get the current status of warden plugin 166 | * 167 | * 168 | * @Return true = enabled, false = disabled 169 | *********************************************************/ 170 | native bool warden_isenabled(); 171 | 172 | 173 | /********************************************************* 174 | * get the current warden if he exists 175 | * 176 | * 177 | * @Return Client Index of warden 178 | *********************************************************/ 179 | native int warden_get(); 180 | 181 | 182 | /********************************************************* 183 | * get the last warden if he exist 184 | * 185 | * 186 | * @Return Client Index of last warden 187 | *********************************************************/ 188 | native int warden_getlast(); 189 | 190 | 191 | 192 | /********************************************************* 193 | * Checks if any Deputy exist 194 | * 195 | * 196 | * @Return true on match, false if not 197 | *********************************************************/ 198 | native bool warden_deputy_exist(); 199 | 200 | 201 | /********************************************************* 202 | * returns if client is Deputy 203 | * 204 | * @param client The client to run the check on 205 | * @Return true on match, false if not 206 | *********************************************************/ 207 | native bool warden_deputy_isdeputy(int client); 208 | 209 | 210 | /********************************************************* 211 | * Set a client as Deputy 212 | * 213 | * @param client The client to set as Deputy 214 | * @NoReturn 215 | *********************************************************/ 216 | native void warden_deputy_set(int client); 217 | 218 | 219 | /********************************************************* 220 | * Removes the current Deputy if he exists 221 | * 222 | * @param client The Deputy client to remove 223 | * @NoReturn 224 | *********************************************************/ 225 | native void warden_deputy_remove(int client); 226 | 227 | 228 | /********************************************************* 229 | * get the current Deputy if he exists 230 | * 231 | * 232 | * @Return Client index of deputy 233 | *********************************************************/ 234 | native int warden_deputy_get(); 235 | 236 | 237 | /********************************************************* 238 | * get the last deputy if he exists 239 | * 240 | * 241 | * @Return Client Index of last deputy 242 | *********************************************************/ 243 | native int warden_deputy_getlast(); 244 | 245 | 246 | 247 | /********************************************************* 248 | * Give a client a amount of paperclips 249 | * 250 | * @param client The client to give the paperclips 251 | * @param amount The amount of paperclips 252 | * @NoReturn 253 | *********************************************************/ 254 | native void warden_handcuffs_givepaperclip(int client, int amount); 255 | 256 | 257 | /********************************************************* 258 | * returns if client is in handcuffs 259 | * 260 | * @param client The client to run the check on 261 | * @Retrun true on match, false if not 262 | *********************************************************/ 263 | native bool warden_handcuffs_iscuffed(int client); 264 | 265 | 266 | 267 | /********************************************************* 268 | * Set the client get a freeday 269 | * 270 | * @param client The client to run the check on 271 | * @NoReturn 272 | *********************************************************/ 273 | native void warden_freeday_set(int client); 274 | 275 | 276 | /********************************************************* 277 | * returns if client has a freeday now 278 | * 279 | * @param client The client to run the check on 280 | * @Return true on match, false if not 281 | *********************************************************/ 282 | native bool warden_freeday_has(int client); -------------------------------------------------------------------------------- /addons/sourcemod/scripting/include/warden.inc: -------------------------------------------------------------------------------- 1 | #if defined _warden_included 2 | #endinput 3 | #endif 4 | #define _warden_included 5 | 6 | 7 | public SharedPlugin __pl_warden = 8 | { 9 | name = "warden", 10 | file = "warden.smx", 11 | 12 | #if defined REQUIRE_PLUGIN 13 | required = 1, 14 | #else 15 | required = 0, 16 | #endif 17 | }; 18 | 19 | 20 | #if !defined REQUIRE_PLUGIN 21 | public __pl_warden_SetNTVOptional() 22 | { 23 | MarkNativeAsOptional("warden_exist"); 24 | MarkNativeAsOptional("warden_iswarden"); 25 | MarkNativeAsOptional("warden_set"); 26 | MarkNativeAsOptional("warden_remove"); 27 | } 28 | #endif 29 | 30 | 31 | /********************************************************* 32 | * Called everytime the warden position become free. 33 | * On wardens dead, disconnect, removed... 34 | * 35 | * @param client The client who was warden 36 | * @NoReturn 37 | *********************************************************/ 38 | forward void warden_OnWardenRemoved(int client); 39 | 40 | 41 | /********************************************************* 42 | * Called when a client trys to become deputy 43 | * By player, admin, randomchoose... 44 | * 45 | * @param client The client who try to become deputy 46 | * @NoReturn 47 | *********************************************************/ 48 | forward void warden_OnWardenCreated(int client); 49 | 50 | 51 | 52 | /********************************************************* 53 | * Checks if any warden exist 54 | * 55 | * 56 | * @return true on match, false if not 57 | *********************************************************/ 58 | native bool warden_exist(); 59 | 60 | 61 | /********************************************************* 62 | * returns if client is warden 63 | * 64 | * @param client The client to run the check on 65 | * @return true on match, false if not 66 | *********************************************************/ 67 | native bool warden_iswarden(int client); 68 | 69 | 70 | /********************************************************* 71 | * Set a client as warden 72 | * 73 | * @param client The client to set as warden 74 | * @param caller The client who set the new warden 75 | * @NoReturn 76 | *********************************************************/ 77 | native void warden_set(int client, int caller); 78 | 79 | 80 | /********************************************************* 81 | * Removes the current warden if he exists 82 | * 83 | * @param client The warden client to remove 84 | * @NoReturn 85 | *********************************************************/ 86 | native void warden_remove(int client); -------------------------------------------------------------------------------- /builds.txt: -------------------------------------------------------------------------------- 1 | hellotagmetaggyagaintrigger --------------------------------------------------------------------------------