Skip to content

Commit bc97bb1

Browse files
committed
Initial commit
0 parents  commit bc97bb1

File tree

677 files changed

+117093
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

677 files changed

+117093
-0
lines changed

.gitignore

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/c++,cmake,clion+all
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=c++,cmake,clion+all
3+
4+
### C++ ###
5+
# Prerequisites
6+
*.d
7+
8+
# Compiled Object files
9+
*.slo
10+
*.lo
11+
*.o
12+
*.obj
13+
14+
# Precompiled Headers
15+
*.gch
16+
*.pch
17+
18+
# Compiled Dynamic libraries
19+
#*.so
20+
#*.dylib
21+
#*.dll
22+
23+
# Fortran module files
24+
*.mod
25+
*.smod
26+
27+
# Compiled Static libraries
28+
#*.lai
29+
#*.la
30+
#*.a
31+
#*.lib
32+
33+
# Executables
34+
*.exe
35+
*.out
36+
*.app
37+
38+
### CLion+all ###
39+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
40+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
41+
42+
# User-specific stuff
43+
.idea/**/workspace.xml
44+
.idea/**/tasks.xml
45+
.idea/**/usage.statistics.xml
46+
.idea/**/dictionaries
47+
.idea/**/shelf
48+
49+
# Generated files
50+
.idea/**/contentModel.xml
51+
52+
# Sensitive or high-churn files
53+
.idea/**/dataSources/
54+
.idea/**/dataSources.ids
55+
.idea/**/dataSources.local.xml
56+
.idea/**/sqlDataSources.xml
57+
.idea/**/dynamic.xml
58+
.idea/**/uiDesigner.xml
59+
.idea/**/dbnavigator.xml
60+
61+
# Gradle
62+
.idea/**/gradle.xml
63+
.idea/**/libraries
64+
65+
# Gradle and Maven with auto-import
66+
# When using Gradle or Maven with auto-import, you should exclude module files,
67+
# since they will be recreated, and may cause churn. Uncomment if using
68+
# auto-import.
69+
# .idea/artifacts
70+
# .idea/compiler.xml
71+
# .idea/jarRepositories.xml
72+
# .idea/modules.xml
73+
# .idea/*.iml
74+
# .idea/modules
75+
# *.iml
76+
# *.ipr
77+
78+
# CMake
79+
cmake-build-*/
80+
81+
# Mongo Explorer plugin
82+
.idea/**/mongoSettings.xml
83+
84+
# File-based project format
85+
*.iws
86+
87+
# IntelliJ
88+
out/
89+
90+
# mpeltonen/sbt-idea plugin
91+
.idea_modules/
92+
93+
# JIRA plugin
94+
atlassian-ide-plugin.xml
95+
96+
# Cursive Clojure plugin
97+
.idea/replstate.xml
98+
99+
# Crashlytics plugin (for Android Studio and IntelliJ)
100+
com_crashlytics_export_strings.xml
101+
crashlytics.properties
102+
crashlytics-build.properties
103+
fabric.properties
104+
105+
# Editor-based Rest Client
106+
.idea/httpRequests
107+
108+
# Android studio 3.1+ serialized cache file
109+
.idea/caches/build_file_checksums.ser
110+
111+
### CLion+all Patch ###
112+
# Ignores the whole .idea folder and all .iml files
113+
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
114+
115+
.idea/
116+
117+
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
118+
119+
*.iml
120+
modules.xml
121+
.idea/misc.xml
122+
*.ipr
123+
124+
# Sonarlint plugin
125+
.idea/sonarlint
126+
127+
### CMake ###
128+
CMakeLists.txt.user
129+
CMakeCache.txt
130+
CMakeFiles
131+
CMakeScripts
132+
Testing
133+
Makefile
134+
cmake_install.cmake
135+
install_manifest.txt
136+
compile_commands.json
137+
CTestTestfile.cmake
138+
_deps
139+
140+
### CMake Patch ###
141+
# External projects
142+
*-prefix/
143+
144+
# End of https://www.toptal.com/developers/gitignore/api/c++,cmake,clion+all
145+
146+
/build
147+
.vscode

.gitmodules

Whitespace-only changes.

CMakeLists.txt

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
project(nextclientapi_amxx)
4+
5+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
6+
set(CMAKE_CXX_STANDARD 17)
7+
8+
if(UNIX)
9+
set(NAPI_TARGET_PROPS
10+
SUFFIX "_i386.so"
11+
COMPILE_FLAGS "-m32"
12+
LINK_FLAGS "-m32 -static-libstdc++ -static-libgcc -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/version.version"
13+
LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/version.version
14+
)
15+
16+
set(CMAKE_LIBRARY_ARCHITECTURE i386-linux-gnu)
17+
endif()
18+
19+
set(AMXXMODULE_SDK_MODULECONFIG_DIR
20+
${CMAKE_SOURCE_DIR}/public
21+
)
22+
23+
find_package(Threads REQUIRED)
24+
add_subdirectory(deps/amxxmodule)
25+
add_subdirectory(deps/cssdk)
26+
add_subdirectory(deps/metamod)
27+
add_subdirectory(deps/openssl)
28+
add_subdirectory(deps/rsa_keygen)
29+
30+
add_library(${PROJECT_NAME} SHARED
31+
src/main.h
32+
src/main.cpp
33+
src/utilfuncs.cpp
34+
src/rehlds_api_provider.h
35+
src/rehlds_api_provider.cpp
36+
src/SizeBufWriter.h
37+
src/api/CvarSandbox.h
38+
src/api/CvarSandbox.cpp
39+
src/api/PrivatePrecache.h
40+
src/api/PrivatePrecache.cpp
41+
src/api/ViewmodelFX.h
42+
src/api/ViewmodelFX.cpp
43+
src/api/Verificator.h
44+
src/api/Verificator.cpp
45+
src/api/HealthNext.h
46+
src/api/HealthNext.cpp
47+
src/api/NextClientApi.h
48+
src/api/NextClientApi.cpp
49+
src/api/NclmProtocol.h
50+
src/api/NclmProtocol.cpp
51+
src/api/DeathMsgWpnIcon.h
52+
src/api/DeathMsgWpnIcon.cpp
53+
src/EventManager.h
54+
src/EventManager.cpp
55+
src/natives/cvar_sandbox.cpp
56+
src/natives/death_notice_wpn_icon.cpp
57+
src/natives/private_precache.cpp
58+
src/natives/viewmodelfx.cpp
59+
src/natives/nextclient.cpp
60+
src/natives/natives.cpp
61+
src/asserts.cpp
62+
src/asserts.h
63+
64+
${AMXXMODULE_SDK_INCLUDE_PATHS}
65+
${AMXXMODULE_SDK_RUNTIME_SOURCE_FILE}
66+
${CSSDK_RUNTIME_SOURCE_FILES}
67+
)
68+
69+
target_compile_definitions(${PROJECT_NAME} PRIVATE
70+
HAVE_STDINT_H
71+
NOMINMAX
72+
)
73+
74+
target_include_directories(${PROJECT_NAME} PUBLIC
75+
${CSSDK_INCLUDE_PATHS}
76+
${METAMOD_SDK_INCLUDE_PATHS}
77+
${AMXXMODULE_SDK_INCLUDE_PATHS}
78+
${OPENSSL_INCLUDE_PATHS}
79+
src
80+
)
81+
82+
set_target_properties(${PROJECT_NAME} PROPERTIES
83+
PREFIX ""
84+
${NAPI_TARGET_PROPS}
85+
)
86+
87+
target_link_libraries(${PROJECT_NAME}
88+
${OPENSSL_STATIC_LIBS}
89+
${NAPI_LINK_LIBS}
90+
Threads::Threads
91+
)
92+
93+
# custom build targets
94+
add_custom_target(BUILD_ALL ALL)
95+
add_dependencies(BUILD_ALL nextclientapi_amxx)
96+
97+
add_custom_target(INSTALL_ALL
98+
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:nextclientapi_amxx> $ENV{nextclientapi_amxx_COPY_TO_PATH})
99+
100+
add_custom_target(BUILD_AND_INSTALL_ALL ALL)
101+
add_dependencies(BUILD_AND_INSTALL_ALL BUILD_ALL)
102+
add_dependencies(BUILD_AND_INSTALL_ALL INSTALL_ALL)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Next21 Team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Description
2+
NextClientServerApi is an amxmodx module that provides an API to interact with Counter-Strike 1.6 NextClient.
3+
4+
See API functions in [next_client_api.inc](https://github.com/Next21Team/NextClientServerApi/blob/main/addons/amxmodx/scripting/include/next_client_api.inc).
5+
6+
# Features
7+
8+
- The cvar sandbox. Allows you to set the value of a cvar to the client and locks it to be changed by the client. cvar value on the client is reset to the user's value after disconnecting from the server.
9+
- Effects for viewmodel. Allows you to set rendering effects for viewmodels, as well as skin and body.
10+
- Sprite management api. Allows you to display sprites on the screen.
11+
- Extended fov message. Allows you to set the interpolation time of the fov change.
12+
- Override of deathmsg weapon sprites. Allows you to customize weapon icons in kill feed.
13+
14+
Coming soon:
15+
- Separate precaching for regular cs 1.6 client and NextClient.
16+
- Precaching hud.txt and default sprites.
17+
18+
> 💎 **USING OF THE API TO GRANT PRIVILEGES** <br />
19+
Since `NextClientServerApi 1.4.0` we introduced a verification method for players playing with nextclient by using `ncl_is_using_nextclient` native and some [RSA public keys](https://github.com/CS-NextClient/NextClientServerApi/tree/main/addons/amxmodx/data/nextclient_api/pkeys) which should be installed on the server to make verification work.<br />
20+
The verification process is carried out only by nextclient since version `2.3.0`, where support for the new client-server protocol was introduced. For earlier versions, it is unfortunately impossible to reliably determine whether a player uses nextclient.<br />
21+
Here is an example of using verification to provide access flags for players playing with updated nextclient:
22+
```c++
23+
#include <amxmodx>
24+
#include <next_client_api>
25+
26+
new const VIP_FLAGS[] = "f"; // the vip flags we are providing
27+
28+
public ncl_client_api_ready(id) {
29+
// Check that the player has verified nextclient
30+
if(ncl_is_using_nextclient(id) == NCL_USING_VERIFICATED)
31+
set_user_flags(id, read_flags(VIP_FLAGS));
32+
}
33+
```
34+
35+
# NextClient specific cvars
36+
37+
| Cvar name | Default value | Available in sandbox | Description |
38+
| --- | --- | --- | --- |
39+
| viewmodel_disable_shift | 0 | Yes | Disable viewmodel shifting (when you looking up or down). |
40+
| viewmodel_offset_x | 0 | Yes | |
41+
| viewmodel_offset_y | 0 | Yes | |
42+
| viewmodel_offset_z | 0 | Yes | |
43+
| viewmodel_fov | 90 | No | Min: 70<br/>Max: 100 |
44+
| cl_crosshair_type | 0 | Yes | Crosshair type. 0 - crosshair, 1 - T-shaped, 2 - circle, 3 - dot. |
45+
| cl_bobstyle | 0 | Yes | 0 for default bob, 1 for old style bob and 2 for CS:GO style bob. |
46+
| cl_bobamt_vert | 0\.13 | Yes | Vertical scale for CS:GO style bob. |
47+
| cl_bobamt_lat | 0\.32 | Yes | Lateral scale for CS:GO style bob. |
48+
| cl_bob_lower_amt | 8 | Yes | Specifies how much the viewmodel moves inwards for CS:GO style bob. |
49+
| cl_rollangle | 0 | Yes | Screen roll angle when strafing or looking (Quake effect). |
50+
| cl_rollspeed | 200 | Yes | Screen roll speed when strafing or looking (Quake effect). |
51+
| viewmodel_lag_scale | 0 | Yes | The value of the lag of the viewmodel from the crosshair (CS:GO effect). |
52+
| viewmodel_lag_speed | 8 | Yes | The speed of the viewmodel following the crosshair (CS:GO effect). |
53+
| fov_horplus | 0 | No | Enables Hor+ scaling for FOV. Fixes the FOV when playing with aspect ratios besides 4:3. |
54+
| fov_angle | 90 | No (use ncl_setfov instead) | Min: 70<br/>Max: 100 |
55+
| fov_lerp | 0 | No (use ncl_setfov instead) | FOV interpolation time in seconds. |
56+
| hud_deathnotice_max | 5 | No | The maximum number of killfeed entries that can be displayed. |
57+
| hud_deathnotice_old | 0 | No | Enable the old style of killfeed. |
58+
59+
60+
## Building
61+
62+
Building NextClientServerApi requires CMake 3.10+ and GCC or MSVC compiler with C++11 support. Tested compilers are:
63+
64+
* GCC 9.4.0
65+
* MSVC 2019
66+
67+
Building the library is done using CMake. You can run the CMake GUI to configure the library or use the command line:
68+
69+
```
70+
mkdir Release
71+
cd Release
72+
cmake .. -DCMAKE_BUILD_TYPE=Release
73+
cmake --build .. --target nextclientapi_amxx
74+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rsa-1
2+
rsa-2
3+
rsa-3
4+
rsa-4
5+
rsa-5
6+
rsa-6
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3hcl4hEcY1SgE7Sui8Pu
3+
m0bq9phV1p0JHr3BPIaFDwgCbfbSFIh1v5Kn462gyUGj0u7urC2sw3EHWWrO0uar
4+
56sMRJNWP2tHRNrvsmmiIORGA93RZvqn88t4x8b6Y9pxoQvcntILepl4IaYKMIz1
5+
gyO21hsRi2P6wG2vGx1IXOmxRk5bVe+EfSeo2WuaedmMA/Iq9AtQ4y10gmOeBZTx
6+
DlvqWQtIxXBbaJNLSvge67c/+TcQSCsqYzDXfxJGiTSRU6e7Vl+eCTVYfXdKOT2n
7+
+vwQVwv4rbgVOFjYftB4fxk9eXPNyZ0bSvMbESm0LucJNpWqrTr5tYAxNfN3tmy3
8+
LQIDAQAB
9+
-----END PUBLIC KEY-----
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3vnaxAdLn09erk3Mgwb3
3+
h26GmrRgfI3C5UVFAOfSlrO1LYUAnR+0dQPoqRhahyhZPtkDQW9PSxTbhJH/2867
4+
w9Pjx1EEMuvtExbWlvLyQCP9dlCaZmLn3d48klMbxl2Z5pg89Pk1kmhhPnIjJyge
5+
nwEJB8gvuhsSTpm4Vrs6XtpQ0cpv7CEXxEEzOpSa+gyz8Gt/0ymjCNRxlVybeuyQ
6+
nYfTvZu1wBsWW8xSBQ/NE5ERr06XpqbiQmGVcDHkea3z/0/SKNLhaqyf/uxuJYlh
7+
8UCuRx0ehVjv2rh9ft+GFOlQrbM47PamPM0W4wrjNqaaEnVLyHxX9/vFb4Dzom00
8+
dwIDAQAB
9+
-----END PUBLIC KEY-----
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA04jpfhnvM37dChFjvBsm
3+
Mrv93ayu6fATla5RfYcREzo4IL+horvqcNvn9FF5fAhctGwhjzUfv1ud1El7WgnD
4+
6JcN4x6vsqjtcpS+KYgov/snpydcdJeHi+WyCpJ29xaTi845V4iGphgKx4GE+k/X
5+
5KKKZh/IaTlkoMK8s9zzbxdp8bZ09E+xTeZRhNWQS4ymON00qDxVbyCIid9DSRKr
6+
Na0VU+qFcSVLLihh9snUpU6RjOk9YaFbuoOMwmjePHNDyzLeUwIZL0NWD9Jzk4aC
7+
ZH3UMTrjhkuoudoHNpiPVla0bbp9hgxthiWlVK39uQcUD3qjZo5tyg0waol/5Fjk
8+
FwIDAQAB
9+
-----END PUBLIC KEY-----

0 commit comments

Comments
 (0)