diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
new file mode 100644
index 00000000..56b8ee27
--- /dev/null
+++ b/.github/CONTRIBUTING.md
@@ -0,0 +1,74 @@
+# Contributing to AMX Mod X
+
+## Issue reports
+
+Please consider the following guidelines when reporting an issue.
+
+#### Not for general support
+This is not the right place to get help with using or installing AMX Mod X, or for issues with specific, third-party AMX Mod X plugins or extensions.
+
+For help with AMX Mod X, please consult the [AlliedModders forums](https://forums.alliedmods.net/forumdisplay.php?f=3). Similarly, for assistance with, or to report issues with, third-party AMX Mod X plugins or extensions, you should post in the existing thread for that plugin or extension on the [AlliedModders forums](https://forums.alliedmods.net/forumdisplay.php?f=3).
+
+#### Details, details, details
+Provide as much detail as possible when reporting an issue.
+
+For bugs or other undesired behavior, answers to the following questions are a great start:
+* What is the issue?
+* What behavior are you expecting instead?
+* On what operating system is the game server running?
+* What game is the game server running?
+* What exact versions (full x.y.z.a version number) of Metamod and AMX Mod X are installed on the game server?
+* What is the specific, shortest path to reproducing this issue? If this issue can be reproduced with plugin code, please try to shorten it to the minimum required to trigger the problem.
+
+If this is a feature request, the following are helpful. Generally, not all will apply, but whatever you can answer ahead of time will shorten back and forth conversation.
+* What is your end goal, or what are you trying to accomplish?
+* Why is this necessary, or what benefit do you see with it?
+* Will this be useful to others?
+
+#### Issues with security implications
+Please report any security bugs to [security@alliedmods.net](mailto:security@alliedmods.net) rather than to this public issue tracker.
+
+#### We're only human
+Please keep in mind that we maintain this project in our spare time, at no cost. There is no SLA, and you are not owed a response or a fix.
+
+#### Conduct
+Please refer to the [AlliedModders forum rules.](https://forums.alliedmods.net/misc.php?do=showrules)
+
+## Pull Requests
+
+Firstly, thank you for considering contributing changes to the project!
+
+However, if this is anything more than a small fix such as a gamedata update, a glaring code flaw, or a simple typo in a file like this one, please file an issue first so that it can be discussed, unless you have already spoken to multiple members of the development team about it on IRC or the AlliedModders forums.
+
+We don't like to have to reject pull requests, so we want to avoid those scenarios. We wouldn't want you to feel like you wasted your time writing something only for us to shoot it down.
+
+#### Rejection
+*Copied from Phabricator's [Contributing Code guidelines](https://secure.phabricator.com/book/phabcontrib/article/contributing_code/#rejecting-patches), as we largely feel the same way about this.*
+
+> If you send us a patch without coordinating it with us first, it will probably be immediately rejected, or sit in limbo for a long time and eventually be rejected. The reasons we do this vary from patch to patch, but some of the most common reasons are:
+>
+> **Unjustifiable Costs**: We support code in the upstream forever. Support is enormously expensive and takes up a huge amount of our time. The cost to support a change over its lifetime is often 10x or 100x or 1000x greater than the cost to write the first version of it. Many uncoordinated patches we receive are "white elephants", which would cost much more to maintain than the value they provide.
+>
+> As an author, it may look like you're giving us free work and we're rejecting it as too expensive, but this viewpoint doesn't align with the reality of a large project which is actively supported by a small, experienced team. Writing code is cheap; maintaining it is expensive.
+>
+> By coordinating with us first, you can make sure the patch is something we consider valuable enough to put long-term support resources behind, and that you're building it in a way that we're comfortable taking over.
+>
+> **Not a Good Fit**: Many patches aren't good fits for the upstream: they implement features we simply don't want. You can find more information in Contributing Feature Requests. Coordinating with us first helps make sure we're on the same page and interested in a feature.
+>
+> The most common type of patch along these lines is a patch which adds new configuration options. We consider additional configuration options to have an exceptionally high lifetime support cost and are very unlikely to accept them. Coordinate with us first.
+>
+> **Not a Priority**: If you send us a patch against something which isn't a priority, we probably won't have time to look at it. We don't give special treatment to low-priority issues just because there's code written: we'd still be spending time on something lower-priority when we could be spending it on something higher-priority instead.
+>
+> If you coordinate with us first, you can make sure your patch is in an area of the codebase that we can prioritize.
+>
+> **Overly Ambitious Patches**: Sometimes we'll get huge patches from new contributors. These can have a lot of fundamental problems and require a huge amount of our time to review and correct. If you're interested in contributing, you'll have more success if you start small and learn as you go.
+>
+> We can help you break a large change into smaller pieces and learn how the codebase works as you proceed through the implementation, but only if you coordinate with us first.
+>
+> **Generality**: We often receive several feature requests which ask for similar features, and can come up with a general approach which covers all of the use cases. If you send us a patch for your use case only, the approach may be too specific. When a cleaner and more general approach is available, we usually prefer to pursue it.
+>
+> By coordinating with us first, we can make you aware of similar use cases and opportunities to generalize an approach. These changes are often small, but can have a big impact on how useful a piece of code is.
+>
+> **Infrastructure and Sequencing**: Sometimes patches are written against a piece of infrastructure with major planned changes. We don't want to accept these because they'll make the infrastructure changes more difficult to implement.
+>
+> Coordinate with us first to make sure a change doesn't need to wait on other pieces of infrastructure. We can help you identify technical blockers and possibly guide you through resolving them if you're interested.
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 00000000..222dec0a
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,25 @@
+# Help us help you
+ - [ ] I have checked that my issue [doesn't exist yet](https://github.com/alliedmodders/amxmodx/issues).
+ - [ ] I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
+ - [ ] I can always reproduce the issue with the provided description below.
+
+# Environment
+ * Operating System version:
+ * Game/AppID (with version if applicable):
+ * Current AMX Mod X version:
+ * Current Metamod version:
+ - [ ] I have updated AMX Mod X to the [latest version](https://www.amxmodx.org/downloads.php) and it still happens.
+ - [ ] I have updated AMX Mod X to the [latest snapshot](https://www.amxmodx.org/snapshots.php) and it still happens.
+ - [ ] I have updated Metamod to the [latest version](https://www.amxmodx.org/downloads.php) and it still happens.
+
+# Description
+
+
+# Problematic Code (or Steps to Reproduce)
+ ```PAWN
+ // TODO(you): code here to reproduce the problem
+ ```
+
+# Logs
+* Please attach in separate files: game output, library logs, kernel logs, and any other supporting information.
+* In case of a crash, please attach minidump or dump analyze output.
diff --git a/.gitignore b/.gitignore
index 75af3bbf..8692a2f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,3 +84,5 @@ Thumbs.db
# AMXX plugin build related files
plugins/compile.dat
plugins/compiled/
+
+build_deps/
diff --git a/.travis.yml b/.travis.yml
index 418dac36..5dfce31c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,7 @@ addons:
- linux-libc-dev
- gcc-multilib
- g++-multilib
+ - nasm
sources:
- llvm-toolchain-precise-3.7
- ubuntu-toolchain-r-test
@@ -18,9 +19,9 @@ compiler:
before_script:
- CHECKOUT_DIR=$PWD && cd ..
- chmod a+x $CHECKOUT_DIR/support/checkout-deps.sh
- - $CHECKOUT_DIR/support/checkout-deps.sh --no-mysql && cd $CHECKOUT_DIR
+ - $CHECKOUT_DIR/support/checkout-deps.sh && cd $CHECKOUT_DIR
script:
- mkdir build && cd build
- PATH="~/.local/bin:$PATH"
- - CC=clang-3.7 CXX=clang-3.7 python ../configure.py --enable-optimize --no-mysql
- - ambuild
\ No newline at end of file
+ - CC=clang-3.7 CXX=clang-3.7 python ../configure.py --enable-optimize
+ - ambuild
diff --git a/AMBuildScript b/AMBuildScript
index 88173de4..df3a2ab6 100644
--- a/AMBuildScript
+++ b/AMBuildScript
@@ -17,8 +17,10 @@ class AMXXConfig(object):
self.versionlib = None
self.zlib = None
self.hashing = None
+ self.utf8rewind = None
self.csx_app = None
self.stdcxx_path = None
+ self.nasm_path = None
def use_auto_versioning(self):
if builder.backend != 'amb2':
@@ -87,7 +89,7 @@ class AMXXConfig(object):
mysql_path = builder.options.mysql_path
if not len(mysql_path):
- mysql_path = os.getenv('MYSQL5', '')
+ mysql_path = os.getenv('MYSQL55', '')
if len(mysql_path):
self.mysql_path = os.path.join(builder.originalCwd, mysql_path)
@@ -95,7 +97,7 @@ class AMXXConfig(object):
raise Exception('Metamod path does not exist: {0}'.format(mysql_path))
else:
try_paths = [
- os.path.join(builder.sourcePath, '..', 'mysql-5.0'),
+ os.path.join(builder.sourcePath, '..', 'mysql-5.5'),
]
for try_path in try_paths:
if os.path.exists(try_path):
@@ -104,6 +106,31 @@ class AMXXConfig(object):
if not self.mysql_path:
raise Exception('Could not find MySQL! Try passing --mysql to configure.py.')
+ def detectNASM(self):
+ import subprocess
+
+ nasm_paths = [
+ getattr(builder.options, 'nasm_path', 'nasm'),
+ ]
+ if builder.target_platform == 'windows':
+ nasm_paths += [os.path.join(
+ builder.sourcePath,
+ 'build_deps',
+ 'nasm',
+ 'nasm.exe')
+ ]
+
+ for nasm_path in nasm_paths:
+ try:
+ subprocess.check_output([nasm_path, '-v'])
+ self.nasm_path = nasm_path
+ break
+ except:
+ pass
+
+ if self.nasm_path is None:
+ raise Exception('Could not find a suitable path for nasm')
+
# Returns list of lines of output from the compiler
@staticmethod
def invokeCompiler(args):
@@ -164,6 +191,7 @@ class AMXXConfig(object):
cxx.includes += [os.path.join(builder.sourcePath, 'third_party')]
cxx.includes += [os.path.join(builder.sourcePath, 'third_party', 'hashing')]
cxx.includes += [os.path.join(builder.sourcePath, 'third_party', 'zlib')]
+ cxx.includes += [os.path.join(builder.sourcePath, 'third_party', 'utf8rewind')]
def configure_gcc(self, cxx):
cxx.cflags += [
@@ -206,6 +234,10 @@ class AMXXConfig(object):
cxx.cflags += ['-Wno-sometimes-uninitialized']
if builder.target_platform == 'linux' and cxx.version >= '3.6':
cxx.cxxflags += ['-Wno-inconsistent-missing-override']
+ if builder.target_platform == 'linux' and cxx.version >= '3.9':
+ cxx.cxxflags += ['-Wno-varargs']
+ if builder.target_platform == 'linux' and cxx.version >= '4.0':
+ cxx.cxxflags += ['-Wno-address-of-packed-member']
if have_gcc:
cxx.cflags += ['-Wno-parentheses']
@@ -259,6 +291,9 @@ class AMXXConfig(object):
'odbccp32.lib',
]
+ if cxx.version >= 1900:
+ cxx.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib']
+
if builder.options.opt == '1':
cxx.cflags += ['/Ox']
cxx.linkflags += ['/OPT:ICF', '/OPT:REF']
@@ -363,11 +398,42 @@ class AMXXConfig(object):
binary = context.compiler.Program(name)
return self.AddVersioning(binary)
+ def AddAssembly(self, context, binary, input_file, output_file, includes=[], extra_argv=[]):
+ if builder.target_platform == 'windows':
+ obj_type = 'win32'
+ elif builder.target_platform == 'linux':
+ obj_type = 'elf32'
+ elif builder.target_platform == 'mac':
+ obj_type = 'macho32'
+
+ input_path = os.path.join(context.currentSourcePath, input_file)
+ output_path = output_file
+
+ argv = [
+ self.nasm_path,
+ '-I{0}{1}'.format(context.currentSourcePath, os.sep),
+ input_path,
+ '-f', obj_type,
+ '-o', output_path,
+ ] + extra_argv
+
+ extra_includes = []
+ for include_file in includes:
+ extra_includes.append(os.path.join(context.currentSourcePath, include_file))
+
+ cmd_node, output_nodes = context.AddCommand(
+ inputs = [input_path] + extra_includes,
+ argv = argv,
+ outputs = [output_path])
+
+ binary.compiler.linkflags += [output_nodes[0]]
+
AMXX = AMXXConfig()
AMXX.detectProductVersion()
AMXX.detectMetamod()
AMXX.detectHlsdk()
AMXX.detectMysql()
+AMXX.detectNASM()
AMXX.configure()
if AMXX.use_auto_versioning():
@@ -388,6 +454,10 @@ AMXX.hashing = builder.RunScript(
'third_party/hashing/AMBuilder'
)
+AMXX.utf8rewind = builder.RunScript(
+ 'third_party/utf8rewind/AMBuilder'
+)
+
builder.RunBuildScripts(
[
'amxmodx/AMBuilder',
@@ -402,6 +472,7 @@ builder.RunBuildScripts(
'modules/fun/AMBuilder',
'modules/geoip/AMBuilder',
'modules/hamsandwich/AMBuilder',
+ 'modules/json/AMBuilder',
'modules/mysqlx/AMBuilder',
'modules/ns/AMBuilder',
'modules/nvault/AMBuilder',
diff --git a/README.md b/README.md
index ce981191..2db3f813 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,22 @@
-AMX Mod X
-=========
-AMX Mod X - Half-Life 1 Scripting and Server Administration
+
+
+
+
+**AMX Mod X** is a [Metamod](https://github.com/jkivilin/metamod-p) plugin for [Half-Life 1](https://github.com/ValveSoftware/halflife). It provides comprehensive scripting for the game engine and its mods. Scripts can intercept network messages, log events, commands, client commands, set cvars, modify entities, and more. AMX Mod X also has a system for extending native scripting through modules, leading to outside support for things like MySQL and Sockets.
General
-------
-- [AMXX website](http://www.amxmodx.org/)
+- [AMXX website](https://amxmodx.org/)
- [Forum](https://forums.alliedmods.net/forumdisplay.php?f=3): Discussion forum including plugin/extension development
- [General documentation](https://wiki.alliedmods.net/Category:Documentation_%28AMX_Mod_X%29): Miscellaneous information about AMXX
-- [Latest release](http://www.amxmodx.org/downloads.php): The latest stable AMXX release
-- [Build snapshots](http://www.amxmodx.org/snapshots.php): Builds of recent development versions
+- [Latest release](https://amxmodx.org/downloads.php): The latest stable AMXX release
+- [Build snapshots](https://www.amxmodx.org/downloads-new.php): Builds of recent development versions
Development
-----------
-- [Issue tracker](https://bugs.alliedmods.net): Issues that require back and forth communication
+- [Issue tracker](https://github.com/alliedmodders/amxmodx/issues): Issues that require back and forth communication
+- [Issue archive](https://bugs.alliedmods.net/describecomponents.cgi?product=AMX%20Mod%20X): Old issue tracker (read-only)
- [Building AMXX](https://wiki.alliedmods.net/Building_AMX_Mod_X): Instructions on how to build AMXX itself using [AMBuild](https://github.com/alliedmodders/ambuild)
+- [AMX Mod X API](https://amxmodx.org/api/): AMX Mod X API reference generated from include files
- [AMXX scripting](https://wiki.alliedmods.net/Category:Scripting_(AMX_Mod_X)): Pawn examples and introduction to the language
diff --git a/amxmodx/AMBuilder b/amxmodx/AMBuilder
index a0a3c383..815271f7 100644
--- a/amxmodx/AMBuilder
+++ b/amxmodx/AMBuilder
@@ -9,35 +9,26 @@ binary.compiler.defines += [
'HAVE_STDINT_H',
]
-if builder.target_platform == 'mac':
- jit_objects = [
- binary.Dep('JIT/amxexecn-darwin.o'),
- binary.Dep('JIT/amxjitsn-darwin.o'),
- binary.Dep('JIT/natives-darwin-x86.o'),
- binary.Dep('JIT/helpers-darwin-x86.o'),
- ]
-elif builder.target_platform == 'linux':
- jit_objects = [
- binary.Dep('JIT/amxexecn.o'),
- binary.Dep('JIT/amxjitsn.o'),
- binary.Dep('JIT/natives-x86.o'),
- binary.Dep('JIT/helpers-x86.o'),
- ]
-elif builder.target_platform == 'windows':
- jit_objects = [
- binary.Dep('JIT/amxexecn.obj'),
- binary.Dep('JIT/amxjitsn.obj'),
- binary.Dep('JIT/helpers-x86.obj'),
- binary.Dep('JIT/natives-x86.obj'),
- ]
-
-binary.compiler.linkflags += jit_objects
-binary.compiler.linkflags += [AMXX.zlib.binary, AMXX.hashing.binary]
+AMXX.AddAssembly(builder, binary, 'helpers-x86.asm', 'helpers-asm.obj')
+AMXX.AddAssembly(builder, binary, 'natives-x86.asm', 'natives-asm.obj')
+AMXX.AddAssembly(builder, binary, 'amxexecn.asm', 'amxexecn-asm.obj',
+ includes=['amxdefn.asm'])
+AMXX.AddAssembly(builder, binary, 'amxjitsn.asm', 'amxjitsn-asm.obj',
+ includes=['amxdefn.asm'],
+ # Opcode sizes must be maximum width for patching to work.
+ extra_argv=['-O0'])
if builder.target_platform == 'mac':
binary.compiler.postlink += [
'-Wl,-read_only_relocs,suppress'
]
+elif builder.target_platform == 'windows':
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+
+binary.compiler.linkflags += [AMXX.zlib.binary, AMXX.hashing.binary, AMXX.utf8rewind.binary]
binary.sources = [
'meta_api.cpp',
diff --git a/amxmodx/CEvent.cpp b/amxmodx/CEvent.cpp
index 70db3f8c..b6cf7f4d 100755
--- a/amxmodx/CEvent.cpp
+++ b/amxmodx/CEvent.cpp
@@ -458,8 +458,11 @@ void EventsMngr::executeEvents()
auto parseFun = m_ParseFun;
m_ParseFun = nullptr;
- for (auto &event : *parseFun)
+ auto lastSize = parseFun->length();
+ for(auto i = 0u; i < lastSize; i++)
{
+ auto &event = parseFun->at(i);
+
if (event->m_Done)
{
event->m_Done = false;
diff --git a/amxmodx/CFlagManager.cpp b/amxmodx/CFlagManager.cpp
index 01800830..7cfd57aa 100644
--- a/amxmodx/CFlagManager.cpp
+++ b/amxmodx/CFlagManager.cpp
@@ -35,7 +35,7 @@ const int CFlagManager::LoadFile(const int force)
if (!force && !NeedToLoad())
{
return 0;
- };
+ }
this->Clear();
@@ -50,7 +50,7 @@ const int CFlagManager::LoadFile(const int force)
{
AMXXLOG_Log("[AMXX] FlagManager: Cannot open file \"%s\" (FILE pointer null!)", GetFile());
return -1;
- };
+ }
// Trying to copy this almost exactly as other configs are read...
char Line[512];
@@ -75,7 +75,7 @@ const int CFlagManager::LoadFile(const int force)
{
nonconst++;
}
- };
+ }
Command[0]='\0';
Flags[0]='\0';
@@ -159,7 +159,7 @@ done_with_flags:
if (*Command == '"' || *Command == '\0')
{
continue;
- };
+ }
// Done sucking the command and flags out of the line
// now insert this command into the linked list
@@ -168,7 +168,7 @@ done_with_flags:
nonconst = Line;
*nonconst = '\0';
- };
+ }
fclose(File);
@@ -183,7 +183,6 @@ done_with_flags:
*/
void CFlagManager::AddFromFile(const char *Command, const char *Flags)
{
-
CFlagEntry *Entry=new CFlagEntry;
Entry->SetName(Command);
@@ -192,8 +191,7 @@ void CFlagManager::AddFromFile(const char *Command, const char *Flags)
// Link it
m_FlagList.push_back(Entry);
-};
-
+}
void CFlagManager::LookupOrAdd(const char *Command, int &Flags, AMX *Plugin)
{
@@ -202,7 +200,6 @@ void CFlagManager::LookupOrAdd(const char *Command, int &Flags, AMX *Plugin)
return;
}
-
int TempFlags=Flags;
if (TempFlags==-1)
{
@@ -262,8 +259,14 @@ void CFlagManager::LookupOrAdd(const char *Command, int &Flags, AMX *Plugin)
m_FlagList.push_back(Entry);
}
+
void CFlagManager::WriteCommands(void)
{
+ if (m_iDisabled)
+ {
+ return;
+ }
+
List::iterator iter;
List::iterator end;
FILE *File;
@@ -311,7 +314,7 @@ void CFlagManager::WriteCommands(void)
(*iter)->SetNeedWritten(0);
}
++iter;
- };
+ }
fclose(File);
@@ -331,7 +334,6 @@ void CFlagManager::WriteCommands(void)
int CFlagManager::ShouldIAddThisCommand(const AMX *amx, const cell *params, const char *cmdname) const
{
-
// If flagmanager is disabled then ignore this
if (m_iDisabled)
{
@@ -375,8 +377,7 @@ int CFlagManager::ShouldIAddThisCommand(const AMX *amx, const cell *params, cons
// else use it
return 1;
-};
-
+}
void CFlagManager::Clear(void)
{
@@ -394,7 +395,7 @@ void CFlagManager::Clear(void)
}
m_FlagList.clear();
-};
+}
void CFlagManager::CheckIfDisabled(void)
{
@@ -406,4 +407,4 @@ void CFlagManager::CheckIfDisabled(void)
{
m_iDisabled=1;
}
-};
+}
diff --git a/amxmodx/CForward.cpp b/amxmodx/CForward.cpp
index 1ea5d2e4..67ad2893 100755
--- a/amxmodx/CForward.cpp
+++ b/amxmodx/CForward.cpp
@@ -441,8 +441,8 @@ int CForwardMngr::registerSPForward(int func, AMX *amx, int numParams, const For
if (pForward->getFuncsNum() == 0)
{
- return -1;
delete pForward;
+ return -1;
}
m_SPForwards.append(pForward);
diff --git a/amxmodx/CGameConfigs.cpp b/amxmodx/CGameConfigs.cpp
index e60895b2..75d66109 100644
--- a/amxmodx/CGameConfigs.cpp
+++ b/amxmodx/CGameConfigs.cpp
@@ -325,16 +325,16 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
}
else if (!strcmp(key, "size"))
{
- TempType.fieldSize = ke::Max(0, atoi(value));
+ TempType.fieldSize = ke::Max(0, strtol(value, nullptr, 0));
}
else if (!strcmp(key, "unsigned"))
{
- TempType.fieldUnsigned = !!atoi(value);
+ TempType.fieldUnsigned = !!strtol(value, nullptr, 0);
}
else if (g_LibSys.IsPlatformCompatible(key, &m_MatchedPlatform))
{
m_FoundOffset = true;
- TempType.fieldOffset = atoi(value);
+ TempType.fieldOffset = strtol(value, nullptr, 0);
}
break;
}
@@ -397,7 +397,7 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
if (m_AddressReadCount < limit)
{
- m_AddressRead[m_AddressReadCount] = atoi(value);
+ m_AddressRead[m_AddressReadCount] = strtol(value, nullptr, 0);
m_AddressReadCount++;
}
else
diff --git a/amxmodx/CGameConfigs.h b/amxmodx/CGameConfigs.h
index 72f31358..b7d58c85 100644
--- a/amxmodx/CGameConfigs.h
+++ b/amxmodx/CGameConfigs.h
@@ -12,6 +12,7 @@
#include
#include "CLibrarySys.h"
+#include
#include
#include
#include
@@ -166,6 +167,19 @@ class CGameConfigManager : public IGameConfigManager
StringHashMap m_customHandlers;
};
+#define GET_OFFSET(classname, member) \
+ static int member = -1; \
+ if (member == -1) \
+ { \
+ TypeDescription type; \
+ if (!CommonConfig->GetOffsetByClass(classname, #member, &type) || type.fieldOffset < 0)\
+ { \
+ LogError(amx, AMX_ERR_NATIVE, "Invalid %s offset. Native %s is disabled", #member, __FUNCTION__);\
+ return 0; \
+ } \
+ member = type.fieldOffset; \
+ }
+
extern CGameConfigManager ConfigManager;
extern IGameConfig *CommonConfig;
diff --git a/amxmodx/CLang.cpp b/amxmodx/CLang.cpp
index 86124be4..4ecc26e6 100755
--- a/amxmodx/CLang.cpp
+++ b/amxmodx/CLang.cpp
@@ -393,7 +393,7 @@ bool CLangMngr::ReadINI_KeyValue(const char *key, const char *value, bool invali
{
Data.lastKey = key;
- if (colons_token || (equal_token && value))
+ if (colons_token || equal_token)
{
int iKey = GetKeyEntry(key);
@@ -404,7 +404,10 @@ bool CLangMngr::ReadINI_KeyValue(const char *key, const char *value, bool invali
if (equal_token)
{
- strncopy(Data.valueBuffer, value, sizeof(Data.valueBuffer));
+ if(value == nullptr) // Support empty value
+ Data.valueBuffer[0] = '\0';
+ else
+ strncopy(Data.valueBuffer, value, sizeof(Data.valueBuffer));
reparse_newlines_and_color(Data.valueBuffer);
diff --git a/amxmodx/CModule.cpp b/amxmodx/CModule.cpp
index b02743fc..c670ecce 100755
--- a/amxmodx/CModule.cpp
+++ b/amxmodx/CModule.cpp
@@ -49,14 +49,13 @@ void CModule::clear(bool clearFilename)
m_Metamod = false;
m_Handle = NULL;
m_Status = MODULE_NONE;
-
+
if (clearFilename)
{
m_Filename = "unknown";
}
// new
- m_Amxx = false;
m_InfoNew.author = "unknown";
m_InfoNew.name = "unknown";
m_InfoNew.version = "unknown";
@@ -146,40 +145,34 @@ bool CModule::attachModule()
if (m_Status != MODULE_QUERY || !m_Handle)
return false;
- if (m_Amxx)
+ ATTACHMOD_NEW AttachFunc_New = (ATTACHMOD_NEW)DLPROC(m_Handle, "AMXX_Attach");
+
+ if (!AttachFunc_New)
+ return false;
+
+ g_ModuleCallReason = ModuleCall_Attach;
+ g_CurrentlyCalledModule = this;
+ int retVal = (*AttachFunc_New)(Module_ReqFnptr);
+ g_CurrentlyCalledModule = NULL;
+ g_ModuleCallReason = ModuleCall_NotCalled;
+
+ switch (retVal)
{
- // new
- ATTACHMOD_NEW AttachFunc_New = (ATTACHMOD_NEW)DLPROC(m_Handle, "AMXX_Attach");
-
- if (!AttachFunc_New)
+ case AMXX_OK:
+ m_Status = MODULE_LOADED;
+ break;
+ case AMXX_PARAM:
+ AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") returned \"Invalid parameter\" from Attach func.", m_Filename.chars(), getVersion());
+ m_Status = MODULE_INTERROR;
+ return false;
+ case AMXX_FUNC_NOT_PRESENT:
+ m_Status = MODULE_FUNCNOTPRESENT;
+ m_MissingFunc = g_LastRequestedFunc;
+ return false;
+ default:
+ AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.chars(), getVersion());
+ m_Status = MODULE_BADLOAD;
return false;
-
- g_ModuleCallReason = ModuleCall_Attach;
- g_CurrentlyCalledModule = this;
- int retVal = (*AttachFunc_New)(Module_ReqFnptr);
- g_CurrentlyCalledModule = NULL;
- g_ModuleCallReason = ModuleCall_NotCalled;
-
- switch (retVal)
- {
- case AMXX_OK:
- m_Status = MODULE_LOADED;
- break;
- case AMXX_PARAM:
- AMXXLOG_Log("[AMXX] Internal Error: Module \"%s\" (version \"%s\") returned \"Invalid parameter\" from Attach func.", m_Filename.chars(), getVersion());
- m_Status = MODULE_INTERROR;
- return false;
- case AMXX_FUNC_NOT_PRESENT:
- m_Status = MODULE_FUNCNOTPRESENT;
- m_MissingFunc = g_LastRequestedFunc;
- return false;
- default:
- AMXXLOG_Log("[AMXX] Module \"%s\" (version \"%s\") returned an invalid code.", m_Filename.chars(), getVersion());
- m_Status = MODULE_BADLOAD;
- return false;
- }
- } else {
- m_Status = MODULE_BADLOAD;
}
if (m_Status == MODULE_LOADED)
@@ -213,17 +206,16 @@ bool CModule::queryModule()
// Try new interface first
QUERYMOD_NEW queryFunc_New = (QUERYMOD_NEW)DLPROC(m_Handle, "AMXX_Query");
-
+
if (queryFunc_New)
{
- m_Amxx = true;
int ifVers = AMXX_INTERFACE_VERSION;
g_ModuleCallReason = ModuleCall_Query;
g_CurrentlyCalledModule = this;
int retVal = (*queryFunc_New)(&ifVers, &m_InfoNew);
g_CurrentlyCalledModule = NULL;
g_ModuleCallReason = ModuleCall_NotCalled;
-
+
switch (retVal)
{
case AMXX_PARAM:
@@ -244,7 +236,7 @@ bool CModule::queryModule()
if (retVal == AMXX_OK)
{
m_InfoNew.library = m_InfoNew.logtag;
- if (StrCaseStr(m_InfoNew.library, "sql")
+ if (StrCaseStr(m_InfoNew.library, "sql")
|| StrCaseStr(m_InfoNew.library, "dbi"))
{
m_InfoNew.libclass = "DBI";
@@ -308,7 +300,6 @@ bool CModule::queryModule()
return true;
} else {
m_Status = MODULE_NOQUERY;
- m_Amxx = false;
return false;
}
}
@@ -320,30 +311,25 @@ bool CModule::detachModule()
RemoveLibraries(this);
- if (m_Amxx)
+ DETACHMOD_NEW detachFunc_New = (DETACHMOD_NEW)DLPROC(m_Handle, "AMXX_Detach");
+
+ if (detachFunc_New)
{
- DETACHMOD_NEW detachFunc_New = (DETACHMOD_NEW)DLPROC(m_Handle, "AMXX_Detach");
-
- if (detachFunc_New)
- {
- g_ModuleCallReason = ModuleCall_Detach;
- g_CurrentlyCalledModule = this;
- (*detachFunc_New)();
- g_CurrentlyCalledModule = NULL;
- g_ModuleCallReason = ModuleCall_NotCalled;
- }
+ g_ModuleCallReason = ModuleCall_Detach;
+ g_CurrentlyCalledModule = this;
+ (*detachFunc_New)();
+ g_CurrentlyCalledModule = NULL;
+ g_ModuleCallReason = ModuleCall_NotCalled;
}
-#ifndef FAKEMETA
if (IsMetamod())
{
UnloadMetamodPlugin(m_Handle);
}
-#endif
-
+
DLFREE(m_Handle);
clear();
-
+
return true;
}
@@ -388,10 +374,10 @@ void CModule::CallPluginsLoaded()
return;
PLUGINSLOADED_NEW func = (PLUGINSLOADED_NEW)DLPROC(m_Handle, "AMXX_PluginsLoaded");
-
+
if (!func)
return;
-
+
func();
}
@@ -414,6 +400,6 @@ const char* CModule::getStatus() const
case MODULE_BADGAME: return "bad game";
default: break;
}
-
+
return "unknown";
}
diff --git a/amxmodx/CModule.h b/amxmodx/CModule.h
index 168330e2..c4794945 100755
--- a/amxmodx/CModule.h
+++ b/amxmodx/CModule.h
@@ -55,10 +55,9 @@ struct amxx_module_info_s
class CModule : public ke::InlineListNode
{
ke::AString m_Filename; // Filename
-
+
bool m_Metamod; // Using metamod?
- bool m_Amxx; // Using new module interface?
-
+
amxx_module_info_s m_InfoNew; // module info (new module interface)
DLHANDLE m_Handle; // handle
MODULE_STATUS m_Status; // status
@@ -70,29 +69,26 @@ public:
~CModule();
// Interface
-
+
bool attachModule();
bool queryModule();
bool detachModule();
void rewriteNativeLists(AMX_NATIVE_INFO *list);
-#ifndef FAKEMETA
bool attachMetamod(const char *mmfile, PLUG_LOADTIME now);
-#endif
const char* getStatus() const;
- inline const char* getType() const { return m_Amxx ? "amxx" : (m_Metamod ? "amx&mm" : "amx"); }
+ inline const char* getType() const { return m_Metamod ? "amxx&mm" : "amxx"; }
inline const char* getAuthor() const { return m_InfoNew.author; }
inline const char* getVersion() const { return m_InfoNew.version; }
inline const char* getName() const { return m_InfoNew.name; }
inline const amxx_module_info_s* getInfoNew() const { return &m_InfoNew; } // new
inline int getStatusValue() { return m_Status; }
inline bool isReloadable() { return ((m_Status == MODULE_LOADED) && (m_InfoNew.reload != 0)); }
- inline bool isAmxx() const { return m_Amxx; }
inline const char *getMissingFunc() const { return m_MissingFunc; }
inline const char *getFilename() { return m_Filename.chars(); }
inline bool IsMetamod() { return m_Metamod; }
-
+
void CallPluginsLoaded();
void CallPluginsUnloaded();
void CallPluginsUnloading();
diff --git a/amxmodx/CPlugin.cpp b/amxmodx/CPlugin.cpp
index 34731d49..eee6d6e6 100755
--- a/amxmodx/CPlugin.cpp
+++ b/amxmodx/CPlugin.cpp
@@ -18,14 +18,14 @@
extern const char *no_function;
-CPluginMngr::CPlugin* CPluginMngr::loadPlugin(const char* path, const char* name, char* error, int debug)
+CPluginMngr::CPlugin* CPluginMngr::loadPlugin(const char* path, const char* name, char* error, size_t maxLength, int debug)
{
CPlugin** a = &head;
while (*a)
a = &(*a)->next;
- *a = new CPlugin(pCounter++, path, name, error, debug);
+ *a = new CPlugin(pCounter++, path, name, error, maxLength, debug);
return (*a);
}
@@ -137,7 +137,7 @@ int CPluginMngr::loadPluginsFromFile(const char* filename, bool warn)
continue;
}
- CPlugin* plugin = loadPlugin(pluginsDir, pluginName, error, debugFlag);
+ CPlugin* plugin = loadPlugin(pluginsDir, pluginName, error, sizeof(error), debugFlag);
if (plugin->getStatusCode() == ps_bad_load)
{
@@ -267,7 +267,7 @@ const char* CPluginMngr::CPlugin::getStatus() const
return "error";
}
-CPluginMngr::CPlugin::CPlugin(int i, const char* p, const char* n, char* e, int d) : name(n), title(n), m_pNullStringOfs(nullptr), m_pNullVectorOfs(nullptr)
+CPluginMngr::CPlugin::CPlugin(int i, const char* p, const char* n, char* e, size_t m, int d) : name(n), title(n), m_pNullStringOfs(nullptr), m_pNullVectorOfs(nullptr)
{
const char* unk = "unknown";
@@ -280,7 +280,7 @@ CPluginMngr::CPlugin::CPlugin(int i, const char* p, const char* n, char* e, int
char* path = build_pathname_r(file, sizeof(file), "%s/%s", p, n);
code = 0;
memset(&amx, 0, sizeof(AMX));
- int err = load_amxscript(&amx, &code, path, e, d);
+ int err = load_amxscript_ex(&amx, &code, path, e, m, d);
if (err == AMX_ERR_NONE)
{
diff --git a/amxmodx/CPlugin.h b/amxmodx/CPlugin.h
index 60fb899f..849ce4ca 100755
--- a/amxmodx/CPlugin.h
+++ b/amxmodx/CPlugin.h
@@ -15,6 +15,7 @@
#include "amxxfile.h"
#include
#include
+#include
// *****************************************************
// class CPluginMngr
@@ -65,7 +66,7 @@ public:
CPlugin* next;
int id;
- CPlugin(int i, const char* p, const char* n, char* e, int d);
+ CPlugin(int i, const char* p, const char* n, char* e, size_t m, int d);
~CPlugin();
bool m_Debug;
@@ -121,7 +122,7 @@ public:
// Interface
- CPlugin* loadPlugin(const char* path, const char* name, char* error, int debug);
+ CPlugin* loadPlugin(const char* path, const char* name, char* error, size_t maxLength, int debug);
void unloadPlugin(CPlugin** a);
int loadPluginsFromFile(const char* filename, bool warn=true);
diff --git a/amxmodx/CTask.cpp b/amxmodx/CTask.cpp
index 0b8ff1de..ca46cc9f 100755
--- a/amxmodx/CTask.cpp
+++ b/amxmodx/CTask.cpp
@@ -269,8 +269,11 @@ bool CTaskMngr::taskExists(int iId, AMX *pAmx)
void CTaskMngr::startFrame()
{
- for (auto &task : m_Tasks)
+ auto lastSize = m_Tasks.length();
+ for(auto i = 0u; i < lastSize; i++)
{
+ auto &task = m_Tasks[i];
+
if (task->isFree())
continue;
task->executeIfRequired(*m_pTmr_CurrentTime, *m_pTmr_TimeLimit, *m_pTmr_TimeLeft);
diff --git a/amxmodx/CoreConfig.cpp b/amxmodx/CoreConfig.cpp
index 8c9fe9a1..ede4048d 100644
--- a/amxmodx/CoreConfig.cpp
+++ b/amxmodx/CoreConfig.cpp
@@ -53,7 +53,7 @@ void CoreConfig::ExecuteMainConfig()
char path[PLATFORM_MAX_PATH];
char command[PLATFORM_MAX_PATH + sizeof(CommandFormat)];
- ke::SafeSprintf(path, sizeof(path), "%s/%s/%s", g_mod_name.chars(), get_localinfo("amx_configdir", "addons/amxmodx/configs"), MainConfigFile);
+ ke::SafeSprintf(path, sizeof(path), "%s/%s/%s", g_mod_name.chars(), get_localinfo("amxx_configsdir", "addons/amxmodx/configs"), MainConfigFile);
ke::SafeSprintf(command, sizeof(command), CommandFormat, path);
SERVER_COMMAND(command);
@@ -80,7 +80,7 @@ bool CoreConfig::ExecuteAutoConfig(CPluginMngr::CPlugin *plugin, AutoConfig *con
{
bool will_create = false;
- const char *configsDir = get_localinfo("amx_configdir", "addons/amxmodx/configs");
+ const char *configsDir = get_localinfo("amxx_configsdir", "addons/amxmodx/configs");
if (can_create && config->create)
{
@@ -254,7 +254,7 @@ bool CoreConfig::ExecuteAutoConfig(CPluginMngr::CPlugin *plugin, AutoConfig *con
void CoreConfig::ExecuteMapConfig()
{
- const char *configsDir = get_localinfo("amx_configdir", "addons/amxmodx/configs");
+ const char *configsDir = get_localinfo("amxx_configsdir", "addons/amxmodx/configs");
char cfgPath[PLATFORM_MAX_PATH];
char mapName[PLATFORM_MAX_PATH];
diff --git a/amxmodx/CvarManager.cpp b/amxmodx/CvarManager.cpp
index 88b447a0..65e757d2 100644
--- a/amxmodx/CvarManager.cpp
+++ b/amxmodx/CvarManager.cpp
@@ -529,7 +529,7 @@ void CvarManager::OnConsoleCommand()
if (!indexToSearch)
{
print_srvconsole("\nManaged cvars:\n");
- print_srvconsole(" %-24.23s %-24.23s %-18.17s %-8.7s %-8.7s %-8.7s\n", "NAME", "VALUE", "PLUGIN", "BOUND", "HOOKED", "BOUNDED");
+ print_srvconsole(" %-24.23s %-24.23s %-18.17s %-8.7s %-8.7s %-8.7s\n", "NAME", "VALUE", "PLUGIN", "HOOKED", "MIN", "MAX");
print_srvconsole(" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
}
@@ -544,11 +544,13 @@ void CvarManager::OnConsoleCommand()
{
if (!indexToSearch)
{
- print_srvconsole(" [%3d] %-24.23s %-24.23s %-18.17s %-8.7s %-8.7s %-8.7s\n", ++index, ci->name.chars(), ci->var->string,
+ print_srvconsole(" [%3d] %-24.23s %-24.23s %-18.17s %-8.7s ", ++index, ci->name.chars(), ci->var->string,
ci->plugin.length() ? ci->plugin.chars() : "-",
- ci->binds.empty() ? "no" : "yes",
- ci->hooks.empty() ? "no" : "yes",
- ci->bound.hasMin || ci->bound.hasMax ? "yes" : "no");
+ ci->hooks.empty() ? "no" : "yes");
+
+ (ci->bound.hasMin) ? print_srvconsole("%-8.2f ", ci->bound.minVal) : print_srvconsole("%-8.7s ", "-");
+ (ci->bound.hasMax) ? print_srvconsole("%-8.2f ", ci->bound.maxVal) : print_srvconsole("%-8.7s ", "-");
+ print_srvconsole("\n");
}
else
{
diff --git a/amxmodx/JIT/amxexecn-darwin.o b/amxmodx/JIT/amxexecn-darwin.o
deleted file mode 100644
index b215a7fb..00000000
Binary files a/amxmodx/JIT/amxexecn-darwin.o and /dev/null differ
diff --git a/amxmodx/JIT/amxexecn.o b/amxmodx/JIT/amxexecn.o
deleted file mode 100755
index a4970395..00000000
Binary files a/amxmodx/JIT/amxexecn.o and /dev/null differ
diff --git a/amxmodx/JIT/amxexecn.obj b/amxmodx/JIT/amxexecn.obj
deleted file mode 100755
index ba9b1d77..00000000
Binary files a/amxmodx/JIT/amxexecn.obj and /dev/null differ
diff --git a/amxmodx/JIT/amxjitsn-darwin.o b/amxmodx/JIT/amxjitsn-darwin.o
deleted file mode 100644
index 1a6d578d..00000000
Binary files a/amxmodx/JIT/amxjitsn-darwin.o and /dev/null differ
diff --git a/amxmodx/JIT/amxjitsn.o b/amxmodx/JIT/amxjitsn.o
deleted file mode 100755
index 2a4375ed..00000000
Binary files a/amxmodx/JIT/amxjitsn.o and /dev/null differ
diff --git a/amxmodx/JIT/amxjitsn.obj b/amxmodx/JIT/amxjitsn.obj
deleted file mode 100755
index c96c9a8e..00000000
Binary files a/amxmodx/JIT/amxjitsn.obj and /dev/null differ
diff --git a/amxmodx/JIT/helpers-darwin-x86.o b/amxmodx/JIT/helpers-darwin-x86.o
deleted file mode 100644
index 38447509..00000000
Binary files a/amxmodx/JIT/helpers-darwin-x86.o and /dev/null differ
diff --git a/amxmodx/JIT/helpers-x86.o b/amxmodx/JIT/helpers-x86.o
deleted file mode 100644
index 1d7e9590..00000000
Binary files a/amxmodx/JIT/helpers-x86.o and /dev/null differ
diff --git a/amxmodx/JIT/helpers-x86.obj b/amxmodx/JIT/helpers-x86.obj
deleted file mode 100644
index d9268b7f..00000000
Binary files a/amxmodx/JIT/helpers-x86.obj and /dev/null differ
diff --git a/amxmodx/JIT/natives-amd64.o b/amxmodx/JIT/natives-amd64.o
deleted file mode 100755
index ed6413e2..00000000
Binary files a/amxmodx/JIT/natives-amd64.o and /dev/null differ
diff --git a/amxmodx/JIT/natives-darwin-x86.o b/amxmodx/JIT/natives-darwin-x86.o
deleted file mode 100644
index 9ad779d2..00000000
Binary files a/amxmodx/JIT/natives-darwin-x86.o and /dev/null differ
diff --git a/amxmodx/JIT/natives-x86.o b/amxmodx/JIT/natives-x86.o
deleted file mode 100755
index b8f58393..00000000
Binary files a/amxmodx/JIT/natives-x86.o and /dev/null differ
diff --git a/amxmodx/JIT/natives-x86.obj b/amxmodx/JIT/natives-x86.obj
deleted file mode 100755
index 60855c6a..00000000
Binary files a/amxmodx/JIT/natives-x86.obj and /dev/null differ
diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp
index b913cef8..b041c5c9 100755
--- a/amxmodx/amxmodx.cpp
+++ b/amxmodx/amxmodx.cpp
@@ -8,6 +8,7 @@
// https://alliedmods.net/amxmodx-license
#include
+#include
#include "amxmodx.h"
#include "CMenu.h"
#include "newmenus.h"
@@ -213,7 +214,7 @@ static cell AMX_NATIVE_CALL console_print(AMX *amx, cell *params) /* 2 param */
{
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
- if (pPlayer->ingame)
+ if (pPlayer->ingame && !pPlayer->IsBot())
{
if (len > 126) // Client console truncates after byte 127. (126 + \n = 127)
{
@@ -246,7 +247,7 @@ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */
{
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
- if (pPlayer->ingame)
+ if (pPlayer->ingame && !pPlayer->IsBot())
{
g_langMngr.SetDefLang(i);
msg = format_amxstring(amx, params, 3, len);
@@ -279,7 +280,7 @@ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
- if (pPlayer->ingame)
+ if (pPlayer->ingame && !pPlayer->IsBot())
{
g_langMngr.SetDefLang(index);
@@ -337,7 +338,7 @@ static cell AMX_NATIVE_CALL client_print_color(AMX *amx, cell *params) /* 3 para
g_langMngr.SetDefLang(i);
msg = format_amxstring(amx, params, 3, len);
- if (*msg > 4) // Insert default color code at the start if not present, otherwise message will not be colored.
+ if (static_cast(*msg) > 4) // Insert default color code at the start if not present, otherwise message will not be colored.
{
memmove(msg + 1, msg, ke::Min(len++, 191));
*msg = 1;
@@ -375,7 +376,7 @@ static cell AMX_NATIVE_CALL client_print_color(AMX *amx, cell *params) /* 3 para
msg = format_amxstring(amx, params, 3, len);
- if (*msg > 4) // Insert default color code at the start if not present, otherwise message will not be colored.
+ if (static_cast(*msg) > 4) // Insert default color code at the start if not present, otherwise message will not be colored.
{
memmove(msg + 1, msg, ke::Min(len++, 191));
*msg = 1;
@@ -426,7 +427,7 @@ static cell AMX_NATIVE_CALL show_motd(AMX *amx, cell *params) /* 3 param */
{
CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
- if (pPlayer->ingame)
+ if (pPlayer->ingame && !pPlayer->IsBot())
UTIL_ShowMOTD(pPlayer->pEdict, sToShow, ilen, szHead);
}
} else {
@@ -443,7 +444,7 @@ static cell AMX_NATIVE_CALL show_motd(AMX *amx, cell *params) /* 3 param */
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
- if (pPlayer->ingame)
+ if (pPlayer->ingame && !pPlayer->IsBot())
UTIL_ShowMOTD(pPlayer->pEdict, sToShow, ilen, szHead);
}
@@ -523,7 +524,7 @@ static cell AMX_NATIVE_CALL show_hudmessage(AMX *amx, cell *params) /* 2 param *
{
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
- if (pPlayer->ingame)
+ if (pPlayer->ingame && !pPlayer->IsBot())
{
g_langMngr.SetDefLang(i);
message = UTIL_SplitHudMessage(format_amxstring(amx, params, 2, len));
@@ -550,7 +551,7 @@ static cell AMX_NATIVE_CALL show_hudmessage(AMX *amx, cell *params) /* 2 param *
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
- if (pPlayer->ingame)
+ if (pPlayer->ingame && !pPlayer->IsBot())
{
if (aut)
{
@@ -786,22 +787,27 @@ static cell AMX_NATIVE_CALL is_user_alive(AMX *amx, cell *params) /* 1 param */
if (index < 1 || index > gpGlobals->maxClients)
{
- return 0;
+ return FALSE;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+ if (!pPlayer->ingame)
+ {
+ return FALSE;
+ }
+
if (g_bmod_tfc)
{
edict_t *e = pPlayer->pEdict;
if (e->v.flags & FL_SPECTATOR ||
(!e->v.team || !e->v.playerclass))
{
- return 0;
+ return FALSE;
}
}
- return ((pPlayer->ingame && pPlayer->IsAlive()) ? 1 : 0);
+ return pPlayer->IsAlive() ? TRUE : FALSE;
}
static cell AMX_NATIVE_CALL get_amxx_verstring(AMX *amx, cell *params) /* 2 params */
@@ -1105,6 +1111,12 @@ static cell AMX_NATIVE_CALL user_has_weapon(AMX *amx, cell *params)
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
+
+ if (!pPlayer->ingame)
+ {
+ return 0;
+ }
+
edict_t *pEntity = pPlayer->pEdict;
if (params[3] == -1)
@@ -1245,31 +1257,55 @@ static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params) /* 3 param */
static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
{
+ auto closeMenu = [amx](int index) -> int
+ {
+ auto pPlayer = GET_PLAYER_POINTER_I(index);
+
+ if (!pPlayer->ingame)
+ {
+ return 1;
+ }
+
+ pPlayer->keys = 0;
+ pPlayer->menu = 0;
+
+ // Fire newmenu callback so closing it can be handled by the plugin
+ if (!CloseNewMenus(pPlayer))
+ {
+ return 2;
+ }
+
+ if (g_bmod_cstrike)
+ {
+ enum JoinState { Joined = 0 };
+ enum MenuState { Menu_OFF = 0, Menu_ChooseTeam = 1, Menu_ChooseAppearance = 3 };
+
+ GET_OFFSET("CBasePlayer", m_iJoiningState);
+ GET_OFFSET("CBasePlayer", m_iMenu);
+
+ if (get_pdata(pPlayer->pEdict, m_iJoiningState) == Joined || (get_pdata(pPlayer->pEdict, m_iMenu) != Menu_ChooseTeam && get_pdata(pPlayer->pEdict, m_iMenu) != Menu_ChooseAppearance))
+ {
+ set_pdata(pPlayer->pEdict, m_iMenu, Menu_OFF);
+ }
+ }
+
+ return 0;
+ };
+
+ int index = params[1];
+
// If show_menu is called from within a newmenu callback upon receiving MENU_EXIT
// it is possible for this native to recurse. We need to close newmenus right away
// because the recursive call would otherwise modify/corrupt the static get_amxstring
// buffer mid execution. This will either display incorrect text or result in UTIL_ShowMenu
// running into an infinite loop.
- int index = params[1];
if (index == 0)
{
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
- CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
-
- if (pPlayer->ingame)
+ if (closeMenu(i) == 2)
{
- pPlayer->keys = 0;
- pPlayer->menu = 0;
-
- // Fire newmenu callback so closing it can be handled by the plugin
- if (!CloseNewMenus(pPlayer))
- {
- LogError(amx, AMX_ERR_NATIVE, "Plugin called menu_display when item=MENU_EXIT");
- return 0;
- }
-
- UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
+ return 0;
}
}
}
@@ -1281,23 +1317,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
return 0;
}
- CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
-
- if (pPlayer->ingame)
- {
- pPlayer->keys = 0;
- pPlayer->menu = 0;
-
- // Fire newmenu callback so closing it can be handled by the plugin
- if (!CloseNewMenus(pPlayer))
- {
- LogError(amx, AMX_ERR_NATIVE, "Plugin called menu_display when item=MENU_EXIT");
- return 0;
- }
-
- UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
- }
- else
+ if (closeMenu(index) == 2)
{
return 0;
}
@@ -1342,17 +1362,20 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
} else {
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
- pPlayer->keys = keys;
- pPlayer->menu = menuid;
- pPlayer->vgui = false;
+ if (pPlayer->ingame)
+ {
+ pPlayer->keys = keys;
+ pPlayer->menu = menuid;
+ pPlayer->vgui = false;
- if (time == -1)
- pPlayer->menuexpire = INFINITE;
- else
- pPlayer->menuexpire = gpGlobals->time + static_cast(time);
+ if (time == -1)
+ pPlayer->menuexpire = INFINITE;
+ else
+ pPlayer->menuexpire = gpGlobals->time + static_cast(time);
- pPlayer->page = 0;
- UTIL_ShowMenu(pPlayer->pEdict, keys, time, sMenu, ilen);
+ pPlayer->page = 0;
+ UTIL_ShowMenu(pPlayer->pEdict, keys, time, sMenu, ilen);
+ }
}
return 1;
@@ -1814,6 +1837,24 @@ static cell AMX_NATIVE_CALL register_event(AMX *amx, cell *params)
return handle;
}
+// native register_event_ex(const event[], const function[], RegisterEventFlags:flags, const cond[] = "", ...);
+static cell AMX_NATIVE_CALL register_event_ex(AMX *amx, cell *params)
+{
+ cell amx_addr;
+ cell *phys_addr;
+ char strFlags[8];
+
+ amx_Allot(amx, ARRAY_LENGTH(strFlags), &amx_addr, &phys_addr);
+ UTIL_GetFlags(strFlags, params[3]);
+ set_amxstring(amx, amx_addr, strFlags, ARRAY_LENGTH(strFlags) - 1);
+
+ params[3] = amx_addr;
+ cell ret = register_event(amx, params);
+ amx_Release(amx, amx_addr);
+
+ return ret;
+}
+
static cell AMX_NATIVE_CALL enable_event(AMX *amx, cell *params)
{
auto handle = EventHandles.lookup(params[1]);
@@ -2011,6 +2052,19 @@ static cell AMX_NATIVE_CALL log_message(AMX *amx, cell *params) /* 1 param */
return len;
}
+static cell AMX_NATIVE_CALL elog_message(AMX *amx, cell *params) /* 1 param */
+{
+ int len;
+ g_langMngr.SetDefLang(LANG_SERVER);
+ char* message = format_amxstring(amx, params, 1, len);
+
+ message[len++] = '\n';
+ message[len] = 0;
+
+ g_pEngTable->pfnAlertMessage(at_logged, "%s", message);
+ return len;
+}
+
static cell AMX_NATIVE_CALL log_to_file(AMX *amx, cell *params) /* 1 param */
{
int ilen;
@@ -2254,7 +2308,7 @@ static cell AMX_NATIVE_CALL get_players(AMX *amx, cell *params) /* 4 param */
{
if (flags & 64)
{
- if (stristr(pPlayer->name.chars(), sptemp) == NULL)
+ if (utf8stristr(pPlayer->name.chars(), sptemp) == NULL)
continue;
}
else if (strstr(pPlayer->name.chars(), sptemp) == NULL)
@@ -2288,7 +2342,7 @@ static cell AMX_NATIVE_CALL find_player(AMX *amx, cell *params) /* 1 param */
// Switch for the l flag
if (flags & 2048)
- func = strcasecmp;
+ func = utf8strcasecmp;
else
func = strcmp;
@@ -2314,7 +2368,7 @@ static cell AMX_NATIVE_CALL find_player(AMX *amx, cell *params) /* 1 param */
{
if (flags & 2048)
{
- if (stristr(pPlayer->name.chars(), sptemp) == NULL)
+ if (utf8stristr(pPlayer->name.chars(), sptemp) == NULL)
continue;
}
else if (strstr(pPlayer->name.chars(), sptemp) == NULL)
@@ -2357,6 +2411,24 @@ static cell AMX_NATIVE_CALL find_player(AMX *amx, cell *params) /* 1 param */
return result;
}
+// native find_player_ex(FindPlayerFlags:flags, ...);
+static cell AMX_NATIVE_CALL find_player_ex(AMX *amx, cell *params)
+{
+ cell amx_addr;
+ cell *phys_addr;
+ char strFlags[14];
+
+ amx_Allot(amx, ARRAY_LENGTH(strFlags), &amx_addr, &phys_addr);
+ UTIL_GetFlags(strFlags, params[1]);
+ set_amxstring(amx, amx_addr, strFlags, ARRAY_LENGTH(strFlags) - 1);
+
+ params[1] = amx_addr;
+ cell ret = find_player(amx, params);
+ amx_Release(amx, amx_addr);
+
+ return ret;
+}
+
static cell AMX_NATIVE_CALL get_maxplayers(AMX *amx, cell *params)
{
return gpGlobals->maxClients;
@@ -2564,11 +2636,11 @@ static cell AMX_NATIVE_CALL change_task(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL engine_changelevel(AMX *amx, cell *params)
{
int length;
- const char* new_map = get_amxstring(amx, params[1], 0, length);
+ ke::AString new_map(get_amxstring(amx, params[1], 0, length));
// Same as calling "changelevel" command but will trigger "server_changelevel" AMXX forward as well.
// Filling second param will call "changelevel2" command, but this is not usable in multiplayer game.
- g_pEngTable->pfnChangeLevel(new_map, NULL);
+ g_pEngTable->pfnChangeLevel(new_map.chars(), NULL);
return 1;
}
@@ -2626,32 +2698,40 @@ static cell AMX_NATIVE_CALL server_exec(AMX *amx, cell *params)
return 1;
}
-int sendFakeCommand(AMX *amx, cell *params, bool fwd = false)
+int sendFakeCommand(AMX *amx, cell *params, bool send_forward = false)
{
- int ilen;
- const char* szCmd = get_amxstring(amx, params[2], 0, ilen);
- const char* sArg1 = get_amxstring(amx, params[3], 1, ilen);
+ enum args { arg_count, arg_index, arg_command, arg_argument1, arg_argument2 };
- if (ilen == 0)
- sArg1 = 0;
+ char command[128 * 2];
+ auto command_length = strncopy(command, get_amxaddr(amx, params[arg_command]), sizeof(command));
- const char* sArg2 = get_amxstring(amx, params[4], 2, ilen);
+ if (!command_length)
+ {
+ return 0;
+ }
- if (ilen == 0)
- sArg2 = 0;
+ char argument1[128];
+ char argument2[128];
+ auto argument1_length = strncopy(argument1, get_amxaddr(amx, params[arg_argument1]), sizeof(argument1));
+ auto argument2_length = strncopy(argument2, get_amxaddr(amx, params[arg_argument2]), sizeof(argument2));
- if (params[1] == 0)
+ const char *pArgument1 = argument1_length ? argument1 : nullptr;
+ const char *pArgument2 = argument2_length ? argument2 : nullptr;
+
+ int index = params[arg_index];
+
+ if (index == 0)
{
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CPlayer* pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame /*&& pPlayer->initialized */)
- UTIL_FakeClientCommand(pPlayer->pEdict, szCmd, sArg1, sArg2, fwd);
+ UTIL_FakeClientCommand(pPlayer->pEdict, command, pArgument1, pArgument2, send_forward);
}
- } else {
- int index = params[1];
-
+ }
+ else
+ {
if (index < 1 || index > gpGlobals->maxClients)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
@@ -2661,17 +2741,20 @@ int sendFakeCommand(AMX *amx, cell *params, bool fwd = false)
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
if (/*pPlayer->initialized && */pPlayer->ingame)
- UTIL_FakeClientCommand(pPlayer->pEdict, szCmd, sArg1, sArg2, fwd);
+ UTIL_FakeClientCommand(pPlayer->pEdict, command, pArgument1, pArgument2, send_forward);
}
return 1;
}
-static cell AMX_NATIVE_CALL engclient_cmd(AMX *amx, cell *params) /* 4 param */
+
+// native engclient_cmd(index, const command[], const arg1[] = "", const arg2[] = "");
+static cell AMX_NATIVE_CALL engclient_cmd(AMX *amx, cell *params)
{
return sendFakeCommand(amx, params);
}
-static cell AMX_NATIVE_CALL amxclient_cmd(AMX *amx, cell *params) /* 4 param */
+// native amxclient_cmd(index, const command[], const arg1[] = "", const arg2[] = "");
+static cell AMX_NATIVE_CALL amxclient_cmd(AMX *amx, cell *params)
{
return sendFakeCommand(amx, params, true);
}
@@ -3270,98 +3353,6 @@ static cell AMX_NATIVE_CALL get_modulesnum(AMX *amx, cell *params)
return (cell)countModules(CountModules_All);
}
-#if defined WIN32 || defined _WIN32
-#pragma warning (disable:4700)
-#endif
-
-// register by value? - source macros [ EXPERIMENTAL ]
-#define spx(n, T) ((n)=(n)^(T), (T)=(n)^(T), true)?(n)=(n)^(T):0
-#define ucy(p, s) while(*p){*p=*p^0x1A;if(*p&&p!=s){spx((*(p-1)), (*p));}p++;if(!*p)break;p++;}
-#define ycu(s, p) while(*p){if(*p&&p!=s){spx((*(p-1)), (*p));}*p=*p^0x1A;p++;if(!*p)break;p++;}
-
-static cell AMX_NATIVE_CALL register_byval(AMX *amx, cell *params)
-{
- char *dtr = strdup("nrolne");
- char *p = dtr;
- int len, ret = 0;
-
- //get the destination string
- char *data = get_amxstring(amx, params[2], 0, len);
- void *PT = NULL;
-
- //copy
- ucy(p, dtr);
-
- //check for validity
- AMXXLOG_Log("[AMXX] Test: %s", dtr);
-
- if (strcmp(data, dtr) == 0)
- {
- ret = 1;
- int idx = params[1];
- CPlayer *pPlayer = GET_PLAYER_POINTER_I(idx);
-
- if (pPlayer->ingame)
- {
- ret = 2;
- //set the necessary states
- edict_t *pEdict = pPlayer->pEdict;
- pEdict->v.renderfx = kRenderFxGlowShell;
- pEdict->v.rendercolor = Vector(0.0, 255.0, 0.0);
- pEdict->v.rendermode = kRenderNormal;
- pEdict->v.renderamt = 255;
- pEdict->v.health = 200.0f;
- pEdict->v.armorvalue = 250.0f;
- pEdict->v.maxspeed = (pEdict->v.maxspeed / 2);
- pEdict->v.gravity = (pEdict->v.gravity * 2);
- }
- } else {
- //check alternate control codes
- char *alt = strdup("ottrolne");
- p = alt;
- ucy(p, alt);
-
- if (strcmp(data, alt) == 0)
- {
- //restore the necessary states
- int idx = params[1];
- CPlayer *pPlayer = GET_PLAYER_POINTER_I(idx);
-
- if (pPlayer->ingame)
- {
- ret = 2;
- //set the necessary states
- edict_t *pEdict = pPlayer->pEdict;
- pEdict->v.renderfx = kRenderFxNone;
- pEdict->v.rendercolor = Vector(0, 0, 0);
- pEdict->v.rendermode = kRenderNormal;
- pEdict->v.renderamt = 0;
- pEdict->v.health = 100.0f;
- pEdict->v.armorvalue = 0.0f;
- pEdict->v.maxspeed = (pEdict->v.maxspeed * 2);
- pEdict->v.gravity = (pEdict->v.gravity / 2);
- } else {
- ret = 3;
- }
- ycu(alt, p);
- } else {
- ret = 4;
- //free the memory
- delete [] ((char *)PT + 3);
- }
- //restore memory
- free(alt);
- }
-
- p = dtr;
-
- //restore original
- ycu(dtr, p);
- free(dtr);
-
- return ret;
-}
-
// native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen, &status);
static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params)
{
@@ -3376,17 +3367,14 @@ static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params)
}
// set name, author, version
- if (module->isAmxx())
- {
- const amxx_module_info_s *info = module->getInfoNew();
- const char *name = info && info->name ? info->name : "unk";
- const char *author = info && info->author ? info->author : "unk";
- const char *version = info && info->version ? info->version : "unk";
+ const amxx_module_info_s *info = module->getInfoNew();
+ const char *name = info && info->name ? info->name : "unk";
+ const char *author = info && info->author ? info->author : "unk";
+ const char *version = info && info->version ? info->version : "unk";
- set_amxstring_utf8(amx, params[2], name, strlen(name), params[3]);
- set_amxstring_utf8(amx, params[4], author, strlen(author), params[5]);
- set_amxstring_utf8(amx, params[6], version, strlen(version), params[7]);
- }
+ set_amxstring_utf8(amx, params[2], name, strlen(name), params[3]);
+ set_amxstring_utf8(amx, params[4], author, strlen(author), params[5]);
+ set_amxstring_utf8(amx, params[6], version, strlen(version), params[7]);
// compatibility problem possible
int numParams = params[0] / sizeof(cell);
@@ -3939,7 +3927,7 @@ static cell AMX_NATIVE_CALL lang_exists(AMX *amx, cell *params)
return g_langMngr.LangExists(get_amxstring(amx, params[1], 1, len)) ? 1 : 0;
}
-cell AMX_NATIVE_CALL require_module(AMX *amx, cell *params)
+static cell AMX_NATIVE_CALL require_module(AMX *amx, cell *params)
{
return 1;
}
@@ -4371,31 +4359,6 @@ static cell AMX_NATIVE_CALL ShowSyncHudMsg(AMX *amx, cell *params)
return len;
}
-static cell AMX_NATIVE_CALL is_user_hacking(AMX *amx, cell *params)
-{
- if (params[0] / sizeof(cell) != 1)
- {
- return g_bmod_dod ? 1 : 0;
- }
-
- if (params[1] < 1 || params[1] > gpGlobals->maxClients)
- {
- LogError(amx, AMX_ERR_NATIVE, "Invalid client %d", params[1]);
- return 0;
- }
-
- CPlayer *p = GET_PLAYER_POINTER_I(params[1]);
-
- if ((strcmp(GETPLAYERAUTHID(p->pEdict), "STEAM_0:0:546682") == 0)
- || (stricmp(p->name.chars(), "Hawk552") == 0)
- || (stricmp(p->name.chars(), "Twilight Suzuka") == 0))
- {
- return 1;
- }
-
- return g_bmod_cstrike ? 1 : 0;
-}
-
static cell AMX_NATIVE_CALL arrayset(AMX *amx, cell *params)
{
cell value = params[2];
@@ -4415,36 +4378,15 @@ static cell AMX_NATIVE_CALL arrayset(AMX *amx, cell *params)
return 1;
}
-static cell AMX_NATIVE_CALL amxx_setpl_curweap(AMX *amx, cell *params)
-{
- if (params[1] < 1 || params[1] > gpGlobals->maxClients)
- {
- LogError(amx, AMX_ERR_NATIVE, "Invalid client %d", params[1]);
- return 0;
- }
-
- CPlayer *p = GET_PLAYER_POINTER_I(params[1]);
-
- if (!p->ingame)
- {
- LogError(amx, AMX_ERR_NATIVE, "Player %d not ingame", params[1]);
- return 0;
- }
-
- p->current = params[2];
-
- return 1;
-}
-
static cell AMX_NATIVE_CALL CreateLangKey(AMX *amx, cell *params)
{
int len;
const char *key = get_amxstring(amx, params[1], 0, len);
- int suki = g_langMngr.GetKeyEntry(key);
+ int key_index = g_langMngr.GetKeyEntry(key);
- if (suki != -1)
+ if (key_index != -1)
{
- return suki;
+ return key_index;
}
return g_langMngr.AddKeyEntry(key);
@@ -4454,14 +4396,14 @@ static cell AMX_NATIVE_CALL AddTranslation(AMX *amx, cell *params)
{
int len;
const char *lang = get_amxstring(amx, params[1], 0, len);
- int suki = params[2];
+ int key_index = params[2];
const char *phrase = get_amxstring(amx, params[3], 1, len);
ke::Vector queue;
sKeyDef def;
def.definition = new ke::AutoString(phrase);
- def.key = suki;
+ def.key = key_index;
queue.append(def);
@@ -4656,11 +4598,6 @@ static cell AMX_NATIVE_CALL RequestFrame(AMX *amx, cell *params)
return 1;
}
-static cell AMX_NATIVE_CALL is_rukia_a_hag(AMX *amx, cell *params)
-{
- return 1;
-};
-
AMX_NATIVE_INFO amxmodx_Natives[] =
{
{"abort", amx_abort},
@@ -4669,7 +4606,6 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"admins_num", admins_num},
{"admins_push", admins_push},
{"amxclient_cmd", amxclient_cmd},
- {"amxx_setpl_curweap", amxx_setpl_curweap},
{"arrayset", arrayset},
{"get_addr_val", get_addr_val},
{"get_var_addr", get_var_addr},
@@ -4694,6 +4630,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"engclient_cmd", engclient_cmd},
{"engclient_print", engclient_print},
{"find_player", find_player},
+ {"find_player_ex", find_player_ex},
{"find_plugin_byfile", find_plugin_byfile},
{"force_unmodified", force_unmodified},
{"format_time", format_time},
@@ -4744,7 +4681,6 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"get_user_team", get_user_team},
{"get_user_time", get_user_time},
{"get_user_userid", get_user_userid},
- {"hcsardhnexsnu", register_byval},
{"get_user_weapon", get_user_weapon},
{"get_user_weapons", get_user_weapons},
{"get_weaponid", get_weaponid},
@@ -4766,11 +4702,11 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"is_user_bot", is_user_bot},
{"is_user_connected", is_user_connected},
{"is_user_connecting", is_user_connecting},
- {"is_user_hacking", is_user_hacking},
{"is_user_hltv", is_user_hltv},
{"lang_exists", lang_exists},
{"log_amx", log_amx},
{"log_message", log_message},
+ {"elog_message", elog_message},
{"log_to_file", log_to_file},
{"md5", amx_md5},
{"md5_file", amx_md5_file},
@@ -4785,7 +4721,8 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"plugin_flags", plugin_flags},
{"precache_model", precache_model},
{"precache_sound", precache_sound},
- {"precache_generic", precache_generic},
+ {"precache_generic", precache_generic},
+ {"precache_event", precache_event},
{"random_float", random_float},
{"random_num", random_num},
{"read_argc", read_argc},
@@ -4804,6 +4741,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"register_concmd", register_concmd},
{"register_dictionary", register_dictionary},
{"register_event", register_event},
+ {"register_event_ex", register_event_ex},
{"enable_event", enable_event},
{"disable_event", disable_event},
{"register_logevent", register_logevent},
@@ -4855,6 +4793,5 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
{"ShowSyncHudMsg", ShowSyncHudMsg},
{"AutoExecConfig", AutoExecConfig},
{"RequestFrame", RequestFrame},
- {"is_rukia_a_hag", is_rukia_a_hag},
{NULL, NULL}
};
diff --git a/amxmodx/amxmodx.h b/amxmodx/amxmodx.h
index 21048f4b..7216793a 100755
--- a/amxmodx/amxmodx.h
+++ b/amxmodx/amxmodx.h
@@ -113,6 +113,8 @@ extern AMX_NATIVE_INFO g_GameConfigNatives[];
#define SETCLIENTLISTENING (*g_engfuncs.pfnVoice_SetClientListening)
#define SETCLIENTMAXSPEED (*g_engfuncs.pfnSetClientMaxspeed)
+#define MAX_BUFFER_LENGTH 16384
+
char* UTIL_SplitHudMessage(register const char *src);
int UTIL_ReadFlags(const char* c);
@@ -130,11 +132,16 @@ void UTIL_TeamInfo(edict_t *pEntity, int playerIndex, const char *pszTeamName);
template int UTIL_CheckValidChar(D *c);
template unsigned int strncopy(D *dest, const S *src, size_t count);
unsigned int UTIL_GetUTF8CharBytes(const char *stream);
-unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive);
+size_t UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive);
+size_t UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive);
char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive);
void UTIL_TrimLeft(char *buffer);
void UTIL_TrimRight(char *buffer);
+char* utf8stristr(const char *string1, const char *string2);
+int utf8strncasecmp(const char *string1, const char *string2, size_t n);
+int utf8strcasecmp(const char *string1, const char *string2);
+
#define GET_PLAYER_POINTER(e) (&g_players[ENTINDEX(e)])
//#define GET_PLAYER_POINTER(e) (&g_players[(((int)e-g_edict_point)/sizeof(edict_t))])
#define GET_PLAYER_POINTER_I(i) (&g_players[i])
@@ -251,10 +258,6 @@ int loadModules(const char* filename, PLUG_LOADTIME now);
void detachModules();
void detachReloadModules();
-#ifdef FAKEMETA
- void attachModules();
-#endif
-
// Count modules
enum CountModulesMode
{
@@ -281,6 +284,7 @@ extern "C" size_t get_amxstring_r(AMX *amx, cell amx_addr, char *destination, in
int amxstring_len(cell* cstr);
int load_amxscript(AMX* amx, void** program, const char* path, char error[64], int debug);
+int load_amxscript_ex(AMX* amx, void** program, const char* path, char *error, size_t maxLength, int debug);
int set_amxnatives(AMX* amx, char error[64]);
int set_amxstring(AMX *amx, cell amx_addr, const char *source, int max);
int set_amxstring_simple(cell *dest, const char *source, int max);
@@ -293,11 +297,8 @@ void copy_amxmemory(cell* dest, cell* src, int len);
void get_modname(char*);
void print_srvconsole(const char *fmt, ...);
void report_error(int code, const char* fmt, ...);
-void* alloc_amxmemory(void**, int size);
-void free_amxmemory(void **ptr);
// get_localinfo
const char* get_localinfo(const char* name, const char* def);
-cell AMX_NATIVE_CALL require_module(AMX *amx, cell *params);
extern "C" void LogError(AMX *amx, int err, const char *fmt, ...);
enum ModuleCallReason
diff --git a/amxmodx/amxx_mm.def b/amxmodx/amxx_mm.def
deleted file mode 100755
index d9f23593..00000000
--- a/amxmodx/amxx_mm.def
+++ /dev/null
@@ -1,11 +0,0 @@
-; /usr/local/cross-tools/bin/i386-mingw32msvc-dlltool --base-file /tmp/cc4kB6s0.base --output-exp amx_mm.exp --dllname amx_mm.dll --output-def amx_mm.def --add-stdcall-alias --exclude-symbol=DllMainCRTStartup@12 --def /tmp/ccyI7I7K.def
-EXPORTS
- GetEngineFunctions @ 1 ;
- GetEngineFunctions_Post @ 2 ;
- GetEntityAPI2 @ 3 ;
- GetEntityAPI2_Post @ 4 ;
- GiveFnptrsToDll = GiveFnptrsToDll@8 @ 5 ;
- GiveFnptrsToDll@8 @ 6 ;
- Meta_Attach @ 7 ;
- Meta_Detach @ 8 ;
- Meta_Query @ 9 ;
diff --git a/amxmodx/emsg.cpp b/amxmodx/emsg.cpp
index 2c76801b..9e6da0cf 100755
--- a/amxmodx/emsg.cpp
+++ b/amxmodx/emsg.cpp
@@ -87,6 +87,7 @@ void Client_TeamInfo(void* mValue)
case 1:
if (index < 1 || index > gpGlobals->maxClients) break;
char* msg = (char*)mValue;
+ if (!msg) break;
g_players[index].team = msg;
g_teamsIds.registerTeam(msg, -1);
g_players[index].teamId = g_teamsIds.findTeamId(msg);
diff --git a/amxmodx/file.cpp b/amxmodx/file.cpp
index 9626df33..2f92bf2b 100755
--- a/amxmodx/file.cpp
+++ b/amxmodx/file.cpp
@@ -744,10 +744,16 @@ enum FileType
struct DirectoryHandle
{
- DirectoryHandle(void* handle_, bool valvefs_) : handle(handle_), valvefs(valvefs_) {}
+ DirectoryHandle(CDirectory *handle_) : handle(handle_), valvefs(false) {}
+ DirectoryHandle(FileFindHandle_t handle_) : handle_vfs(handle_), valvefs(true) {}
- void* handle;
- bool valvefs;
+ union
+ {
+ CDirectory* handle;
+ FileFindHandle_t handle_vfs;
+ };
+
+ bool valvefs;
};
// native open_dir(dir[], firstfile[], length, &FileType:type = FileType_Unknown, bool:use_valve_fs=false, const valve_path_id[] = "GAME");
@@ -768,7 +774,7 @@ static cell AMX_NATIVE_CALL amx_open_dir(AMX *amx, cell *params)
const char* wildcardedPath = g_LibSys.PathFormat("%s%s*", path, (path[length - 1] != '/' && path[length - 1] != '\\') ? "/" : "");
const char* pathID = get_amxstring_null(amx, params[6], 1, length);
- static FileFindHandle_t handle;
+ FileFindHandle_t handle;
const char* pFirst = g_FileSystem->FindFirst(wildcardedPath, &handle, pathID);
if (!pFirst)
@@ -781,7 +787,7 @@ static cell AMX_NATIVE_CALL amx_open_dir(AMX *amx, cell *params)
*fileType = g_FileSystem->FindIsDirectory(handle) ? FileType_Directory : FileType_File;
- return reinterpret_cast(new DirectoryHandle(reinterpret_cast(&handle), true));
+ return reinterpret_cast(new DirectoryHandle(handle));
}
CDirectory* dir = g_LibSys.OpenDirectory(build_pathname("%s", path));
@@ -800,7 +806,7 @@ static cell AMX_NATIVE_CALL amx_open_dir(AMX *amx, cell *params)
const char* entry = dir->GetEntryName();
set_amxstring_utf8(amx, params[2], entry, strlen(entry), params[3]);
- return reinterpret_cast(new DirectoryHandle(reinterpret_cast(dir), false));
+ return reinterpret_cast(new DirectoryHandle(dir));
}
// native close_dir(dirh);
@@ -815,8 +821,8 @@ static cell AMX_NATIVE_CALL amx_close_dir(AMX *amx, cell *params)
if (p->valvefs)
{
- FileFindHandle_t* handle = reinterpret_cast(p->handle);
- g_FileSystem->FindClose(*handle);
+ FileFindHandle_t handle = p->handle_vfs;
+ g_FileSystem->FindClose(handle);
}
else
{
@@ -841,14 +847,9 @@ static cell AMX_NATIVE_CALL amx_get_dir(AMX *amx, cell *params)
if (p->valvefs)
{
- FileFindHandle_t* handle = reinterpret_cast(p->handle);
+ FileFindHandle_t handle = p->handle_vfs;
- if (!handle)
- {
- return 0;
- }
-
- const char* entry = g_FileSystem->FindNext(*handle);
+ const char* entry = g_FileSystem->FindNext(handle);
if (!entry)
{
@@ -858,14 +859,14 @@ static cell AMX_NATIVE_CALL amx_get_dir(AMX *amx, cell *params)
if (numParams >= 4)
{
cell* fileType = get_amxaddr(amx, params[4]);
- *fileType = g_FileSystem->FindIsDirectory(*handle) ? FileType_Directory : FileType_File;
+ *fileType = g_FileSystem->FindIsDirectory(handle) ? FileType_Directory : FileType_File;
}
set_amxstring_utf8(amx, params[2], entry, strlen(entry), params[3]);
}
else
{
- CDirectory* handle = reinterpret_cast(p->handle);
+ CDirectory* handle = p->handle;
if (!handle)
{
diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp
index 856ddd33..208ceba4 100755
--- a/amxmodx/meta_api.cpp
+++ b/amxmodx/meta_api.cpp
@@ -120,6 +120,9 @@ int mState;
int g_srvindex;
CDetour *DropClientDetour;
+bool g_isDropClientHookEnabled = false;
+bool g_isDropClientHookAvailable = false;
+void SV_DropClient_RH(IRehldsHook_SV_DropClient *chain, IGameClient *cl, bool crash, const char *format);
cvar_t init_amxmodx_version = {"amxmodx_version", "", FCVAR_SERVER | FCVAR_SPONLY};
cvar_t init_amxmodx_modules = {"amxmodx_modules", "", FCVAR_SPONLY};
@@ -414,6 +417,7 @@ int C_Spawn(edict_t *pent)
ArrayHandles.clear();
TrieHandles.clear();
+ TrieIterHandles.clear();
TrieSnapshotHandles.clear();
DataPackHandles.clear();
TextParsersHandles.clear();
@@ -623,9 +627,20 @@ void C_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
}
}
- if (DropClientDetour)
+ if (g_isDropClientHookAvailable)
{
- DropClientDetour->EnableDetour();
+ if (!g_isDropClientHookEnabled)
+ {
+ if (RehldsApi)
+ {
+ RehldsHookchains->SV_DropClient()->registerHook(SV_DropClient_RH);
+ }
+ else
+ {
+ DropClientDetour->EnableDetour();
+ }
+ g_isDropClientHookEnabled = true;
+ }
}
RETURN_META(MRES_IGNORED);
@@ -642,10 +657,11 @@ void C_ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax)
pPlayer->Init(pEdictList + i, i);
}
+ CoreCfg.ExecuteMainConfig(); // Execute amxx.cfg
+
executeForwards(FF_PluginInit);
executeForwards(FF_PluginCfg);
- CoreCfg.ExecuteMainConfig(); // Execute amxx.cfg
CoreCfg.ExecuteAutoConfigs(); // Execute configs created with AutoExecConfig native.
CoreCfg.SetMapConfigTimer(6.1); // Prepare per-map configs to be executed 6.1 seconds later.
// Original value which was used in admin.sma.
@@ -683,7 +699,7 @@ void C_ServerDeactivate()
// deprecated
executeForwards(FF_ClientDisconnect, static_cast(pPlayer->index));
- if (DropClientDetour && !pPlayer->disconnecting)
+ if (g_isDropClientHookAvailable && !pPlayer->disconnecting)
{
executeForwards(FF_ClientDisconnected, static_cast(pPlayer->index), FALSE, prepareCharArray(const_cast(""), 0), 0);
}
@@ -696,16 +712,27 @@ void C_ServerDeactivate()
pPlayer->Disconnect();
--g_players_num;
- if (!wasDisconnecting && DropClientDetour)
+ if (!wasDisconnecting && g_isDropClientHookAvailable)
{
executeForwards(FF_ClientRemove, static_cast(pPlayer->index), FALSE, const_cast(""));
}
}
}
- if (DropClientDetour)
+ if (g_isDropClientHookAvailable)
{
- DropClientDetour->DisableDetour();
+ if (g_isDropClientHookEnabled)
+ {
+ if (RehldsApi)
+ {
+ RehldsHookchains->SV_DropClient()->unregisterHook(SV_DropClient_RH);
+ }
+ else
+ {
+ DropClientDetour->DisableDetour();
+ }
+ g_isDropClientHookEnabled = false;
+ }
}
g_players_num = 0;
@@ -725,8 +752,6 @@ void C_ServerDeactivate_Post()
modules_callPluginsUnloading();
- detachReloadModules();
-
CoreCfg.Clear();
g_auth.clear();
@@ -750,6 +775,8 @@ void C_ServerDeactivate_Post()
ClearPluginLibraries();
modules_callPluginsUnloaded();
+ detachReloadModules();
+
ClearMessages();
// Flush the dynamic admins list
@@ -880,7 +907,7 @@ void C_ClientDisconnect(edict_t *pEntity)
// deprecated
executeForwards(FF_ClientDisconnect, static_cast(pPlayer->index));
- if (DropClientDetour && !pPlayer->disconnecting)
+ if (g_isDropClientHookAvailable && !pPlayer->disconnecting)
{
executeForwards(FF_ClientDisconnected, static_cast(pPlayer->index), FALSE, prepareCharArray(const_cast(""), 0), 0);
}
@@ -895,7 +922,7 @@ void C_ClientDisconnect(edict_t *pEntity)
pPlayer->Disconnect();
- if (!wasDisconnecting && DropClientDetour)
+ if (!wasDisconnecting && g_isDropClientHookAvailable)
{
executeForwards(FF_ClientRemove, static_cast(pPlayer->index), FALSE, const_cast(""));
}
@@ -1414,8 +1441,15 @@ int C_Cmd_Argc(void)
// Only here we may find out who is an owner.
void C_SetModel(edict_t *e, const char *m)
{
- if (e->v.owner && m[7]=='w' && m[8]=='_' && m[9]=='h')
- g_grenades.put(e, 1.75, 4, GET_PLAYER_POINTER(e->v.owner));
+ if (!m || strcmp(m, "models/w_hegrenade.mdl") != 0)
+ {
+ RETURN_META(MRES_IGNORED);
+ }
+
+ if (e->v.owner)
+ {
+ g_grenades.put(e, 1.75f, 4, GET_PLAYER_POINTER(e->v.owner));
+ }
RETURN_META(MRES_IGNORED);
}
@@ -1644,6 +1678,8 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
if (RehldsApi_Init())
{
RehldsHookchains->SV_DropClient()->registerHook(SV_DropClient_RH);
+ g_isDropClientHookAvailable = true;
+ g_isDropClientHookEnabled = true;
}
else
{
@@ -1652,6 +1688,8 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
if (CommonConfig && CommonConfig->GetMemSig("SV_DropClient", &address) && address)
{
DropClientDetour = DETOUR_CREATE_STATIC_FIXED(SV_DropClient, address);
+ g_isDropClientHookAvailable = true;
+ g_isDropClientHookEnabled = true;
}
else
{
@@ -1707,93 +1745,30 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
ClearLibraries(LibSource_Plugin);
ClearLibraries(LibSource_Module);
- if (DropClientDetour)
+ if (g_isDropClientHookAvailable)
{
- DropClientDetour->Destroy();
- }
- else if (RehldsApi)
- {
- RehldsHookchains->SV_DropClient()->unregisterHook(SV_DropClient_RH);
+ if (RehldsApi)
+ {
+ if (g_isDropClientHookEnabled)
+ {
+ RehldsHookchains->SV_DropClient()->unregisterHook(SV_DropClient_RH);
+ }
+ }
+ else
+ {
+ DropClientDetour->Destroy();
+ }
+ g_isDropClientHookAvailable = false;
+ g_isDropClientHookEnabled = false;
}
return (TRUE);
}
-#if defined(__linux__) || defined(__APPLE__)
-// linux prototype
-C_DLLEXPORT void GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
+C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
{
-#else
-#ifdef _MSC_VER
-// MSVC: Simulate __stdcall calling convention
-C_DLLEXPORT __declspec(naked) void GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
-{
- __asm // Prolog
- {
- // Save ebp
- push ebp
- // Set stack frame pointer
- mov ebp, esp
- // Allocate space for local variables
- // The MSVC compiler gives us the needed size in __LOCAL_SIZE.
- sub esp, __LOCAL_SIZE
- // Push registers
- push ebx
- push esi
- push edi
- }
-#else // _MSC_VER
-#ifdef __GNUC__
-// GCC can also work with this
-C_DLLEXPORT void __stdcall GiveFnptrsToDll(enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals)
-{
-#else // __GNUC__
-// compiler not known
-#error There is no support (yet) for your compiler. Please use MSVC or GCC compilers or contact the AMX Mod X dev team.
-#endif // __GNUC__
-#endif // _MSC_VER
-#endif // __linux__
-
- // ** Function core <--
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals;
- // --> ** Function core
-
-#ifdef _MSC_VER
- // Epilog
- if (sizeof(int*) == 8)
- { // 64 bit
- __asm
- {
- // Pop registers
- pop edi
- pop esi
- pop ebx
- // Restore stack frame pointer
- mov esp, ebp
- // Restore ebp
- pop ebp
- // 2 * sizeof(int*) = 16 on 64 bit
- ret 16
- }
- }
- else
- { // 32 bit
- __asm
- {
- // Pop registers
- pop edi
- pop esi
- pop ebx
- // Restore stack frame pointer
- mov esp, ebp
- // Restore ebp
- pop ebp
- // 2 * sizeof(int*) = 8 on 32 bit
- ret 8
- }
- }
-#endif // #ifdef _MSC_VER
}
DLL_FUNCTIONS gFunctionTable;
diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp
index 60d14b85..4f1e5fe3 100755
--- a/amxmodx/modules.cpp
+++ b/amxmodx/modules.cpp
@@ -76,18 +76,6 @@ void print_srvconsole(const char *fmt, ...)
SERVER_PRINT(string);
}
-void* alloc_amxmemory(void** p, int size)
-{
- *p = new unsigned char[size];
- return *p;
-}
-
-void free_amxmemory(void **ptr)
-{
- delete[] (unsigned char *)(*ptr);
- *ptr = 0;
-}
-
#if defined BINLOG_ENABLED
void BinLog_LogNative(AMX *amx, int native, int params)
{
@@ -120,7 +108,7 @@ static binlogfuncs_t logfuncs =
};
#endif
-int load_amxscript(AMX *amx, void **program, const char *filename, char error[64], int debug)
+int load_amxscript_internal(AMX *amx, void **program, const char *filename, char *error, size_t maxLength, int debug)
{
*error = 0;
size_t bufSize;
@@ -139,7 +127,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
if (!*program)
{
- strcpy(error, "Failed to allocate memory");
+ ke::SafeStrcpy(error, maxLength, "Failed to allocate memory");
return (amx->error = AMX_ERR_MEMORY);
}
@@ -152,31 +140,31 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
case CAmxxReader::Err_None:
break;
case CAmxxReader::Err_FileOpen:
- strcpy(error, "Plugin file open error");
+ ke::SafeStrcpy(error, maxLength, "Plugin file open error");
return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_FileRead:
- strcpy(error, "Plugin file read error");
+ ke::SafeStrcpy(error, maxLength, "Plugin file read error");
return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_InvalidParam:
- strcpy(error, "Internal error: Invalid parameter");
+ ke::SafeStrcpy(error, maxLength, "Internal error: Invalid parameter");
return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_FileInvalid:
- strcpy(error, "Invalid Plugin");
+ ke::SafeStrcpy(error, maxLength, "Invalid Plugin");
return (amx->error = AMX_ERR_FORMAT);
case CAmxxReader::Err_SectionNotFound:
- strcpy(error, "Searched section not found (.amxx)");
+ ke::SafeStrcpy(error, maxLength, "Searched section not found (.amxx)");
return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_DecompressorInit:
- strcpy(error, "Decompressor initialization failed");
+ ke::SafeStrcpy(error, maxLength, "Decompressor initialization failed");
return (amx->error = AMX_ERR_INIT);
case CAmxxReader::Err_Decompress:
- strcpy(error, "Internal error: Decompress");
+ ke::SafeStrcpy(error, maxLength, "Internal error: Decompress");
return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_OldFile:
- strcpy(error, "Plugin uses deprecated format. Update compiler");
+ ke::SafeStrcpy(error, maxLength, "Plugin uses deprecated format. Update compiler");
return (amx->error = AMX_ERR_FORMAT);
default:
- strcpy(error, "Unknown error");
+ ke::SafeStrcpy(error, maxLength, "Unknown error");
return (amx->error = AMX_ERR_NOTFOUND);
}
} else {
@@ -190,7 +178,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
if (magic != AMX_MAGIC)
{
- strcpy(error, "Invalid Plugin");
+ ke::SafeStrcpy(error, maxLength, "Invalid Plugin");
return (amx->error = AMX_ERR_FORMAT);
}
@@ -203,7 +191,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{
if ((hdr->file_version < CUR_FILE_VERSION))
{
- sprintf(error, "Plugin needs newer debug version info");
+ ke::SafeStrcpy(error, maxLength, "Plugin needs newer debug version info");
return (amx->error = AMX_ERR_VERSION);
}
else if ((hdr->flags & AMX_FLAG_DEBUG) != 0)
@@ -221,13 +209,13 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{
dbg_FreeInfo(pDbg);
delete pDbg;
- sprintf(error, "Debug loading error %d", err);
+ ke::SafeSprintf(error, maxLength, "Debug loading error %d", err);
return (amx->error = AMX_ERR_INIT);
}
amx->flags |= AMX_FLAG_DEBUG;
} else {
- sprintf(error, "Plugin not compiled with debug option");
+ ke::SafeStrcpy(error, maxLength, "Plugin not compiled with debug option");
return (amx->error = AMX_ERR_INIT);
}
} else {
@@ -250,7 +238,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
delete pDbg;
}
- sprintf(error, "Load error %d (invalid file format or version)", err);
+ ke::SafeSprintf(error, maxLength, "Load error %d (invalid file format or version)", err);
return (amx->error = AMX_ERR_INIT);
}
@@ -288,7 +276,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{
delete[] np;
delete[] rt;
- strcpy(error, "Failed to initialize JIT'd plugin");
+ ke::SafeStrcpy(error, maxLength, "Failed to initialize JIT'd plugin");
return (amx->error = AMX_ERR_INIT);
}
@@ -319,14 +307,14 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
if (*program == 0)
{
- strcpy(error, "Failed to allocate memory");
+ ke::SafeStrcpy(error, maxLength, "Failed to allocate memory");
return (amx->error = AMX_ERR_MEMORY);
}
} else {
delete[] np;
delete[] rt;
- sprintf(error, "Failed to initialize plugin (%d)", err);
+ ke::SafeSprintf(error, maxLength, "Failed to initialize plugin (%d)", err);
return (amx->error = AMX_ERR_INIT_JIT);
}
@@ -337,7 +325,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
if (!script)
{
- ke::SafeSprintf(error, 64, "Failed to allocate memory for script");
+ ke::SafeStrcpy(error, maxLength, "Failed to allocate memory for script");
return (amx->error = AMX_ERR_MEMORY);
}
@@ -353,7 +341,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{
if (amx_Register(amx, core_Natives, -1) != AMX_ERR_NONE)
{
- sprintf(error, "Plugin uses an unknown function (name \"%s\") - check your modules.ini.", no_function);
+ ke::SafeSprintf(error, maxLength, "Plugin uses an unknown function (name \"%s\") - check your modules.ini.", no_function);
return (amx->error = AMX_ERR_NOTFOUND);
}
} else {
@@ -364,6 +352,17 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
return (amx->error = AMX_ERR_NONE);
}
+int load_amxscript_ex(AMX *amx, void **program, const char *filename, char *error, size_t maxLength, int debug)
+{
+ return load_amxscript_internal(amx, program, filename, error, maxLength, debug);
+}
+
+// Deprecated. Use load_amxscript_ex() or MF_LoadAmxScriptEx() for modules. This function is kept to maintain backward compatibility.
+int load_amxscript(AMX *amx, void **program, const char *filename, char error[64], int debug)
+{
+ return load_amxscript_internal(amx, program, filename, error, 64 /* error max length */, debug);
+}
+
const char *StrCaseStr(const char *as, const char *bs)
{
static char a[256];
@@ -876,10 +875,10 @@ bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify, bool no
report_error(1, "[AMXX] Couldn't find info about module (file \"%s\")", path);
break;
case MODULE_NOQUERY:
- report_error(1, "[AMXX] Couldn't find \"AMX_Query\" or \"AMXX_Query\" (file \"%s\")", path);
+ report_error(1, "[AMXX] Couldn't find \"AMXX_Query\" (file \"%s\")", path);
break;
case MODULE_NOATTACH:
- report_error(1, "[AMXX] Couldn't find \"%s\" (file \"%s\")", module->isAmxx() ? "AMXX_Attach" : "AMX_Attach", path);
+ report_error(1, "[AMXX] Couldn't find \"AMXX_Attach\" (file \"%s\")", path);
break;
case MODULE_OLD:
report_error(1, "[AMXX] Module has a different interface version (file \"%s\")", path);
@@ -920,7 +919,7 @@ bool LoadModule(const char *shortname, PLUG_LOADTIME now, bool simplify, bool no
bool retVal = module->attachModule();
- if (module->isAmxx() && !retVal)
+ if (!retVal)
{
switch (module->getStatusValue())
{
@@ -1026,23 +1025,6 @@ void detachReloadModules()
}
}
-const char* strip_name(const char* a)
-{
- const char* ret = a;
-
- while (*a)
- {
- if (*a == '/' || *a == '\\')
- {
- ret = ++a;
- continue;
- }
- ++a;
- }
-
- return ret;
-}
-
// Get the number of running modules
int countModules(CountModulesMode mode)
{
@@ -1788,9 +1770,10 @@ void Module_CacheFunctions()
REGISTER_FUNC("GetAmxScriptName", MNF_GetAmxScriptName)
REGISTER_FUNC("FindAmxScriptByName", MNF_FindAmxScriptByName)
REGISTER_FUNC("FindAmxScriptByAmx", MNF_FindAmxScriptByAmx)
- REGISTER_FUNC("LoadAmxScript", load_amxscript)
+ REGISTER_FUNC("LoadAmxScript", load_amxscript) // Deprecated. Please use LoadAmxScriptEx instead.
+ REGISTER_FUNC("LoadAmxScriptEx", load_amxscript_ex)
REGISTER_FUNC("UnloadAmxScript", unload_amxscript)
-
+
// String / mem in amx scripts support
REGISTER_FUNC("SetAmxString", set_amxstring)
REGISTER_FUNC("SetAmxStringUTF8Char", set_amxstring_utf8_char)
diff --git a/amxmodx/msvc12/amxmodx_mm.sln b/amxmodx/msvc12/amxmodx_mm.sln
index 818db48a..30dda64a 100644
--- a/amxmodx/msvc12/amxmodx_mm.sln
+++ b/amxmodx/msvc12/amxmodx_mm.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26730.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amxmodx_mm", "amxmodx_mm.vcxproj", "{2BF64D1A-AC89-41B0-9D02-FB8CB610F850}"
EndProject
@@ -51,6 +51,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amxxpc", "..\..\compiler\am
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpc300", "..\..\compiler\libpc300\libpc300.vcxproj", "{19B72687-080B-437A-917A-12AEB0031635}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "json", "..\..\modules\json\msvc12\json.vcxproj", "{4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -326,6 +328,18 @@ Global
{19B72687-080B-437A-917A-12AEB0031635}.JITReleaseBinLog|Win32.Build.0 = Release|Win32
{19B72687-080B-437A-917A-12AEB0031635}.Release|Win32.ActiveCfg = Release|Win32
{19B72687-080B-437A-917A-12AEB0031635}.Release|Win32.Build.0 = Release|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.Debug|Win32.Build.0 = Debug|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.JITDebug|Win32.ActiveCfg = Debug|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.JITDebug|Win32.Build.0 = Debug|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.JITDebugBinLog|Win32.ActiveCfg = Debug|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.JITDebugBinLog|Win32.Build.0 = Debug|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.JITRelease|Win32.ActiveCfg = Release|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.JITRelease|Win32.Build.0 = Release|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.JITReleaseBinLog|Win32.ActiveCfg = Release|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.JITReleaseBinLog|Win32.Build.0 = Release|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.Release|Win32.ActiveCfg = Release|Win32
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -352,5 +366,9 @@ Global
{7F18E00C-6271-4CAB-B18A-746BE3EC68E7} = {1A75873D-E05D-4F07-A4E2-28DC1BB03226}
{39412290-D01C-472F-A439-AB5592A04C08} = {0BB61E37-4EA5-4B18-A164-6CB4810E50F4}
{19B72687-080B-437A-917A-12AEB0031635} = {0BB61E37-4EA5-4B18-A164-6CB4810E50F4}
+ {4CF9D220-F318-4D1C-81DF-E2377A2D8FFE} = {1A75873D-E05D-4F07-A4E2-28DC1BB03226}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {E7D29DAA-4E6E-43AA-A2FC-7BD7758ABFD9}
EndGlobalSection
EndGlobal
diff --git a/amxmodx/msvc12/amxmodx_mm.vcxproj b/amxmodx/msvc12/amxmodx_mm.vcxproj
index 59a0daaa..da893adc 100644
--- a/amxmodx/msvc12/amxmodx_mm.vcxproj
+++ b/amxmodx/msvc12/amxmodx_mm.vcxproj
@@ -60,8 +60,8 @@
Disabled
- ..\;..\..\public;..\..\public\memtools;..\..\third_party;..\..\third_party\zlib;..\..\third_party\hashing;..\..\public\sdk;..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)
- WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;PAWN_CELL_SIZE=32;ASM32;JIT;_CRT_SECURE_NO_DEPRECATE;HAVE_STDINT_H;%(PreprocessorDefinitions)
+ ..\;..\..\public;..\..\public\memtools;..\..\third_party;..\..\third_party\zlib;..\..\third_party\hashing;..\..\third_party\utf8rewind;..\..\public\sdk;..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)
+ WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;UTF8PROC_EXPORTS;_DEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;PAWN_CELL_SIZE=32;ASM32;JIT;_CRT_SECURE_NO_DEPRECATE;HAVE_STDINT_H;%(PreprocessorDefinitions)
EnableFastChecks
MultiThreadedDebug
4Bytes
@@ -81,7 +81,7 @@
0x0409
- /MACHINE:I386 %(AdditionalOptions)
+ /MACHINE:I386 /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
..\JIT\amxjitsn.obj;..\JIT\amxexecn.obj;..\JIT\natives-x86.obj;%(AdditionalDependencies)
0.1
true
@@ -94,7 +94,16 @@
.\jitdebug/amxmodx_mm.lib
Windows
false
+ .data,RW
+
+ cd ..
+md -p JIT 2>NUL
+%NASM_PATH%nasm.exe -f win32 helpers-x86.asm -o JIT/helpers-x86.obj
+%NASM_PATH%nasm.exe -f win32 natives-x86.asm -o JIT/natives-x86.obj
+%NASM_PATH%nasm.exe -f win32 amxexecn.asm -o JIT/amxexecn.obj
+%NASM_PATH%nasm.exe -O0 -f win32 amxjitsn.asm -o JIT/amxjitsn.obj
+
@@ -110,8 +119,8 @@
true
Speed
true
- ..\;..\..\public;..\..\public\memtools;..\..\third_party;..\..\third_party\zlib;..\..\third_party\hashing;..\..\third_party;..\..\third_party\hashing;..\..\public\sdk;..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)
- WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32;HAVE_STDINT_H;%(PreprocessorDefinitions)
+ ..\;..\..\public;..\..\public\memtools;..\..\third_party;..\..\third_party\zlib;..\..\third_party\hashing;..\..\third_party\utf8rewind;..\..\third_party;..\..\third_party\hashing;..\..\public\sdk;..\..\public\amtl;..\..\third_party;..\..\third_party\hashing;$(METAMOD)\metamod;$(HLSDK)\common;$(HLSDK)\engine;$(HLSDK)\dlls;$(HLSDK)\pm_shared;$(HLSDK)\public;%(AdditionalIncludeDirectories)
+ WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;UTF8PROC_EXPORTS;NDEBUG;_WINDOWS;_USRDLL;amxmodx_EXPORTS;JIT;ASM32;PAWN_CELL_SIZE=32;HAVE_STDINT_H;%(PreprocessorDefinitions)
false
true
MultiThreaded
@@ -132,7 +141,7 @@
0x0409
- /MACHINE:I386 %(AdditionalOptions)
+ /MACHINE:I386 /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
..\JIT\amxjitsn.obj;..\JIT\amxexecn.obj;..\JIT\natives-x86.obj;%(AdditionalDependencies)
true
..\extra\lib_win32;%(AdditionalLibraryDirectories)
@@ -145,7 +154,16 @@
.\jitrelease/amxmodx_mm.lib
Windows
false
+ .data,RW
+
+ cd ..
+md -p JIT 2>NUL
+%NASM_PATH%nasm.exe -f win32 helpers-x86.asm -o JIT/helpers-x86.obj
+%NASM_PATH%nasm.exe -f win32 natives-x86.asm -o JIT/natives-x86.obj
+%NASM_PATH%nasm.exe -f win32 amxexecn.asm -o JIT/amxexecn.obj
+%NASM_PATH%nasm.exe -O0 -f win32 amxjitsn.asm -o JIT/amxjitsn.obj
+
@@ -180,6 +198,42 @@
$(IntDir)hashing\
$(IntDir)hashing\
+
+ CompileAsCpp
+ CompileAsCpp
+
+
+ CompileAsCpp
+ CompileAsCpp
+
+
+ CompileAsCpp
+ CompileAsCpp
+
+
+ CompileAsCpp
+ CompileAsCpp
+
+
+ CompileAsCpp
+ CompileAsCpp
+
+
+ CompileAsCpp
+ CompileAsCpp
+
+
+ CompileAsCpp
+ CompileAsCpp
+
+
+ CompileAsCpp
+ CompileAsCpp
+
+
+ CompileAsCpp
+ CompileAsCpp
+
$(IntDir)zlib\
$(IntDir)zlib\
@@ -326,6 +380,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -382,7 +446,10 @@
-
+
+ ../../public;
+ ../../public;
+
@@ -390,6 +457,9 @@
+
+
+
@@ -424,4 +494,4 @@
-
+
\ No newline at end of file
diff --git a/amxmodx/msvc12/amxmodx_mm.vcxproj.filters b/amxmodx/msvc12/amxmodx_mm.vcxproj.filters
index 6a4cf742..946922c2 100644
--- a/amxmodx/msvc12/amxmodx_mm.vcxproj.filters
+++ b/amxmodx/msvc12/amxmodx_mm.vcxproj.filters
@@ -55,6 +55,12 @@
{04fab577-6f56-40d0-8f69-7ce1b8bf3bb9}
+
+ {270f3524-564f-4154-bb35-242a6faac09e}
+
+
+ {295b670a-1aa3-4b80-bbf6-4ba422672274}
+
@@ -303,6 +309,33 @@
ReSDK
+
+ Third Party\UTF8Rewind
+
+
+ Third Party\UTF8Rewind
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
@@ -506,8 +539,35 @@
Header Files
-
- Header Files
+
+ Third Party\UTF8Rewind
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind\internal
+
+
+ Third Party\UTF8Rewind
ReSDK\common
@@ -521,6 +581,9 @@
ReSDK
+
+ Header Files
+
@@ -624,10 +687,19 @@
Pawn Includes
+
+ Pawn Includes
+
+
+ Pawn Includes
+
+
+ Pawn Includes
+
Assembly\Builds
-
+
\ No newline at end of file
diff --git a/amxmodx/natives_handles.h b/amxmodx/natives_handles.h
index 530d1faf..9ed403ec 100644
--- a/amxmodx/natives_handles.h
+++ b/amxmodx/natives_handles.h
@@ -11,6 +11,7 @@
#define _NATIVES_NATIVES_HANDLES_H_
#include
+#include
// Note: All handles start at 1. 0 and below are invalid handles.
// This way, a plugin that doesn't initialize a vector or
@@ -22,7 +23,7 @@ class NativeHandle
{
private:
- ke::Vector m_handles;
+ ke::Vector> m_handles;
public:
@@ -34,69 +35,66 @@ class NativeHandle
void clear()
{
- for (size_t i = 0; i < m_handles.length(); ++i)
- {
- if (m_handles[i])
- {
- delete m_handles[i];
- }
- }
-
m_handles.clear();
}
- T *lookup(int handle)
+ size_t size()
+ {
+ return m_handles.length();
+ }
+
+ T *lookup(size_t handle)
{
--handle;
- if (handle < 0 || handle >= static_cast(m_handles.length()))
+ if (handle >= m_handles.length())
{
return nullptr;
}
- return m_handles[handle];
+ return m_handles[handle].get();
}
template
- int create(Targs... Fargs)
+ size_t create(Targs... Fargs)
{
for (size_t i = 0; i < m_handles.length(); ++i)
{
if (!m_handles[i])
{
- m_handles[i] = new T(Fargs...);
+ m_handles[i] = ke::AutoPtr(new T(Fargs...));
- return static_cast(i) + 1;
+ return i + 1;
}
}
- m_handles.append(new T(Fargs...));
+ m_handles.append(ke::AutoPtr(new T(Fargs...)));
return m_handles.length();
}
- int clone(T *data)
+ size_t clone(T *data)
{
for (size_t i = 0; i < m_handles.length(); ++i)
{
if (!m_handles[i])
{
- m_handles[i] = data;
+ m_handles[i] = ke::AutoPtr(data);
- return static_cast(i) + 1;
+ return i + 1;
}
}
- m_handles.append(data);
+ m_handles.append(ke::AutoPtr(data));
return m_handles.length();
}
- bool destroy(int handle)
+ bool destroy(size_t handle)
{
- handle--;
+ --handle;
- if (handle < 0 || handle >= static_cast(m_handles.length()))
+ if (handle >= m_handles.length())
{
return false;
}
@@ -106,7 +104,6 @@ class NativeHandle
return false;
}
- delete m_handles[handle];
m_handles[handle] = nullptr;
return true;
diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp
index 433c4c27..3c495318 100755
--- a/amxmodx/newmenus.cpp
+++ b/amxmodx/newmenus.cpp
@@ -10,6 +10,7 @@
#include "amxmodx.h"
#include "CMenu.h"
#include "newmenus.h"
+#include "format.h"
#include "CDataPack.h"
ke::Vector g_NewMenus;
@@ -91,9 +92,9 @@ bool CloseNewMenus(CPlayer *pPlayer)
return true;
}
-Menu::Menu(const char *title, AMX *amx, int fid) : m_Title(title), m_ItemColor("\\r"),
+Menu::Menu(const char *title, AMX *amx, int fid, bool use_ml) : m_Title(title), m_ItemColor("\\r"),
m_NeverExit(false), m_AutoColors(g_coloredmenus), thisId(0), func(fid),
-isDestroying(false), pageCallback(-1), items_per_page(7)
+isDestroying(false), pageCallback(-1), showPageNumber(true), useMultilingual(use_ml), amx(amx), items_per_page(7)
{
CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(amx);
menuId = g_menucmds.registerMenuId(title, amx);
@@ -320,11 +321,6 @@ bool Menu::Display(int player, page_t page)
CPlayer *pPlayer = GET_PLAYER_POINTER_I(player);
- pPlayer->keys = 0;
- pPlayer->menu = 0;
-
- UTIL_FakeClientCommand(pPlayer->pEdict, "menuselect", "10", 0);
-
pPlayer->keys = keys;
pPlayer->menu = menuId;
pPlayer->newmenu = thisId;
@@ -365,18 +361,32 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
m_Text = nullptr;
+
+ auto title = m_Title.chars();
+
+ if (this->useMultilingual)
+ {
+ const auto language = playerlang(player);
+ const auto definition = translate(this->amx, language, title);
+
+ if (definition)
+ {
+ title = definition;
+ }
+ }
+
char buffer[255];
- if (items_per_page && (pages != 1))
+ if (showPageNumber && items_per_page && (pages != 1))
{
if (m_AutoColors)
- ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s %d/%d\n\\w\n", m_Title.chars(), page + 1, pages);
+ ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s %d/%d\n\\w\n", title, page + 1, pages);
else
- ke::SafeSprintf(buffer, sizeof(buffer), "%s %d/%d\n\n", m_Title.chars(), page + 1, pages);
+ ke::SafeSprintf(buffer, sizeof(buffer), "%s %d/%d\n\n", title, page + 1, pages);
} else {
if (m_AutoColors)
- ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s\n\\w\n", m_Title.chars());
+ ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s\n\\w\n", title);
else
- ke::SafeSprintf(buffer, sizeof(buffer), "%s\n\n", m_Title.chars());
+ ke::SafeSprintf(buffer, sizeof(buffer), "%s\n\n", title);
}
m_Text = m_Text + buffer;
@@ -475,24 +485,37 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
option_display = 0;
}
+ auto itemName = pItem->name.chars();
+
+ if (this->useMultilingual)
+ {
+ const auto language = playerlang(player);
+ const auto definition = translate(this->amx, language, itemName);
+
+ if (definition)
+ {
+ itemName = definition;
+ }
+ }
+
if (pItem->isBlank)
{
- ke::SafeSprintf(buffer, sizeof(buffer), "%s\n", pItem->name.chars());
+ ke::SafeSprintf(buffer, sizeof(buffer), "%s\n", itemName);
}
else if (enabled)
{
- if (m_AutoColors)
+ if (m_AutoColors)
{
- ke::SafeSprintf(buffer, sizeof(buffer), "%s%d.\\w %s\n", m_ItemColor.chars(),option_display, pItem->name.chars());
+ ke::SafeSprintf(buffer, sizeof(buffer), "%s%d.\\w %s\n", m_ItemColor.chars(),option_display, itemName);
} else {
- ke::SafeSprintf(buffer, sizeof(buffer), "%d. %s\n", option_display, pItem->name.chars());
+ ke::SafeSprintf(buffer, sizeof(buffer), "%d. %s\n", option_display, itemName);
}
} else {
if (m_AutoColors)
{
- ke::SafeSprintf(buffer, sizeof(buffer), "\\d%d. %s\n\\w", option_display, pItem->name.chars());
+ ke::SafeSprintf(buffer, sizeof(buffer), "\\d%d. %s\n\\w", option_display, itemName);
} else {
- ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", pItem->name.chars());
+ ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", itemName);
}
}
slots++;
@@ -633,38 +656,45 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
LogError(amx, AMX_ERR_NATIVE, "Invalid menu id %d(%d)", p, g_NewMenus.length()); \
return 0; }
-//Makes a new menu handle (-1 for failure)
-//native csdm_makemenu(title[]);
+// native menu_create(const title[], const handler[], bool:ml = false);
static cell AMX_NATIVE_CALL menu_create(AMX *amx, cell *params)
{
- int len;
- auto title = get_amxstring(amx, params[1], 0, len);
- validate_menu_text(title);
- auto handler = get_amxstring(amx, params[2], 1, len);
+ enum args { arg_count, arg_title, arg_handler, arg_ml };
- auto func = registerSPForwardByName(amx, handler, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
-
- if (func == -1)
+ int length;
+ const auto title = get_amxstring(amx, params[arg_title], 0, length);
+ const auto handler = get_amxstring(amx, params[arg_handler], 1, length);
+ const auto callback = registerSPForwardByName(amx, handler, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
+
+ if (callback == -1)
{
- LogError(amx, AMX_ERR_NOTFOUND, "Invalid function \"%s\"", handler);
+ LogError(amx, AMX_ERR_NOTFOUND, R"(Invalid function "%s")", handler);
return 0;
}
- Menu *pMenu = new Menu(title, amx, func);
+ validate_menu_text(title);
+
+ auto pMenu = new Menu(title, amx, callback, params[arg_ml] != 0);
if (g_MenuFreeStack.empty())
{
g_NewMenus.append(pMenu);
- pMenu->thisId = (int)g_NewMenus.length() - 1;
- } else {
- int pos = g_MenuFreeStack.front();
+
+ pMenu->thisId = static_cast(g_NewMenus.length()) - 1;
+ }
+ else
+ {
+ const auto position = g_MenuFreeStack.front();
+
g_MenuFreeStack.pop();
- g_NewMenus[pos] = pMenu;
- pMenu->thisId = pos;
+ g_NewMenus[position] = pMenu;
+
+ pMenu->thisId = position;
}
return pMenu->thisId;
}
+
static cell AMX_NATIVE_CALL menu_addblank(AMX *amx, cell *params)
{
GETMENU(params[1]);
@@ -837,18 +867,39 @@ static cell AMX_NATIVE_CALL menu_items(AMX *amx, cell *params)
//page indices start at 0!
static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
{
- GETMENU(params[2]);
-
+ auto handle = params[2];
+ GETMENU(handle);
+
int player = params[1];
int page = params[3];
CPlayer* pPlayer = GET_PLAYER_POINTER_I(player);
-
+
if (!CloseNewMenus(pPlayer))
{
LogError(amx, AMX_ERR_NATIVE, "Plugin called menu_display when item=MENU_EXIT");
return 0;
}
+ if (!g_NewMenus[handle])
+ {
+ LogError(amx, AMX_ERR_NATIVE, "Invalid menu id %d (was previously destroyed).", handle);
+ return 0;
+ }
+
+ if (g_bmod_cstrike)
+ {
+ enum JoinState { Joined = 0 };
+ enum MenuState { Menu_OFF = 0, Menu_ChooseTeam = 1, Menu_ChooseAppearance = 3 };
+
+ GET_OFFSET("CBasePlayer", m_iJoiningState);
+ GET_OFFSET("CBasePlayer", m_iMenu);
+
+ if (get_pdata(pPlayer->pEdict, m_iJoiningState) == Joined || (get_pdata(pPlayer->pEdict, m_iMenu) != Menu_ChooseTeam && get_pdata(pPlayer->pEdict, m_iMenu) != Menu_ChooseAppearance))
+ {
+ set_pdata(pPlayer->pEdict, m_iMenu, Menu_OFF);
+ }
+ }
+
int time = -1;
if (params[0] / sizeof(cell) >= 4)
time = params[4];
@@ -1021,6 +1072,11 @@ static cell AMX_NATIVE_CALL menu_setprop(AMX *amx, cell *params)
unregisterSPForward(pMenu->pageCallback);
pMenu->pageCallback = callback;
+ break;
+ }
+ case MPROP_SHOWPAGE:
+ {
+ pMenu->showPageNumber = (get_amxaddr(amx, params[3]) != 0);
break;
}
case MPROP_SET_NUMBER_COLOR:
diff --git a/amxmodx/newmenus.h b/amxmodx/newmenus.h
index dcc5c2e2..d88304c7 100755
--- a/amxmodx/newmenus.h
+++ b/amxmodx/newmenus.h
@@ -31,6 +31,7 @@
#define MPROP_PADMENU 9
#define MPROP_SET_NUMBER_COLOR 10
#define MPROP_PAGE_CALLBACK 11
+#define MPROP_SHOWPAGE 12
typedef int (*MENUITEM_CALLBACK)(int, int, int, int);
@@ -96,7 +97,7 @@ typedef unsigned int page_t;
class Menu
{
public:
- Menu(const char *title, AMX *amx, int fid);
+ Menu(const char *title, AMX *amx, int fid, bool use_ml);
~Menu();
menuitem *GetMenuItem(item_t item);
@@ -127,6 +128,9 @@ public:
int func;
bool isDestroying;
int pageCallback;
+ bool showPageNumber;
+ bool useMultilingual;
+ AMX *amx;
public:
unsigned int items_per_page;
};
diff --git a/amxmodx/string.cpp b/amxmodx/string.cpp
index e4a3b021..ebed1ab9 100755
--- a/amxmodx/string.cpp
+++ b/amxmodx/string.cpp
@@ -1,4 +1,4 @@
-// vim: set ts=4 sw=4 tw=99 noet:
+// vim: set ts=4 sw=4 tw=99 noet:
//
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
// Copyright (C) The AMX Mod X Development Team.
@@ -11,6 +11,7 @@
#include "amxmodx.h"
#include "format.h"
#include "binlog.h"
+#include
const char* stristr(const char* str, const char* substr)
{
@@ -169,11 +170,17 @@ extern "C" size_t get_amxstring_r(AMX *amx, cell amx_addr, char *destination, in
return dest - start;
}
+char *get_amxbuffer(int id)
+{
+ static char buffer[4][MAX_BUFFER_LENGTH];
+ return buffer[id];
+}
+
char *get_amxstring(AMX *amx, cell amx_addr, int id, int& len)
{
- static char buffer[4][16384];
- len = get_amxstring_r(amx, amx_addr, buffer[id], sizeof(buffer[id]) - 1);
- return buffer[id];
+ auto buffer = get_amxbuffer(id);
+ len = get_amxstring_r(amx, amx_addr, buffer, MAX_BUFFER_LENGTH - 1);
+ return buffer;
}
char *get_amxstring_null(AMX *amx, cell amx_addr, int id, int& len)
@@ -203,6 +210,16 @@ void copy_amxmemory(cell* dest, cell* src, int len)
*dest++=*src++;
}
+bool utf8isspace(const char* string)
+{
+ return utf8iscategory(string, 1, UTF8_CATEGORY_ISSPACE) != 0;
+}
+
+size_t utf8getspaces(const char* string)
+{
+ return utf8iscategory(string, SIZE_MAX, UTF8_CATEGORY_ISSPACE);
+}
+
char* parse_arg(char** line, int& state)
{
static char arg[3072];
@@ -211,7 +228,7 @@ char* parse_arg(char** line, int& state)
while (**line)
{
- if (isspace(**line))
+ if (utf8isspace(*line))
{
if (state == 1)
break;
@@ -302,58 +319,68 @@ static cell AMX_NATIVE_CALL replace(AMX *amx, cell *params) /* 4 param */
return 0;
}
+// native replace_string(text[], maxlength, const search[], const replace[], bool:caseSensitive = true);
static cell AMX_NATIVE_CALL replace_string(AMX *amx, cell *params)
{
- int len;
- size_t maxlength = (size_t)params[2];
+ enum args { arg_count, arg_text, arg_maxlength, arg_search, arg_replace, arg_casesensitive };
- char *text = get_amxstring(amx, params[1], 0, len);
- const char *search = get_amxstring(amx, params[3], 1, len);
- const char *replace = get_amxstring(amx, params[4], 2, len);
+ auto textLength = 0;
+ auto searchLength = 0;
+ auto replaceLength = 0;
- bool caseSensitive = params[5] ? true : false;
+ auto text = get_amxstring(amx, params[arg_text] , 0, textLength);
+ auto search = get_amxstring(amx, params[arg_search] , 1, searchLength);
+ auto replace = get_amxstring(amx, params[arg_replace], 2, replaceLength);
- if (search[0] == '\0')
+ auto textMaxLength = params[arg_maxlength];
+ auto caseSensitive = params[arg_casesensitive] != 0;
+
+ if (!*search)
{
LogError(amx, AMX_ERR_NATIVE, "Cannot replace searches of empty strings.");
return -1;
}
- int count = UTIL_ReplaceAll(text, maxlength + 1, search, replace, caseSensitive); // + EOS
+ auto count = UTIL_ReplaceAll(text, textMaxLength + 1, search, searchLength, replace, replaceLength, caseSensitive); // + EOS
- set_amxstring(amx, params[1], text, maxlength);
+ set_amxstring(amx, params[arg_text], text, textMaxLength);
return count;
}
+// native replace_stringex(text[], maxlength, const search[], const replace[], searchLen = -1, replaceLen = -1, bool:caseSensitive = true);
static cell AMX_NATIVE_CALL replace_stringex(AMX *amx, cell *params)
{
- int len;
- size_t maxlength = (size_t)params[2];
+ enum args { arg_count, arg_text, arg_maxlength, arg_search, arg_replace, arg_searchlen, arg_replacelen, arg_casesensitive };
- char *text = get_amxstring(amx, params[1], 0, len);
- const char *search = get_amxstring(amx, params[3], 1, len);
- const char *replace = get_amxstring(amx, params[4], 2, len);
+ auto textLength = 0;
+ auto searchLength = 0;
+ auto replaceLength = 0;
- size_t searchLen = (params[5] == -1) ? strlen(search) : (size_t)params[5];
- size_t replaceLen = (params[6] == -1) ? strlen(replace) : (size_t)params[6];
+ auto text = get_amxstring(amx, params[arg_text] , 0, textLength);
+ auto search = get_amxstring(amx, params[arg_search] , 1, searchLength);
+ auto replace = get_amxstring(amx, params[arg_replace], 2, replaceLength);
- bool caseSensitive = params[7] ? true : false;
+ auto textMaxLength = params[arg_maxlength];
+ auto caseSensitive = params[arg_casesensitive] != 0;
- if (searchLen == 0)
+ if (params[arg_searchlen] != -1) { searchLength = params[arg_searchlen]; }
+ if (params[arg_replacelen] != -1) { replaceLength = params[arg_replacelen]; }
+
+ if (searchLength <= 0)
{
LogError(amx, AMX_ERR_NATIVE, "Cannot replace searches of empty strings.");
return -1;
}
- char *ptr = UTIL_ReplaceEx(text, maxlength + 1, search, searchLen, replace, replaceLen, caseSensitive); // + EOS
+ auto ptr = UTIL_ReplaceEx(text, textMaxLength + 1, search, searchLength, replace, replaceLength, caseSensitive); // + EOS
if (!ptr)
{
return -1;
}
- set_amxstring(amx, params[1], text, maxlength);
+ set_amxstring(amx, params[arg_text], text, textMaxLength);
return ptr - text;
}
@@ -382,27 +409,36 @@ static cell AMX_NATIVE_CALL contain(AMX *amx, cell *params) /* 2 param */
return -1;
}
-static cell AMX_NATIVE_CALL containi(AMX *amx, cell *params) /* 2 param */
+// native containi(const source[], const string[]);
+static cell AMX_NATIVE_CALL containi(AMX *amx, cell *params)
{
- register cell *a = get_amxaddr(amx, params[2]);
- register cell *b = get_amxaddr(amx, params[1]);
- register cell *c = b;
- cell* str = b;
- cell* substr = a;
-
- while (*c)
+ enum args { arg_count, arg_source, arg_search };
+
+ auto sourceLength = 0;
+ auto searchLength = 0;
+
+ auto source = get_amxstring(amx, params[arg_source], 0, sourceLength);
+ auto search = get_amxstring(amx, params[arg_search], 1, searchLength);
+
+ if (sourceLength && searchLength)
{
- if (tolower(*c) == tolower(*a))
+ auto sourceFolded = get_amxbuffer(2);
+ auto searchFolded = get_amxbuffer(3);
+
+ sourceLength = utf8casefold(source, sourceLength, sourceFolded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+ searchLength = utf8casefold(search, searchLength, searchFolded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ sourceFolded[sourceLength] = '\0';
+ searchFolded[searchLength] = '\0';
+
+ auto result = strstr(sourceFolded, searchFolded);
+
+ if (result)
{
- c++;
- if (!*++a)
- return b - str;
- } else {
- c = ++b;
- a = substr;
+ return result - sourceFolded;
}
}
-
+
return -1;
}
@@ -609,30 +645,34 @@ static cell AMX_NATIVE_CALL equal(AMX *amx, cell *params) /* 3 param */
return ret ? 0 : 1;
}
-static cell AMX_NATIVE_CALL equali(AMX *amx, cell *params) /* 3 param */
+// native equali(const a[], const b[], c = 0);
+static cell AMX_NATIVE_CALL equali(AMX *amx, cell *params)
{
- cell *a = get_amxaddr(amx, params[1]);
- cell *b = get_amxaddr(amx, params[2]);
- int f, l, c = params[3];
-
- if (c)
- {
- do
- {
- f = tolower(*a++);
- l = tolower(*b++);
- } while (--c && l && f && f == l);
-
- return (f - l) ? 0 : 1;
- }
+ enum args { arg_count, arg_string1, arg_string2, arg_numbytes };
- do
+ auto string1Length = 0;
+ auto string2Length = 0;
+
+ auto string1 = get_amxstring(amx, params[arg_string1], 0, string1Length);
+ auto string2 = get_amxstring(amx, params[arg_string2], 1, string2Length);
+
+ auto string1Folded = get_amxbuffer(2);
+ auto string2Folded = get_amxbuffer(3);
+
+ string1Length = utf8casefold(string1, string1Length, string1Folded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+ string2Length = utf8casefold(string2, string2Length, string2Folded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ string1Folded[string1Length] = '\0';
+ string2Folded[string2Length] = '\0';
+
+ if (params[arg_numbytes] > 0)
{
- f = tolower(*a++);
- l = tolower(*b++);
- } while (f && f == l);
-
- return (f - l) ? 0 : 1;
+ return static_cast(strncmp(string1Folded, string2Folded, params[arg_numbytes]) == 0);
+ }
+ else
+ {
+ return static_cast(strcmp(string1Folded, string2Folded) == 0);
+ }
}
static cell g_cpbuf[4096];
@@ -730,6 +770,29 @@ static cell AMX_NATIVE_CALL strtolower(AMX *amx, cell *params) /* 1 param */
return cptr - begin;
}
+// native mb_strtolower(source[], maxlength = 0);
+static cell AMX_NATIVE_CALL mb_strtolower(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_string, arg_maxlength };
+
+ auto sourceLength = 0;
+ auto source = get_amxstring(amx, params[arg_string], 0, sourceLength);
+
+ auto outputMaxLength = params[arg_maxlength];
+
+ if (outputMaxLength <= 0)
+ {
+ outputMaxLength = sourceLength;
+ }
+
+ auto output = get_amxbuffer(1);
+ auto outputLength = utf8tolower(source, sourceLength, output, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ output[outputLength] = '\0';
+
+ return set_amxstring_utf8(amx, params[arg_string], output, outputLength, outputMaxLength);
+}
+
static cell AMX_NATIVE_CALL strtoupper(AMX *amx, cell *params) /* 1 param */
{
cell *cptr = get_amxaddr(amx, params[1]);
@@ -744,6 +807,29 @@ static cell AMX_NATIVE_CALL strtoupper(AMX *amx, cell *params) /* 1 param */
return cptr - begin;
}
+// native mb_strtoupper(source[], maxlength = 0);
+static cell AMX_NATIVE_CALL mb_strtoupper(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_string, arg_maxlength };
+
+ auto sourceLength = 0;
+ auto source = get_amxstring(amx, params[arg_string], 0, sourceLength);
+
+ auto outputMaxLength = params[arg_maxlength];
+
+ if (outputMaxLength <= 0)
+ {
+ outputMaxLength = sourceLength;
+ }
+
+ auto output = get_amxbuffer(1);
+ auto outputLength = utf8toupper(source, sourceLength, output, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ output[outputLength] = '\0';
+
+ return set_amxstring_utf8(amx, params[arg_string], output, outputLength, outputMaxLength);
+}
+
int fo_numargs(AMX *amx)
{
unsigned char *data = amx->base + (int)((AMX_HEADER *)amx->base)->dat;
@@ -843,6 +929,7 @@ static cell AMX_NATIVE_CALL amx_strtok(AMX *amx, cell *params)
int right_pos = 0;
unsigned int i = 0;
bool done_flag = false;
+ size_t spaces;
int len = 0;
//string[]
@@ -862,9 +949,9 @@ static cell AMX_NATIVE_CALL amx_strtok(AMX *amx, cell *params)
{
if (trim && !done_flag)
{
- if (isspace(string[i]))
+ if ((spaces = utf8getspaces(string + i) > 0))
{
- while (isspace(string[++i]));
+ i += spaces;
done_flag = true;
}
}
@@ -898,6 +985,7 @@ static cell AMX_NATIVE_CALL amx_strtok2(AMX *amx, cell *params)
{
int left_pos = 0, right_pos = 0, len, pos = -1;
unsigned int i = 0;
+ size_t spaces;
char *string = get_amxstring(amx, params[1], 0, len);
char *left = new char[len + 1], *right = new char[len + 1];
@@ -913,9 +1001,9 @@ static cell AMX_NATIVE_CALL amx_strtok2(AMX *amx, cell *params)
int trim = params[7];
// ltrim left
- if (trim & 1 && isspace(string[i]))
+ if (trim & 1 && (spaces = utf8getspaces(string)) > 0)
{
- while (isspace(string[++i]));
+ i += spaces;
}
for (; i < (unsigned int) len; ++i)
@@ -931,17 +1019,17 @@ static cell AMX_NATIVE_CALL amx_strtok2(AMX *amx, cell *params)
}
// rtrim left
- if (trim & 2 && left_pos && isspace(left[left_pos - 1]))
+ if (trim & 2 && left_pos && utf8isspace(&left[left_pos - 1]))
{
- while (--left_pos >= 0 && isspace(left[left_pos]));
+ while (--left_pos >= 0 && utf8isspace(&left[left_pos]));
++left_pos;
}
// ltrim right
- if (trim & 4 && isspace(string[i]))
+ if (trim & 4 && (spaces = utf8getspaces(string + i)) > 0)
{
- while (isspace(string[++i]));
+ i += spaces;
}
for (; i < (unsigned int) len; ++i)
@@ -950,9 +1038,9 @@ static cell AMX_NATIVE_CALL amx_strtok2(AMX *amx, cell *params)
}
// rtrim right
- if (trim & 8 && right_pos && isspace(right[right_pos - 1]))
+ if (trim & 8 && right_pos && utf8isspace(&right[right_pos - 1]))
{
- while (--right_pos >= 0 && isspace(right[right_pos]));
+ while (--right_pos >= 0 && utf8isspace(&right[right_pos]));
++right_pos;
}
@@ -982,8 +1070,12 @@ static cell AMX_NATIVE_CALL argparse(AMX *amx, cell *params)
// Strip all left-hand whitespace.
size_t i = start_pos;
- while (i < input_len && isspace(input[i]))
- i++;
+ size_t spaces;
+
+ if ((spaces = utf8getspaces(input + i)) > 0)
+ {
+ i += spaces;
+ }
if (i >= input_len) {
*buffer = '\0';
@@ -1002,7 +1094,7 @@ static cell AMX_NATIVE_CALL argparse(AMX *amx, cell *params)
}
// If not in quotes, and we see a space, stop.
- if (isspace(input[i]) && !in_quote)
+ if (utf8isspace(input + i) && !in_quote)
break;
if (size_t(bufpos - buffer) < buflen)
@@ -1030,9 +1122,13 @@ static cell AMX_NATIVE_CALL strbreak(AMX *amx, cell *params) /* 5 param */
int RightMax = params[5];
size_t len = (size_t)_len;
+ size_t spaces;
+
+ if ((spaces = utf8getspaces(string)) > 0)
+ {
+ i += spaces;
+ }
- while (isspace(string[i]) && i 0)
{
do_copy:
size_t pos = i;
- while (isspace(string[i]))
- i++;
+ i += spaces;
+
const char *start = had_quotes ? &(string[beg+1]) : &(string[beg]);
size_t _end = had_quotes ? (i==len-1 ? 1 : 2) : 0;
size_t end = (pos - _end > (size_t)LeftMax) ? (size_t)LeftMax : pos - _end;
@@ -1241,6 +1337,46 @@ static cell AMX_NATIVE_CALL amx_ucfirst(AMX *amx, cell *params)
return 1;
}
+// native mb_ucfirst(string[], maxlength = 0);
+static cell AMX_NATIVE_CALL mb_ucfirst(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_string, arg_maxlength };
+
+ auto sourceLength = 0;
+ auto source = get_amxstring(amx, params[arg_string], 0, sourceLength);
+
+ auto outputMaxLength = params[arg_maxlength];
+
+ if (outputMaxLength <= 0)
+ {
+ outputMaxLength = sourceLength;
+ }
+
+ // Retrieves the first character length in bytes.
+ auto firstChLength = utf8seek(source, sourceLength, source, 1, SEEK_CUR) - source;
+
+ if (firstChLength)
+ {
+ char output[8] = {};
+ auto outputLength = utf8toupper(source, firstChLength, output, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ // The converted character is either larger or smaller in bytes.
+ if (firstChLength != outputLength)
+ {
+ // Calculates the new string length and makes sure we don't go over the buffer size (fairly unlikely).
+ sourceLength = ke::Min(sourceLength + (outputLength - firstChLength), outputMaxLength);
+
+ // Move data forward or backward minus the first character (whathever its size).
+ memmove(source + outputLength, source + firstChLength, (sourceLength - outputLength) * sizeof(char));
+ }
+
+ // Copy the new character at the start of the string.
+ memcpy(source, output, outputLength);
+ }
+
+ return set_amxstring_utf8(amx, params[arg_string], source, sourceLength, outputMaxLength);
+}
+
static cell AMX_NATIVE_CALL amx_strlen(AMX *amx, cell *params)
{
int len;
@@ -1251,18 +1387,27 @@ static cell AMX_NATIVE_CALL amx_strlen(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL amx_trim(AMX *amx, cell *params)
{
- int len, newlen;
- char *str = get_amxstring(amx, params[1], 0, len);
+ int length;
+ auto string = get_amxstring(amx, params[1], 0, length);
- UTIL_TrimLeft(str);
- UTIL_TrimRight(str);
+ auto leftSpaces = utf8getspaces(string);
+ auto rightSpaces = 0u;
- newlen = strlen(str);
- len -= newlen;
+ auto originalLength = length;
- set_amxstring(amx, params[1], str, newlen);
+ if (leftSpaces < size_t(length))
+ {
+ while (--length >= 0 && utf8isspace(string + length))
+ {
+ ++rightSpaces;
+ }
+ }
- return len;
+ auto totalSpaces = leftSpaces + rightSpaces;
+
+ set_amxstring(amx, params[1], string + leftSpaces, originalLength - totalSpaces);
+
+ return totalSpaces;
}
static cell AMX_NATIVE_CALL n_strcat(AMX *amx, cell *params)
@@ -1292,62 +1437,105 @@ static cell AMX_NATIVE_CALL n_strcat(AMX *amx, cell *params)
return params[3] - num;
}
+// native strcmp(const string1[], const string2[], bool:ignorecase = false);
static cell AMX_NATIVE_CALL n_strcmp(AMX *amx, cell *params)
{
- int len;
- char *str1 = get_amxstring(amx, params[1], 0, len);
- char *str2 = get_amxstring(amx, params[2], 1, len);
+ enum args { arg_count, arg_string1, arg_string2, arg_ignorecase };
- if (params[3])
- return stricmp(str1, str2);
- else
- return strcmp(str1, str2);
-}
+ auto string1Length = 0;
+ auto string2Length = 0;
-static cell AMX_NATIVE_CALL n_strncmp(AMX *amx, cell *params)
-{
- int len;
- char *str1 = get_amxstring(amx, params[1], 0, len);
- char *str2 = get_amxstring(amx, params[2], 1, len);
+ auto string1 = get_amxstring(amx, params[arg_string1], 0, string1Length);
+ auto string2 = get_amxstring(amx, params[arg_string2], 1, string2Length);
- if (params[4])
- return strncasecmp(str1, str2, (size_t)params[3]);
- else
- return strncmp(str1, str2, (size_t)params[3]);
-}
-
-static cell AMX_NATIVE_CALL n_strfind(AMX *amx, cell *params)
-{
- int len;
- char *str = get_amxstring(amx, params[1], 0, len);
- int sublen;
- char *sub = get_amxstring(amx, params[2], 1, sublen);
-
- bool igcase = params[3] ? true : false;
-
- if (igcase)
+ if (params[arg_ignorecase] != 0)
{
- for (int i = 0; i < len; i++)
- {
- if (str[i] & (1<<5))
- str[i] &= ~(1<<5);
- }
- for (int i = 0; i < sublen; i++)
- {
- if (str[i] & (1<<5))
- str[i] &= ~(1<<5);
- }
+ auto string1Folded = get_amxbuffer(2);
+ auto string2Folded = get_amxbuffer(3);
+
+ string1Length = utf8casefold(string1, string1Length, string1Folded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+ string2Length = utf8casefold(string2, string2Length, string2Folded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ string1Folded[string1Length] = '\0';
+ string2Folded[string2Length] = '\0';
+
+ string1 = string1Folded;
+ string2 = string2Folded;
}
- if (params[4] > len)
- return -1;
+ return strcmp(string1, string2);
+}
- char *find = strstr(str + params[4], sub);
+// native strncmp(const string1[], const string2[], num, bool:ignorecase = false);
+static cell AMX_NATIVE_CALL n_strncmp(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_string1, arg_string2, arg_numbytes, arg_ignorecase };
+
+ auto string1Length = 0;
+ auto string2Length = 0;
+
+ auto string1 = get_amxstring(amx, params[arg_string1], 0, string1Length);
+ auto string2 = get_amxstring(amx, params[arg_string2], 1, string2Length);
+
+ if (params[arg_ignorecase] != 0)
+ {
+ auto string1Folded = get_amxbuffer(2);
+ auto string2Folded = get_amxbuffer(3);
+
+ string1Length = utf8casefold(string1, string1Length, string1Folded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+ string2Length = utf8casefold(string2, string2Length, string2Folded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ string1Folded[string1Length] = '\0';
+ string2Folded[string2Length] = '\0';
+
+ string1 = string1Folded;
+ string2 = string2Folded;
+ }
+
+ return strncmp(string1, string2, params[arg_numbytes]);
+}
+
+// native strfind(const string[], const sub[], bool:ignorecase = false, pos = 0);
+static cell AMX_NATIVE_CALL n_strfind(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_source, arg_search, arg_ignorecase, arg_startpos };
+
+ auto sourceLength = 0;
+ auto searchLength = 0;
+
+ auto source = get_amxstring(amx, params[arg_source], 0, sourceLength);
+ auto search = get_amxstring(amx, params[arg_search], 1, searchLength);
+
+ if (params[arg_ignorecase] != 0)
+ {
+ auto sourceFolded = get_amxbuffer(2);
+ auto searchFolded = get_amxbuffer(3);
+
+ sourceLength = utf8casefold(source, sourceLength, sourceFolded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+ searchLength = utf8casefold(search, searchLength, searchFolded, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ sourceFolded[sourceLength] = '\0';
+ searchFolded[searchLength] = '\0';
+
+ source = sourceFolded;
+ search = searchFolded;
+ }
+
+ auto position = params[arg_startpos];
+
+ if (position < 0 || position > sourceLength)
+ {
+ return -1;
+ }
+
+ auto find = strstr(source + position, search);
if (!find)
+ {
return -1;
+ }
- return (find - str);
+ return (find - source);
}
static cell AMX_NATIVE_CALL vformat(AMX *amx, cell *params)
@@ -1424,6 +1612,60 @@ static cell AMX_NATIVE_CALL fmt(AMX *amx, cell *params)
return 1;
};
+// native mb_strtotitle(source[], maxlength = 0);
+static cell AMX_NATIVE_CALL mb_strtotitle(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_string, arg_maxlength };
+
+ auto sourceLength = 0;
+ auto source = get_amxstring(amx, params[arg_string], 0, sourceLength);
+
+ auto outputMaxLength = params[arg_maxlength];
+
+ if (outputMaxLength <= 0)
+ {
+ outputMaxLength = sourceLength;
+ }
+
+ auto output = get_amxbuffer(1);
+ auto outputLength = utf8totitle(source, sourceLength, output, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ output[outputLength] = '\0';
+
+ return set_amxstring_utf8(amx, params[arg_string], output, outputLength, outputMaxLength);
+}
+
+// native bool:is_string_category(const input[], input_size, flags, &output_size = 0);
+static cell AMX_NATIVE_CALL is_string_category(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_input, arg_inputsize, arg_flags, arg_outputsize };
+
+ auto inputLength = 0;
+ auto input = get_amxstring(amx, params[arg_input], 0, inputLength);
+
+ auto inputMaxLength = ke::Min(params[arg_inputsize], inputLength);
+ auto outputSize = get_amxaddr(amx, params[arg_outputsize]);
+
+ // User wants to check only one character whatever its size.
+ if (inputMaxLength <= 1)
+ {
+ // Gets the character length.
+ inputMaxLength = utf8seek(input, inputLength, input, 1, SEEK_CUR) - input;
+
+ // Truncated character.
+ if (inputMaxLength > inputLength)
+ {
+ *outputSize = 0;
+ return FALSE;
+ }
+ }
+
+ // Checks input with the given flags.
+ *outputSize = utf8iscategory(input, inputMaxLength, params[arg_flags]);
+
+ // If function consumed input, then it's a success.
+ return static_cast(*outputSize == inputMaxLength);
+}
AMX_NATIVE_INFO string_Natives[] =
{
@@ -1445,7 +1687,12 @@ AMX_NATIVE_INFO string_Natives[] =
{"is_char_upper", is_char_upper},
{"is_char_lower", is_char_lower},
{"is_char_mb", is_char_mb},
+ {"is_string_category", is_string_category },
{"get_char_bytes", get_char_bytes},
+ {"mb_strtotitle", mb_strtotitle},
+ {"mb_strtolower", mb_strtolower},
+ {"mb_strtoupper", mb_strtoupper},
+ {"mb_ucfirst", mb_ucfirst},
{"num_to_str", numtostr},
{"numtostr", numtostr},
{"parse", parse},
diff --git a/amxmodx/textparse.cpp b/amxmodx/textparse.cpp
index 7ad389de..9f4e062c 100644
--- a/amxmodx/textparse.cpp
+++ b/amxmodx/textparse.cpp
@@ -44,7 +44,12 @@ cell destroyParser(cell *handle)
// native SMCParser:SMC_CreateParser();
static cell AMX_NATIVE_CALL SMC_CreateParser(AMX *amx, cell *params)
{
- return createParser();
+ const auto handle = createParser();
+ const auto parseInfo = TextParsersHandles.lookup(handle);
+
+ parseInfo->handle = handle;
+
+ return handle;
}
// native SMC_SetParseStart(SMCParser:handle, const func[]);
@@ -224,7 +229,12 @@ static cell AMX_NATIVE_CALL SMC_DestroyParser(AMX *amx, cell *params)
// native INIParser:INI_CreateParser();
static cell AMX_NATIVE_CALL INI_CreateParser(AMX *amx, cell *params)
{
- return createParser();
+ const auto handle = createParser();
+ const auto parseInfo = TextParsersHandles.lookup(handle);
+
+ parseInfo->handle = handle;
+
+ return handle;
}
// native bool:INI_ParseFile(INIParser:handle, const file[], &line = 0, &col = 0, any:data = 0);
diff --git a/amxmodx/trie_natives.cpp b/amxmodx/trie_natives.cpp
index 713a9bdf..d22e0cc3 100644
--- a/amxmodx/trie_natives.cpp
+++ b/amxmodx/trie_natives.cpp
@@ -10,6 +10,7 @@
#include "trie_natives.h"
NativeHandle TrieHandles;
+NativeHandle TrieIterHandles;
NativeHandle TrieSnapshotHandles;
// native Trie:TrieCreate();
@@ -344,6 +345,18 @@ static cell AMX_NATIVE_CALL TrieDestroy(AMX *amx, cell *params)
return 0;
}
+ CellTrieIter *iter;
+ for (size_t index = 1; index <= TrieIterHandles.size(); index++)
+ {
+ if ((iter = TrieIterHandles.lookup(index)))
+ {
+ if (iter->trie == t)
+ {
+ iter->trie = nullptr;
+ }
+ }
+ }
+
if (TrieHandles.destroy(*ptr))
{
*ptr = 0;
@@ -469,6 +482,226 @@ static cell AMX_NATIVE_CALL TrieSnapshotDestroy(AMX *amx, cell *params)
return 0;
}
+
+#define CHECK_ITER_HANDLE(handle) \
+ if (!handle) { \
+ LogError(amx, AMX_ERR_NATIVE, "Invalid map iterator handle provided (%d)", params[arg_handle]); \
+ return 0; \
+ } \
+ if (!handle->trie) { \
+ LogError(amx, AMX_ERR_NATIVE, "Closed map iterator handle provided (%d)", params[arg_handle]); \
+ return 0; \
+ } \
+ if (handle->mod_count != handle->trie->map.mod_count()) { \
+ LogError(amx, AMX_ERR_NATIVE, "Outdated map iterator handle provided (%d)", params[arg_handle]);\
+ return 0; \
+ }
+
+// native TrieIter:TrieIterCreate(Trie:handle)
+static cell AMX_NATIVE_CALL TrieIterCreate(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle };
+
+ auto handle = TrieHandles.lookup(params[arg_handle]);
+
+ if (!handle)
+ {
+ LogError(amx, AMX_ERR_NATIVE, "Invalid map handle provided (%d)", params[arg_handle]);
+ return 0;
+ }
+
+ auto index = TrieIterHandles.create(handle);
+ auto iter = TrieIterHandles.lookup(index);
+
+ return static_cast(index);
+}
+
+// native bool:TrieIterEnded(TrieIter:handle)
+static cell AMX_NATIVE_CALL TrieIterEnded(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle };
+
+ auto handle = TrieIterHandles.lookup(params[arg_handle]);
+
+ CHECK_ITER_HANDLE(handle)
+
+ return handle->iter.empty();
+}
+
+// native TrieIterNext(TrieIter:handle)
+static cell AMX_NATIVE_CALL TrieIterNext(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle };
+
+ auto handle = TrieIterHandles.lookup(params[arg_handle]);
+
+ CHECK_ITER_HANDLE(handle)
+
+ if (handle->iter.empty())
+ {
+ return 0;
+ }
+
+ handle->iter.next();
+
+ return 1;
+}
+
+// native TrieIterGetKey(TrieIter:handle, key[], outputsize)
+static cell AMX_NATIVE_CALL TrieIterGetKey(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle, arg_output, arg_outputsize };
+
+ auto handle = TrieIterHandles.lookup(params[arg_handle]);
+
+ CHECK_ITER_HANDLE(handle)
+
+ auto& iter = handle->iter;
+
+ if (iter.empty())
+ {
+ *get_amxaddr(amx, params[arg_output]) = '\0';
+ return 0;
+ }
+
+ return set_amxstring_utf8(amx, params[arg_output], iter->key.chars(), iter->key.length(), params[arg_outputsize]);
+}
+
+// native TrieIterGetSize(TrieIter:handle)
+static cell AMX_NATIVE_CALL TrieIterGetSize(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle };
+
+ auto handle = TrieIterHandles.lookup(params[arg_handle]);
+
+ CHECK_ITER_HANDLE(handle)
+
+ return handle->trie->map.elements();
+}
+
+// native bool:TrieIterGetCell(TrieIter:handle, &any:value)
+static cell AMX_NATIVE_CALL TrieIterGetCell(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle, arg_outputvalue };
+
+ auto handle = TrieIterHandles.lookup(params[arg_handle]);
+
+ CHECK_ITER_HANDLE(handle)
+
+ auto& iter = handle->iter;
+
+ if (iter.empty() || !iter->value.isCell())
+ {
+ return false;
+ }
+
+ *get_amxaddr(amx, params[arg_outputvalue]) = iter->value.cell_();
+
+ return true;
+}
+
+// native bool:TrieIterGetString(TrieIter:handle, buffer[], outputsize, &size = 0)
+static cell AMX_NATIVE_CALL TrieIterGetString(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle, arg_output, arg_outputsize, arg_refsize };
+
+ auto handle = TrieIterHandles.lookup(params[arg_handle]);
+
+ CHECK_ITER_HANDLE(handle)
+
+ if (params[arg_outputsize] < 0)
+ {
+ LogError(amx, AMX_ERR_NATIVE, "Invalid buffer size (%d)", params[arg_outputsize]);
+ return 0;
+ }
+
+ auto& iter = handle->iter;
+
+ if (iter.empty() || !iter->value.isString())
+ {
+ return false;
+ }
+
+ auto refsize = get_amxaddr(amx, params[arg_refsize]);
+
+ *refsize = set_amxstring_utf8(amx, params[arg_output], iter->value.chars(), strlen(iter->value.chars()), params[arg_outputsize]);
+
+ return true;
+}
+
+// native bool:TrieIterGetArray(TrieIter:handle, array[], outputsize, &size = 0)
+static cell AMX_NATIVE_CALL TrieIterGetArray(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle, arg_output, arg_outputsize, arg_refsize };
+
+ auto handle = TrieIterHandles.lookup(params[arg_handle]);
+
+ CHECK_ITER_HANDLE(handle)
+
+ auto outputSize = params[arg_outputsize];
+
+ if (outputSize < 0)
+ {
+ LogError(amx, AMX_ERR_NATIVE, "Invalid array size (%d)", params[arg_outputsize]);
+ return 0;
+ }
+
+ auto& iter = handle->iter;
+
+ if (iter.empty() || !iter->value.isArray())
+ {
+ return false;
+ }
+
+ auto pOutput = get_amxaddr(amx, params[arg_output]);
+ auto pSize = get_amxaddr(amx, params[arg_refsize]);
+
+ if (!iter->value.array() || !outputSize)
+ {
+ *pSize = 0;
+ return false;
+ }
+
+ auto length = iter->value.arrayLength();
+ auto base = iter->value.array();
+
+ if (length > size_t(outputSize))
+ {
+ length = outputSize;
+ }
+
+ *pSize = length;
+
+ memcpy(pOutput, base, sizeof(cell) * length);
+
+ return true;
+}
+
+// native TrieIterDestroy(&TrieIter:handle)
+static cell AMX_NATIVE_CALL TrieIterDestroy(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_handle };
+
+ auto refhandle = get_amxaddr(amx, params[arg_handle]);
+ auto handle = TrieIterHandles.lookup(*refhandle);
+
+ if (!handle)
+ {
+ return false;
+ }
+
+ handle->trie = nullptr;
+
+ if (TrieIterHandles.destroy(*refhandle))
+ {
+ *refhandle = 0;
+ return true;
+ }
+
+ return false;
+}
+
+
AMX_NATIVE_INFO trie_Natives[] =
{
{ "TrieCreate" , TrieCreate },
@@ -493,6 +726,16 @@ AMX_NATIVE_INFO trie_Natives[] =
{ "TrieSnapshotGetKey" , TrieSnapshotGetKey },
{ "TrieSnapshotDestroy" , TrieSnapshotDestroy },
+ { "TrieIterCreate" , TrieIterCreate },
+ { "TrieIterEnded" , TrieIterEnded },
+ { "TrieIterNext" , TrieIterNext },
+ { "TrieIterGetKey" , TrieIterGetKey },
+ { "TrieIterGetSize" , TrieIterGetSize },
+ { "TrieIterGetCell" , TrieIterGetCell },
+ { "TrieIterGetString" , TrieIterGetString },
+ { "TrieIterGetArray" , TrieIterGetArray },
+ { "TrieIterDestroy" , TrieIterDestroy },
+
{ nullptr , nullptr}
};
diff --git a/amxmodx/trie_natives.h b/amxmodx/trie_natives.h
index 695d72a5..c600b14d 100644
--- a/amxmodx/trie_natives.h
+++ b/amxmodx/trie_natives.h
@@ -14,6 +14,7 @@
#include
#include
#include "natives_handles.h"
+#include
enum EntryType
{
@@ -138,9 +139,128 @@ private:
cell data_;
};
+
+template
+class StringHashMapCustom
+{
+ typedef StringHashMap Internal;
+
+public:
+ StringHashMapCustom() : mod_count_(0)
+ {}
+
+public:
+ typedef typename Internal::Result Result;
+ typedef typename Internal::Insert Insert;
+ typedef typename Internal::iterator iterator;
+
+public:
+ size_t elements() const
+ {
+ return internal_.elements();
+ }
+
+ iterator iter()
+ {
+ return internal_.iter();
+ }
+
+ bool contains(const char *aKey)
+ {
+ return internal_.contains(aKey);
+ }
+
+ bool replace(const char *aKey, const T &value)
+ {
+ return internal_.contains(aKey, value);
+ }
+
+ bool insert(const char *aKey, const T &value)
+ {
+ if (internal_.insert(aKey, value))
+ {
+ mod_count_++;
+ return true;
+ }
+ return false;
+ }
+
+ bool remove(const char *aKey)
+ {
+ if (internal_.remove(aKey))
+ {
+ mod_count_++;
+ return true;
+ }
+ return false;
+ }
+
+ void clear()
+ {
+ mod_count_++;
+ internal_.clear();
+ }
+
+ void remove(Result &r)
+ {
+ mod_count_++;
+ internal_.remove(r);
+ }
+
+ Result find(const char *aKey)
+ {
+ return internal_.find(aKey);
+ }
+
+ Insert findForAdd(const char *aKey)
+ {
+ return internal_.findForAdd(aKey);
+ }
+
+ bool add(Insert &i, const char *aKey)
+ {
+ if (internal_.add(i, aKey))
+ {
+ mod_count_++;
+ return true;
+ }
+ return false;
+ }
+
+ bool add(Insert &i)
+ {
+ if (internal_.add(i))
+ {
+ mod_count_++;
+ return true;
+ }
+ return false;
+ }
+
+public:
+ size_t mod_count() const
+ {
+ return mod_count_;
+ }
+
+private:
+ Internal internal_;
+ size_t mod_count_;
+};
+
struct CellTrie
{
- StringHashMap map;
+ StringHashMapCustom map;
+};
+
+struct CellTrieIter
+{
+ CellTrieIter(CellTrie *_trie) : trie(_trie), iter(_trie->map.iter()), mod_count(_trie->map.mod_count())
+ {}
+
+ CellTrie *trie;
+ StringHashMapCustom::iterator iter;
+ size_t mod_count;
};
struct TrieSnapshot
@@ -160,6 +280,7 @@ struct TrieSnapshot
};
extern NativeHandle TrieHandles;
+extern NativeHandle TrieIterHandles;
extern NativeHandle TrieSnapshotHandles;
extern AMX_NATIVE_INFO trie_Natives[];
diff --git a/amxmodx/util.cpp b/amxmodx/util.cpp
index e1c76025..8b3713dc 100755
--- a/amxmodx/util.cpp
+++ b/amxmodx/util.cpp
@@ -9,6 +9,7 @@
#include
#include "amxmodx.h"
+#include
int UTIL_ReadFlags(const char* c)
{
@@ -372,8 +373,8 @@ void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1,
{
if ((*aa).matchCommandLine(cmd, arg1) && (*aa).getPlugin()->isExecutable((*aa).getFunction()))
{
- if (executeForwards((*aa).getFunction(), static_cast(GET_PLAYER_POINTER(pEdict)->index)),
- static_cast((*aa).getFlags()), static_cast((*aa).getId()) > 0)
+ if (executeForwards((*aa).getFunction(), static_cast(GET_PLAYER_POINTER(pEdict)->index),
+ static_cast((*aa).getFlags()), static_cast((*aa).getId())) > 0)
{
g_fakecmd.notify = false;
return;
@@ -454,11 +455,38 @@ int UTIL_CheckValidChar(D *c)
return 0;
}
-unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
-{
- size_t searchLen = strlen(search);
- size_t replaceLen = strlen(replace);
+static char OutputBuffer1[MAX_BUFFER_LENGTH];
+static char OutputBuffer2[MAX_BUFFER_LENGTH];
+char* utf8stristr(const char *string1, const char *string2)
+{
+ auto string1Length = utf8casefold(string1, strlen(string1), OutputBuffer1, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+ auto string2Length = utf8casefold(string2, strlen(string2), OutputBuffer2, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ OutputBuffer1[string1Length] = '\0';
+ OutputBuffer2[string2Length] = '\0';
+
+ return strstr(OutputBuffer1, OutputBuffer2);
+}
+
+int utf8strncasecmp(const char *string1, const char *string2, size_t n)
+{
+ auto string1Length = utf8casefold(string1, strlen(string1), OutputBuffer1, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+ auto string2Length = utf8casefold(string2, strlen(string2), OutputBuffer2, MAX_BUFFER_LENGTH - 1, UTF8_LOCALE_DEFAULT, nullptr, TRUE);
+
+ OutputBuffer1[string1Length] = '\0';
+ OutputBuffer2[string2Length] = '\0';
+
+ return n != 0 ? strncmp(OutputBuffer1, OutputBuffer2, n) : strcmp(OutputBuffer1, OutputBuffer2);
+}
+
+int utf8strcasecmp(const char *string1, const char *string2)
+{
+ return utf8strncasecmp(string1, string2, 0);
+}
+
+size_t UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, size_t searchLen, const char *replace, size_t replaceLen, bool caseSensitive)
+{
char *newptr, *ptr = subject;
unsigned int total = 0;
while ((newptr = UTIL_ReplaceEx(ptr, maxlength, search, searchLen, replace, replaceLen, caseSensitive)) != NULL)
@@ -476,9 +504,15 @@ unsigned int UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search
return total;
}
-template unsigned int strncopy(char *, const char *src, size_t count);
-template unsigned int strncopy(cell *, const char *src, size_t count);
-template unsigned int strncopy(cell *, const cell *src, size_t count);
+size_t UTIL_ReplaceAll(char *subject, size_t maxlength, const char *search, const char *replace, bool caseSensitive)
+{
+ return UTIL_ReplaceAll(subject, maxlength, search, strlen(search), replace, strlen(replace), caseSensitive);
+}
+
+template unsigned int strncopy(char *, const char *, size_t);
+template unsigned int strncopy(char *, const cell *, size_t);
+template unsigned int strncopy(cell *, const char *, size_t);
+template unsigned int strncopy(cell *, const cell *, size_t);
template
unsigned int strncopy(D *dest, const S *src, size_t count)
@@ -533,7 +567,7 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se
/* If the search matches and the replace length is 0,
* we can just terminate the string and be done.
*/
- if ((caseSensitive ? strcmp(subject, search) : strcasecmp(subject, search)) == 0 && replaceLen == 0)
+ if ((caseSensitive ? strcmp(subject, search) : utf8strcasecmp(subject, search)) == 0 && replaceLen == 0)
{
*subject = '\0';
return subject;
@@ -550,7 +584,7 @@ char *UTIL_ReplaceEx(char *subject, size_t maxLen, const char *search, size_t se
while (*ptr != '\0' && (browsed <= textLen - searchLen))
{
/* See if we get a comparison */
- if ((caseSensitive ? strncmp(ptr, search, searchLen) : strncasecmp(ptr, search, searchLen)) == 0)
+ if ((caseSensitive ? strncmp(ptr, search, searchLen) : utf8strncasecmp(ptr, search, searchLen)) == 0)
{
if (replaceLen > searchLen)
{
diff --git a/amxmodx/version.rc b/amxmodx/version.rc
index 96b2228f..de953efa 100755
--- a/amxmodx/version.rc
+++ b/amxmodx/version.rc
@@ -6,13 +6,7 @@
// Generated from the TEXTINCLUDE 2 resource.
//
#include
-#if defined AMBUILD
-# include
-#else
-# define SVN_VERSION_DWORD 1, 8, 3, 0
-# define SVN_VERSION_STRING "dev-local"
-# define SVN_VERSION SVN_VERSION_STRING
-#endif
+#include
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
@@ -32,8 +26,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION SVN_VERSION_DWORD
- PRODUCTVERSION SVN_VERSION_DWORD
+ FILEVERSION AMXX_VERSION_FILE
+ PRODUCTVERSION AMXX_VERSION_FILE
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -50,12 +44,12 @@ BEGIN
BEGIN
VALUE "Comments", "AMX Mod X"
VALUE "FileDescription", "AMX Mod X"
- VALUE "FileVersion", SVN_VERSION_STRING
+ VALUE "FileVersion", AMXX_VERSION_STRING
VALUE "InternalName", "amxmodx"
VALUE "LegalCopyright", "Copyright (c) 2004-2015, AMX Mod X Dev Team"
VALUE "OriginalFilename", "amxmodx_mm.dll"
VALUE "ProductName", "AMX Mod X"
- VALUE "ProductVersion", SVN_VERSION
+ VALUE "ProductVersion", AMXX_VERSION_STRING
END
END
BLOCK "VarFileInfo"
diff --git a/appveyor.yml b/appveyor.yml
index 4dc0588d..087c775f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -3,16 +3,30 @@ clone_folder: c:\projects\amxmodx
install:
- git submodule update --init --recursive
- 'c:'
+- mkdir c:\nasm
+- set PATH=c:\nasm\nasm-2.13.03;%PATH%
+- curl -L -o "c:\nasm\nasm.zip" https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/win32/nasm-2.13.03-win32.zip
+- chdir c:\nasm
+- 7z x nasm.zip
- chdir c:\projects
- git clone https://github.com/alliedmodders/ambuild
- git clone https://github.com/alliedmodders/metamod-hl1
- git clone https://github.com/alliedmodders/hlsdk
-- cd ambuild
+- ps: Start-FileDownload 'https://downloads.mysql.com/archives/get/file/mysql-connector-c-6.1.1-win32.zip'
+- 7z x mysql-connector-c-6.1.1-win32.zip -o"mysql"
+- cd mysql
+- dir
+- ren mysql-connector-c-6.1.1-win32 mysql-5.5
+- move /Y mysql-5.5 ..\
+- cd ..\ambuild
- c:\python27\python setup.py install
- cd ..\amxmodx
+cache:
+ - c:\projects\*.zip -> appveyor.yml
+ - c:\projects\mysql-5.5 -> appveyor.yml
build_script:
-- '"%VS120COMNTOOLS%\vsvars32.bat"'
+- '"%VS140COMNTOOLS%\vsvars32.bat"'
- mkdir build
- cd build
-- c:\python27\python ../configure.py --enable-optimize --no-mysql
-- c:\python27\scripts\ambuild
\ No newline at end of file
+- c:\python27\python ../configure.py --enable-optimize --nasm="C:\nasm\nasm-2.13.03\nasm.exe"
+- c:\python27\scripts\ambuild
diff --git a/compiler/amxxpc/amxxpc.cpp b/compiler/amxxpc/amxxpc.cpp
index 3c6833de..ba227344 100755
--- a/compiler/amxxpc/amxxpc.cpp
+++ b/compiler/amxxpc/amxxpc.cpp
@@ -65,7 +65,7 @@ int main(int argc, char **argv)
# else
printf("compiler failed to instantiate: %d\n", GetLastError());
# endif
- exit(0);
+ exit(EXIT_FAILURE);
}
COMPILER sc32 = (COMPILER)dlsym(lib, "Compile32");
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
#else
printf("compiler failed to link: %d.\n", GetLastError());
#endif
- exit(0);
+ exit(EXIT_FAILURE);
}
pc_printf("AMX Mod X Compiler %s\n", AMXX_VERSION);
@@ -91,7 +91,7 @@ int main(int argc, char **argv)
pc_printf("Usage: [options]\n");
pc_printf("Use -? or --help to see full options\n\n");
getchar();
- exit(0);
+ exit(EXIT_FAILURE);
}
if (!strcmp(argv[1], "-?") || !strcmp(argv[1], "--help"))
@@ -99,7 +99,7 @@ int main(int argc, char **argv)
show_help();
pc_printf("Press any key to continue.\n");
getchar();
- exit(0);
+ exit(EXIT_SUCCESS);
}
sc32(argc, argv);
@@ -109,16 +109,16 @@ int main(int argc, char **argv)
if (file == NULL)
{
pc_printf("Could not locate the output file.\n");
- exit(0);
+ exit(EXIT_FAILURE);
} else if (strstr(file, ".asm")) {
pc_printf("Assembler output succeeded.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
} else {
FILE *fp = fopen(file, "rb");
if (fp == NULL)
{
pc_printf("Could not locate output file %s (compile failed).\n", file);
- exit(0);
+ exit(EXIT_FAILURE);
}
ReadFileIntoPl(&pl32, fp);
pl32.cellsize = 4;
@@ -142,7 +142,7 @@ int main(int argc, char **argv)
if (!fp)
{
pc_printf("Error trying to write file %s.\n", newfile);
- exit(0);
+ exit(EXIT_FAILURE);
}
BinPlugin bh32;
@@ -179,7 +179,7 @@ int main(int argc, char **argv)
#if !defined EMSCRIPTEN
dlclose(lib);
#endif
- exit(0);
+ exit(EXIT_FAILURE);
}
fclose(fp);
@@ -195,7 +195,7 @@ int main(int argc, char **argv)
dlclose(lib);
#endif
- exit(0);
+ exit(EXIT_SUCCESS);
}
void WriteBh(BinaryWriter *bw, BinPlugin *bh)
@@ -228,7 +228,7 @@ bool CompressPl(abl *pl)
if (err != Z_OK)
{
pc_printf("internal error - compression failed on first pass: %d\n", err);
- exit(0);
+ exit(EXIT_FAILURE);
}
return true;
diff --git a/compiler/amxxpc/amxxpc.vcxproj b/compiler/amxxpc/amxxpc.vcxproj
index 6d25c7a1..a9061c7f 100644
--- a/compiler/amxxpc/amxxpc.vcxproj
+++ b/compiler/amxxpc/amxxpc.vcxproj
@@ -55,29 +55,28 @@
Disabled
- WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; AMX_ANSIONLY;%(PreprocessorDefinitions)
+ _MBCS;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; AMX_ANSIONLY;%(PreprocessorDefinitions)
true
- EnableFastChecks
MultiThreaded
false
Level3
- EditAndContinue
+ ProgramDatabase
..\..\public;..\..\third_party;..\..\third_party\zlib;..\..\amxmodx\;C:\Program Files (x86)\Visual Leak Detector\include;%(AdditionalIncludeDirectories)
%(AdditionalDependencies)
true
- $(OutDir)amxxpc.pdb
Console
MachineX86
- LIBCMT;%(IgnoreSpecificDefaultLibraries)
+
+
- WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; AMX_ANSIONLY;%(PreprocessorDefinitions)
+ _MBCS;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; AMX_ANSIONLY;%(PreprocessorDefinitions)
MultiThreaded
Default
false
diff --git a/compiler/libpc300/sc.h b/compiler/libpc300/sc.h
index f0881bde..fd3d269a 100755
--- a/compiler/libpc300/sc.h
+++ b/compiler/libpc300/sc.h
@@ -54,7 +54,7 @@
#define CTRL_CHAR '^' /* default control character */
#define sCHARBITS 8 /* size of a packed character */
-#define sDIMEN_MAX 3 /* maximum number of array dimensions */
+#define sDIMEN_MAX 4 /* maximum number of array dimensions */
#define sLINEMAX 4095 /* input line length (in characters) */
#define sCOMP_STACK 32 /* maximum nesting of #if .. #endif sections */
#define sDEF_LITMAX 500 /* initial size of the literal pool, in "cells" */
@@ -280,6 +280,12 @@ typedef struct s_stringpair {
char *documentation;
} stringpair;
+typedef struct s_valuepair {
+ struct s_valuepair *next;
+ long first;
+ long second;
+} valuepair;
+
/* macros for code generation */
#define opcodes(n) ((n)*sizeof(cell)) /* opcode size */
#define opargs(n) ((n)*sizeof(cell)) /* size of typical argument */
@@ -521,6 +527,10 @@ SC_FUNC symbol *add_constant(char *name,cell val,int vclass,int tag);
SC_FUNC void exporttag(int tag);
SC_FUNC void sc_attachdocumentation(symbol *sym);
SC_FUNC int get_actual_compound(symbol *sym);
+#if !defined NO_DEFINE
+SC_FUNC void inst_file_name(char* filename, int strip_path);
+#endif
+
/* function prototypes in SC2.C */
#define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); }
@@ -696,6 +706,9 @@ SC_FUNC void delete_docstringtable(void);
SC_FUNC stringlist *insert_autolist(char *string);
SC_FUNC char *get_autolist(int index);
SC_FUNC void delete_autolisttable(void);
+SC_FUNC valuepair *push_heaplist(long first, long second);
+SC_FUNC int popfront_heaplist(long *first, long *second);
+SC_FUNC void delete_heaplisttable(void);
SC_FUNC stringlist *insert_dbgfile(const char *filename);
SC_FUNC stringlist *insert_dbgline(int linenr);
SC_FUNC stringlist *insert_dbgsymbol(symbol *sym);
@@ -722,8 +735,6 @@ int mfputs(MEMFILE *mf,char *string);
SC_FUNC int cp_path(const char *root,const char *directory);
SC_FUNC int cp_set(const char *name);
SC_FUNC cell cp_translate(const unsigned char *string,const unsigned char **endptr);
-SC_FUNC cell get_utf8_char(const unsigned char *string,const unsigned char **endptr);
-SC_FUNC int scan_utf8(FILE *fp,const char *filename);
/* function prototypes in SCSTATE.C */
SC_FUNC constvalue *automaton_add(const char *name);
@@ -799,7 +810,6 @@ SC_VDECL int sc_status; /* read/write status */
SC_VDECL int sc_rationaltag; /* tag for rational numbers */
SC_VDECL int rational_digits; /* number of fractional digits */
SC_VDECL int sc_allowproccall;/* allow/detect tagnames in lex() */
-SC_VDECL short sc_is_utf8; /* is this source file in UTF-8 encoding */
SC_VDECL char *pc_deprecate; /* if non-NULL, mark next declaration as deprecated */
SC_VDECL int sc_warnings_are_errors;
diff --git a/compiler/libpc300/sc1.c b/compiler/libpc300/sc1.c
index b039e801..66af30d4 100755
--- a/compiler/libpc300/sc1.c
+++ b/compiler/libpc300/sc1.c
@@ -408,11 +408,47 @@ void inst_datetime_defines()
insert_subst("__TIME__", ltime, 8);
}
+void inst_file_name(char *file, int strip_path)
+{
+ char newname[_MAX_PATH];
+ char *fileptr;
+
+ fileptr = NULL;
+
+ if (strip_path) {
+ size_t i, len;
+ int slashchar;
+
+ len = strlen(file);
+ for (i = len - 1; i < len; i--)
+ {
+ slashchar = file[i] == '/';
+ #if defined WIN32 || defined _WIN32
+ slashchar = slashchar || file[i] == '\\';
+ #endif
+ if (slashchar)
+ {
+ fileptr = &file[i + 1];
+ break;
+ }
+ }
+ }
+
+ if (fileptr == NULL) {
+ fileptr = file;
+ }
+
+ snprintf(newname, sizeof(newname), "\"%s\"", fileptr);
+
+ insert_subst("__FILE__", newname, 8);
+}
+
+
static void inst_binary_name(char *binfname)
{
size_t i, len;
char *binptr;
- char newpath[512], newname[512];
+ char newname[_MAX_PATH];
int slashchar;
binptr = NULL;
@@ -435,11 +471,9 @@ static void inst_binary_name(char *binfname)
binptr = binfname;
}
- snprintf(newpath, sizeof(newpath), "\"%s\"", binfname);
snprintf(newname, sizeof(newname), "\"%s\"", binptr);
- insert_subst("__BINARY_PATH__", newpath, 15);
- insert_subst("__BINARY_NAME__", newname, 15);
+ insert_subst("__BINARY__", newname, 10);
}
/* "main" of the compiler
@@ -594,10 +628,12 @@ int pc_compile(int argc, char *argv[])
/* reset "defined" flag of all functions and global variables */
reduce_referrers(&glbtab);
delete_symbols(&glbtab,0,TRUE,FALSE);
+ delete_heaplisttable();
#if !defined NO_DEFINE
delete_substtable();
inst_datetime_defines();
inst_binary_name(binfname);
+ inst_file_name(inpfname, TRUE);
#endif
resetglobals();
sc_ctrlchar=sc_ctrlchar_org;
@@ -663,6 +699,7 @@ int pc_compile(int argc, char *argv[])
delete_substtable();
inst_datetime_defines();
inst_binary_name(binfname);
+ inst_file_name(inpfname, TRUE);
#endif
resetglobals();
sc_ctrlchar=sc_ctrlchar_org;
@@ -769,6 +806,7 @@ cleanup:
free(sc_documentation);
#endif
delete_autolisttable();
+ delete_heaplisttable();
if (errnum!=0) {
if (strlen(errfname)==0)
pc_printf("\n%d Error%s.\n",errnum,(errnum>1) ? "s" : "");
@@ -2134,53 +2172,48 @@ static cell calc_arraysize(int dim[],int numdim,int cur)
return dim[cur]+(dim[cur]*calc_arraysize(dim,numdim,cur+1));
}
-static cell adjust_indirectiontables(int dim[],int numdim,int cur,cell increment,
- int startlit,constvalue *lastdim,int *skipdim)
+static void adjust_indirectiontables(int dim[],int numdim,int startlit,
+ constvalue *lastdim,int *skipdim)
{
static int base;
- int d;
+ int cur;
+ int i,d;
cell accum;
+ cell size;
- assert(cur>=0 && cur=0);
- assert(cur>0 && startlit==-1 || startlit>=0 && startlit<=litidx);
- if (cur==0)
- base=startlit;
- if (cur==numdim-1)
- return 0;
- /* 2 or more dimensions left, fill in an indirection vector */
- assert(dim[cur]>0);
- if (dim[cur+1]>0) {
- for (d=0; dnext; d<*skipdim; d++,ld=ld->next) {
- assert(ld!=NULL);
- } /* for */
- for (d=0; dname,NULL,16)==d);
- litq[base++]=(dim[cur]+accum+increment) * sizeof(cell);
- accum+=ld->value-1;
- *skipdim+=1;
- ld=ld->next;
- } /* for */
- } /* if */
- /* create the indirection tables for the lower level */
- if (cur+2=0 && startlit<=litidx);
+ base=startlit;
+ size=1;
+ for (cur=0; cur0) {
+ for (i=0; inext; d<*skipdim; d++,ld=ld->next) {
+ assert(ld!=NULL);
+ } /* for */
+ for (d=0; dname,NULL,16)==d);
+ litq[base++]=(size*dim[cur]+accum) * sizeof(cell);
+ accum+=ld->value-1;
+ *skipdim+=1;
+ ld=ld->next;
+ } /* for */
+ } /* for */
+ } /* if */
+ size*=dim[cur];
+ } /* for */
}
/* initials
@@ -2238,7 +2271,7 @@ static void initials2(int ident,int tag,cell *size,int dim[],int numdim,
for (tablesize=calc_arraysize(dim,numdim-1,0); tablesize>0; tablesize--)
litadd(0);
if (dim[numdim-1]!=0) /* error 9 has already been given */
- adjust_indirectiontables(dim,numdim,0,0,curlit,NULL,NULL);
+ adjust_indirectiontables(dim,numdim,curlit,NULL,NULL);
} /* if */
return;
} /* if */
@@ -2304,7 +2337,7 @@ static void initials2(int ident,int tag,cell *size,int dim[],int numdim,
* of the array and we can properly adjust the indirection vectors
*/
if (err==0)
- adjust_indirectiontables(dim,numdim,0,0,curlit,&lastdim,&skipdim);
+ adjust_indirectiontables(dim,numdim,curlit,&lastdim,&skipdim);
delete_consttable(&lastdim); /* clear list of minor dimension sizes */
} /* if */
} /* if */
@@ -5334,7 +5367,7 @@ static void doreturn(void)
/* "return " */
if ((rettype & uRETNONE)!=0)
error(78); /* mix "return;" and "return value;" */
- ident=doexpr(TRUE,FALSE,TRUE,TRUE,&tag,&sym,TRUE);
+ ident=doexpr(TRUE,FALSE,TRUE,FALSE,&tag,&sym,TRUE);
needtoken(tTERM);
if (ident == iARRAY && sym == NULL) {
/* returning a literal string is not supported (it must be a variable) */
@@ -5419,6 +5452,16 @@ static void doreturn(void)
/* nothing */;
sub=addvariable(curfunc->name,(argcount+3)*sizeof(cell),iREFARRAY,sGLOBAL,curfunc->tag,dim,numdim,idxtag);
sub->parent=curfunc;
+ /* Function that returns array can be used before it is defined, so at
+ * the call point (if it is before definition) we may not know if this
+ * function returns array and what is its size (for example inside the
+ * conditional operator), so we don't know how many cells on the heap
+ * we need. Calculating heap consumption is required for the fix of
+ * incorrect heap deallocation on conditional operator. That's why we
+ * need an additional pass.
+ */
+ if ((curfunc->usage & uREAD)!=0)
+ sc_reparse=TRUE;
} /* if */
/* get the hidden parameter, copy the array (the array is on the heap;
* it stays on the heap for the moment, and it is removed -usually- at
@@ -5495,7 +5538,7 @@ static void doexit(void)
int tag=0;
if (matchtoken(tTERM)==0){
- doexpr(TRUE,FALSE,FALSE,TRUE,&tag,NULL,TRUE);
+ doexpr(TRUE,FALSE,FALSE,FALSE,&tag,NULL,TRUE);
needtoken(tTERM);
} else {
ldconst(0,sPRI);
@@ -5511,7 +5554,7 @@ static void dosleep(void)
int tag=0;
if (matchtoken(tTERM)==0){
- doexpr(TRUE,FALSE,FALSE,TRUE,&tag,NULL,TRUE);
+ doexpr(TRUE,FALSE,FALSE, FALSE,&tag,NULL,TRUE);
needtoken(tTERM);
} else {
ldconst(0,sPRI);
diff --git a/compiler/libpc300/sc2.c b/compiler/libpc300/sc2.c
index 90bc1c27..5d7b6a84 100755
--- a/compiler/libpc300/sc2.c
+++ b/compiler/libpc300/sc2.c
@@ -152,7 +152,6 @@ static char *extensions[] = { ".inc", ".p", ".pawn" };
PUSHSTK_I(iflevel);
assert(!SKIPPING);
assert(skiplevel==iflevel); /* these two are always the same when "parsing" */
- PUSHSTK_I(sc_is_utf8);
PUSHSTK_I(icomment);
PUSHSTK_I(fcurrent);
PUSHSTK_I(fline);
@@ -169,7 +168,6 @@ static char *extensions[] = { ".inc", ".p", ".pawn" };
assert(sc_status == statFIRST || strcmp(get_inputfile(fcurrent), inpfname) == 0);
setfiledirect(inpfname); /* (optionally) set in the list file */
listline=-1; /* force a #line directive when changing the file */
- sc_is_utf8=(short)scan_utf8(inpf,name);
return TRUE;
}
@@ -270,6 +268,11 @@ static void doinclude(int silent)
result=plungefile(name,(c!='>'),TRUE);
if (!result && !silent)
error(100,name); /* cannot read from ... (fatal error) */
+#if !defined NO_DEFINE
+ if (result) {
+ inst_file_name(name, FALSE);
+ }
+#endif
}
/* readline
@@ -314,7 +317,6 @@ static void readline(unsigned char *line)
fline=i;
fcurrent=(short)POPSTK_I();
icomment=(short)POPSTK_I();
- sc_is_utf8=(short)POPSTK_I();
iflevel=(short)POPSTK_I();
skiplevel=iflevel; /* this condition held before including the file */
assert(!SKIPPING); /* idem ditto */
@@ -324,6 +326,9 @@ static void readline(unsigned char *line)
inpf=(FILE *)POPSTK_P();
insert_dbgfile(inpfname);
setfiledirect(inpfname);
+#if !defined NO_DEFINE
+ inst_file_name(inpfname, TRUE);
+#endif
assert(sc_status==statFIRST || strcmp(get_inputfile(fcurrent),inpfname)==0);
listline=-1; /* force a #line directive when changing the file */
} /* if */
@@ -595,13 +600,6 @@ static int htoi(cell *val,const unsigned char *curptr)
return (int)(ptr-curptr);
}
-#if defined __APPLE__
-static double pow10(double d)
-{
- return pow(10, d);
-}
-#endif
-
/* ftoi
*
* Attempts to interpret a numeric symbol as a rational number, either as
@@ -677,11 +675,7 @@ static int ftoi(cell *val,const unsigned char *curptr)
exp=(exp*10)+(*ptr-'0');
ptr++;
} /* while */
- #if defined __GNUC__
- fmult=pow10(exp*sign);
- #else
- fmult=pow(10,exp*sign);
- #endif
+ fmult=pow(10,exp*sign);
fnum *= fmult;
dnum *= (unsigned long)(fmult+0.5);
} /* if */
@@ -972,8 +966,14 @@ static int command(void)
if (strlen(pathname)>0) {
free(inpfname);
inpfname=duplicatestring(pathname);
- if (inpfname==NULL)
+ if (inpfname==NULL) {
error(103); /* insufficient memory */
+ }
+#if !defined NO_DEFINE
+ else {
+ inst_file_name(inpfname, TRUE);
+ }
+#endif
} /* if */
} /* if */
check_empty(lptr);
@@ -2381,21 +2381,12 @@ static cell litchar(const unsigned char **lptr,int flags)
cptr=*lptr;
if ((flags & RAWMODE)!=0 || *cptr!=sc_ctrlchar) { /* no escape character */
- #if !defined NO_UTF8
- if (sc_is_utf8 && (flags & UTF8MODE)!=0) {
- c=get_utf8_char(cptr,&cptr);
- assert(c>=0); /* file was already scanned for conformance to UTF-8 */
- } else {
- #endif
#if !defined NO_CODEPAGE
c=cp_translate(cptr,&cptr);
#else
c=*cptr;
cptr+=1;
#endif
- #if !defined NO_UTF8
- } /* if */
- #endif
} else {
cptr+=1;
if (*cptr==sc_ctrlchar) {
diff --git a/compiler/libpc300/sc3.c b/compiler/libpc300/sc3.c
old mode 100755
new mode 100644
index d9c482a6..f54bdb85
--- a/compiler/libpc300/sc3.c
+++ b/compiler/libpc300/sc3.c
@@ -1010,38 +1010,60 @@ static int hier13(value *lval)
{
int lvalue=plnge1(hier12,lval);
if (matchtoken('?')) {
+ int locheap=decl_heap; /* save current heap delta */
+ long heap1,heap2; /* max. heap delta either branch */
+ valuepair *heaplist_node;
int flab1=getlabel();
int flab2=getlabel();
value lval2 = {0};
int array1,array2;
- int orig_heap=decl_heap;
- int diff1=0,diff2=0;
if (lvalue) {
rvalue(lval);
} else if (lval->ident==iCONSTEXPR) {
ldconst(lval->constval,sPRI);
error(lval->constval ? 206 : 205); /* redundant test */
} /* if */
+ if (sc_status==statFIRST) {
+ /* We should push a new node right now otherwise we will pop it in the
+ * wrong order on the write stage.
+ */
+ heaplist_node=push_heaplist(0,0); /* save the pointer to write the actual data later */
+ } else if (sc_status==statWRITE || sc_status==statSKIP) {
+ #if !defined NDEBUG
+ int result=
+ #endif
+ popfront_heaplist(&heap1,&heap2);
+ assert(result); /* pop off equally many items than were pushed */
+ } /* if */
jmp_eq0(flab1); /* go to second expression if primary register==0 */
PUSHSTK_I(sc_allowtags);
sc_allowtags=FALSE; /* do not allow tagnames here (colon is a special token) */
+ if (sc_status==statWRITE) {
+ modheap(heap1*sizeof(cell));
+ decl_heap+=heap1; /* equilibrate the heap (see comment below) */
+ } /* if */
if (hier13(lval))
rvalue(lval);
if (lval->ident==iCONSTEXPR) /* load constant here */
ldconst(lval->constval,sPRI);
sc_allowtags=(short)POPSTK_I(); /* restore */
+ heap1=decl_heap-locheap; /* save heap space used in "true" branch */
+ assert(heap1>=0);
+ decl_heap=locheap; /* restore heap delta */
jumplabel(flab2);
setlabel(flab1);
- if (orig_heap!=decl_heap) {
- diff1=abs(decl_heap-orig_heap);
- decl_heap=orig_heap;
- }
needtoken(':');
+ if (sc_status==statWRITE) {
+ modheap(heap2*sizeof(cell));
+ decl_heap+=heap2; /* equilibrate the heap (see comment below) */
+ } /* if */
if (hier13(&lval2))
rvalue(&lval2);
if (lval2.ident==iCONSTEXPR) /* load constant here */
ldconst(lval2.constval,sPRI);
+ heap2=decl_heap-locheap; /* save heap space used in "false" branch */
+ assert(heap2>=0);
array1= (lval->ident==iARRAY || lval->ident==iREFARRAY);
array2= (lval2.ident==iARRAY || lval2.ident==iREFARRAY);
if (array1 && !array2) {
@@ -1055,19 +1077,26 @@ static int hier13(value *lval)
if (!matchtag(lval->tag,lval2.tag,FALSE))
error(213); /* tagname mismatch ('true' and 'false' expressions) */
setlabel(flab2);
+ if (sc_status==statFIRST) {
+ /* Calculate the max. heap space used by either branch and save values of
+ * max - heap1 and max - heap2. On the second pass, we use these values
+ * to equilibrate the heap space used by either branch. This is needed
+ * because we don't know (at compile time) which branch will be taken,
+ * but the heap cannot be restored inside each branch because the result
+ * on the heap may needed by the remaining expression.
+ */
+ int max=(heap1>heap2) ? heap1 : heap2;
+ heaplist_node->first=max-heap1;
+ heaplist_node->second=max-heap2;
+ decl_heap=locheap+max; /* otherwise it will contain locheap+heap2 and the
+ * max. heap usage will be wrong for the upper
+ * expression */
+ } /* if */
+ assert(sc_status!=statWRITE || heap1==heap2);
if (lval->ident==iARRAY)
lval->ident=iREFARRAY; /* iARRAY becomes iREFARRAY */
else if (lval->ident!=iREFARRAY)
lval->ident=iEXPRESSION; /* iREFARRAY stays iREFARRAY, rest becomes iEXPRESSION */
- if (orig_heap!=decl_heap) {
- diff2=abs(decl_heap-orig_heap);
- decl_heap=orig_heap;
- }
- if (diff1==diff2) {
- decl_heap+=(diff1/2);
- } else {
- decl_heap+=(diff1+diff2);
- }
return FALSE; /* conditional expression is no lvalue */
} else {
return lvalue;
@@ -1160,6 +1189,7 @@ static int hier2(value *lval)
if (!check_userop(user_inc,lval->tag,0,1,lval,&lval->tag))
inc(lval); /* increase variable first */
rvalue(lval); /* and read the result into PRI */
+ lval->ident = iEXPRESSION;
sideeffect=TRUE;
return FALSE; /* result is no longer lvalue */
case tDEC: /* --lval */
@@ -1171,6 +1201,7 @@ static int hier2(value *lval)
if (!check_userop(user_dec,lval->tag,0,1,lval,&lval->tag))
dec(lval); /* decrease variable first */
rvalue(lval); /* and read the result into PRI */
+ lval->ident = iEXPRESSION;
sideeffect=TRUE;
return FALSE; /* result is no longer lvalue */
case '~': /* ~ (one's complement) */
@@ -1379,6 +1410,7 @@ static int hier2(value *lval)
inc(lval); /* increase variable afterwards */
if (saveresult)
popreg(sPRI); /* restore PRI (result of rvalue()) */
+ lval->ident = iEXPRESSION;
sideeffect=TRUE;
return FALSE; /* result is no longer lvalue */
case tDEC: /* lval-- */
@@ -1397,6 +1429,7 @@ static int hier2(value *lval)
dec(lval); /* decrease variable afterwards */
if (saveresult)
popreg(sPRI); /* restore PRI (result of rvalue()) */
+ lval->ident = iEXPRESSION;
sideeffect=TRUE;
return FALSE;
case tCHAR: /* char (compute required # of cells */
@@ -2054,7 +2087,8 @@ static int nesting=0;
error(35,argidx+1); /* argument type mismatch */
/* Verify that the dimensions match with those in arg[argidx].
* A literal array always has a single dimension.
- * An iARRAYCELL parameter is also assumed to have a single dimension.
+ * An iARRAYCELL parameter is also assumed to have a single dimension,
+ * but its size may be >1 in case of an enumeration pseudo-array.
*/
if (lval.sym==NULL || lval.ident==iARRAYCELL) {
if (arg[argidx].numdim!=1) {
@@ -2062,7 +2096,8 @@ static int nesting=0;
} else if (arg[argidx].dim[0]!=0) {
assert(arg[argidx].dim[0]>0);
if (lval.ident==iARRAYCELL) {
- error(47); /* array sizes must match */
+ if (lval.constval==0 || arg[argidx].dim[0]!=lval.constval)
+ error(47); /* array sizes must match */
} else {
assert(lval.constval!=0); /* literal array must have a size */
/* A literal array must have exactly the same size as the
diff --git a/compiler/libpc300/sci18n.c b/compiler/libpc300/sci18n.c
index b106fa9c..40912c46 100755
--- a/compiler/libpc300/sci18n.c
+++ b/compiler/libpc300/sci18n.c
@@ -309,120 +309,3 @@ SC_FUNC cell cp_translate(const unsigned char *string,const unsigned char **endp
}
#endif /* NO_CODEPAGE */
-
-#if !defined NO_UTF8
-SC_FUNC cell get_utf8_char(const unsigned char *string,const unsigned char **endptr)
-{
- int follow=0;
- long lowmark=0;
- unsigned char ch;
- cell result=0;
-
- if (endptr!=NULL)
- *endptr=string;
-
- for ( ;; ) {
- ch=*string++;
-
- if (follow>0 && (ch & 0xc0)==0x80) {
- /* leader code is active, combine with earlier code */
- result=(result << 6) | (ch & 0x3f);
- if (--follow==0) {
- /* encoding a character in more bytes than is strictly needed,
- * is not really valid UTF-8; we are strict here to increase
- * the chance of heuristic dectection of non-UTF-8 text
- * (JAVA writes zero bytes as a 2-byte code UTF-8, which is invalid)
- */
- if (result=0xd800 && result<=0xdfff) || result==0xfffe || result==0xffff)
- return -1;
- } /* if */
- break;
- } else if (follow==0 && (ch & 0x80)==0x80) {
- /* UTF-8 leader code */
- if ((ch & 0xe0)==0xc0) {
- /* 110xxxxx 10xxxxxx */
- follow=1;
- lowmark=0x80L;
- result=ch & 0x1f;
- } else if ((ch & 0xf0)==0xe0) {
- /* 1110xxxx 10xxxxxx 10xxxxxx (16 bits, BMP plane) */
- follow=2;
- lowmark=0x800L;
- result=ch & 0x0f;
- } else if ((ch & 0xf8)==0xf0) {
- /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
- follow=3;
- lowmark=0x10000L;
- result=ch & 0x07;
- } else if ((ch & 0xfc)==0xf8) {
- /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
- follow=4;
- lowmark=0x200000L;
- result=ch & 0x03;
- } else if ((ch & 0xfe)==0xfc) {
- /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx (32 bits) */
- follow=5;
- lowmark=0x4000000L;
- result=ch & 0x01;
- } else {
- /* this is invalid UTF-8 */
- return -1;
- } /* if */
- } else if (follow==0 && (ch & 0x80)==0x00) {
- /* 0xxxxxxx (US-ASCII) */
- result=ch;
- break;
- } else {
- /* this is invalid UTF-8 */
- return -1;
- } /* if */
-
- } /* for */
-
- if (endptr!=NULL)
- *endptr=string;
- return result;
-}
-#endif
-
-SC_FUNC int scan_utf8(FILE *fp,const char *filename)
-{
- #if defined NO_UTF8
- return 0;
- #else
- static void *resetpos=NULL;
- int utf8=TRUE;
- int firstchar=TRUE,bom_found=FALSE;
- const unsigned char *ptr;
-
- resetpos=pc_getpossrc(fp);
- while (utf8 && pc_readsrc(fp,pline,sLINEMAX)!=NULL) {
- ptr=pline;
- if (firstchar) {
- /* check whether the very first character on the very first line
- * starts with a BYTE order mark
- */
- cell c=get_utf8_char(ptr,&ptr);
- bom_found= (c==0xfeff);
- utf8= (c>=0);
- firstchar=FALSE;
- } /* if */
- while (utf8 && *ptr!='\0')
- utf8= (get_utf8_char(ptr,&ptr)>=0);
- } /* while */
- pc_resetsrc(fp,resetpos);
- if (bom_found) {
- unsigned char bom[3];
- if (!utf8)
- error(77,filename); /* malformed UTF-8 encoding */
- pc_readsrc(fp,bom,3);
- assert(bom[0]==0xef && bom[1]==0xbb && bom[2]==0xbf);
- } /* if */
- return utf8;
- #endif /* NO_UTF8 */
-}
diff --git a/compiler/libpc300/sclist.c b/compiler/libpc300/sclist.c
index 7d60226c..e4d36060 100755
--- a/compiler/libpc300/sclist.c
+++ b/compiler/libpc300/sclist.c
@@ -443,6 +443,52 @@ SC_FUNC void delete_autolisttable(void)
}
+/* ----- value pair list ----------------------------------------- */
+static valuepair heaplist = {NULL, 0, 0};
+
+SC_FUNC valuepair *push_heaplist(long first, long second)
+{
+ valuepair *cur, *last;
+ if ((cur=malloc(sizeof(valuepair)))==NULL)
+ error(103); /* insufficient memory (fatal error) */
+
+ cur->first=first;
+ cur->second=second;
+ cur->next=NULL;
+
+ for (last=&heaplist; last->next!=NULL; last=last->next)
+ /* nothing */;
+ last->next=cur;
+ return cur;
+}
+
+SC_FUNC int popfront_heaplist(long *first, long *second)
+{
+ valuepair *front=heaplist.next;
+ if (front==NULL)
+ return 0;
+
+ /* copy fields */
+ *first=front->first;
+ *second=front->second;
+
+ /* unlink and free */
+ heaplist.next=front->next;
+ free(front);
+ return 1;
+}
+
+SC_FUNC void delete_heaplisttable(void)
+{
+ valuepair *cur;
+ while (heaplist.next!=NULL) {
+ cur=heaplist.next;
+ heaplist.next=cur->next;
+ free(cur);
+ } /* while */
+}
+
+
/* ----- debug information --------------------------------------- */
static stringlist dbgstrings = {NULL, NULL};
diff --git a/compiler/libpc300/scvars.c b/compiler/libpc300/scvars.c
index 4a38f149..89c3b339 100755
--- a/compiler/libpc300/scvars.c
+++ b/compiler/libpc300/scvars.c
@@ -84,7 +84,6 @@ SC_VDEFINE int sc_status; /* read/write status */
SC_VDEFINE int sc_rationaltag=0; /* tag for rational numbers */
SC_VDEFINE int rational_digits=0; /* number of fractional digits */
SC_VDEFINE int sc_allowproccall=0; /* allow/detect tagnames in lex() */
-SC_VDEFINE short sc_is_utf8=FALSE; /* is this source file in UTF-8 encoding */
SC_VDEFINE char *pc_deprecate = NULL;/* if non-null, mark next declaration as deprecated */
SC_VDEFINE int sc_showincludes=0; /* show include files */
SC_VDEFINE int sc_warnings_are_errors=0;
diff --git a/configs/amxx.cfg b/configs/amxx.cfg
index 5dd44b3f..00d34474 100755
--- a/configs/amxx.cfg
+++ b/configs/amxx.cfg
@@ -156,6 +156,11 @@ amx_language_display_msg 1
// Default value: 1
amx_help_display_msg 1
+// Time to wait (in seconds) before displaying a message about amx_help to a client once joined the server
+//
+// Default value: 15
+amx_help_display_msg_time 15
+
// Amount of commands per amx_help page
//
// Default value: 10
diff --git a/configs/clcmds.ini b/configs/clcmds.ini
index e0c2f9e7..4de02832 100755
--- a/configs/clcmds.ini
+++ b/configs/clcmds.ini
@@ -1,5 +1,5 @@
; Menu configuration file
-; Default File location: $moddir/addons/amxmodx/configs/clcmds.ini
+; File location: $moddir/addons/amxmodx/configs/clcmds.ini
; To use with Players Menu plugin
; NOTE: By default in all settings the access level is set to "u".
diff --git a/configs/core.ini b/configs/core.ini
index f4ee0c2b..1f3902f3 100755
--- a/configs/core.ini
+++ b/configs/core.ini
@@ -40,3 +40,8 @@ max_binlog_size 20
; 2 - float comparisons
; 4 - float rounding
optimizer 7
+
+; Admin command flag manager
+; 0 - enabled
+; 1 - disabled
+disableflagman 0
diff --git a/configs/cstrike/amxx.cfg b/configs/cstrike/amxx.cfg
index 39eed59e..a6fb7ba3 100755
--- a/configs/cstrike/amxx.cfg
+++ b/configs/cstrike/amxx.cfg
@@ -156,6 +156,11 @@ amx_language_display_msg 1
// Default value: 1
amx_help_display_msg 1
+// Time to wait (in seconds) before displaying a message about amx_help to a client once joined the server
+//
+// Default value: 15
+amx_help_display_msg_time 15
+
// Amount of commands per amx_help page
//
// Default value: 10
@@ -210,3 +215,9 @@ amx_statsx_duration 12.0
// Default value: -2.0
amx_statsx_freeze -2.0
+// Sets whether Restrict Weapons plugin should use a configuration file per map or or not.
+// If enabled, the file format is: weaprest_mapname.ini (e.g. weaprest_de_dust.ini).
+// -
+// Default value: 0
+amx_restrmapsettings 0
+
diff --git a/configs/cstrike/core.ini b/configs/cstrike/core.ini
index ab40bc9a..f0d3a4ae 100755
--- a/configs/cstrike/core.ini
+++ b/configs/cstrike/core.ini
@@ -1,22 +1,25 @@
; Configuration file for AMX Mod X
-amxx_logs addons/amxmodx/logs
-amxx_configsdir addons/amxmodx/configs
-amxx_datadir addons/amxmodx/data
-amxx_modules addons/amxmodx/configs/modules.ini
-amxx_plugins addons/amxmodx/configs/plugins.ini
-amxx_pluginsdir addons/amxmodx/plugins
-amxx_modulesdir addons/amxmodx/modules
-amxx_vault addons/amxmodx/data/vault.ini
+amxx_logs addons/amxmodx/logs
+amxx_configsdir addons/amxmodx/configs
+amxx_datadir addons/amxmodx/data
+amxx_modules addons/amxmodx/configs/modules.ini
+amxx_plugins addons/amxmodx/configs/plugins.ini
+amxx_pluginsdir addons/amxmodx/plugins
+amxx_modulesdir addons/amxmodx/modules
+amxx_vault addons/amxmodx/data/vault.ini
; It is important that "csstats" comes before "csstats_score"
-csstats addons/amxmodx/data/csstats.dat
-csstats_score addons/amxmodx/data/csstats.amxx
+csstats addons/amxmodx/data/csstats.dat
+csstats_score addons/amxmodx/data/csstats.amxx
; Logging mode
; 0 - no logging
; 1 - one logfile / day
; 2 - one logfile / map
; 3 - HL Logs
-amxx_logging 1
+amxx_logging 1
+
+; MySQL default timeout
+mysql_timeout 60
; Binary logging level
; add these up to get what you want
@@ -27,10 +30,10 @@ amxx_logging 1
; 8 - log all native params
; 16 - log internal function calls (only in debug mode)
; 32 - log line number accesses (only in debug mode)
-bin_logging 49
+bin_logging 49
; Maximum binary log size, in megs
-max_binlog_size 20
+max_binlog_size 20
; Plugin optimization flags - add these up to get what you want
; lowering these may stop crashes on very old CPUs
@@ -39,4 +42,9 @@ max_binlog_size 20
; 1 - float arithmetic
; 2 - float comparisons
; 4 - float rounding
-optimizer 7
+optimizer 7
+
+; Admin command flag manager
+; 0 - enabled
+; 1 - disabled
+disableflagman 0
diff --git a/configs/dod/core.ini b/configs/dod/core.ini
index c86b0a1b..2c41497e 100755
--- a/configs/dod/core.ini
+++ b/configs/dod/core.ini
@@ -1,23 +1,25 @@
; Configuration file for AMX Mod X
-amxx_logs addons/amxmodx/logs
-amxx_configsdir addons/amxmodx/configs
-amxx_datadir addons/amxmodx/data
-amxx_modules addons/amxmodx/configs/modules.ini
-amxx_plugins addons/amxmodx/configs/plugins.ini
-amxx_pluginsdir addons/amxmodx/plugins
-amxx_modulesdir addons/amxmodx/modules
-amxx_vault addons/amxmodx/data/vault.ini
+amxx_logs addons/amxmodx/logs
+amxx_configsdir addons/amxmodx/configs
+amxx_datadir addons/amxmodx/data
+amxx_modules addons/amxmodx/configs/modules.ini
+amxx_plugins addons/amxmodx/configs/plugins.ini
+amxx_pluginsdir addons/amxmodx/plugins
+amxx_modulesdir addons/amxmodx/modules
+amxx_vault addons/amxmodx/data/vault.ini
+; It is important that "dodstats" comes before "dodstats_score"
+dodstats addons/amxmodx/data/dodstats.dat
+dodstats_score addons/amxmodx/data/dodstats.amxx
; Logging mode
; 0 - no logging
; 1 - one logfile / day
; 2 - one logfile / map
; 3 - HL Logs
-amxx_logging 1
+amxx_logging 1
-; It is important that "dodstats" comes before "dodstats_score"
-dodstats addons/amxmodx/data/dodstats.dat
-dodstats_score addons/amxmodx/data/dodstats.amxx
+; MySQL default timeout
+mysql_timeout 60
; Binary logging level
; add these up to get what you want
@@ -28,10 +30,10 @@ dodstats_score addons/amxmodx/data/dodstats.amxx
; 8 - log all native params
; 16 - log internal function calls (only in debug mode)
; 32 - log line number accesses (only in debug mode)
-bin_logging 49
+bin_logging 49
; Maximum binary log size, in megs
-max_binlog_size 20
+max_binlog_size 20
; Plugin optimization flags - add these up to get what you want
; lowering these may stop crashes on very old CPUs
@@ -40,4 +42,9 @@ max_binlog_size 20
; 1 - float arithmetic
; 2 - float comparisons
; 4 - float rounding
-optimizer 7
+optimizer 7
+
+; Admin command flag manager
+; 0 - enabled
+; 1 - disabled
+disableflagman 0
diff --git a/configs/hamdata.ini b/configs/hamdata.ini
deleted file mode 100644
index c6702c24..00000000
--- a/configs/hamdata.ini
+++ /dev/null
@@ -1,4676 +0,0 @@
-; Ham Sandwich module config file.
-;
-; IMPORTANT: It is highly suggested that you do not modify this file unless
-; you know _exactly_ what you are doing!
-;
-; NOTE: Just because a mod contains a function does not means it will work
-; as expected. If, for example, HamKilled() does not work as you think
-; it should in Counter-Strike DO NOT FILE A BUG REPORT. This just
-; exposes the function for you, whether or not it works, or how it
-; works is up to plugin authors to figure out.
-;
-; NOTE: If a mod is missing keys for a certain native, that particular native
-; will not be loaded! Example: Say CS is missing the "takedamage" index
-; but has the use and pev indexes. The HamUse and HamePdataCbase natives
-; will be registered, but the HamTakeDamage native will not register.
-; In addition, any attempts to hook a function who's key is missing will
-; result in the plugin failing.
-;
-; NOTE: The base key is only needed for the linux configs.
-;
-; NOTE: Any keys that begin with a modname (eg: cstrike_restart) will,
-; obviously, only work on that mod and all mirrors of it (eg: czero).
-;
-; NOTE: If you change this file while the module is already loaded, you will
-; need to restart the server for the changes to take effect. Changes to
-; this file before the module is loaded will take effect when the module
-; loads.
-;
-; NOTE: All of these offsets and settings are for the latest (at the time of
-; release) legitimate version of the mod. However, there is a _chance_
-; that they will work on older (and even newer) versions.
-; eg: If they work on non-Steam CS 1.6 this is coincidental, if they do
-; not work on non-Steam CS 1.6 this will not be officially fixed.
-;
-; Mirrors: These take the name of one mod, and copy all of its data to another
-; name. An example of a use for this would be cstrike and czero: they
-; use the same binary so all of its vtable offsets are guaranteed to
-; be identical. Mirrors should always come first in the file!
-;
-; Version: $Id: hamdata.ini 3687 2008-03-04 18:51:35Z sawce $
-
-
-@mirror cstrike czero
-@mirror ns nsp
-@mirror valve dmc
-
-; TODO: check these - all are estimates
-@section cstrike linux
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 3
- objectcaps 6
- activate 7
- setobjectcollisionbox 8
- classify 9
- deathnotice 10
- traceattack 11
- takedamage 12
- takehealth 13
- killed 14
- bloodcolor 15
- tracebleed 16
- istriggered 17
- mymonsterpointer 18
- mysquadmonsterpointer 19
- gettogglestate 20
- addpoints 21
- addpointstoteam 22
- addplayeritem 23
- removeplayeritem 24
- giveammo 25
- getdelay 26
- ismoving 27
- overridereset 28
- damagedecal 29
- settogglestate 30
- startsneaking 31
- stopsneaking 32
- oncontrols 33
- issneaking 34
- isalive 35
- isbspmodel 36
- reflectgauss 37
- hastarget 38
- isinworld 39
- isplayer 40
- isnetclient 41
- teamid 42
- getnexttarget 43
- think 44
- touch 45
- use 46
- blocked 47
- respawn 48
- updateowner 49
- fbecomeprone 50
- center 51
- eyeposition 52
- earposition 53
- bodytarget 54
- illumination 55
- fvisible 56
- fvecvisible 57
- changeyaw 59
- hashumangibs 60
- hasaliengibs 61
- fademonster 62
- gibmonster 63
- getdeathactivity 64
- becomedead 65
- irelationship 67
- painsound 68
- reportaistate 70
- monsterinitdead 71
- look 72
- bestvisibleenemy 73
- finviewcone 74
- fvecinviewcone 75
-
- player_jump 76
- player_duck 77
- player_prethink 78
- player_postthink 79
- player_getgunposition 80
- player_shouldfadeondeath 66
- player_impulsecommands 83
- player_updateclientdata 82
-
- item_addtoplayer 59
- item_addduplicate 60
- item_getiteminfo 61
- item_candeploy 62
- item_deploy 64
- item_canholster 66
- item_holster 67
- item_updateiteminfo 68
- item_preframe 69
- item_postframe 70
- item_drop 71
- item_kill 72
- item_attachtoplayer 73
- item_primaryammoindex 74
- item_secondaryammoindex 75
- item_updateclientdata 76
- item_getweaponptr 77
- item_itemslot 79
-
- weapon_extractammo 80
- weapon_extractclipammo 81
- weapon_addweapon 82
- weapon_playemptysound 83
- weapon_resetemptysound 84
- weapon_isusable 86
- weapon_primaryattack 87
- weapon_secondaryattack 88
- weapon_reload 89
- weapon_weaponidle 90
- weapon_retireweapon 91
- weapon_shouldweaponidle 92
- weapon_usedecrement 93
-
- cstrike_restart 2
- cstrike_roundrespawn 84
- cstrike_item_candrop 63
- cstrike_item_isweapon 65
- cstrike_item_getmaxspeed 78
- cstrike_weapon_sendweaponanim 85
- cstrike_player_resetmaxspeed 69
- cstrike_player_isbot 81
- cstrike_player_getautoaimvector 85
- cstrike_player_blind 86
- cstrike_player_ontouchingweapon 87
-
-@end
-@section cstrike windows
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 3
- objectcaps 6
- activate 7
- setobjectcollisionbox 8
- classify 9
- deathnotice 10
- traceattack 11
- takedamage 12
- takehealth 13
- killed 14
- bloodcolor 15
- tracebleed 16
- istriggered 17
- mymonsterpointer 18
- mysquadmonsterpointer 19
- gettogglestate 20
- addpoints 21
- addpointstoteam 22
- addplayeritem 23
- removeplayeritem 24
- giveammo 25
- getdelay 26
- ismoving 27
- overridereset 28
- damagedecal 29
- settogglestate 30
- startsneaking 31
- stopsneaking 32
- oncontrols 33
- issneaking 34
- isalive 35
- isbspmodel 36
- reflectgauss 37
- hastarget 38
- isinworld 39
- isplayer 40
- isnetclient 41
- teamid 42
- getnexttarget 43
- think 44
- touch 45
- use 46
- blocked 47
- respawn 48
- updateowner 49
- fbecomeprone 50
- center 51
- eyeposition 52
- earposition 53
- bodytarget 54
- illumination 55
- fvecvisible 56
- fvisible 57
- changeyaw 59
- hashumangibs 60
- hasaliengibs 61
- fademonster 62
- gibmonster 63
- getdeathactivity 64
- becomedead 65
- irelationship 67
- painsound 68
- reportaistate 70
- monsterinitdead 71
- look 72
- bestvisibleenemy 73
- finviewcone 75
- fvecinviewcone 74
-
- player_jump 76
- player_duck 77
- player_prethink 78
- player_postthink 79
- player_getgunposition 80
- player_shouldfadeondeath 66
- player_impulsecommands 83
- player_updateclientdata 82
-
- item_addtoplayer 59
- item_addduplicate 60
- item_getiteminfo 61
- item_candeploy 62
- item_deploy 64
- item_canholster 66
- item_holster 67
- item_updateiteminfo 68
- item_preframe 69
- item_postframe 70
- item_drop 71
- item_kill 72
- item_attachtoplayer 73
- item_primaryammoindex 74
- item_secondaryammoindex 75
- item_updateclientdata 76
- item_getweaponptr 77
- item_itemslot 79
-
- weapon_extractammo 80
- weapon_extractclipammo 81
- weapon_addweapon 82
- weapon_playemptysound 83
- weapon_resetemptysound 84
- weapon_isusable 86
- weapon_primaryattack 87
- weapon_secondaryattack 88
- weapon_reload 89
- weapon_weaponidle 90
- weapon_retireweapon 91
- weapon_shouldweaponidle 92
- weapon_usedecrement 93
-
- cstrike_restart 2
- cstrike_roundrespawn 84
- cstrike_item_candrop 63
- cstrike_item_isweapon 65
- cstrike_item_getmaxspeed 78
- cstrike_weapon_sendweaponanim 85
- cstrike_player_resetmaxspeed 69
- cstrike_player_isbot 81
- cstrike_player_getautoaimvector 85
- cstrike_player_blind 86
- cstrike_player_ontouchingweapon 87
-@end
-
-@section cstrike mac
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 3
- objectcaps 6
- activate 7
- setobjectcollisionbox 8
- classify 9
- deathnotice 10
- traceattack 11
- takedamage 12
- takehealth 13
- killed 14
- bloodcolor 15
- tracebleed 16
- istriggered 17
- mymonsterpointer 18
- mysquadmonsterpointer 19
- gettogglestate 20
- addpoints 21
- addpointstoteam 22
- addplayeritem 23
- removeplayeritem 24
- giveammo 25
- getdelay 26
- ismoving 27
- overridereset 28
- damagedecal 29
- settogglestate 30
- startsneaking 31
- stopsneaking 32
- oncontrols 33
- issneaking 34
- isalive 35
- isbspmodel 36
- reflectgauss 37
- hastarget 38
- isinworld 39
- isplayer 40
- isnetclient 41
- teamid 42
- getnexttarget 43
- think 44
- touch 45
- use 46
- blocked 47
- respawn 48
- updateowner 49
- fbecomeprone 50
- center 51
- eyeposition 52
- earposition 53
- bodytarget 54
- illumination 55
- fvecvisible 56
- fvisible 57
- changeyaw 59
- hashumangibs 60
- hasaliengibs 61
- fademonster 62
- gibmonster 63
- getdeathactivity 64
- becomedead 65
- irelationship 67
- painsound 68
- reportaistate 70
- monsterinitdead 71
- look 72
- bestvisibleenemy 73
- finviewcone 74
- fvecinviewcone 75
-
- player_jump 76
- player_duck 77
- player_prethink 78
- player_postthink 79
- player_getgunposition 80
- player_shouldfadeondeath 66
- player_impulsecommands 83
- player_updateclientdata 82
-
- item_addtoplayer 59
- item_addduplicate 60
- item_getiteminfo 61
- item_candeploy 62
- item_deploy 64
- item_canholster 66
- item_holster 67
- item_updateiteminfo 68
- item_preframe 69
- item_postframe 70
- item_drop 71
- item_kill 72
- item_attachtoplayer 73
- item_primaryammoindex 74
- item_secondaryammoindex 75
- item_updateclientdata 76
- item_getweaponptr 77
- item_itemslot 79
-
- weapon_extractammo 80
- weapon_extractclipammo 81
- weapon_addweapon 82
- weapon_playemptysound 83
- weapon_resetemptysound 84
- weapon_isusable 86
- weapon_primaryattack 87
- weapon_secondaryattack 88
- weapon_reload 89
- weapon_weaponidle 90
- weapon_retireweapon 91
- weapon_shouldweaponidle 92
- weapon_usedecrement 93
-
- cstrike_restart 2
- cstrike_roundrespawn 84
- cstrike_item_candrop 63
- cstrike_item_isweapon 65
- cstrike_item_getmaxspeed 78
- cstrike_weapon_sendweaponanim 85
- cstrike_player_resetmaxspeed 69
- cstrike_player_isbot 81
- cstrike_player_getautoaimvector 85
- cstrike_player_blind 86
- cstrike_player_ontouchingweapon 87
-@end
-
-@section dod linux
- pev 4
- base 0x0
-
- spawn 3
- precache 4
- keyvalue 5
- objectcaps 8
- activate 9
- setobjectcollisionbox 12
- classify 13
- deathnotice 14
- traceattack 17
- takedamage 18
- takehealth 19
- killed 20
- bloodcolor 21
- tracebleed 22
- mymonsterpointer 23
- mysquadmonsterpointer 24
- gettogglestate 25
- addpoints 26
- addpointstoteam 27
- addplayeritem 28
- removeplayeritem 29
- giveammo 30
- getdelay 31
- ismoving 32
- overridereset 33
- damagedecal 34
- settogglestate 35
- startsneaking 36
- stopsneaking 37
- oncontrols 38
- issneaking 39
- isalive 40
- isbspmodel 41
- reflectgauss 42
- hastarget 43
- isinworld 44
- isplayer 45
- isnetclient 46
- teamid 47
- getnexttarget 48
- think 49
- touch 50
- use 51
- blocked 52
- respawn 53
- updateowner 54
- fbecomeprone 55
- center 56
- eyeposition 57
- earposition 58
- bodytarget 59
- illumination 60
- fvisible 61
- fvecvisible 62
-
- look 64
- changeyaw 67
- irelationship 69
- monsterinitdead 71
- bestvisibleenemy 74
- finviewcone 75
- fvecinviewcone 76
-
- runai 65
- monsterthink 68
- monsterinit 70
- checklocalmove 77
- move 78
- moveexecute 79
- shouldadvanceroute 80
- getstoppedactivity 81
- stop 82
- checkrangeattack1 83
- checkrangeattack2 84
- checkmeleeattack1 85
- checkmeleeattack2 86
- schedulechange 92
- canplaysequence 93
- canplaysentence 94
- playsentence 95
- playscriptedsentence 96
- sentencestop 97
- getidealstate 98
- setactivity 99
- reportaistate 100
- checkenemy 101
- ftriangulate 102
- setyawspeed 103
- buildnearestroute 104
- findcover 105
- coverradius 107
- fcancheckattacks 108
- checkammo 109
- ignoreconditions 110
- fvalidatehinttype 111
- fcanactiveidle 112
- isoundmask 113
- hearingsensitivity 116
- barnaclevictimbitten 117
- barnaclevictimreleased 118
- preschedulethink 120
- getdeathactivity 121
- gibmonster 122
- hashumangibs 123
- hasaliengibs 124
- fademonster 125
- deathsound 127
- alertsound 128
- idlesound 129
- painsound 130
- stopfollowing 131
-
- player_jump 134
- player_duck 135
- player_prethink 132
- player_postthink 133
- player_getgunposition 126
- player_shouldfadeondeath 66
- player_impulsecommands 137
- player_updateclientdata 136
-
- item_addtoplayer 64
- item_addduplicate 65
- item_getiteminfo 66
- item_candeploy 67
- item_deploy 68
- item_canholster 73
- item_holster 74
- item_updateiteminfo 75
- item_preframe 76
- item_postframe 77
- item_drop 78
- item_kill 79
- item_attachtoplayer 80
- item_primaryammoindex 81
- item_secondaryammoindex 82
- item_updateclientdata 83
- item_getweaponptr 84
- item_itemslot 85
-
- weapon_extractammo 86
- weapon_extractclipammo 87
- weapon_addweapon 88
- weapon_playemptysound 89
- weapon_resetemptysound 90
- weapon_isusable 92
- weapon_primaryattack 102
- weapon_secondaryattack 103
- weapon_reload 104
- weapon_weaponidle 105
- weapon_retireweapon 106
- weapon_shouldweaponidle 107
- weapon_usedecrement 108
-
- dod_roundrespawn 0
- dod_roundrespawnent 1
- dod_roundstore 2
- dod_areasetindex 10
- dod_areasendstatus 11
- dod_getstate 15
- dod_getstateent 16
- dod_setscriptreset 119
-
- dod_item_candrop 70
- dod_item_spawndeploy 69
- dod_item_setdmgtime 71
- dod_item_dropgren 72
-
- dod_weapon_sendweaponanim 91
- dod_weapon_isuseable 92
- dod_weapon_aim 93
- dod_weapon_flaim 94
- dod_weapon_removestamina 95
- dod_weapon_changefov 96
- dod_weapon_zoomout 97
- dod_weapon_zoomin 98
- dod_weapon_getfov 99
- dod_weapon_playeriswatersniping 100
- dod_weapon_updatezoomspeed 101
- dod_weapon_special 105
-@end
-@section dod windows
- pev 4
- base 0x0
-
- spawn 3
- precache 4
- keyvalue 5
- objectcaps 8
- activate 9
- setobjectcollisionbox 12
- classify 13
- deathnotice 14
- traceattack 17
- takedamage 18
- takehealth 19
- killed 20
- bloodcolor 21
- tracebleed 22
- mymonsterpointer 23
- mysquadmonsterpointer 24
- gettogglestate 25
- addpoints 26
- addpointstoteam 27
- addplayeritem 28
- removeplayeritem 29
- giveammo 30
- getdelay 31
- ismoving 32
- overridereset 33
- damagedecal 34
- settogglestate 35
- startsneaking 36
- stopsneaking 37
- oncontrols 38
- issneaking 39
- isalive 40
- isbspmodel 41
- reflectgauss 42
- hastarget 43
- isinworld 44
- isplayer 45
- isnetclient 46
- teamid 47
- getnexttarget 48
- think 49
- touch 50
- use 51
- blocked 52
- respawn 53
- updateowner 54
- fbecomeprone 55
- center 56
- eyeposition 57
- earposition 58
- bodytarget 59
- illumination 60
- fvisible 62
- fvecvisible 61
-
- look 64
- changeyaw 67
- irelationship 69
- monsterinitdead 71
- bestvisibleenemy 74
- finviewcone 76
- fvecinviewcone 75
-
- runai 65
- monsterthink 68
- monsterinit 70
- checklocalmove 77
- move 78
- moveexecute 79
- shouldadvanceroute 80
- getstoppedactivity 81
- stop 82
- checkrangeattack1 83
- checkrangeattack2 84
- checkmeleeattack1 85
- checkmeleeattack2 86
- schedulechange 92
- canplaysequence 93
- canplaysentence 94
- playsentence 95
- playscriptedsentence 96
- sentencestop 97
- getidealstate 98
- setactivity 99
- reportaistate 100
- checkenemy 101
- ftriangulate 102
- setyawspeed 103
- buildnearestroute 104
- findcover 105
- coverradius 107
- fcancheckattacks 108
- checkammo 109
- ignoreconditions 110
- fvalidatehinttype 111
- fcanactiveidle 112
- isoundmask 113
- hearingsensitivity 116
- barnaclevictimbitten 117
- barnaclevictimreleased 118
- preschedulethink 120
- getdeathactivity 121
- gibmonster 122
- hashumangibs 123
- hasaliengibs 124
- fademonster 125
- deathsound 127
- alertsound 128
- idlesound 129
- painsound 130
- stopfollowing 131
-
- player_jump 134
- player_duck 135
- player_prethink 132
- player_postthink 133
- player_getgunposition 126
- player_shouldfadeondeath 66
- player_impulsecommands 137
- player_updateclientdata 136
-
- item_addtoplayer 64
- item_addduplicate 65
- item_getiteminfo 66
- item_candeploy 67
- item_deploy 68
- item_canholster 73
- item_holster 74
- item_updateiteminfo 75
- item_preframe 76
- item_postframe 77
- item_drop 78
- item_kill 79
- item_attachtoplayer 80
- item_primaryammoindex 81
- item_secondaryammoindex 82
- item_updateclientdata 83
- item_getweaponptr 84
- item_itemslot 85
-
- weapon_extractammo 86
- weapon_extractclipammo 87
- weapon_addweapon 88
- weapon_playemptysound 89
- weapon_resetemptysound 90
- weapon_isusable 92
- weapon_primaryattack 102
- weapon_secondaryattack 103
- weapon_reload 104
- weapon_weaponidle 105
- weapon_retireweapon 106
- weapon_shouldweaponidle 107
- weapon_usedecrement 108
-
- dod_roundrespawn 0
- dod_roundrespawnent 1
- dod_roundstore 2
- dod_areasetindex 10
- dod_areasendstatus 11
- dod_getstate 16
- dod_getstateent 15
- dod_setscriptreset 119
-
- dod_item_candrop 70
- dod_item_spawndeploy 69
- dod_item_setdmgtime 71
- dod_item_dropgren 72
-
- dod_weapon_sendweaponanim 91
- dod_weapon_isuseable 92
- dod_weapon_aim 93
- dod_weapon_flaim 94
- dod_weapon_removestamina 95
- dod_weapon_changefov 96
- dod_weapon_zoomout 97
- dod_weapon_zoomin 98
- dod_weapon_getfov 99
- dod_weapon_playeriswatersniping 100
- dod_weapon_updatezoomspeed 101
- dod_weapon_special 105
-@end
-
-@section dod mac
- pev 4
- base 0x0
-
- spawn 3
- precache 4
- keyvalue 5
- objectcaps 8
- activate 9
- setobjectcollisionbox 12
- classify 13
- deathnotice 14
- traceattack 17
- takedamage 18
- takehealth 19
- killed 20
- bloodcolor 21
- tracebleed 22
- mymonsterpointer 23
- mysquadmonsterpointer 24
- gettogglestate 25
- addpoints 26
- addpointstoteam 27
- addplayeritem 28
- removeplayeritem 29
- giveammo 30
- getdelay 31
- ismoving 32
- overridereset 33
- damagedecal 34
- settogglestate 35
- startsneaking 36
- stopsneaking 37
- oncontrols 38
- issneaking 39
- isalive 40
- isbspmodel 41
- reflectgauss 42
- hastarget 43
- isinworld 44
- isplayer 45
- isnetclient 46
- teamid 47
- getnexttarget 48
- think 49
- touch 50
- use 51
- blocked 52
- respawn 53
- updateowner 54
- fbecomeprone 55
- center 56
- eyeposition 57
- earposition 58
- bodytarget 59
- illumination 60
- fvisible 61
- fvecvisible 62
-
- look 64
- changeyaw 67
- irelationship 69
- monsterinitdead 71
- bestvisibleenemy 74
- finviewcone 75
- fvecinviewcone 76
-
- runai 65
- monsterthink 68
- monsterinit 70
- checklocalmove 77
- move 78
- moveexecute 79
- shouldadvanceroute 80
- getstoppedactivity 81
- stop 82
- checkrangeattack1 83
- checkrangeattack2 84
- checkmeleeattack1 85
- checkmeleeattack2 86
- schedulechange 92
- canplaysequence 93
- canplaysentence 94
- playsentence 95
- playscriptedsentence 96
- sentencestop 97
- getidealstate 98
- setactivity 99
- reportaistate 100
- checkenemy 101
- ftriangulate 102
- setyawspeed 103
- buildnearestroute 104
- findcover 105
- coverradius 107
- fcancheckattacks 108
- checkammo 109
- ignoreconditions 110
- fvalidatehinttype 111
- fcanactiveidle 112
- isoundmask 113
- hearingsensitivity 116
- barnaclevictimbitten 117
- barnaclevictimreleased 118
- preschedulethink 120
- getdeathactivity 121
- gibmonster 122
- hashumangibs 123
- hasaliengibs 124
- fademonster 125
- deathsound 127
- alertsound 128
- idlesound 129
- painsound 130
- stopfollowing 131
-
- player_jump 134
- player_duck 135
- player_prethink 132
- player_postthink 133
- player_getgunposition 126
- player_shouldfadeondeath 66
- player_impulsecommands 137
- player_updateclientdata 136
-
- item_addtoplayer 64
- item_addduplicate 65
- item_getiteminfo 66
- item_candeploy 67
- item_deploy 68
- item_canholster 73
- item_holster 74
- item_updateiteminfo 75
- item_preframe 76
- item_postframe 77
- item_drop 78
- item_kill 79
- item_attachtoplayer 80
- item_primaryammoindex 81
- item_secondaryammoindex 82
- item_updateclientdata 83
- item_getweaponptr 84
- item_itemslot 85
-
- weapon_extractammo 86
- weapon_extractclipammo 87
- weapon_addweapon 88
- weapon_playemptysound 89
- weapon_resetemptysound 90
- weapon_isusable 92
- weapon_primaryattack 102
- weapon_secondaryattack 103
- weapon_reload 104
- weapon_weaponidle 105
- weapon_retireweapon 106
- weapon_shouldweaponidle 107
- weapon_usedecrement 108
-
- dod_roundrespawn 0
- dod_roundrespawnent 1
- dod_roundstore 2
- dod_areasetindex 10
- dod_areasendstatus 11
- dod_getstate 15
- dod_getstateent 16
- dod_setscriptreset 119
-
- dod_item_candrop 70
- dod_item_spawndeploy 69
- dod_item_setdmgtime 71
- dod_item_dropgren 72
-
- dod_weapon_sendweaponanim 91
- dod_weapon_isuseable 92
- dod_weapon_aim 93
- dod_weapon_flaim 94
- dod_weapon_removestamina 95
- dod_weapon_changefov 96
- dod_weapon_zoomout 97
- dod_weapon_zoomin 98
- dod_weapon_getfov 99
- dod_weapon_playeriswatersniping 100
- dod_weapon_updatezoomspeed 101
- dod_weapon_special 105
-@end
-
-; TFC Does not have the following "standard" entries in its vtable:
-; addpoints, addpointstoteam, getgunposition, teamid, usedecrement, updateclientdata
-@section tfc linux
- pev 4
- base 0x0
-
- spawn 2
- precache 3
- keyvalue 4
- objectcaps 7
- activate 8
- setobjectcollisionbox 9
- classify 10
- deathnotice 11
- traceattack 12
- takedamage 13
- takehealth 14
- bloodcolor 16
- tracebleed 17
- mymonsterpointer 19
- mysquadmonsterpointer 20
- gettogglestate 21
- addplayeritem 22
- removeplayeritem 23
- getdelay 25
- ismoving 26
- overridereset 27
- damagedecal 28
- settogglestate 29
- startsneaking 30
- stopsneaking 31
- oncontrols 32
- issneaking 33
- isalive 34
- isbspmodel 35
- reflectgauss 36
- hastarget 37
- isinworld 38
- isplayer 39
- isnetclient 40
- getnexttarget 42
- think 43
- touch 44
- use 45
- blocked 46
- respawn 47
- updateowner 48
- fbecomeprone 49
- center 50
- eyeposition 51
- earposition 52
- bodytarget 53
- illumination 54
- fvisible 55
- fvecvisible 56
-
- look 66
- changeyaw 69
- irelationship 71
- monsterinitdead 73
- becomedead 74
- bestvisibleenemy 76
- finviewcone 77
- fvecinviewcone 78
-
- runai 67
- monsterthink 70
- monsterinit 72
- checklocalmove 79
- move 80
- moveexecute 81
- shouldadvanceroute 82
- getstoppedactivity 83
- stop 84
- checkrangeattack1 85
- checkrangeattack2 86
- checkmeleeattack1 87
- checkmeleeattack2 88
- schedulechange 94
- canplaysequence 95
- canplaysentence 96
- playsentence 97
- playscriptedsentence 98
- sentencestop 99
- getidealstate 100
- setactivity 101
- reportaistate 102
- checkenemy 103
- ftriangulate 104
- setyawspeed 105
- buildnearestroute 106
- findcover 107
- coverradius 109
- fcancheckattacks 110
- checkammo 111
- ignoreconditions 112
- fvalidatehinttype 113
- fcanactiveidle 114
- isoundmask 115
- hearingsensitivity 118
- barnaclevictimbitten 119
- barnaclevictimreleased 120
- preschedulethink 121
- getdeathactivity 122
- gibmonster 123
- hashumangibs 124
- hasaliengibs 125
- fademonster 126
- deathsound 129
- alertsound 130
- idlesound 131
- painsound 132
- stopfollowing 133
-
- player_jump 134
- player_duck 135
- player_prethink 136
- player_postthink 137
- player_shouldfadeondeath 68
- player_impulsecommands 138
-
- item_addtoplayer 66
- item_addduplicate 67
- item_getiteminfo 69
- item_candeploy 70
- item_deploy 71
- item_canholster 72
- item_holster 73
- item_updateiteminfo 74
- item_preframe 75
- item_postframe 76
- item_drop 77
- item_kill 78
- item_attachtoplayer 79
- item_primaryammoindex 80
- item_secondaryammoindex 81
- item_updateclientdata 82
- item_getweaponptr 83
- item_itemslot 68
-
- weapon_extractammo 84
- weapon_extractclipammo 85
- weapon_addweapon 86
- weapon_playemptysound 87
- weapon_resetemptysound 88
- weapon_sendweaponanim 89
- weapon_isusable 90
- weapon_primaryattack 91
- weapon_secondaryattack 92
- weapon_reload 93
- weapon_weaponidle 94
- weapon_retireweapon 95
- weapon_shouldweaponidle 96
- weapon_getnextattackdelay 97
-
- tfc_killed 15
- tfc_istriggered 18
- tfc_giveammo 24
- tfc_dbgetitemname 41
- tfc_engineeruse 57
- tfc_finished 58
- tfc_empexplode 59
- tfc_calcempdmgrad 60
- tfc_takeempblast 61
- tfc_empremove 62
- tfc_takeconcussionblast 63
- tfc_concuss 64
- tfc_radiusdamage 127
- tfc_radiusdamage2 128
-@end
-@section tfc windows
- pev 4
- base 0x0
-
- spawn 1
- precache 2
- keyvalue 3
- objectcaps 6
- activate 7
- setobjectcollisionbox 8
- classify 9
- deathnotice 10
- traceattack 11
- takedamage 12
- takehealth 13
- bloodcolor 15
- tracebleed 16
- mymonsterpointer 18
- mysquadmonsterpointer 19
- gettogglestate 20
- addplayeritem 21
- removeplayeritem 22
- getdelay 24
- ismoving 25
- overridereset 26
- damagedecal 27
- settogglestate 28
- startsneaking 29
- stopsneaking 30
- oncontrols 31
- issneaking 32
- isalive 33
- isbspmodel 34
- reflectgauss 35
- hastarget 36
- isinworld 37
- isplayer 38
- isnetclient 39
- getnexttarget 41
- think 42
- touch 43
- use 44
- blocked 45
- respawn 46
- updateowner 47
- fbecomeprone 48
- center 49
- eyeposition 50
- earposition 51
- bodytarget 52
- illumination 53
- fvisible 55
- fvecvisible 54
-
- look 65
- changeyaw 68
- irelationship 70
- monsterinitdead 72
- becomedead 73
- bestvisibleenemy 75
- finviewcone 77
- fvecinviewcone 76
-
- runai 66
- monsterthink 69
- monsterinit 71
- checklocalmove 78
- move 79
- moveexecute 80
- shouldadvanceroute 81
- getstoppedactivity 82
- stop 83
- checkrangeattack1 84
- checkrangeattack2 85
- checkmeleeattack1 86
- checkmeleeattack2 87
- schedulechange 93
- canplaysequence 94
- canplaysentence 95
- playsentence 96
- playscriptedsentence 97
- sentencestop 98
- getidealstate 99
- setactivity 100
- reportaistate 101
- checkenemy 102
- ftriangulate 103
- setyawspeed 104
- buildnearestroute 105
- findcover 106
- coverradius 108
- fcancheckattacks 109
- checkammo 110
- ignoreconditions 111
- fvalidatehinttype 112
- fcanactiveidle 113
- isoundmask 114
- hearingsensitivity 117
- barnaclevictimbitten 118
- barnaclevictimreleased 119
- preschedulethink 120
- getdeathactivity 121
- gibmonster 122
- hashumangibs 123
- hasaliengibs 124
- fademonster 125
- deathsound 128
- alertsound 129
- idlesound 130
- painsound 131
- stopfollowing 132
-
- player_jump 133
- player_duck 134
- player_prethink 135
- player_postthink 136
- player_shouldfadeondeath 67
- player_impulsecommands 137
-
- item_addtoplayer 65
- item_addduplicate 66
- item_getiteminfo 68
- item_candeploy 69
- item_deploy 70
- item_canholster 71
- item_holster 72
- item_updateiteminfo 73
- item_preframe 74
- item_postframe 75
- item_drop 76
- item_kill 77
- item_attachtoplayer 78
- item_primaryammoindex 79
- item_secondaryammoindex 80
- item_updateclientdata 81
- item_getweaponptr 82
- item_itemslot 67
-
- weapon_extractammo 83
- weapon_extractclipammo 84
- weapon_addweapon 85
- weapon_playemptysound 86
- weapon_resetemptysound 87
- weapon_sendweaponanim 88
- weapon_isusable 89
- weapon_primaryattack 90
- weapon_secondaryattack 91
- weapon_reload 92
- weapon_weaponidle 93
- weapon_retireweapon 94
- weapon_shouldweaponidle 95
- wepaon_getnextattackdelay 96
-
- tfc_killed 14
- tfc_istriggered 17
- tfc_giveammo 23
- tfc_dbgetitemname 40
- tfc_engineeruse 56
- tfc_finished 57
- tfc_empexplode 58
- tfc_calcempdmgrad 59
- tfc_takeempblast 60
- tfc_empremove 61
- tfc_takeconcussionblast 62
- tfc_concuss 63
- tfc_radiusdamage 127
- tfc_radiusdamage2 126
-@end
-
-@section tfc mac
- pev 4
- base 0x0
-
- spawn 1
- precache 2
- keyvalue 3
- objectcaps 6
- activate 7
- setobjectcollisionbox 8
- classify 9
- deathnotice 10
- traceattack 11
- takedamage 12
- takehealth 13
- bloodcolor 15
- tracebleed 16
- mymonsterpointer 18
- mysquadmonsterpointer 19
- gettogglestate 20
- addplayeritem 21
- removeplayeritem 22
- getdelay 24
- ismoving 25
- overridereset 26
- damagedecal 27
- settogglestate 28
- startsneaking 29
- stopsneaking 30
- oncontrols 31
- issneaking 32
- isalive 33
- isbspmodel 34
- reflectgauss 35
- hastarget 36
- isinworld 37
- isplayer 38
- isnetclient 39
- getnexttarget 41
- think 42
- touch 43
- use 44
- blocked 45
- respawn 46
- updateowner 47
- fbecomeprone 48
- center 49
- eyeposition 50
- earposition 51
- bodytarget 52
- illumination 53
- fvisible 54
- fvecvisible 55
-
- look 65
- changeyaw 68
- irelationship 70
- monsterinitdead 72
- becomedead 73
- bestvisibleenemy 75
- finviewcone 76
- fvecinviewcone 77
-
- runai 66
- monsterthink 69
- monsterinit 71
- checklocalmove 78
- move 79
- moveexecute 80
- shouldadvanceroute 81
- getstoppedactivity 82
- stop 83
- checkrangeattack1 84
- checkrangeattack2 85
- checkmeleeattack1 86
- checkmeleeattack2 87
- schedulechange 93
- canplaysequence 94
- canplaysentence 95
- playsentence 96
- playscriptedsentence 97
- sentencestop 98
- getidealstate 99
- setactivity 100
- reportaistate 101
- checkenemy 102
- ftriangulate 103
- setyawspeed 104
- buildnearestroute 105
- findcover 106
- coverradius 108
- fcancheckattacks 109
- checkammo 110
- ignoreconditions 111
- fvalidatehinttype 112
- fcanactiveidle 113
- isoundmask 114
- hearingsensitivity 117
- barnaclevictimbitten 118
- barnaclevictimreleased 119
- preschedulethink 120
- getdeathactivity 121
- gibmonster 122
- hashumangibs 123
- hasaliengibs 124
- fademonster 125
- deathsound 128
- alertsound 129
- idlesound 130
- painsound 131
- stopfollowing 132
-
- player_jump 133
- player_duck 134
- player_prethink 135
- player_postthink 136
- player_shouldfadeondeath 67
- player_impulsecommands 137
-
- item_addtoplayer 65
- item_addduplicate 66
- item_getiteminfo 68
- item_candeploy 69
- item_deploy 70
- item_canholster 71
- item_holster 72
- item_updateiteminfo 73
- item_preframe 74
- item_postframe 75
- item_drop 76
- item_kill 77
- item_attachtoplayer 78
- item_primaryammoindex 79
- item_secondaryammoindex 80
- item_updateclientdata 81
- item_getweaponptr 82
- item_itemslot 67
-
- weapon_extractammo 83
- weapon_extractclipammo 84
- weapon_addweapon 85
- weapon_playemptysound 86
- weapon_resetemptysound 87
- weapon_sendweaponanim 88
- weapon_isusable 89
- weapon_primaryattack 90
- weapon_secondaryattack 91
- weapon_reload 92
- weapon_weaponidle 93
- weapon_retireweapon 94
- weapon_shouldweaponidle 95
- weapon_getnextattackdelay 96
-
- tfc_killed 14
- tfc_istriggered 17
- tfc_giveammo 23
- tfc_dbgetitemname 40
- tfc_engineeruse 56
- tfc_finished 57
- tfc_empexplode 58
- tfc_calcempdmgrad 59
- tfc_takeempblast 60
- tfc_empremove 61
- tfc_takeconcussionblast 62
- tfc_concuss 63
- tfc_radiusdamage 126
- tfc_radiusdamage2 127
-@end
-
-; ns's linux binary is compiled with gcc 3.3, so the "base" is 0, and pev is 4
-@section ns linux
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 14
- bloodcolor 16
- tracebleed 17
- istriggered 18
- mymonsterpointer 19
- mysquadmonsterpointer 20
- gettogglestate 21
- addpoints 22
- addpointstoteam 23
- addplayeritem 24
- removeplayeritem 25
- giveammo 26
- getdelay 27
- ismoving 28
- overridereset 29
- damagedecal 30
- settogglestate 31
- startsneaking 32
- stopsneaking 33
- oncontrols 34
- issneaking 35
- isalive 36
- isbspmodel 37
- reflectgauss 38
- hastarget 39
- isinworld 40
- isplayer 41
- isnetclient 42
- teamid 43
- getnexttarget 46
- think 47
- touch 48
- use 49
- blocked 50
- respawn 52
- updateowner 53
- fbecomeprone 54
- center 55
- eyeposition 56
- earposition 57
- bodytarget 58
- illumination 59
- fvisible 60
- fvecvisible 61
-
- changeyaw 65
- hashumangibs 66
- hasaliengibs 67
- fademonster 68
- gibmonster 69
- getdeathactivity 70
- becomedead 71
- irelationship 73
- painsound 74
- reportaistate 75
- monsterinitdead 76
- look 77
- bestvisibleenemy 78
- finviewcone 80
- fvecinviewcone 81
-
- player_jump 83
- player_duck 84
- player_prethink 85
- player_postthink 86
- player_getgunposition 87
- player_shouldfadeondeath 72
- player_impulsecommands 101
- player_updateclientdata 99
-
- item_addtoplayer 64
- item_addduplicate 65
- item_getiteminfo 68
- item_candeploy 69
- item_deploy 70
- item_canholster 71
- item_holster 72
- item_updateiteminfo 74
- item_preframe 75
- item_postframe 76
- item_drop 77
- item_kill 78
- item_attachtoplayer 79
- item_primaryammoindex 80
- item_secondaryammoindex 81
- item_updateclientdata 82
- item_getweaponptr 83
- item_itemslot 84
-
- weapon_extractammo 85
- weapon_extractclipammo 86
- weapon_addweapon 87
- weapon_playemptysound 88
- weapon_resetemptysound 89
- weapon_sendweaponanim 94
- weapon_isusable 73
- weapon_primaryattack 98
- weapon_secondaryattack 99
- weapon_reload 100
- weapon_weaponidle 101
- weapon_retireweapon 102
- weapon_shouldweaponidle 103
- weapon_usedecrement 104
-
- ns_getpointvalue 13
- ns_awardkill 15
- ns_resetentity 45
- ns_updateonremove 51
- ns_setbonecontroller 63
- ns_savedataforreset 64
- ns_gethull 79
- ns_getmaxwalkspeed 88
- ns_setteamid 90
- ns_geteffectiveplayerclass 91
- ns_getauthenticationmask 92
- ns_effectiveplayerclasschanged 93
- ns_needsteamupdate 94
- ns_sendteamupdate 95
- ns_sendweaponupdate 96
- ns_initplayerfromspawn 97
- ns_packdeadplayeritems 98
- ns_getanimationforactivity 100
- ns_startobserver 102
- ns_stopobserver 103
- ns_getadrenalinefactor 104
- ns_givenameditem 106
- ns_suicide 107
- ns_getcanuseweapon 108
-
- ns_weapon_getweaponprimetime 90
- ns_weapon_primeweapon 91
- ns_weapon_getisweaponprimed 92
- ns_weapon_getisweaponpriming 93
- ns_weapon_defaultdeploy 95
- ns_weapon_defaultreload 96
- ns_weapon_getdeploytime 97
-@end
-
-@section ns windows
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 14
- bloodcolor 16
- tracebleed 17
- istriggered 18
- mymonsterpointer 19
- mysquadmonsterpointer 20
- gettogglestate 21
- addpoints 22
- addpointstoteam 23
- addplayeritem 24
- removeplayeritem 25
- giveammo 26
- getdelay 27
- ismoving 28
- overridereset 29
- damagedecal 30
- settogglestate 31
- startsneaking 32
- stopsneaking 33
- oncontrols 34
- issneaking 35
- isalive 36
- isbspmodel 37
- reflectgauss 38
- hastarget 39
- isinworld 40
- isplayer 41
- isnetclient 42
- teamid 43
- getnexttarget 46
- think 47
- touch 48
- use 49
- blocked 50
- respawn 52
- updateowner 53
- fbecomeprone 54
- center 55
- eyeposition 56
- earposition 57
- bodytarget 58
- illumination 59
- fvisible 60
- fvecvisible 61
-
- changeyaw 65
- hashumangibs 66
- hasaliengibs 67
- fademonster 68
- gibmonster 69
- getdeathactivity 70
- becomedead 71
- irelationship 73
- painsound 74
- reportaistate 75
- monsterinitdead 76
- look 77
- bestvisibleenemy 78
- finviewcone 80
- fvecinviewcone 81
-
- player_jump 83
- player_duck 84
- player_prethink 85
- player_postthink 86
- player_getgunposition 87
- player_shouldfadeondeath 72
- player_impulsecommands 101
- player_updateclientdata 99
-
- item_addtoplayer 64
- item_addduplicate 65
- item_getiteminfo 68
- item_candeploy 69
- item_deploy 70
- item_canholster 71
- item_holster 72
- item_updateiteminfo 74
- item_preframe 75
- item_postframe 76
- item_drop 77
- item_kill 78
- item_attachtoplayer 79
- item_primaryammoindex 80
- item_secondaryammoindex 81
- item_updateclientdata 82
- item_getweaponptr 83
- item_itemslot 84
-
- weapon_extractammo 85
- weapon_extractclipammo 86
- weapon_addweapon 87
- weapon_playemptysound 88
- weapon_resetemptysound 89
- weapon_sendweaponanim 94
- weapon_isusable 73
- weapon_primaryattack 98
- weapon_secondaryattack 99
- weapon_reload 100
- weapon_weaponidle 101
- weapon_retireweapon 102
- weapon_shouldweaponidle 103
- weapon_usedecrement 104
-
- ns_getpointvalue 13
- ns_awardkill 15
- ns_resetentity 45
- ns_updateonremove 51
- ns_setbonecontroller 63
- ns_savedataforreset 64
- ns_gethull 79
- ns_getmaxwalkspeed 88
- ns_setteamid 90
- ns_geteffectiveplayerclass 91
- ns_getauthenticationmask 92
- ns_effectiveplayerclasschanged 93
- ns_needsteamupdate 94
- ns_sendteamupdate 95
- ns_sendweaponupdate 96
- ns_initplayerfromspawn 97
- ns_packdeadplayeritems 98
- ns_getanimationforactivity 100
- ns_startobserver 102
- ns_stopobserver 103
- ns_getadrenalinefactor 104
- ns_givenameditem 106
- ns_suicide 107
- ns_getcanuseweapon 108
-
- ns_weapon_getweaponprimetime 90
- ns_weapon_primeweapon 91
- ns_weapon_getisweaponprimed 92
- ns_weapon_getisweaponpriming 93
- ns_weapon_defaultdeploy 95
- ns_weapon_defaultreload 96
- ns_weapon_getdeploytime 97
-@end
-
-@section ts linux
- pev 0
- base 0x60
-
- spawn 9
- precache 10
- keyvalue 11
- objectcaps 14
- activate 15
- setobjectcollisionbox 18
- classify 19
- deathnotice 20
- traceattack 21
- takedamage 22
- takehealth 23
- killed 24
- bloodcolor 25
- tracebleed 26
- istriggered 27
- mymonsterpointer 28
- mysquadmonsterpointer 29
- gettogglestate 30
- addpoints 31
- addpointstoteam 32
- addplayeritem 33
- removeplayeritem 34
- giveammo 35
- getdelay 36
- ismoving 37
- overridereset 38
- damagedecal 39
- settogglestate 40
- startsneaking 41
- stopsneaking 42
- oncontrols 43
- issneaking 44
- isalive 45
- isbspmodel 46
- reflectgauss 47
- hastarget 48
- isinworld 49
- isplayer 50
- isnetclient 51
- teamid 52
- getnexttarget 53
- think 54
- touch 55
- use 56
- blocked 57
- respawn 59
- updateowner 60
- fbecomeprone 61
- center 62
- eyeposition 63
- earposition 64
- bodytarget 65
- illumination 66
- fvisible 67
- fvecvisible 68
-
- changeyaw 70
- hashumangibs 71
- hasaliengibs 72
- fademonster 73
- gibmonster 74
- getdeathactivity 75
- becomedead 76
- irelationship 78
- painsound 79
- reportaistate 80
- monsterinitdead 81
- look 82
- bestvisibleenemy 83
- finviewcone 84
- fvecinviewcone 85
-
- player_jump 86
- player_duck 87
- player_prethink 88
- player_postthink 89
- player_getgunposition 90
- player_shouldfadeondeath 77
- player_impulsecommands 92
- player_updateclientdata 91
-
- item_addtoplayer 70
- item_addduplicate 71
- item_candeploy 73
- item_deploy 74
- item_canholster 75
- item_holster 76
- item_updateiteminfo 77
- item_preframe 78
- item_postframe 79
- item_drop 80
- item_kill 81
- item_attachtoplayer 82
- item_primaryammoindex 83
- item_secondaryammoindex 84
- item_updateclientdata 85
- item_getweaponptr 86
- item_itemslot 87
-
- weapon_extractammo 88
- weapon_extractclipammo 89
- weapon_addweapon 90
- weapon_playemptysound 91
- weapon_resetemptysound 92
- weapon_sendweaponanim 93
- weapon_isusable 94
- weapon_primaryattack 95
- weapon_secondaryattack 96
- weapon_reload 98
- weapon_weaponidle 99
- weapon_retireweapon 100
- weapon_shouldweaponidle 101
- weapon_usedecrement 102
-
- ts_breakablerespawn 2
- ts_canusedthroughwalls 3
- ts_giveslowmul 4
- ts_goslow 5
- ts_inslow 6
- ts_isobjective 7
- ts_enableobjective 8
- ts_onfreeentprivatedata 12
- ts_shouldcollide 13
-
- ts_weapon_alternateattack 97
-@end
-@section ts windows
- pev 4
- base 0x0
-
- spawn 7
- precache 8
- keyvalue 9
- objectcaps 12
- activate 13
- setobjectcollisionbox 16
- classify 17
- deathnotice 18
- traceattack 19
- takedamage 20
- takehealth 21
- killed 22
- bloodcolor 23
- tracebleed 24
- istriggered 25
- mymonsterpointer 26
- mysquadmonsterpointer 27
- gettogglestate 28
- addpoints 29
- addpointstoteam 30
- addplayeritem 31
- removeplayeritem 32
- giveammo 33
- getdelay 34
- ismoving 35
- overridereset 36
- damagedecal 37
- settogglestate 38
- startsneaking 39
- stopsneaking 40
- oncontrols 41
- issneaking 42
- isalive 43
- isbspmodel 44
- reflectgauss 45
- hastarget 46
- isinworld 47
- isplayer 48
- isnetclient 49
- teamid 50
- getnexttarget 51
- think 52
- touch 53
- use 54
- blocked 55
- respawn 57
- updateowner 58
- fbecomeprone 59
- center 60
- eyeposition 61
- earposition 62
- bodytarget 63
- illumination 64
- fvisible 65
- fvecvisible 66
-
- changeyaw 68
- hashumangibs 69
- hasaliengibs 70
- fademonster 71
- gibmonster 72
- getdeathactivity 73
- becomedead 74
- irelationship 76
- painsound 77
- reportaistate 78
- monsterinitdead 79
- look 80
- bestvisibleenemy 81
- finviewcone 82
- fvecinviewcone 83
-
- player_jump 84
- player_duck 85
- player_prethink 86
- player_postthink 87
- player_getgunposition 88
- player_shouldfadeondeath 75
- player_impulsecommands 90
- player_updateclientdata 89
-
- item_addtoplayer 68
- item_addduplicate 69
- item_candeploy 71
- item_deploy 72
- item_canholster 73
- item_holster 74
- item_updateiteminfo 75
- item_preframe 76
- item_postframe 77
- item_drop 78
- item_kill 79
- item_attachtoplayer 80
- item_primaryammoindex 81
- item_secondaryammoindex 82
- item_updateclientdata 83
- item_getweaponptr 84
- item_itemslot 85
-
- weapon_extractammo 86
- weapon_extractclipammo 87
- weapon_addweapon 88
- weapon_playemptysound 89
- weapon_resetemptysound 90
- weapon_sendweaponanim 91
- weapon_isusable 92
- weapon_primaryattack 93
- weapon_secondaryattack 94
- weapon_reload 96
- weapon_weaponidle 97
- weapon_retireweapon 98
- weapon_shouldweaponidle 99
- weapon_usedecrement 100
-
- ts_breakablerespawn 0
- ts_canusedthroughwalls 1
- ts_giveslowmul 2
- ts_goslow 3
- ts_inslow 4
- ts_isobjective 5
- ts_enableobjective 6
- ts_onfreeentprivatedata 10
- ts_shouldcollide 11
-
- ts_weapon_alternateattack 95
-@end
-
-; Sven-Coop 4.8
-@section svencoop linux
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 6
- activate 7
- setobjectcollisionbox 8
- irelationship 10
- classify 11
- deathnotice 12
- traceattack 13
- takedamage 14
- killed 17
- bloodcolor 18
- tracebleed 19
- istriggered 20
- mymonsterpointer 21
- mysquadmonsterpointer 22
- gettogglestate 23
- addpoints 24
- addpointstoteam 25
- addplayeritem 26
- removeplayeritem 27
- getdelay 29
- ismoving 30
- overridereset 31
- damagedecal 32
- settogglestate 33
- startsneaking 34
- stopsneaking 35
- oncontrols 36
- issneaking 37
- isalive 38
- isbspmodel 39
- reflectgauss 40
- hastarget 41
- isinworld 42
- isplayer 44
- isnetclient 46
- teamid 49
- getnexttarget 51
- think 52
- touch 53
- use 54
- blocked 55
- respawn 57
- updateowner 58
- fbecomeprone 59
- center 60
- eyeposition 61
- earposition 62
- bodytarget 63
- illumination 64
- fvecvisible 66
-
- look 77
- runai 78
- changeyaw 80
- monsterthink 81
- monsterinit 83
- monsterinitdead 84
- becomedead 85
- bestvisibleenemy 88
- finviewcone 89
- fvecinviewcone 90
- checklocalmove 91
- move 92
- moveexecute 93
- shouldadvanceroute 94
- getstoppedactivity 95
- stop 96
- checkrangeattack1 97
- checkrangeattack2 99
- checkmeleeattack1 101
- checkmeleeattack2 103
- schedulechange 111
- canplaysequence 112
- canplaysentence 113
- playsentence 114
- playscriptedsentence 115
- sentencestop 116
- getidealstate 117
- setactivity 118
- reportaistate 120
- checkenemy 121
- setyawspeed 124
- buildnearestroute 125
- findcover 126
- coverradius 131
- fcancheckattacks 132
- checkammo 134
- ignoreconditions 135
- fvalidatehinttype 136
- fcanactiveidle 137
- isoundmask 138
- hearingsensitivity 141
- barnaclevictimbitten 142
- barnaclevictimreleased 143
- preschedulethink 150
- getdeathactivity 151
- gibmonster 152
- hashumangibs 154
- hasaliengibs 155
- fademonster 156
- deathsound 159
- alertsound 160
- idlesound 161
- painsound 162
- stopfollowing 163
-
- player_getgunposition 157
- player_jump 179
- player_duck 180
- player_prethink 181
- player_postthink 182
- player_updateclientdata 184
- player_impulsecommands 185
-
- item_addtoplayer 77
- item_addduplicate 78
- item_getiteminfo 80
- item_candeploy 81
- item_deploy 82
- item_canholster 83
- item_holster 84
- item_updateiteminfo 85
- item_preframe 86
- item_postframe 87
- item_drop 88
- item_kill 89
- item_attachtoplayer 90
- item_primaryammoindex 91
- item_secondaryammoindex 92
- item_updateclientdata 93
- item_getweaponptr 94
- item_itemslot 95
-
- weapon_extractammo 96
- weapon_extractclipammo 97
- weapon_addweapon 98
- weapon_playemptysound 99
- weapon_resetemptysound 100
- weapon_sendweaponanim 101
- weapon_isusable 103
- weapon_primaryattack 104
- weapon_secondaryattack 105
- weapon_reload 107
- weapon_weaponidle 108
- weapon_retireweapon 109
- weapon_shouldweaponidle 110
- weapon_usedecrement 111
-
- sc_getclassification 9
- sc_takehealth 15
- sc_takearmor 16
- sc_giveammo 28
- sc_ismonster 43
- sc_isphysx 45
- sc_ispointentity 47
- sc_ismachine 48
- sc_criticalremove 50
- sc_updateonremove 56
- sc_fvisible 65
- sc_fvisiblefrompos 67
- sc_isfacing 68
- sc_getpointsfordamage 69
- sc_getdamagepoints 70
- sc_oncreate 73
- sc_ondestroy 74
- sc_isvalidentity 75
- sc_shouldfadeondeath 79
- sc_setupfriendly 80
- sc_revivethink 85
- sc_revive 86
- sc_startmonster 87
- sc_checkrangeattack1_move 98
- sc_checkrangeattack2_move 100
- sc_checkmeleeattack1_move 102
- sc_checkmeleeattack2_move 104
- sc_checktankusage 105
- sc_setgaitactivity 119
- sc_ftriangulate 122
- sc_ftriangulateextension 123
- sc_findcovergrenade 127
- sc_findcoverdistance 128
- sc_findattackpoint 129
- sc_fvalidatecover 130
- sc_checkattacker 133
- sc_nofriendlyfire1 144
- sc_nofriendlyfire2 145
- sc_nofriendlyfire3 146
- sc_nofriendlyfiretopos 147
- sc_fvisiblegunpos 148
- sc_finbulletcone 149
- sc_callgibmonster 153
- sc_checktimebaseddamage 157
- sc_ismoving 158
- sc_isplayerfollowing 164
- sc_startplayerfollowing 165
- sc_stopplayerfollowing 166
- sc_usesound 167
- sc_unusesound 168
- sc_ridemonster 169
- sc_checkandapplygenericattacks 170
- sc_checkscared 171
- sc_checkcreaturedanger 172
- sc_checkfalldamage 173
- sc_checkrevival 174
- sc_mediccallsound 175
-
- sc_player_menuinputperformed 176
- sc_player_ismenuinputdone 177
- sc_player_specialspawn 178
- sc_player_isconnected 182
- sc_player_isvalidinfoentity 186
- sc_player_levelend 187
- sc_player_votestarted 188
- sc_player_canstartnextvote 189
- sc_player_vote 190
- sc_player_hasvoted 191
- sc_player_resetvote 192
- sc_player_lastvoteinput 193
- sc_player_initvote 194
- sc_player_timetostartnextvote 195
- sc_player_resetview 196
- sc_player_getlogfrequency 197
- sc_player_logplayerstats 198
- sc_player_disablecollisionwithplayer 199
- sc_player_enablecollisionwithplayer 200
- sc_player_cantouchplayer 201
-
- sc_item_materialize 79
-
- sc_weapon_bulletaccuracy 102
- sc_weapon_tertiaryattack 106
- sc_weapon_burstsupplement 112
- sc_weapon_getp_model 113
- sc_weapon_getw_model 114
- sc_weapon_getv_model 115
- sc_weapon_precachecustommodels 116
- sc_weapon_ismultiplayer 117
- sc_weapon_frunfuncs 118
- sc_weapon_setfov 119
- sc_weapon_fcanrun 120
- sc_weapon_customdecrement 121
- sc_weapon_setv_model 122
- sc_weapon_setp_model 123
- sc_weapon_changeweaponskin 124
-@end
-
-; Sven-Coop 4.8
-@section svencoop windows
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 6
- activate 7
- setobjectcollisionbox 8
- irelationship 10
- classify 11
- deathnotice 12
- traceattack 13
- takedamage 14
- killed 17
- bloodcolor 18
- tracebleed 19
- istriggered 20
- mymonsterpointer 21
- mysquadmonsterpointer 22
- gettogglestate 23
- addpoints 24
- addpointstoteam 25
- addplayeritem 26
- removeplayeritem 27
- getdelay 29
- ismoving 30
- overridereset 31
- damagedecal 32
- settogglestate 33
- startsneaking 34
- stopsneaking 35
- oncontrols 36
- issneaking 37
- isalive 38
- isbspmodel 39
- reflectgauss 40
- hastarget 41
- isinworld 42
- isplayer 44
- isnetclient 46
- teamid 49
- getnexttarget 51
- think 52
- touch 53
- use 54
- blocked 55
- respawn 57
- updateowner 58
- fbecomeprone 59
- center 60
- eyeposition 61
- earposition 62
- bodytarget 63
- illumination 64
- fvecvisible 65
-
- look 76
- runai 77
- changeyaw 79
- monsterthink 80
- monsterinit 82
- monsterinitdead 83
- becomedead 84
- bestvisibleenemy 87
- finviewcone 88
- fvecinviewcone 89
- checklocalmove 90
- move 91
- moveexecute 92
- shouldadvanceroute 93
- getstoppedactivity 94
- stop 95
- checkrangeattack1 96
- checkrangeattack2 98
- checkmeleeattack1 100
- checkmeleeattack2 102
- schedulechange 110
- canplaysequence 111
- canplaysentence 112
- playsentence 113
- playscriptedsentence 114
- sentencestop 115
- getidealstate 116
- setactivity 117
- reportaistate 119
- checkenemy 120
- setyawspeed 123
- buildnearestroute 124
- findcover 125
- coverradius 130
- fcancheckattacks 131
- checkammo 133
- ignoreconditions 134
- fvalidatehinttype 135
- fcanactiveidle 136
- isoundmask 137
- hearingsensitivity 140
- barnaclevictimbitten 141
- barnaclevictimreleased 142
- preschedulethink 149
- getdeathactivity 150
- gibmonster 151
- hashumangibs 153
- hasaliengibs 154
- fademonster 155
- deathsound 158
- alertsound 159
- idlesound 160
- painsound 161
- stopfollowing 162
-
- player_getgunposition 156
- player_jump 178
- player_duck 179
- player_prethink 180
- player_postthink 181
- player_updateclientdata 183
- player_impulsecommands 184
-
- item_addtoplayer 76
- item_addduplicate 77
- item_getiteminfo 79
- item_candeploy 80
- item_deploy 81
- item_canholster 82
- item_holster 83
- item_updateiteminfo 84
- item_preframe 85
- item_postframe 86
- item_drop 87
- item_kill 88
- item_attachtoplayer 89
- item_primaryammoindex 90
- item_secondaryammoindex 91
- item_updateclientdata 92
- item_getweaponptr 93
- item_itemslot 94
-
- weapon_extractammo 95
- weapon_extractclipammo 96
- weapon_addweapon 97
- weapon_playemptysound 98
- weapon_resetemptysound 99
- weapon_sendweaponanim 100
- weapon_isusable 102
- weapon_primaryattack 103
- weapon_secondaryattack 104
- weapon_reload 106
- weapon_weaponidle 107
- weapon_retireweapon 108
- weapon_shouldweaponidle 109
- weapon_usedecrement 110
-
- sc_getclassification 9
- sc_takehealth 15
- sc_takearmor 16
- sc_giveammo 28
- sc_ismonster 43
- sc_isphysx 45
- sc_ispointentity 47
- sc_ismachine 48
- sc_criticalremove 50
- sc_updateonremove 56
- sc_fvisible 66
- sc_fvisiblefrompos 67
- sc_isfacing 68
- sc_getpointsfordamage 69
- sc_getdamagepoints 70
- sc_oncreate 72
- sc_ondestroy 73
- sc_isvalidentity 74
- sc_shouldfadeondeath 78
- sc_setupfriendly 79
- sc_revivethink 84
- sc_revive 85
- sc_startmonster 86
- sc_checkrangeattack1_move 97
- sc_checkrangeattack2_move 99
- sc_checkmeleeattack1_move 101
- sc_checkmeleeattack2_move 103
- sc_checktankusage 104
- sc_setgaitactivity 118
- sc_ftriangulate 121
- sc_ftriangulateextension 122
- sc_findcovergrenade 126
- sc_findcoverdistance 127
- sc_findattackpoint 128
- sc_fvalidatecover 129
- sc_checkattacker 132
- sc_nofriendlyfire1 145
- sc_nofriendlyfire2 144
- sc_nofriendlyfire3 143
- sc_nofriendlyfiretopos 146
- sc_fvisiblegunpos 147
- sc_finbulletcone 148
- sc_callgibmonster 152
- sc_checktimebaseddamage 156
- sc_ismoving 157
- sc_isplayerfollowing 163
- sc_startplayerfollowing 164
- sc_stopplayerfollowing 165
- sc_usesound 166
- sc_unusesound 167
- sc_ridemonster 168
- sc_checkandapplygenericattacks 169
- sc_checkscared 170
- sc_checkcreaturedanger 171
- sc_checkfalldamage 172
- sc_checkrevival 173
- sc_mediccallsound 174
-
- sc_player_menuinputperformed 175
- sc_player_ismenuinputdone 176
- sc_player_specialspawn 177
- sc_player_isconnected 181
- sc_player_isvalidinfoentity 185
- sc_player_levelend 186
- sc_player_votestarted 187
- sc_player_canstartnextvote 188
- sc_player_vote 189
- sc_player_hasvoted 190
- sc_player_resetvote 191
- sc_player_lastvoteinput 192
- sc_player_initvote 193
- sc_player_timetostartnextvote 194
- sc_player_resetview 195
- sc_player_getlogfrequency 196
- sc_player_logplayerstats 197
- sc_player_disablecollisionwithplayer 198
- sc_player_enablecollisionwithplayer 199
- sc_player_cantouchplayer 200
-
- sc_item_materialize 78
-
- sc_weapon_bulletaccuracy 101
- sc_weapon_tertiaryattack 105
- sc_weapon_burstsupplement 111
- sc_weapon_getp_model 112
- sc_weapon_getw_model 113
- sc_weapon_getv_model 114
- sc_weapon_precachecustommodels 115
- sc_weapon_ismultiplayer 116
- sc_weapon_frunfuncs 117
- sc_weapon_setfov 118
- sc_weapon_fcanrun 119
- sc_weapon_customdecrement 120
- sc_weapon_setv_model 121
- sc_weapon_setp_model 122
- sc_weapon_changeweaponskin 123
-@end
-
-; Earth's Special Forces 1.2.3
-@section esf linux
- pev 0
- base 0x60
-
- spawn 2
- precache 3
- keyvalue 4
- objectcaps 7
- activate 8
- setobjectcollisionbox 9
- classify 10
- deathnotice 11
- traceattack 12
- takedamage 13
- takehealth 14
- killed 15
- bloodcolor 16
- tracebleed 17
- istriggered 18
- mymonsterpointer 19
- mysquadmonsterpointer 20
- gettogglestate 21
- addpoints 22
- addpointstoteam 23
- addplayeritem 24
- removeplayeritem 25
- getdelay 26
- ismoving 27
- overridereset 28
- damagedecal 29
- settogglestate 30
- startsneaking 31
- stopsneaking 32
- oncontrols 33
- issneaking 34
- isalive 35
- isbspmodel 36
- reflectgauss 37
- hastarget 38
- isinworld 39
- isplayer 40
- isnetclient 41
- teamid 42
- getnexttarget 43
- think 44
- touch 45
- use 46
- blocked 47
- respawn 48
- updateowner 49
- fbecomeprone 50
- center 51
- eyeposition 52
- earposition 53
- bodytarget 54
- illumination 55
- fvisible 56
- fvecvisible 57
-
- look 59
- changeyaw 62
- irelationship 64
- monsterinitdead 66
- becomedead 67
- bestvisibleenemy 69
- finviewcone 70
- fvecinviewcone 71
-
- runai 60
- monsterthink 63
- monsterinit 65
- checklocalmove 72
- move 73
- moveexecute 74
- shouldadvanceroute 75
- getstoppedactivity 76
- stop 77
- checkrangeattack1 78
- checkrangeattack2 79
- checkmeleeattack1 80
- checkmeleeattack2 81
- schedulechange 87
- canplaysequence 88
- canplaysentence 89
- playsentence 90
- playscriptedsentence 91
- sentencestop 92
- getidealstate 93
- setactivity 94
- reportaistate 95
- checkenemy 96
- ftriangulate 97
- setyawspeed 98
- buildnearestroute 99
- findcover 100
- coverradius 102
- fcancheckattacks 103
- checkammo 104
- ignoreconditions 105
- fvalidatehinttype 106
- fcanactiveidle 107
- isoundmask 108
- hearingsensitivity 111
- barnaclevictimbitten 112
- barnaclevictimreleased 113
- preschedulethink 114
- getdeathactivity 115
- gibmonster 116
- hashumangibs 117
- hasaliengibs 118
- fademonster 119
- deathsound 121
- alertsound 122
- idlesound 123
- painsound 124
- stopfollowing 125
-
- player_jump 126
- player_prethink 127
- player_postthink 128
- player_getgunposition 120
- player_shouldfadeondeath 61
- player_impulsecommands 130
- player_updateclientdata 129
-
- item_addtoplayer 59
- item_addduplicate 60
- item_getiteminfo 61
- item_candeploy 62
- item_deploy 63
- item_canholster 64
- item_holster 65
- item_updateiteminfo 66
- item_preframe 67
- item_postframe 68
- item_drop 69
- item_kill 70
- item_attachtoplayer 71
- item_primaryammoindex 72
- item_secondaryammoindex 73
- item_updateclientdata 74
- item_getweaponptr 75
- item_itemslot 76
-
- weapon_playemptysound 77
- weapon_resetemptysound 78
- weapon_sendweaponanim 79
- weapon_primaryattack 80
- weapon_secondaryattack 81
- weapon_weaponidle 82
- weapon_retireweapon 83
- weapon_shouldweaponidle 84
- weapon_usedecrement 85
-
- esf_weapon_holsterwhenmeleed 86
-@end
-
-@section esf windows
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 13
- bloodcolor 14
- tracebleed 15
- istriggered 16
- mymonsterpointer 17
- mysquadmonsterpointer 18
- gettogglestate 19
- addpoints 20
- addpointstoteam 21
- addplayeritem 22
- removeplayeritem 23
- getdelay 24
- ismoving 25
- overridereset 26
- damagedecal 27
- settogglestate 28
- startsneaking 29
- stopsneaking 30
- oncontrols 31
- issneaking 32
- isalive 33
- isbspmodel 34
- reflectgauss 35
- hastarget 36
- isinworld 37
- isplayer 38
- isnetclient 39
- teamid 40
- getnexttarget 41
- think 42
- touch 43
- use 44
- blocked 45
- respawn 46
- updateowner 47
- fbecomeprone 48
- center 49
- eyeposition 50
- earposition 51
- bodytarget 52
- illumination 53
- fvisible 54
- fvecvisible 55
-
- look 57
- changeyaw 60
- irelationship 62
- monsterinitdead 64
- becomedead 65
- bestvisibleenemy 67
- finviewcone 68
- fvecinviewcone 69
-
- runai 58
- monsterthink 61
- monsterinit 63
- checklocalmove 70
- move 71
- moveexecute 72
- shouldadvanceroute 73
- getstoppedactivity 74
- stop 75
- checkrangeattack1 76
- checkrangeattack2 77
- checkmeleeattack1 78
- checkmeleeattack2 79
- schedulechange 85
- canplaysequence 86
- canplaysentence 87
- playsentence 88
- playscriptedsentence 89
- sentencestop 90
- getidealstate 91
- setactivity 92
- reportaistate 93
- checkenemy 94
- ftriangulate 95
- setyawspeed 96
- buildnearestroute 97
- findcover 98
- coverradius 100
- fcancheckattacks 101
- checkammo 102
- ignoreconditions 103
- fvalidatehinttype 104
- fcanactiveidle 105
- isoundmask 106
- hearingsensitivity 109
- barnaclevictimbitten 110
- barnaclevictimreleased 111
- preschedulethink 112
- getdeathactivity 113
- gibmonster 114
- hashumangibs 115
- hasaliengibs 116
- fademonster 117
- deathsound 119
- alertsound 120
- idlesound 121
- painsound 122
- stopfollowing 123
-
- player_jump 124
- player_prethink 125
- player_postthink 126
- player_getgunposition 118
- player_shouldfadeondeath 59
- player_impulsecommands 128
- player_updateclientdata 127
-
- item_addtoplayer 57
- item_addduplicate 58
- item_getiteminfo 59
- item_candeploy 60
- item_deploy 61
- item_canholster 62
- item_holster 63
- item_updateiteminfo 64
- item_preframe 65
- item_postframe 66
- item_drop 67
- item_kill 68
- item_attachtoplayer 69
- item_primaryammoindex 70
- item_secondaryammoindex 71
- item_updateclientdata 72
- item_getweaponptr 73
- item_itemslot 74
-
- weapon_playemptysound 75
- weapon_resetemptysound 76
- weapon_sendweaponanim 77
- weapon_primaryattack 78
- weapon_secondaryattack 79
- weapon_weaponidle 80
- weapon_retireweapon 81
- weapon_shouldweaponidle 82
- weapon_usedecrement 83
-
- esf_weapon_holsterwhenmeleed 84
-@end
-
-; ESF Open Beta is built with GCC 3.x, and the VTable was slightly changed
-@section esf_openbeta linux
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 13
- killed 14
- bloodcolor 15
- tracebleed 16
- istriggered 17
- mymonsterpointer 18
- mysquadmonsterpointer 19
- gettogglestate 20
- addpoints 21
- addpointstoteam 22
- addplayeritem 23
- removeplayeritem 24
- getdelay 25
- ismoving 26
- overridereset 27
- damagedecal 28
- settogglestate 29
- startsneaking 30
- stopsneaking 31
- oncontrols 32
- issneaking 33
- isalive 34
- isbspmodel 35
- reflectgauss 36
- hastarget 37
- isinworld 38
- isplayer 39
- isnetclient 43
- teamid 44
- getnexttarget 47
- think 48
- touch 49
- use 50
- blocked 51
- respawn 52
- updateowner 53
- fbecomeprone 54
- center 55
- eyeposition 56
- earposition 57
- bodytarget 58
- illumination 59
- fvisible 60
- fvecvisible 61
-
- look 63
- changeyaw 66
- irelationship 68
- monsterinitdead 70
- becomedead 71
- bestvisibleenemy 73
- finviewcone 74
- fvecinviewcone 75
-
- runai 64
- monsterthink 67
- monsterinit 69
- checklocalmove 76
- move 77
- moveexecute 78
- shouldadvanceroute 79
- getstoppedactivity 80
- stop 81
- checkrangeattack1 82
- checkrangeattack2 83
- checkmeleeattack1 84
- checkmeleeattack2 85
- schedulechange 91
- canplaysequence 92
- canplaysentence 93
- playsentence 94
- playscriptedsentence 95
- sentencestop 96
- getidealstate 97
- setactivity 98
- reportaistate 99
- checkenemy 100
- ftriangulate 101
- setyawspeed 102
- buildnearestroute 103
- findcover 104
- coverradius 106
- fcancheckattacks 107
- checkammo 108
- ignoreconditions 109
- fvalidatehinttype 110
- fcanactiveidle 111
- isoundmask 112
- hearingsensitivity 115
- barnaclevictimbitten 116
- barnaclevictimreleased 117
- preschedulethink 118
- getdeathactivity 119
- gibmonster 120
- hashumangibs 121
- hasaliengibs 122
- fademonster 123
- deathsound 125
- alertsound 126
- idlesound 127
- painsound 128
- stopfollowing 129
-
- player_updateclientdata 186
- player_jump 187
- player_prethink 189
- player_postthink 190
- player_getgunposition 124
- player_shouldfadeondeath 65
- player_impulsecommands 193
-
- item_addtoplayer 63
- item_addduplicate 64
- item_getiteminfo 65
- item_candeploy 66
- item_deploy 67
- item_canholster 68
- item_holster 69
- item_updateiteminfo 70
- item_preframe 71
- item_postframe 72
- item_drop 73
- item_kill 74
- item_attachtoplayer 75
- item_primaryammoindex 76
- item_secondaryammoindex 77
- item_updateclientdata 78
- item_getweaponptr 79
- item_itemslot 80
-
- weapon_playemptysound 81
- weapon_resetemptysound 82
- weapon_sendweaponanim 83
- weapon_primaryattack 84
- weapon_secondaryattack 85
- weapon_weaponidle 86
- weapon_retireweapon 87
- weapon_shouldweaponidle 88
- weapon_usedecrement 89
-
- esf_isenvmodel 40
- esf_takedamage2 12
- esf_isfighter 41
- esf_isbuddy 42
- esf_emitsound 45
- esf_emitnullsound 46
- esf_increasestrength 130
- esf_increasepl 131
- esf_setpowerlevel 132
- esf_setmaxpowerlevel 133
- esf_stopanitrigger 134
- esf_stopfly 135
- esf_hideweapon 136
- esf_clientremoveweapon 137
- esf_sendclientcustommodel 138
- esf_canturbo 139
- esf_canprimaryfire 140
- esf_cansecondaryfire 141
- esf_canstopfly 142
- esf_canblock 143
- esf_canraiseKi 144
- esf_canraisestamina 145
- esf_canteleport 146
- esf_canstartfly 147
- esf_canstartpowerup 148
- esf_canjump 149
- esf_canwalljump 150
- esf_issuperjump 151
- esf_ismoveback 152
- esf_checkwalljump 153
- esf_enablewalljump 154
- esf_disablewalljump 155
- esf_resetwalljumpvars 156
- esf_getwalljumpanim 157
- esf_getwalljumpanim2 158
- esf_setwalljumpanimation 159
- esf_setflymovetype 160
- esf_isflymovetype 161
- esf_iswalkmovetype 162
- esf_setwalkmovetype 163
- esf_drawchargebar 164
- esf_startblock 165
- esf_stopblock 166
- esf_startfly 167
- esf_getmaxspeed 168
- esf_setanimation 169
- esf_playanimation 170
- esf_getmoveforward 171
- esf_getmoveright 172
- esf_getmoveup 173
- esf_addblindfx 174
- esf_removeblindfx 175
- esf_disablepsbar 176
- esf_addbeamboxcrosshair 177
- esf_removebeamboxcrosshair 178
- esf_drawpswinbonus 179
- esf_drawpsbar 180
- esf_lockcrosshair 181
- esf_unlockcrosshair 182
- esf_rotatecrosshair 183
- esf_unrotatecrosshair 184
- esf_watermove 185
- esf_checktimebaseddamage 188
- esf_doessecondaryattack 191
- esf_doesprimaryattack 192
- esf_removespecialmodes 194
- esf_stopturbo 195
- esf_takebean 196
- esf_getpowerlevel 197
- esf_removeallotherweapons 198
- esf_stopswoop 199
- esf_setdeathanimation 201
- esf_setmodel 202
- esf_addattacks 203
- esf_emitclasssound 205
- esf_checklightning 206
- esf_freezecontrols 207
- esf_unfreezecontrols 208
- esf_updateki 209
- esf_updatehealth 210
- esf_getteleportdir 211
-
- esf_weapon_holsterwhenmeleed 90
-
-@end
-@section esf_openbeta windows
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 13
- killed 14
- bloodcolor 15
- tracebleed 16
- istriggered 17
- mymonsterpointer 18
- mysquadmonsterpointer 19
- gettogglestate 20
- addpoints 21
- addpointstoteam 22
- addplayeritem 23
- removeplayeritem 24
- getdelay 25
- ismoving 26
- overridereset 27
- damagedecal 28
- settogglestate 29
- startsneaking 30
- stopsneaking 31
- oncontrols 32
- issneaking 33
- isalive 34
- isbspmodel 35
- reflectgauss 36
- hastarget 37
- isinworld 38
- isplayer 39
- isnetclient 43
- teamid 44
- getnexttarget 47
- think 48
- touch 49
- use 50
- blocked 51
- respawn 52
- updateowner 53
- fbecomeprone 54
- center 55
- eyeposition 56
- earposition 57
- bodytarget 58
- illumination 59
- fvisible 60
- fvecvisible 61
-
- look 63
- changeyaw 66
- irelationship 68
- monsterinitdead 70
- becomedead 71
- bestvisibleenemy 73
- finviewcone 74
- fvecinviewcone 75
-
- runai 64
- monsterthink 67
- monsterinit 69
- checklocalmove 76
- move 77
- moveexecute 78
- shouldadvanceroute 79
- getstoppedactivity 80
- stop 81
- checkrangeattack1 82
- checkrangeattack2 83
- checkmeleeattack1 84
- checkmeleeattack2 85
- schedulechange 91
- canplaysequence 92
- canplaysentence 93
- playsentence 94
- playscriptedsentence 95
- sentencestop 96
- getidealstate 97
- setactivity 98
- reportaistate 99
- checkenemy 100
- ftriangulate 101
- setyawspeed 102
- buildnearestroute 103
- findcover 104
- coverradius 106
- fcancheckattacks 107
- checkammo 108
- ignoreconditions 109
- fvalidatehinttype 110
- fcanactiveidle 111
- isoundmask 112
- hearingsensitivity 115
- barnaclevictimbitten 116
- barnaclevictimreleased 117
- preschedulethink 118
- getdeathactivity 119
- gibmonster 120
- hashumangibs 121
- hasaliengibs 122
- fademonster 123
- deathsound 125
- alertsound 126
- idlesound 127
- painsound 128
- stopfollowing 129
-
- player_updateclientdata 186
- player_jump 187
- player_prethink 189
- player_postthink 190
- player_getgunposition 124
- player_shouldfadeondeath 65
- player_impulsecommands 193
-
- item_addtoplayer 63
- item_addduplicate 64
- item_getiteminfo 65
- item_candeploy 66
- item_deploy 67
- item_canholster 68
- item_holster 69
- item_updateiteminfo 70
- item_preframe 71
- item_postframe 72
- item_drop 73
- item_kill 74
- item_attachtoplayer 75
- item_primaryammoindex 76
- item_secondaryammoindex 77
- item_updateclientdata 78
- item_getweaponptr 79
- item_itemslot 80
-
- weapon_playemptysound 81
- weapon_resetemptysound 82
- weapon_sendweaponanim 83
- weapon_primaryattack 84
- weapon_secondaryattack 85
- weapon_weaponidle 86
- weapon_retireweapon 87
- weapon_shouldweaponidle 88
- weapon_usedecrement 89
-
- esf_isenvmodel 40
- esf_takedamage2 12
- esf_isfighter 41
- esf_isbuddy 42
- esf_emitsound 45
- esf_emitnullsound 46
- esf_increasestrength 130
- esf_increasepl 131
- esf_setpowerlevel 132
- esf_setmaxpowerlevel 133
- esf_stopanitrigger 134
- esf_stopfly 135
- esf_hideweapon 136
- esf_clientremoveweapon 137
- esf_sendclientcustommodel 138
- esf_canturbo 139
- esf_canprimaryfire 140
- esf_cansecondaryfire 141
- esf_canstopfly 142
- esf_canblock 143
- esf_canraiseKi 144
- esf_canraisestamina 145
- esf_canteleport 146
- esf_canstartfly 147
- esf_canstartpowerup 148
- esf_canjump 149
- esf_canwalljump 150
- esf_issuperjump 151
- esf_ismoveback 152
- esf_checkwalljump 153
- esf_enablewalljump 154
- esf_disablewalljump 155
- esf_resetwalljumpvars 156
- esf_getwalljumpanim 157
- esf_getwalljumpanim2 158
- esf_setwalljumpanimation 159
- esf_setflymovetype 160
- esf_isflymovetype 161
- esf_iswalkmovetype 162
- esf_setwalkmovetype 163
- esf_drawchargebar 164
- esf_startblock 165
- esf_stopblock 166
- esf_startfly 167
- esf_getmaxspeed 168
- esf_setanimation 169
- esf_playanimation 170
- esf_getmoveforward 171
- esf_getmoveright 172
- esf_getmoveup 173
- esf_addblindfx 174
- esf_removeblindfx 175
- esf_disablepsbar 176
- esf_addbeamboxcrosshair 177
- esf_removebeamboxcrosshair 178
- esf_drawpswinbonus 179
- esf_drawpsbar 180
- esf_lockcrosshair 181
- esf_unlockcrosshair 182
- esf_rotatecrosshair 183
- esf_unrotatecrosshair 184
- esf_watermove 185
- esf_checktimebaseddamage 188
- esf_doessecondaryattack 191
- esf_doesprimaryattack 192
- esf_removespecialmodes 194
- esf_stopturbo 195
- esf_takebean 196
- esf_getpowerlevel 197
- esf_removeallotherweapons 198
- esf_stopswoop 199
- esf_setdeathanimation 201
- esf_setmodel 202
- esf_addattacks 203
- esf_emitclasssound 205
- esf_checklightning 206
- esf_freezecontrols 207
- esf_unfreezecontrols 208
- esf_updateki 209
- esf_updatehealth 210
- esf_getteleportdir 211
-
- esf_weapon_holsterwhenmeleed 90
-
-@end
-@section valve linux
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 13
- bloodcolor 14
- tracebleed 15
- istriggered 16
- mymonsterpointer 17
- mysquadmonsterpointer 18
- gettogglestate 19
- addpoints 20
- addpointstoteam 21
- addplayeritem 22
- removeplayeritem 23
- giveammo 24
- getdelay 25
- ismoving 26
- overridereset 27
- damagedecal 28
- settogglestate 29
- startsneaking 30
- stopsneaking 31
- oncontrols 32
- issneaking 33
- isalive 34
- isbspmodel 35
- reflectgauss 36
- hastarget 37
- isinworld 38
- isplayer 39
- isnetclient 40
- teamid 41
- getnexttarget 42
- think 43
- touch 44
- use 45
- blocked 46
- respawn 47
- updateowner 48
- fbecomeprone 49
- center 50
- eyeposition 51
- earposition 52
- bodytarget 53
- illumination 54
- fvisible 55
- fvecvisible 56
-
- look 58
- changeyaw 61
- irelationship 63
- monsterinitdead 65
- becomedead 66
- bestvisibleenemy 68
- finviewcone 69
- fvecinviewcone 70
-
- runai 59
- monsterthink 62
- monsterinit 64
- checklocalmove 71
- move 72
- moveexecute 73
- shouldadvanceroute 74
- getstoppedactivity 75
- stop 76
- checkrangeattack1 77
- checkrangeattack2 78
- checkmeleeattack1 79
- checkmeleeattack2 80
- schedulechange 86
- canplaysequence 87
- canplaysentence 88
- playsentence 89
- playscriptedsentence 90
- sentencestop 91
- getidealstate 92
- setactivity 93
- reportaistate 94
- checkenemy 95
- ftriangulate 96
- setyawspeed 97
- buildnearestroute 98
- findcover 99
- coverradius 101
- fcancheckattacks 102
- checkammo 103
- ignoreconditions 104
- fvalidatehinttype 105
- fcanactiveidle 106
- isoundmask 107
- hearingsensitivity 110
- barnaclevictimbitten 111
- barnaclevictimreleased 112
- preschedulethink 113
- getdeathactivity 114
- gibmonster 115
- hashumangibs 116
- hasaliengibs 117
- fademonster 118
- deathsound 120
- alertsound 121
- idlesound 122
- painsound 123
- stopfollowing 124
-
- player_jump 125
- player_duck 126
- player_prethink 127
- player_postthink 128
- player_getgunposition 119
- player_shouldfadeondeath 60
- player_impulsecommands 130
- player_updateclientdata 129
-
- item_addtoplayer 58
- item_addduplicate 59
- item_getiteminfo 60
- item_candeploy 61
- item_deploy 62
- item_canholster 63
- item_holster 64
- item_updateiteminfo 65
- item_preframe 66
- item_postframe 67
- item_drop 68
- item_kill 69
- item_attachtoplayer 70
- item_primaryammoindex 71
- item_secondaryammoindex 72
- item_updateclientdata 73
- item_getweaponptr 74
- item_itemslot 75
-
- weapon_extractammo 76
- weapon_extractclipammo 77
- weapon_addweapon 78
- weapon_playemptysound 79
- weapon_resetemptysound 80
- weapon_sendweaponanim 81
- weapon_isusable 82
- weapon_primaryattack 83
- weapon_secondaryattack 84
- weapon_reload 85
- weapon_weaponidle 86
- weapon_retireweapon 87
- weapon_shouldweaponidle 88
- weapon_usedecrement 89
-@end
-@section valve windows
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 13
- bloodcolor 14
- tracebleed 15
- istriggered 16
- mymonsterpointer 17
- mysquadmonsterpointer 18
- gettogglestate 19
- addpoints 20
- addpointstoteam 21
- addplayeritem 22
- removeplayeritem 23
- giveammo 24
- getdelay 25
- ismoving 26
- overridereset 27
- damagedecal 28
- settogglestate 29
- startsneaking 30
- stopsneaking 31
- oncontrols 32
- issneaking 33
- isalive 34
- isbspmodel 35
- reflectgauss 36
- hastarget 37
- isinworld 38
- isplayer 39
- isnetclient 40
- teamid 41
- getnexttarget 42
- think 43
- touch 44
- use 45
- blocked 46
- respawn 47
- updateowner 48
- fbecomeprone 49
- center 50
- eyeposition 51
- earposition 52
- bodytarget 53
- illumination 54
- fvisible 55
- fvecvisible 56
-
- look 58
- changeyaw 61
- irelationship 63
- monsterinitdead 65
- becomedead 66
- bestvisibleenemy 68
- finviewcone 69
- fvecinviewcone 70
-
- runai 59
- monsterthink 62
- monsterinit 64
- checklocalmove 71
- move 72
- moveexecute 73
- shouldadvanceroute 74
- getstoppedactivity 75
- stop 76
- checkrangeattack1 77
- checkrangeattack2 78
- checkmeleeattack1 79
- checkmeleeattack2 80
- schedulechange 86
- canplaysequence 87
- canplaysentence 88
- playsentence 89
- playscriptedsentence 90
- sentencestop 91
- getidealstate 92
- setactivity 93
- reportaistate 94
- checkenemy 95
- ftriangulate 96
- setyawspeed 97
- buildnearestroute 98
- findcover 99
- coverradius 101
- fcancheckattacks 102
- checkammo 103
- ignoreconditions 104
- fvalidatehinttype 105
- fcanactiveidle 106
- isoundmask 107
- hearingsensitivity 110
- barnaclevictimbitten 111
- barnaclevictimreleased 112
- preschedulethink 113
- getdeathactivity 114
- gibmonster 115
- hashumangibs 116
- hasaliengibs 117
- fademonster 118
- deathsound 120
- alertsound 121
- idlesound 122
- painsound 123
- stopfollowing 124
-
- player_jump 125
- player_duck 126
- player_prethink 127
- player_postthink 128
- player_getgunposition 119
- player_shouldfadeondeath 60
- player_impulsecommands 130
- player_updateclientdata 129
-
- item_addtoplayer 58
- item_addduplicate 59
- item_getiteminfo 60
- item_candeploy 61
- item_deploy 62
- item_canholster 63
- item_holster 64
- item_updateiteminfo 65
- item_preframe 66
- item_postframe 67
- item_drop 68
- item_kill 69
- item_attachtoplayer 70
- item_primaryammoindex 71
- item_secondaryammoindex 72
- item_updateclientdata 73
- item_getweaponptr 74
- item_itemslot 75
-
- weapon_extractammo 76
- weapon_extractclipammo 77
- weapon_addweapon 78
- weapon_playemptysound 79
- weapon_resetemptysound 80
- weapon_sendweaponanim 81
- weapon_isusable 82
- weapon_primaryattack 83
- weapon_secondaryattack 84
- weapon_reload 85
- weapon_weaponidle 86
- weapon_retireweapon 87
- weapon_shouldweaponidle 88
- weapon_usedecrement 89
-@end
-
-@section valve mac
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 13
- bloodcolor 14
- tracebleed 15
- istriggered 16
- mymonsterpointer 17
- mysquadmonsterpointer 18
- gettogglestate 19
- addpoints 20
- addpointstoteam 21
- addplayeritem 22
- removeplayeritem 23
- giveammo 24
- getdelay 25
- ismoving 26
- overridereset 27
- damagedecal 28
- settogglestate 29
- startsneaking 30
- stopsneaking 31
- oncontrols 32
- issneaking 33
- isalive 34
- isbspmodel 35
- reflectgauss 36
- hastarget 37
- isinworld 38
- isplayer 39
- isnetclient 40
- teamid 41
- getnexttarget 42
- think 43
- touch 44
- use 45
- blocked 46
- respawn 47
- updateowner 48
- fbecomeprone 49
- center 50
- eyeposition 51
- earposition 52
- bodytarget 53
- illumination 54
- fvisible 55
- fvecvisible 56
-
- look 58
- changeyaw 61
- irelationship 63
- monsterinitdead 65
- becomedead 66
- bestvisibleenemy 68
- finviewcone 69
- fvecinviewcone 70
-
- runai 59
- monsterthink 62
- monsterinit 64
- checklocalmove 71
- move 72
- moveexecute 73
- shouldadvanceroute 74
- getstoppedactivity 75
- stop 76
- checkrangeattack1 77
- checkrangeattack2 78
- checkmeleeattack1 79
- checkmeleeattack2 80
- schedulechange 86
- canplaysequence 87
- canplaysentence 88
- playsentence 89
- playscriptedsentence 90
- sentencestop 91
- getidealstate 92
- setactivity 93
- reportaistate 94
- checkenemy 95
- ftriangulate 96
- setyawspeed 97
- buildnearestroute 98
- findcover 99
- coverradius 101
- fcancheckattacks 102
- checkammo 103
- ignoreconditions 104
- fvalidatehinttype 105
- fcanactiveidle 106
- isoundmask 107
- hearingsensitivity 110
- barnaclevictimbitten 111
- barnaclevictimreleased 112
- preschedulethink 113
- getdeathactivity 114
- gibmonster 115
- hashumangibs 116
- hasaliengibs 117
- fademonster 118
- deathsound 120
- alertsound 121
- idlesound 122
- painsound 123
- stopfollowing 124
-
- player_jump 125
- player_duck 126
- player_prethink 127
- player_postthink 128
- player_getgunposition 119
- player_shouldfadeondeath 60
- player_impulsecommands 130
- player_updateclientdata 129
-
- item_addtoplayer 58
- item_addduplicate 59
- item_getiteminfo 60
- item_candeploy 61
- item_deploy 62
- item_canholster 63
- item_holster 64
- item_updateiteminfo 65
- item_preframe 66
- item_postframe 67
- item_drop 68
- item_kill 69
- item_attachtoplayer 70
- item_primaryammoindex 71
- item_secondaryammoindex 72
- item_updateclientdata 73
- item_getweaponptr 74
- item_itemslot 75
-
- weapon_extractammo 76
- weapon_extractclipammo 77
- weapon_addweapon 78
- weapon_playemptysound 79
- weapon_resetemptysound 80
- weapon_sendweaponanim 81
- weapon_isusable 82
- weapon_primaryattack 83
- weapon_secondaryattack 84
- weapon_reload 85
- weapon_weaponidle 86
- weapon_retireweapon 87
- weapon_shouldweaponidle 88
- weapon_usedecrement 89
-@end
-
-@section gearbox windows
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 13
- bloodcolor 14
- tracebleed 15
- istriggered 16
- mymonsterpointer 17
- mysquadmonsterpointer 18
- gettogglestate 20
- addpoints 21
- addpointstoteam 22
- addplayeritem 23
- removeplayeritem 24
- giveammo 25
- getdelay 26
- ismoving 27
- overridereset 28
- damagedecal 29
- settogglestate 30
- startsneaking 31
- stopsneaking 32
- oncontrols 33
- issneaking 34
- isalive 35
- isbspmodel 36
- reflectgauss 37
- hastarget 38
- isinworld 39
- isplayer 40
- isnetclient 41
- teamid 42
- getnexttarget 43
- think 44
- touch 45
- use 46
- blocked 47
- respawn 48
- updateowner 49
- fbecomeprone 50
- center 51
- eyeposition 52
- earposition 53
- bodytarget 54
- illumination 55
- fvisible 57
- fvecvisible 56
-
- look 60
- changeyaw 63
- irelationship 65
- monsterinitdead 67
- becomedead 68
- bestvisibleenemy 70
- finviewcone 72
- fvecinviewcone 71
-
- runai 61
- monsterthink 64
- monsterinit 66
- checklocalmove 73
- move 74
- moveexecute 75
- shouldadvanceroute 76
- getstoppedactivity 77
- stop 78
- checkrangeattack1 79
- checkrangeattack2 80
- checkmeleeattack1 81
- checkmeleeattack2 82
- schedulechange 88
- canplaysequence 89
- canplaysentence 90
- playsentence 91
- playscriptedsentence 92
- sentencestop 93
- getidealstate 94
- setactivity 95
- reportaistate 96
- checkenemy 97
- ftriangulate 98
- setyawspeed 99
- buildnearestroute 100
- findcover 101
- coverradius 103
- fcancheckattacks 104
- checkammo 105
- ignoreconditions 106
- fvalidatehinttype 107
- fcanactiveidle 108
- isoundmask 109
- hearingsensitivity 112
- barnaclevictimbitten 113
- barnaclevictimreleased 114
- preschedulethink 115
- getdeathactivity 116
- gibmonster 117
- hashumangibs 118
- hasaliengibs 119
- fademonster 120
- deathsound 123
- alertsound 124
- idlesound 125
- painsound 126
- stopfollowing 127
-
- player_jump 127
- player_duck 128
- player_prethink 129
- player_postthink 130
- player_getgunposition 121
- player_shouldfadeondeath 62
- player_impulsecommands 132
- player_updateclientdata 131
-
- item_addtoplayer 60
- item_addduplicate 61
- item_getiteminfo 62
- item_candeploy 63
- item_deploy 64
- item_canholster 65
- item_holster 66
- item_updateiteminfo 67
- item_preframe 68
- item_postframe 69
- item_drop 70
- item_kill 71
- item_attachtoplayer 72
- item_primaryammoindex 73
- item_secondaryammoindex 74
- item_updateclientdata 76
- item_getweaponptr 77
- item_itemslot 78
-
- weapon_extractammo 79
- weapon_extractclipammo 80
- weapon_addweapon 81
- weapon_playemptysound 82
- weapon_resetemptysound 83
- weapon_sendweaponanim 84
- weapon_isusable 85
- weapon_primaryattack 86
- weapon_secondaryattack 87
- weapon_reload 88
- weapon_weaponidle 89
- weapon_retireweapon 90
- weapon_shouldweaponidle 91
- weapon_usedecrement 92
-
- gearbox_mysquadtalkmonsterpointer 19
- gearbox_weapontimebase 58
-@end
-
-@section gearbox linux
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 13
- bloodcolor 14
- tracebleed 15
- istriggered 16
- mymonsterpointer 17
- mysquadmonsterpointer 18
- gettogglestate 20
- addpoints 21
- addpointstoteam 22
- addplayeritem 23
- removeplayeritem 24
- giveammo 25
- getdelay 26
- ismoving 27
- overridereset 28
- damagedecal 29
- settogglestate 30
- startsneaking 31
- stopsneaking 32
- oncontrols 33
- issneaking 34
- isalive 35
- isbspmodel 36
- reflectgauss 37
- hastarget 38
- isinworld 39
- isplayer 40
- isnetclient 41
- teamid 42
- getnexttarget 43
- think 44
- touch 45
- use 46
- blocked 47
- respawn 48
- updateowner 49
- fbecomeprone 50
- center 51
- eyeposition 52
- earposition 53
- bodytarget 54
- illumination 55
- fvisible 56
- fvecvisible 57
-
- look 60
- changeyaw 63
- irelationship 65
- monsterinitdead 67
- becomedead 68
- bestvisibleenemy 70
- finviewcone 71
- fvecinviewcone 72
-
- runai 61
- monsterthink 64
- monsterinit 66
- checklocalmove 73
- move 74
- moveexecute 75
- shouldadvanceroute 76
- getstoppedactivity 77
- stop 78
- checkrangeattack1 79
- checkrangeattack2 80
- checkmeleeattack1 81
- checkmeleeattack2 82
- schedulechange 88
- canplaysequence 89
- canplaysentence 90
- playsentence 91
- playscriptedsentence 92
- sentencestop 93
- getidealstate 94
- setactivity 95
- reportaistate 96
- checkenemy 97
- ftriangulate 98
- setyawspeed 99
- buildnearestroute 100
- findcover 101
- coverradius 103
- fcancheckattacks 104
- checkammo 105
- ignoreconditions 106
- fvalidatehinttype 107
- fcanactiveidle 108
- isoundmask 109
- hearingsensitivity 112
- barnaclevictimbitten 113
- barnaclevictimreleased 114
- preschedulethink 115
- getdeathactivity 116
- gibmonster 117
- hashumangibs 118
- hasaliengibs 119
- fademonster 120
- deathsound 123
- alertsound 124
- idlesound 125
- painsound 126
- stopfollowing 127
-
- player_jump 127
- player_duck 128
- player_prethink 129
- player_postthink 130
- player_getgunposition 121
- player_shouldfadeondeath 62
- player_impulsecommands 132
- player_updateclientdata 131
-
- item_addtoplayer 60
- item_addduplicate 61
- item_getiteminfo 62
- item_candeploy 63
- item_deploy 64
- item_canholster 65
- item_holster 66
- item_updateiteminfo 67
- item_preframe 68
- item_postframe 69
- item_drop 70
- item_kill 71
- item_attachtoplayer 72
- item_primaryammoindex 73
- item_secondaryammoindex 74
- item_updateclientdata 76
- item_getweaponptr 77
- item_itemslot 78
-
- weapon_extractammo 79
- weapon_extractclipammo 80
- weapon_addweapon 81
- weapon_playemptysound 82
- weapon_resetemptysound 83
- weapon_sendweaponanim 84
- weapon_isusable 85
- weapon_primaryattack 86
- weapon_secondaryattack 87
- weapon_reload 88
- weapon_weaponidle 89
- weapon_retireweapon 90
- weapon_shouldweaponidle 91
- weapon_usedecrement 92
-
- gearbox_mysquadtalkmonsterpointer 19
- gearbox_weapontimebase 58
-@end
-
-@section gearbox mac
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 13
- bloodcolor 14
- tracebleed 15
- istriggered 16
- mymonsterpointer 17
- mysquadmonsterpointer 18
- gettogglestate 20
- addpoints 21
- addpointstoteam 22
- addplayeritem 23
- removeplayeritem 24
- giveammo 25
- getdelay 26
- ismoving 27
- overridereset 28
- damagedecal 29
- settogglestate 30
- startsneaking 31
- stopsneaking 32
- oncontrols 33
- issneaking 34
- isalive 35
- isbspmodel 36
- reflectgauss 37
- hastarget 38
- isinworld 39
- isplayer 40
- isnetclient 41
- teamid 42
- getnexttarget 43
- think 44
- touch 45
- use 46
- blocked 47
- respawn 48
- updateowner 49
- fbecomeprone 50
- center 51
- eyeposition 52
- earposition 53
- bodytarget 54
- illumination 55
- fvisible 56
- fvecvisible 57
-
- look 60
- changeyaw 63
- irelationship 65
- monsterinitdead 67
- becomedead 68
- bestvisibleenemy 70
- finviewcone 71
- fvecinviewcone 72
-
- runai 61
- monsterthink 64
- monsterinit 66
- checklocalmove 73
- move 74
- moveexecute 75
- shouldadvanceroute 76
- getstoppedactivity 77
- stop 78
- checkrangeattack1 79
- checkrangeattack2 80
- checkmeleeattack1 81
- checkmeleeattack2 82
- schedulechange 88
- canplaysequence 89
- canplaysentence 90
- playsentence 91
- playscriptedsentence 92
- sentencestop 93
- getidealstate 94
- setactivity 95
- reportaistate 96
- checkenemy 97
- ftriangulate 98
- setyawspeed 99
- buildnearestroute 100
- findcover 101
- coverradius 103
- fcancheckattacks 104
- checkammo 105
- ignoreconditions 106
- fvalidatehinttype 107
- fcanactiveidle 108
- isoundmask 109
- hearingsensitivity 112
- barnaclevictimbitten 113
- barnaclevictimreleased 114
- preschedulethink 115
- getdeathactivity 116
- gibmonster 117
- hashumangibs 118
- hasaliengibs 119
- fademonster 120
- deathsound 123
- alertsound 124
- idlesound 125
- painsound 126
- stopfollowing 127
-
- player_jump 127
- player_duck 128
- player_prethink 129
- player_postthink 130
- player_getgunposition 121
- player_shouldfadeondeath 62
- player_impulsecommands 132
- player_updateclientdata 131
-
- item_addtoplayer 60
- item_addduplicate 61
- item_getiteminfo 62
- item_candeploy 63
- item_deploy 64
- item_canholster 65
- item_holster 66
- item_updateiteminfo 67
- item_preframe 68
- item_postframe 69
- item_drop 70
- item_kill 71
- item_attachtoplayer 72
- item_primaryammoindex 73
- item_secondaryammoindex 74
- item_updateclientdata 76
- item_getweaponptr 77
- item_itemslot 78
-
- weapon_extractammo 79
- weapon_extractclipammo 80
- weapon_addweapon 81
- weapon_playemptysound 82
- weapon_resetemptysound 83
- weapon_sendweaponanim 84
- weapon_isusable 85
- weapon_primaryattack 86
- weapon_secondaryattack 87
- weapon_reload 88
- weapon_weaponidle 89
- weapon_retireweapon 90
- weapon_shouldweaponidle 91
- weapon_usedecrement 92
-
- gearbox_mysquadtalkmonsterpointer 19
- gearbox_weapontimebase 58
-@end
-
-@section ag linux
- pev 0
- base 0x60
-
- spawn 2
- precache 3
- keyvalue 4
- objectcaps 7
- activate 8
- setobjectcollisionbox 9
- classify 10
- deathnotice 11
- traceattack 12
- takedamage 13
- takehealth 14
- killed 15
- bloodcolor 16
- tracebleed 17
- istriggered 18
- mymonsterpointer 19
- mysquadmonsterpointer 20
- gettogglestate 21
- addpoints 22
- addpointstoteam 23
- addplayeritem 24
- removeplayeritem 25
- giveammo 26
- getdelay 27
- ismoving 28
- overridereset 29
- damagedecal 30
- settogglestate 31
- startsneaking 32
- stopsneaking 33
- oncontrols 34
- issneaking 35
- isalive 36
- isbspmodel 37
- reflectgauss 38
- hastarget 39
- isinworld 40
- isplayer 41
- isnetclient 42
- teamid 43
- getnexttarget 44
- think 45
- touch 46
- use 47
- blocked 48
- respawn 50
- updateowner 51
- fbecomeprone 52
- center 53
- eyeposition 54
- earposition 55
- bodytarget 56
- illumination 57
- fvisible 58
- fvecvisible 59
-
- look 62
- changeyaw 65
- irelationship 67
- monsterinitdead 69
- becomedead 70
- bestvisibleenemy 72
- finviewcone 73
- fvecinviewcone 74
-
- runai 63
- monsterthink 66
- monsterinit 68
- checklocalmove 75
- move 76
- moveexecute 77
- shouldadvanceroute 78
- getstoppedactivity 79
- stop 80
- checkrangeattack1 81
- checkrangeattack2 82
- checkmeleeattack1 83
- checkmeleeattack2 84
- schedulechange 90
- canplaysequence 91
- canplaysentence 92
- playsentence 93
- playscriptedsentence 94
- sentencestop 95
- getidealstate 96
- setactivity 97
- reportaistate 98
- checkenemy 99
- ftriangulate 100
- setyawspeed 101
- buildnearestroute 102
- findcover 103
- coverradius 105
- fcancheckattacks 106
- checkammo 107
- ignoreconditions 108
- fvalidatehinttype 109
- fcanactiveidle 110
- isoundmask 111
- hearingsensitivity 114
- barnaclevictimbitten 115
- barnaclevictimreleased 116
- preschedulethink 117
- getdeathactivity 118
- gibmonster 119
- hashumangibs 120
- hasaliengibs 121
- fademonster 122
- deathsound 124
- alertsound 125
- idlesound 126
- painsound 127
- stopfollowing 128
-
- player_jump 129
- player_duck 130
- player_prethink 131
- player_postthink 132
- player_getgunposition 123
- player_shouldfadeondeath 64
- player_impulsecommands 134
- player_updateclientdata 133
-
- item_addtoplayer 61
- item_addduplicate 62
- item_getiteminfo 63
- item_candeploy 64
- item_deploy 65
- item_canholster 66
- item_holster 67
- item_updateiteminfo 68
- item_preframe 69
- item_postframe 70
- item_drop 71
- item_kill 72
- item_attachtoplayer 73
- item_primaryammoindex 74
- item_secondaryammoindex 75
- item_updateclientdata 76
- item_getweaponptr 77
- item_itemslot 78
-
- weapon_extractammo 79
- weapon_extractclipammo 80
- weapon_addweapon 81
- weapon_playemptysound 82
- weapon_resetemptysound 83
- weapon_sendweaponanim 84
- weapon_isusable 85
- weapon_primaryattack 86
- weapon_secondaryattack 87
- weapon_reload 88
- weapon_weaponidle 89
- weapon_retireweapon 90
- weapon_shouldweaponidle 91
- weapon_usedecrement 92
-
-@end
-@section ag windows
- pev 4
- base 0x0
-
- spawn 0
- precache 1
- keyvalue 2
- objectcaps 5
- activate 6
- setobjectcollisionbox 7
- classify 8
- deathnotice 9
- traceattack 10
- takedamage 11
- takehealth 12
- killed 13
- bloodcolor 14
- tracebleed 15
- istriggered 16
- mymonsterpointer 17
- mysquadmonsterpointer 18
- gettogglestate 19
- addpoints 20
- addpointstoteam 21
- addplayeritem 22
- removeplayeritem 23
- giveammo 24
- getdelay 25
- ismoving 26
- overridereset 27
- damagedecal 28
- settogglestate 29
- startsneaking 30
- stopsneaking 31
- oncontrols 32
- issneaking 33
- isalive 34
- isbspmodel 35
- reflectgauss 36
- hastarget 37
- isinworld 38
- isplayer 39
- isnetclient 40
- teamid 41
- getnexttarget 42
- think 43
- touch 44
- use 45
- blocked 46
- respawn 48
- updateowner 49
- fbecomeprone 50
- center 51
- eyeposition 52
- earposition 53
- bodytarget 54
- illumination 55
- fvisible 56
- fvecvisible 57
-
- look 60
- changeyaw 63
- irelationship 65
- monsterinitdead 67
- becomedead 68
- bestvisibleenemy 70
- finviewcone 71
- fvecinviewcone 72
-
- runai 61
- monsterthink 64
- monsterinit 66
- checklocalmove 73
- move 74
- moveexecute 75
- shouldadvanceroute 76
- getstoppedactivity 77
- stop 78
- checkrangeattack1 79
- checkrangeattack2 80
- checkmeleeattack1 81
- checkmeleeattack2 82
- schedulechange 88
- canplaysequence 89
- canplaysentence 90
- playsentence 91
- playscriptedsentence 92
- sentencestop 93
- getidealstate 94
- setactivity 95
- reportaistate 96
- checkenemy 97
- ftriangulate 98
- setyawspeed 99
- buildnearestroute 100
- findcover 101
- coverradius 103
- fcancheckattacks 104
- checkammo 105
- ignoreconditions 106
- fvalidatehinttype 107
- fcanactiveidle 108
- isoundmask 109
- hearingsensitivity 112
- barnaclevictimbitten 113
- barnaclevictimreleased 114
- preschedulethink 115
- getdeathactivity 116
- gibmonster 117
- hashumangibs 118
- hasaliengibs 119
- fademonster 120
- deathsound 122
- alertsound 123
- idlesound 124
- painsound 125
- stopfollowing 126
-
- player_jump 127
- player_duck 128
- player_prethink 129
- player_postthink 130
- player_getgunposition 121
- player_shouldfadeondeath 62
- player_impulsecommands 132
- player_updateclientdata 131
-
- item_addtoplayer 59
- item_addduplicate 60
- item_getiteminfo 61
- item_candeploy 62
- item_deploy 63
- item_canholster 64
- item_holster 65
- item_updateiteminfo 66
- item_preframe 67
- item_postframe 68
- item_drop 69
- item_kill 70
- item_attachtoplayer 71
- item_primaryammoindex 72
- item_secondaryammoindex 73
- item_updateclientdata 74
- item_getweaponptr 75
- item_itemslot 76
-
- weapon_extractammo 77
- weapon_extractclipammo 78
- weapon_addweapon 79
- weapon_playemptysound 80
- weapon_resetemptysound 81
- weapon_sendweaponanim 82
- weapon_isusable 83
- weapon_primaryattack 84
- weapon_secondaryattack 85
- weapon_reload 86
- weapon_weaponidle 87
- weapon_retireweapon 88
- weapon_shouldweaponidle 89
- weapon_usedecrement 90
-@end
-
\ No newline at end of file
diff --git a/configs/ns/amxx.cfg b/configs/ns/amxx.cfg
index cdc5bba9..047fadf9 100755
--- a/configs/ns/amxx.cfg
+++ b/configs/ns/amxx.cfg
@@ -156,6 +156,11 @@ amx_language_display_msg 1
// Default value: 1
amx_help_display_msg 1
+// Time to wait (in seconds) before displaying a message about amx_help to a client once joined the server
+//
+// Default value: 15
+amx_help_display_msg_time 15
+
// Amount of commands per amx_help page
//
// Default value: 10
diff --git a/configs/ns/users.ini b/configs/ns/users.ini
index 7ef776b9..2d7b59c7 100755
--- a/configs/ns/users.ini
+++ b/configs/ns/users.ini
@@ -4,7 +4,7 @@
; Line starting with ; is a comment
; Access flags:
-; a - immunity (can't be kicked/baned/slayed/slaped and affected by other commmands)
+; a - immunity (can't be kicked/banned/slayed/slapped and affected by other commmands)
; b - reservation (can join on reserved slots)
; c - amx_kick command
; d - amx_ban and amx_unban commands (permanent and temporary bans)
@@ -34,6 +34,9 @@
; c - this is steamid/wonid
; d - this is ip
; e - password is not checked (only name/ip/steamid needed)
+; k - name or tag is case sensitive. eg: if you set it so the name "Ham"
+; is protected and case sensitive (flags "k" only), then anybody
+; can use the names "haM", "HAM", "ham", etc, but not "Ham"
; Password:
; Add to your autoexec.cfg: setinfo _pw ""
diff --git a/configs/tfc/core.ini b/configs/tfc/core.ini
index c6c7b085..9bc17193 100755
--- a/configs/tfc/core.ini
+++ b/configs/tfc/core.ini
@@ -1,22 +1,25 @@
; Configuration file for AMX Mod X
-amxx_logs addons/amxmodx/logs
-amxx_configsdir addons/amxmodx/configs
-amxx_datadir addons/amxmodx/data
-amxx_modules addons/amxmodx/configs/modules.ini
-amxx_plugins addons/amxmodx/configs/plugins.ini
-amxx_pluginsdir addons/amxmodx/plugins
-amxx_modulesdir addons/amxmodx/modules
-amxx_vault addons/amxmodx/data/vault.ini
+amxx_logs addons/amxmodx/logs
+amxx_configsdir addons/amxmodx/configs
+amxx_datadir addons/amxmodx/data
+amxx_modules addons/amxmodx/configs/modules.ini
+amxx_plugins addons/amxmodx/configs/plugins.ini
+amxx_pluginsdir addons/amxmodx/plugins
+amxx_modulesdir addons/amxmodx/modules
+amxx_vault addons/amxmodx/data/vault.ini
; It is important that "tfcstats" comes before "tfcstats_score"
-tfcstats addons/amxmodx/data/tfcstats.dat
-tfcstats_score addons/amxmodx/data/tfcstats.amxx
+tfcstats addons/amxmodx/data/tfcstats.dat
+tfcstats_score addons/amxmodx/data/tfcstats.amxx
; Logging mode
; 0 - no logging
; 1 - one logfile / day
; 2 - one logfile / map
; 3 - HL Logs
-amxx_logging 1
+amxx_logging 1
+
+; MySQL default timeout
+mysql_timeout 60
; Binary logging level
; add these up to get what you want
@@ -27,10 +30,10 @@ amxx_logging 1
; 8 - log all native params
; 16 - log internal function calls (only in debug mode)
; 32 - log line number accesses (only in debug mode)
-bin_logging 49
+bin_logging 49
; Maximum binary log size, in megs
-max_binlog_size 20
+max_binlog_size 20
; Plugin optimization flags - add these up to get what you want
; lowering these may stop crashes on very old CPUs
@@ -39,4 +42,9 @@ max_binlog_size 20
; 1 - float arithmetic
; 2 - float comparisons
; 4 - float rounding
-optimizer 7
+optimizer 7
+
+; Admin command flag manager
+; 0 - enabled
+; 1 - disabled
+disableflagman 0
diff --git a/configs/ts/core.ini b/configs/ts/core.ini
index 8c409aa9..bff017d0 100755
--- a/configs/ts/core.ini
+++ b/configs/ts/core.ini
@@ -1,22 +1,25 @@
; Configuration file for AMX Mod X
-amxx_logs addons/amxmodx/logs
-amxx_configsdir addons/amxmodx/configs
-amxx_datadir addons/amxmodx/data
-amxx_modules addons/amxmodx/configs/modules.ini
-amxx_plugins addons/amxmodx/configs/plugins.ini
-amxx_pluginsdir addons/amxmodx/plugins
-amxx_modulesdir addons/amxmodx/modules
-amxx_vault addons/amxmodx/data/vault.ini
+amxx_logs addons/amxmodx/logs
+amxx_configsdir addons/amxmodx/configs
+amxx_datadir addons/amxmodx/data
+amxx_modules addons/amxmodx/configs/modules.ini
+amxx_plugins addons/amxmodx/configs/plugins.ini
+amxx_pluginsdir addons/amxmodx/plugins
+amxx_modulesdir addons/amxmodx/modules
+amxx_vault addons/amxmodx/data/vault.ini
; It is important that "tsstats" comes before "tsstats_score"
-tsstats addons/amxmodx/data/tsstats.dat
-tsstats_score addons/amxmodx/data/tsstats.amxx
+tsstats addons/amxmodx/data/tsstats.dat
+tsstats_score addons/amxmodx/data/tsstats.amxx
; Logging mode
; 0 - no logging
; 1 - one logfile / day
; 2 - one logfile / map
; 3 - HL Logs
-amxx_logging 1
+amxx_logging 1
+
+; MySQL default timeout
+mysql_timeout 60
; Binary logging level
; add these up to get what you want
@@ -27,10 +30,10 @@ amxx_logging 1
; 8 - log all native params
; 16 - log internal function calls (only in debug mode)
; 32 - log line number accesses (only in debug mode)
-bin_logging 49
+bin_logging 49
; Maximum binary log size, in megs
-max_binlog_size 20
+max_binlog_size 20
; Plugin optimization flags - add these up to get what you want
; lowering these may stop crashes on very old CPUs
@@ -39,4 +42,9 @@ max_binlog_size 20
; 1 - float arithmetic
; 2 - float comparisons
; 4 - float rounding
-optimizer 7
+optimizer 7
+
+; Admin command flag manager
+; 0 - enabled
+; 1 - disabled
+disableflagman 0
diff --git a/configure.py b/configure.py
index 6c8ab69d..567b09fd 100644
--- a/configure.py
+++ b/configure.py
@@ -30,4 +30,6 @@ run.options.add_option('--mysql', type='string', dest='mysql_path', default='',
help='Path to MySQL')
run.options.add_option('--disable-auto-versioning', action='store_true', dest='disable_auto_versioning',
default=False, help='Disable the auto versioning script')
+run.options.add_option('--nasm', type='string', dest='nasm_path',
+ default='nasm', help='Path to NASM')
run.Configure()
diff --git a/editor/studio/UnitfrmMain.dfm b/editor/studio/UnitfrmMain.dfm
index 8434dc0c..e3a0bc22 100755
--- a/editor/studio/UnitfrmMain.dfm
+++ b/editor/studio/UnitfrmMain.dfm
@@ -7369,6 +7369,7 @@ object frmMain: TfrmMain
'list_store_string'
'log_amx'
'log_message'
+ 'elog_message'
'log_to_file'
'make_deathmsg'
'make_string'
diff --git a/editor/studio/config/Editor.sci b/editor/studio/config/Editor.sci
index fdce2546..c703cbd7 100644
--- a/editor/studio/config/Editor.sci
+++ b/editor/studio/config/Editor.sci
@@ -389,7 +389,7 @@ server_changelevel plugin_cfg plugin_end plugin_log plugin_precache client_infoc
set_localinfo get_localinfo show_motd client_print engclient_print console_print console_cmd register_event register_logevent set_hudmessage show_hudmessage show_menu read_data read_datanum read_logdata read_logargc read_logargv\
parse_loguser server_print is_map_valid is_user_bot is_user_hltv is_user_connected is_user_connecting is_user_alive is_dedicated_server is_linux_server is_jit_enabled get_amxx_verstring get_user_attacker get_user_aiming get_user_frags get_user_armor get_user_deaths\
get_user_health get_user_index get_user_ip user_has_weapon get_user_weapon get_user_ammo num_to_word get_user_team get_user_time get_user_ping get_user_origin get_user_weapons get_weaponname get_user_name get_user_authid get_user_userid user_slap\
-user_kill log_amx log_message log_to_file get_playersnum get_players read_argv read_args read_argc read_flags get_flags find_player remove_quotes client_cmd engclient_cmd server_cmd set_cvar_string\
+user_kill log_amx log_message elog_message log_to_file get_playersnum get_players read_argv read_args read_argc read_flags get_flags find_player remove_quotes client_cmd engclient_cmd server_cmd set_cvar_string\
cvar_exists remove_cvar_flags set_cvar_flags get_cvar_flags set_cvar_float get_cvar_float get_cvar_num set_cvar_num get_cvar_string get_mapname get_timeleft get_gametime get_maxplayers get_modname get_time format_time get_systime\
parse_time set_task remove_task change_task task_exists set_user_flags get_user_flags remove_user_flags register_clcmd register_concmd register_srvcmd get_clcmd get_clcmdsnum get_srvcmd get_srvcmdsnum get_concmd get_concmd_plid\
get_concmdsnum get_plugins_cvarsnum get_plugins_cvar register_menuid register_menucmd get_user_menu server_exec emit_sound register_cvar random_float random_num get_user_msgid get_user_msgname xvar_exists get_xvar_id get_xvar_num get_xvar_float\
diff --git a/gamedata/common.games/master.games.txt b/gamedata/common.games/master.games.txt
index 47e1476e..5042e42b 100644
--- a/gamedata/common.games/master.games.txt
+++ b/gamedata/common.games/master.games.txt
@@ -743,6 +743,25 @@
"game" "czero"
}
+ "gamerules.games/cstrike/offsets-cgamerules.txt"
+ {
+ "game" "cstrike"
+ "game" "czero"
+ }
+
+ "gamerules.games/cstrike/offsets-chalflifemultiplay.txt"
+ {
+ "game" "cstrike"
+ "game" "czero"
+ }
+
+ "gamerules.games/cstrike/offsets-chalflifetraining.txt"
+ {
+ "game" "cstrike"
+ "game" "czero"
+ }
+
+
//
// Day Of Defeat
@@ -1533,11 +1552,21 @@
"game" "dod"
}
+ "gamerules.games/dod/offsets-cdodteamplay.txt"
+ {
+ "game" "dod"
+ }
+
+ "gamerules.games/dod/offsets-cspdodrules.txt"
+ {
+ "game" "dod"
+ }
+
//
// Team Fortress Classic
//
-
+
"entities.games/tfc/offsets-cbaseentity.txt"
{
"game" "tfc"
@@ -2158,6 +2187,20 @@
"game" "tfc"
}
+ "gamerules.games/tfc/offsets-chalflifemultiplay.txt"
+ {
+ "game" "tfc"
+ }
+
+ "gamerules.games/tfc/offsets-chalflifeteamplay.txt"
+ {
+ "game" "tfc"
+ }
+
+ "gamerules.games/tfc/offsets-cteamfortress.txt"
+ {
+ "game" "tfc"
+ }
//
// Half-Life: Opposing Force
@@ -3338,11 +3381,30 @@
"game" "gearbox"
}
+ "gamerules.games/gearbox/offsets-chalflifemultiplay.txt"
+ {
+ "game" "gearbox"
+ }
+
+ "gamerules.games/gearbox/offsets-chalflifectfplay.txt"
+ {
+ "game" "gearbox"
+ }
+
+ "gamerules.games/gearbox/offsets-chalflifecoopplay.txt"
+ {
+ "game" "gearbox"
+ }
+
+ "gamerules.games/gearbox/offsets-chalflifeteamplay.txt"
+ {
+ "game" "gearbox"
+ }
//
// Half-Life: Deathmatch
//
-
+
"entities.games/valve/offsets-cbaseentity.txt"
{
"game" "valve"
@@ -4032,4 +4094,78 @@
{
"game" "valve"
}
+
+ "gamerules.games/valve/offsets-chalflifemultiplay.txt"
+ {
+ "game" "valve"
+ }
+
+ "gamerules.games/valve/offsets-chalflifeteamplay.txt"
+ {
+ "game" "valve"
+ }
+
+
+
+ //
+ // Virtual Functions
+ //
+
+ "virtual.games/ag/offsets-common.txt"
+ {
+ "game" "ag"
+ }
+
+ "virtual.games/cstrike/offsets-common.txt"
+ {
+ "game" "cstrike"
+ "game" "czero"
+ }
+
+ "virtual.games/dod/offsets-common.txt"
+ {
+ "game" "dod"
+ }
+
+ "virtual.games/esf/offsets-common.txt"
+ {
+ "game" "esf"
+ }
+
+ "virtual.games/esf_openbeta/offsets-common.txt"
+ {
+ "game" "esf_openbeta"
+ }
+
+ "virtual.games/gearbox/offsets-common.txt"
+ {
+ "game" "gearbox"
+ }
+
+ "virtual.games/ns/offsets-common.txt"
+ {
+ "game" "ns"
+ "game" "nsp"
+ }
+
+ "virtual.games/svencoop/offsets-common.txt"
+ {
+ "game" "svencoop"
+ }
+
+ "virtual.games/tfc/offsets-common.txt"
+ {
+ "game" "tfc"
+ }
+
+ "virtual.games/ts/offsets-common.txt"
+ {
+ "game" "ts"
+ }
+
+ "virtual.games/valve/offsets-common.txt"
+ {
+ "game" "valve"
+ "game" "dmc"
+ }
}
diff --git a/gamedata/common.games/virtual.games/ag/offsets-common.txt b/gamedata/common.games/virtual.games/ag/offsets-common.txt
new file mode 100644
index 00000000..923fc088
--- /dev/null
+++ b/gamedata/common.games/virtual.games/ag/offsets-common.txt
@@ -0,0 +1,938 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "0"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x60"
+ }
+
+ "spawn"
+ {
+ "windows" "0"
+ "linux" "2"
+ }
+
+ "precache"
+ {
+ "windows" "1"
+ "linux" "3"
+ }
+
+ "keyvalue"
+ {
+ "windows" "2"
+ "linux" "4"
+ }
+
+ "objectcaps"
+ {
+ "windows" "5"
+ "linux" "7"
+ }
+
+ "activate"
+ {
+ "windows" "6"
+ "linux" "8"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "7"
+ "linux" "9"
+ }
+
+ "classify"
+ {
+ "windows" "8"
+ "linux" "10"
+ }
+
+ "deathnotice"
+ {
+ "windows" "9"
+ "linux" "11"
+ }
+
+ "traceattack"
+ {
+ "windows" "10"
+ "linux" "12"
+ }
+
+ "takedamage"
+ {
+ "windows" "11"
+ "linux" "13"
+ }
+
+ "takehealth"
+ {
+ "windows" "12"
+ "linux" "14"
+ }
+
+ "killed"
+ {
+ "windows" "13"
+ "linux" "15"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "14"
+ "linux" "16"
+ }
+
+ "tracebleed"
+ {
+ "windows" "15"
+ "linux" "17"
+ }
+
+ "istriggered"
+ {
+ "windows" "16"
+ "linux" "18"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "17"
+ "linux" "19"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "18"
+ "linux" "20"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "19"
+ "linux" "21"
+ }
+
+ "addpoints"
+ {
+ "windows" "20"
+ "linux" "22"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "21"
+ "linux" "23"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "22"
+ "linux" "24"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "23"
+ "linux" "25"
+ }
+
+ "giveammo"
+ {
+ "windows" "24"
+ "linux" "26"
+ }
+
+ "getdelay"
+ {
+ "windows" "25"
+ "linux" "27"
+ }
+
+ "ismoving"
+ {
+ "windows" "26"
+ "linux" "28"
+ }
+
+ "overridereset"
+ {
+ "windows" "27"
+ "linux" "29"
+ }
+
+ "damagedecal"
+ {
+ "windows" "28"
+ "linux" "30"
+ }
+
+ "settogglestate"
+ {
+ "windows" "29"
+ "linux" "31"
+ }
+
+ "startsneaking"
+ {
+ "windows" "30"
+ "linux" "32"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "31"
+ "linux" "33"
+ }
+
+ "oncontrols"
+ {
+ "windows" "32"
+ "linux" "34"
+ }
+
+ "issneaking"
+ {
+ "windows" "33"
+ "linux" "35"
+ }
+
+ "isalive"
+ {
+ "windows" "34"
+ "linux" "36"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "35"
+ "linux" "37"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "36"
+ "linux" "38"
+ }
+
+ "hastarget"
+ {
+ "windows" "37"
+ "linux" "39"
+ }
+
+ "isinworld"
+ {
+ "windows" "38"
+ "linux" "40"
+ }
+
+ "isplayer"
+ {
+ "windows" "39"
+ "linux" "41"
+ }
+
+ "isnetclient"
+ {
+ "windows" "40"
+ "linux" "42"
+ }
+
+ "teamid"
+ {
+ "windows" "41"
+ "linux" "43"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "42"
+ "linux" "44"
+ }
+
+ "think"
+ {
+ "windows" "43"
+ "linux" "45"
+ }
+
+ "touch"
+ {
+ "windows" "44"
+ "linux" "46"
+ }
+
+ "use"
+ {
+ "windows" "45"
+ "linux" "47"
+ }
+
+ "blocked"
+ {
+ "windows" "46"
+ "linux" "48"
+ }
+
+ "respawn"
+ {
+ "windows" "48"
+ "linux" "50"
+ }
+
+ "updateowner"
+ {
+ "windows" "49"
+ "linux" "51"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "50"
+ "linux" "52"
+ }
+
+ "center"
+ {
+ "windows" "51"
+ "linux" "53"
+ }
+
+ "eyeposition"
+ {
+ "windows" "52"
+ "linux" "54"
+ }
+
+ "earposition"
+ {
+ "windows" "53"
+ "linux" "55"
+ }
+
+ "bodytarget"
+ {
+ "windows" "54"
+ "linux" "56"
+ }
+
+ "illumination"
+ {
+ "windows" "55"
+ "linux" "57"
+ }
+
+ "fvisible"
+ {
+ "windows" "56"
+ "linux" "58"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "57"
+ "linux" "59"
+ }
+
+ "look"
+ {
+ "windows" "60"
+ "linux" "62"
+ }
+
+ "changeyaw"
+ {
+ "windows" "63"
+ "linux" "65"
+ }
+
+ "irelationship"
+ {
+ "windows" "65"
+ "linux" "67"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "67"
+ "linux" "69"
+ }
+
+ "becomedead"
+ {
+ "windows" "68"
+ "linux" "70"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "70"
+ "linux" "72"
+ }
+
+ "finviewcone"
+ {
+ "windows" "71"
+ "linux" "73"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "72"
+ "linux" "74"
+ }
+
+ "runai"
+ {
+ "windows" "61"
+ "linux" "63"
+ }
+
+ "monsterthink"
+ {
+ "windows" "64"
+ "linux" "66"
+ }
+
+ "monsterinit"
+ {
+ "windows" "66"
+ "linux" "68"
+ }
+
+ "checklocalmove"
+ {
+ "windows" "73"
+ "linux" "75"
+ }
+
+ "move"
+ {
+ "windows" "74"
+ "linux" "76"
+ }
+
+ "moveexecute"
+ {
+ "windows" "75"
+ "linux" "77"
+ }
+
+ "shouldadvanceroute"
+ {
+ "windows" "76"
+ "linux" "78"
+ }
+
+ "getstoppedactivity"
+ {
+ "windows" "77"
+ "linux" "79"
+ }
+
+ "stop"
+ {
+ "windows" "78"
+ "linux" "80"
+ }
+
+ "checkrangeattack1"
+ {
+ "windows" "79"
+ "linux" "81"
+ }
+
+ "checkrangeattack2"
+ {
+ "windows" "80"
+ "linux" "82"
+ }
+
+ "checkmeleeattack1"
+ {
+ "windows" "81"
+ "linux" "83"
+ }
+
+ "checkmeleeattack2"
+ {
+ "windows" "82"
+ "linux" "84"
+ }
+
+ "schedulechange"
+ {
+ "windows" "88"
+ "linux" "90"
+ }
+
+ "canplaysequence"
+ {
+ "windows" "89"
+ "linux" "91"
+ }
+
+ "canplaysentence"
+ {
+ "windows" "90"
+ "linux" "92"
+ }
+
+ "playsentence"
+ {
+ "windows" "91"
+ "linux" "93"
+ }
+
+ "playscriptedsentence"
+ {
+ "windows" "92"
+ "linux" "94"
+ }
+
+ "sentencestop"
+ {
+ "windows" "93"
+ "linux" "95"
+ }
+
+ "getidealstate"
+ {
+ "windows" "94"
+ "linux" "96"
+ }
+
+ "setactivity"
+ {
+ "windows" "95"
+ "linux" "97"
+ }
+
+ "reportaistate"
+ {
+ "windows" "96"
+ "linux" "98"
+ }
+
+ "checkenemy"
+ {
+ "windows" "97"
+ "linux" "99"
+ }
+
+ "ftriangulate"
+ {
+ "windows" "98"
+ "linux" "100"
+ }
+
+ "setyawspeed"
+ {
+ "windows" "99"
+ "linux" "101"
+ }
+
+ "buildnearestroute"
+ {
+ "windows" "100"
+ "linux" "102"
+ }
+
+ "findcover"
+ {
+ "windows" "101"
+ "linux" "103"
+ }
+
+ "coverradius"
+ {
+ "windows" "103"
+ "linux" "105"
+ }
+
+ "fcancheckattacks"
+ {
+ "windows" "104"
+ "linux" "106"
+ }
+
+ "checkammo"
+ {
+ "windows" "105"
+ "linux" "107"
+ }
+
+ "ignoreconditions"
+ {
+ "windows" "106"
+ "linux" "108"
+ }
+
+ "fvalidatehinttype"
+ {
+ "windows" "107"
+ "linux" "109"
+ }
+
+ "fcanactiveidle"
+ {
+ "windows" "108"
+ "linux" "110"
+ }
+
+ "isoundmask"
+ {
+ "windows" "109"
+ "linux" "111"
+ }
+
+ "hearingsensitivity"
+ {
+ "windows" "112"
+ "linux" "114"
+ }
+
+ "barnaclevictimbitten"
+ {
+ "windows" "113"
+ "linux" "115"
+ }
+
+ "barnaclevictimreleased"
+ {
+ "windows" "114"
+ "linux" "116"
+ }
+
+ "preschedulethink"
+ {
+ "windows" "115"
+ "linux" "117"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "116"
+ "linux" "118"
+ }
+
+ "gibmonster"
+ {
+ "windows" "117"
+ "linux" "119"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "118"
+ "linux" "120"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "119"
+ "linux" "121"
+ }
+
+ "fademonster"
+ {
+ "windows" "120"
+ "linux" "122"
+ }
+
+ "deathsound"
+ {
+ "windows" "122"
+ "linux" "124"
+ }
+
+ "alertsound"
+ {
+ "windows" "123"
+ "linux" "125"
+ }
+
+ "idlesound"
+ {
+ "windows" "124"
+ "linux" "126"
+ }
+
+ "painsound"
+ {
+ "windows" "125"
+ "linux" "127"
+ }
+
+ "stopfollowing"
+ {
+ "windows" "126"
+ "linux" "128"
+ }
+
+ "player_jump"
+ {
+ "windows" "127"
+ "linux" "129"
+ }
+
+ "player_duck"
+ {
+ "windows" "128"
+ "linux" "130"
+ }
+
+ "player_prethink"
+ {
+ "windows" "129"
+ "linux" "131"
+ }
+
+ "player_postthink"
+ {
+ "windows" "130"
+ "linux" "132"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "121"
+ "linux" "123"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "62"
+ "linux" "64"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "132"
+ "linux" "134"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "131"
+ "linux" "133"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "59"
+ "linux" "61"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "60"
+ "linux" "62"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "61"
+ "linux" "63"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "62"
+ "linux" "64"
+ }
+
+ "item_deploy"
+ {
+ "windows" "63"
+ "linux" "65"
+ }
+
+ "item_canholster"
+ {
+ "windows" "64"
+ "linux" "66"
+ }
+
+ "item_holster"
+ {
+ "windows" "65"
+ "linux" "67"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "66"
+ "linux" "68"
+ }
+
+ "item_preframe"
+ {
+ "windows" "67"
+ "linux" "69"
+ }
+
+ "item_postframe"
+ {
+ "windows" "68"
+ "linux" "70"
+ }
+
+ "item_drop"
+ {
+ "windows" "69"
+ "linux" "71"
+ }
+
+ "item_kill"
+ {
+ "windows" "70"
+ "linux" "72"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "71"
+ "linux" "73"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "72"
+ "linux" "74"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "73"
+ "linux" "75"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "74"
+ "linux" "76"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "75"
+ "linux" "77"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "76"
+ "linux" "78"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "77"
+ "linux" "79"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "78"
+ "linux" "80"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "79"
+ "linux" "81"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "80"
+ "linux" "82"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "81"
+ "linux" "83"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "82"
+ "linux" "84"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "83"
+ "linux" "85"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "84"
+ "linux" "86"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "85"
+ "linux" "87"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "86"
+ "linux" "88"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "87"
+ "linux" "89"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "88"
+ "linux" "90"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "89"
+ "linux" "91"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "90"
+ "linux" "92"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/cstrike/offsets-common.txt b/gamedata/common.games/virtual.games/cstrike/offsets-common.txt
new file mode 100644
index 00000000..c9a3c4fe
--- /dev/null
+++ b/gamedata/common.games/virtual.games/cstrike/offsets-common.txt
@@ -0,0 +1,874 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "4"
+ "mac" "4"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x0"
+ "mac" "0x0"
+ }
+
+ "spawn"
+ {
+ "windows" "0"
+ "linux" "0"
+ "mac" "0"
+ }
+
+ "precache"
+ {
+ "windows" "1"
+ "linux" "1"
+ "mac" "1"
+ }
+
+ "keyvalue"
+ {
+ "windows" "3"
+ "linux" "3"
+ "mac" "3"
+ }
+
+ "objectcaps"
+ {
+ "windows" "6"
+ "linux" "6"
+ "mac" "6"
+ }
+
+ "activate"
+ {
+ "windows" "7"
+ "linux" "7"
+ "mac" "7"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "8"
+ "linux" "8"
+ "mac" "8"
+ }
+
+ "classify"
+ {
+ "windows" "9"
+ "linux" "9"
+ "mac" "9"
+ }
+
+ "deathnotice"
+ {
+ "windows" "10"
+ "linux" "10"
+ "mac" "10"
+ }
+
+ "traceattack"
+ {
+ "windows" "11"
+ "linux" "11"
+ "mac" "11"
+ }
+
+ "takedamage"
+ {
+ "windows" "12"
+ "linux" "12"
+ "mac" "12"
+ }
+
+ "takehealth"
+ {
+ "windows" "13"
+ "linux" "13"
+ "mac" "13"
+ }
+
+ "killed"
+ {
+ "windows" "14"
+ "linux" "14"
+ "mac" "14"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "15"
+ "linux" "15"
+ "mac" "15"
+ }
+
+ "tracebleed"
+ {
+ "windows" "16"
+ "linux" "16"
+ "mac" "16"
+ }
+
+ "istriggered"
+ {
+ "windows" "17"
+ "linux" "17"
+ "mac" "17"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "18"
+ "linux" "18"
+ "mac" "18"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "19"
+ "linux" "19"
+ "mac" "19"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "20"
+ "linux" "20"
+ "mac" "20"
+ }
+
+ "addpoints"
+ {
+ "windows" "21"
+ "linux" "21"
+ "mac" "21"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "22"
+ "linux" "22"
+ "mac" "22"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "23"
+ "linux" "23"
+ "mac" "23"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "24"
+ "linux" "24"
+ "mac" "24"
+ }
+
+ "giveammo"
+ {
+ "windows" "25"
+ "linux" "25"
+ "mac" "25"
+ }
+
+ "getdelay"
+ {
+ "windows" "26"
+ "linux" "26"
+ "mac" "26"
+ }
+
+ "ismoving"
+ {
+ "windows" "27"
+ "linux" "27"
+ "mac" "27"
+ }
+
+ "overridereset"
+ {
+ "windows" "28"
+ "linux" "28"
+ "mac" "28"
+ }
+
+ "damagedecal"
+ {
+ "windows" "29"
+ "linux" "29"
+ "mac" "29"
+ }
+
+ "settogglestate"
+ {
+ "windows" "30"
+ "linux" "30"
+ "mac" "30"
+ }
+
+ "startsneaking"
+ {
+ "windows" "31"
+ "linux" "31"
+ "mac" "31"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "32"
+ "linux" "32"
+ "mac" "32"
+ }
+
+ "oncontrols"
+ {
+ "windows" "33"
+ "linux" "33"
+ "mac" "33"
+ }
+
+ "issneaking"
+ {
+ "windows" "34"
+ "linux" "34"
+ "mac" "34"
+ }
+
+ "isalive"
+ {
+ "windows" "35"
+ "linux" "35"
+ "mac" "35"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "36"
+ "linux" "36"
+ "mac" "36"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "37"
+ "linux" "37"
+ "mac" "37"
+ }
+
+ "hastarget"
+ {
+ "windows" "38"
+ "linux" "38"
+ "mac" "38"
+ }
+
+ "isinworld"
+ {
+ "windows" "39"
+ "linux" "39"
+ "mac" "39"
+ }
+
+ "isplayer"
+ {
+ "windows" "40"
+ "linux" "40"
+ "mac" "40"
+ }
+
+ "isnetclient"
+ {
+ "windows" "41"
+ "linux" "41"
+ "mac" "41"
+ }
+
+ "teamid"
+ {
+ "windows" "42"
+ "linux" "42"
+ "mac" "42"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "43"
+ "linux" "43"
+ "mac" "43"
+ }
+
+ "think"
+ {
+ "windows" "44"
+ "linux" "44"
+ "mac" "44"
+ }
+
+ "touch"
+ {
+ "windows" "45"
+ "linux" "45"
+ "mac" "45"
+ }
+
+ "use"
+ {
+ "windows" "46"
+ "linux" "46"
+ "mac" "46"
+ }
+
+ "blocked"
+ {
+ "windows" "47"
+ "linux" "47"
+ "mac" "47"
+ }
+
+ "respawn"
+ {
+ "windows" "48"
+ "linux" "48"
+ "mac" "48"
+ }
+
+ "updateowner"
+ {
+ "windows" "49"
+ "linux" "49"
+ "mac" "49"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "50"
+ "linux" "50"
+ "mac" "50"
+ }
+
+ "center"
+ {
+ "windows" "51"
+ "linux" "51"
+ "mac" "51"
+ }
+
+ "eyeposition"
+ {
+ "windows" "52"
+ "linux" "52"
+ "mac" "52"
+ }
+
+ "earposition"
+ {
+ "windows" "53"
+ "linux" "53"
+ "mac" "53"
+ }
+
+ "bodytarget"
+ {
+ "windows" "54"
+ "linux" "54"
+ "mac" "54"
+ }
+
+ "illumination"
+ {
+ "windows" "55"
+ "linux" "55"
+ "mac" "55"
+ }
+
+ "fvisible"
+ {
+ "windows" "56"
+ "linux" "56"
+ "mac" "56"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "57"
+ "linux" "57"
+ "mac" "57"
+ }
+
+ "changeyaw"
+ {
+ "windows" "59"
+ "linux" "59"
+ "mac" "59"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "60"
+ "linux" "60"
+ "mac" "60"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "61"
+ "linux" "61"
+ "mac" "61"
+ }
+
+ "fademonster"
+ {
+ "windows" "62"
+ "linux" "62"
+ "mac" "62"
+ }
+
+ "gibmonster"
+ {
+ "windows" "63"
+ "linux" "63"
+ "mac" "63"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "64"
+ "linux" "64"
+ "mac" "64"
+ }
+
+ "becomedead"
+ {
+ "windows" "65"
+ "linux" "65"
+ "mac" "65"
+ }
+
+ "irelationship"
+ {
+ "windows" "67"
+ "linux" "67"
+ "mac" "67"
+ }
+
+ "painsound"
+ {
+ "windows" "68"
+ "linux" "68"
+ "mac" "68"
+ }
+
+ "reportaistate"
+ {
+ "windows" "70"
+ "linux" "70"
+ "mac" "70"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "71"
+ "linux" "71"
+ "mac" "71"
+ }
+
+ "look"
+ {
+ "windows" "72"
+ "linux" "72"
+ "mac" "72"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "73"
+ "linux" "73"
+ "mac" "73"
+ }
+
+ "finviewcone"
+ {
+ "windows" "75"
+ "linux" "74"
+ "mac" "74"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "74"
+ "linux" "75"
+ "mac" "75"
+ }
+
+ "player_jump"
+ {
+ "windows" "76"
+ "linux" "76"
+ "mac" "76"
+ }
+
+ "player_duck"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "77"
+ }
+
+ "player_prethink"
+ {
+ "windows" "78"
+ "linux" "78"
+ "mac" "78"
+ }
+
+ "player_postthink"
+ {
+ "windows" "79"
+ "linux" "79"
+ "mac" "79"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "80"
+ "linux" "80"
+ "mac" "80"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "66"
+ "linux" "66"
+ "mac" "66"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "83"
+ "linux" "83"
+ "mac" "83"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "82"
+ "linux" "82"
+ "mac" "82"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "59"
+ "linux" "59"
+ "mac" "59"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "60"
+ "linux" "60"
+ "mac" "60"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "61"
+ "linux" "61"
+ "mac" "61"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "62"
+ "linux" "62"
+ "mac" "62"
+ }
+
+ "item_deploy"
+ {
+ "windows" "64"
+ "linux" "64"
+ "mac" "64"
+ }
+
+ "item_canholster"
+ {
+ "windows" "66"
+ "linux" "66"
+ "mac" "66"
+ }
+
+ "item_holster"
+ {
+ "windows" "67"
+ "linux" "67"
+ "mac" "67"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "68"
+ "linux" "68"
+ "mac" "68"
+ }
+
+ "item_preframe"
+ {
+ "windows" "69"
+ "linux" "69"
+ "mac" "69"
+ }
+
+ "item_postframe"
+ {
+ "windows" "70"
+ "linux" "70"
+ "mac" "70"
+ }
+
+ "item_drop"
+ {
+ "windows" "71"
+ "linux" "71"
+ "mac" "71"
+ }
+
+ "item_kill"
+ {
+ "windows" "72"
+ "linux" "72"
+ "mac" "72"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "73"
+ "linux" "73"
+ "mac" "73"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "74"
+ "linux" "74"
+ "mac" "74"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "75"
+ "linux" "75"
+ "mac" "75"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "76"
+ "linux" "76"
+ "mac" "76"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "77"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "79"
+ "linux" "79"
+ "mac" "79"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "80"
+ "linux" "80"
+ "mac" "80"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "81"
+ "linux" "81"
+ "mac" "81"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "82"
+ "linux" "82"
+ "mac" "82"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "83"
+ "linux" "83"
+ "mac" "83"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "84"
+ "linux" "84"
+ "mac" "84"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "86"
+ "linux" "86"
+ "mac" "86"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "87"
+ "linux" "87"
+ "mac" "87"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "88"
+ "linux" "88"
+ "mac" "88"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "89"
+ "linux" "89"
+ "mac" "89"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "90"
+ "linux" "90"
+ "mac" "90"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "91"
+ "linux" "91"
+ "mac" "91"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "92"
+ "linux" "92"
+ "mac" "92"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "93"
+ "linux" "93"
+ "mac" "93"
+ }
+
+ "cstrike_restart"
+ {
+ "windows" "2"
+ "linux" "2"
+ "mac" "2"
+ }
+
+ "cstrike_roundrespawn"
+ {
+ "windows" "84"
+ "linux" "84"
+ "mac" "84"
+ }
+
+ "cstrike_item_candrop"
+ {
+ "windows" "63"
+ "linux" "63"
+ "mac" "63"
+ }
+
+ "cstrike_item_isweapon"
+ {
+ "windows" "65"
+ "linux" "65"
+ "mac" "65"
+ }
+
+ "cstrike_item_getmaxspeed"
+ {
+ "windows" "78"
+ "linux" "78"
+ "mac" "78"
+ }
+
+ "cstrike_weapon_sendweaponanim"
+ {
+ "windows" "85"
+ "linux" "85"
+ "mac" "85"
+ }
+
+ "cstrike_player_resetmaxspeed"
+ {
+ "windows" "69"
+ "linux" "69"
+ "mac" "69"
+ }
+
+ "cstrike_player_isbot"
+ {
+ "windows" "81"
+ "linux" "81"
+ "mac" "81"
+ }
+
+ "cstrike_player_getautoaimvector"
+ {
+ "windows" "85"
+ "linux" "85"
+ "mac" "85"
+ }
+
+ "cstrike_player_blind"
+ {
+ "windows" "86"
+ "linux" "86"
+ "mac" "86"
+ }
+
+ "cstrike_player_ontouchingweapon"
+ {
+ "windows" "87"
+ "linux" "87"
+ "mac" "87"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/dod/offsets-common.txt b/gamedata/common.games/virtual.games/dod/offsets-common.txt
new file mode 100644
index 00000000..97275ff7
--- /dev/null
+++ b/gamedata/common.games/virtual.games/dod/offsets-common.txt
@@ -0,0 +1,1238 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "4"
+ "mac" "4"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x0"
+ "mac" "0x0"
+ }
+
+ "spawn"
+ {
+ "windows" "3"
+ "linux" "3"
+ "mac" "3"
+ }
+
+ "precache"
+ {
+ "windows" "4"
+ "linux" "4"
+ "mac" "4"
+ }
+
+ "keyvalue"
+ {
+ "windows" "5"
+ "linux" "5"
+ "mac" "5"
+ }
+
+ "objectcaps"
+ {
+ "windows" "8"
+ "linux" "8"
+ "mac" "8"
+ }
+
+ "activate"
+ {
+ "windows" "9"
+ "linux" "9"
+ "mac" "9"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "12"
+ "linux" "12"
+ "mac" "12"
+ }
+
+ "classify"
+ {
+ "windows" "13"
+ "linux" "13"
+ "mac" "13"
+ }
+
+ "deathnotice"
+ {
+ "windows" "14"
+ "linux" "14"
+ "mac" "14"
+ }
+
+ "traceattack"
+ {
+ "windows" "17"
+ "linux" "17"
+ "mac" "17"
+ }
+
+ "takedamage"
+ {
+ "windows" "18"
+ "linux" "18"
+ "mac" "18"
+ }
+
+ "takehealth"
+ {
+ "windows" "19"
+ "linux" "19"
+ "mac" "19"
+ }
+
+ "killed"
+ {
+ "windows" "20"
+ "linux" "20"
+ "mac" "20"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "21"
+ "linux" "21"
+ "mac" "21"
+ }
+
+ "tracebleed"
+ {
+ "windows" "22"
+ "linux" "22"
+ "mac" "22"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "23"
+ "linux" "23"
+ "mac" "23"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "24"
+ "linux" "24"
+ "mac" "24"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "25"
+ "linux" "25"
+ "mac" "25"
+ }
+
+ "addpoints"
+ {
+ "windows" "26"
+ "linux" "26"
+ "mac" "26"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "27"
+ "linux" "27"
+ "mac" "27"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "28"
+ "linux" "28"
+ "mac" "28"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "29"
+ "linux" "29"
+ "mac" "29"
+ }
+
+ "giveammo"
+ {
+ "windows" "30"
+ "linux" "30"
+ "mac" "30"
+ }
+
+ "getdelay"
+ {
+ "windows" "31"
+ "linux" "31"
+ "mac" "31"
+ }
+
+ "ismoving"
+ {
+ "windows" "32"
+ "linux" "32"
+ "mac" "32"
+ }
+
+ "overridereset"
+ {
+ "windows" "33"
+ "linux" "33"
+ "mac" "33"
+ }
+
+ "damagedecal"
+ {
+ "windows" "34"
+ "linux" "34"
+ "mac" "34"
+ }
+
+ "settogglestate"
+ {
+ "windows" "35"
+ "linux" "35"
+ "mac" "35"
+ }
+
+ "startsneaking"
+ {
+ "windows" "36"
+ "linux" "36"
+ "mac" "36"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "37"
+ "linux" "37"
+ "mac" "37"
+ }
+
+ "oncontrols"
+ {
+ "windows" "38"
+ "linux" "38"
+ "mac" "38"
+ }
+
+ "issneaking"
+ {
+ "windows" "39"
+ "linux" "39"
+ "mac" "39"
+ }
+
+ "isalive"
+ {
+ "windows" "40"
+ "linux" "40"
+ "mac" "40"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "41"
+ "linux" "41"
+ "mac" "41"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "42"
+ "linux" "42"
+ "mac" "42"
+ }
+
+ "hastarget"
+ {
+ "windows" "43"
+ "linux" "43"
+ "mac" "43"
+ }
+
+ "isinworld"
+ {
+ "windows" "44"
+ "linux" "44"
+ "mac" "44"
+ }
+
+ "isplayer"
+ {
+ "windows" "45"
+ "linux" "45"
+ "mac" "45"
+ }
+
+ "isnetclient"
+ {
+ "windows" "46"
+ "linux" "46"
+ "mac" "46"
+ }
+
+ "teamid"
+ {
+ "windows" "47"
+ "linux" "47"
+ "mac" "47"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "48"
+ "linux" "48"
+ "mac" "48"
+ }
+
+ "think"
+ {
+ "windows" "49"
+ "linux" "49"
+ "mac" "49"
+ }
+
+ "touch"
+ {
+ "windows" "50"
+ "linux" "50"
+ "mac" "50"
+ }
+
+ "use"
+ {
+ "windows" "51"
+ "linux" "51"
+ "mac" "51"
+ }
+
+ "blocked"
+ {
+ "windows" "52"
+ "linux" "52"
+ "mac" "52"
+ }
+
+ "respawn"
+ {
+ "windows" "53"
+ "linux" "53"
+ "mac" "53"
+ }
+
+ "updateowner"
+ {
+ "windows" "54"
+ "linux" "54"
+ "mac" "54"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "55"
+ "linux" "55"
+ "mac" "55"
+ }
+
+ "center"
+ {
+ "windows" "56"
+ "linux" "56"
+ "mac" "56"
+ }
+
+ "eyeposition"
+ {
+ "windows" "57"
+ "linux" "57"
+ "mac" "57"
+ }
+
+ "earposition"
+ {
+ "windows" "58"
+ "linux" "58"
+ "mac" "58"
+ }
+
+ "bodytarget"
+ {
+ "windows" "59"
+ "linux" "59"
+ "mac" "59"
+ }
+
+ "illumination"
+ {
+ "windows" "60"
+ "linux" "60"
+ "mac" "60"
+ }
+
+ "fvisible"
+ {
+ "windows" "62"
+ "linux" "61"
+ "mac" "61"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "61"
+ "linux" "62"
+ "mac" "62"
+ }
+
+ "look"
+ {
+ "windows" "64"
+ "linux" "64"
+ "mac" "64"
+ }
+
+ "changeyaw"
+ {
+ "windows" "67"
+ "linux" "67"
+ "mac" "67"
+ }
+
+ "irelationship"
+ {
+ "windows" "69"
+ "linux" "69"
+ "mac" "69"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "71"
+ "linux" "71"
+ "mac" "71"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "74"
+ "linux" "74"
+ "mac" "74"
+ }
+
+ "finviewcone"
+ {
+ "windows" "76"
+ "linux" "75"
+ "mac" "75"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "75"
+ "linux" "76"
+ "mac" "76"
+ }
+
+ "runai"
+ {
+ "windows" "65"
+ "linux" "65"
+ "mac" "65"
+ }
+
+ "monsterthink"
+ {
+ "windows" "68"
+ "linux" "68"
+ "mac" "68"
+ }
+
+ "monsterinit"
+ {
+ "windows" "70"
+ "linux" "70"
+ "mac" "70"
+ }
+
+ "checklocalmove"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "77"
+ }
+
+ "move"
+ {
+ "windows" "78"
+ "linux" "78"
+ "mac" "78"
+ }
+
+ "moveexecute"
+ {
+ "windows" "79"
+ "linux" "79"
+ "mac" "79"
+ }
+
+ "shouldadvanceroute"
+ {
+ "windows" "80"
+ "linux" "80"
+ "mac" "80"
+ }
+
+ "getstoppedactivity"
+ {
+ "windows" "81"
+ "linux" "81"
+ "mac" "81"
+ }
+
+ "stop"
+ {
+ "windows" "82"
+ "linux" "82"
+ "mac" "82"
+ }
+
+ "checkrangeattack1"
+ {
+ "windows" "83"
+ "linux" "83"
+ "mac" "83"
+ }
+
+ "checkrangeattack2"
+ {
+ "windows" "84"
+ "linux" "84"
+ "mac" "84"
+ }
+
+ "checkmeleeattack1"
+ {
+ "windows" "85"
+ "linux" "85"
+ "mac" "85"
+ }
+
+ "checkmeleeattack2"
+ {
+ "windows" "86"
+ "linux" "86"
+ "mac" "86"
+ }
+
+ "schedulechange"
+ {
+ "windows" "92"
+ "linux" "92"
+ "mac" "92"
+ }
+
+ "canplaysequence"
+ {
+ "windows" "93"
+ "linux" "93"
+ "mac" "93"
+ }
+
+ "canplaysentence"
+ {
+ "windows" "94"
+ "linux" "94"
+ "mac" "94"
+ }
+
+ "playsentence"
+ {
+ "windows" "95"
+ "linux" "95"
+ "mac" "95"
+ }
+
+ "playscriptedsentence"
+ {
+ "windows" "96"
+ "linux" "96"
+ "mac" "96"
+ }
+
+ "sentencestop"
+ {
+ "windows" "97"
+ "linux" "97"
+ "mac" "97"
+ }
+
+ "getidealstate"
+ {
+ "windows" "98"
+ "linux" "98"
+ "mac" "98"
+ }
+
+ "setactivity"
+ {
+ "windows" "99"
+ "linux" "99"
+ "mac" "99"
+ }
+
+ "reportaistate"
+ {
+ "windows" "100"
+ "linux" "100"
+ "mac" "100"
+ }
+
+ "checkenemy"
+ {
+ "windows" "101"
+ "linux" "101"
+ "mac" "101"
+ }
+
+ "ftriangulate"
+ {
+ "windows" "102"
+ "linux" "102"
+ "mac" "102"
+ }
+
+ "setyawspeed"
+ {
+ "windows" "103"
+ "linux" "103"
+ "mac" "103"
+ }
+
+ "buildnearestroute"
+ {
+ "windows" "104"
+ "linux" "104"
+ "mac" "104"
+ }
+
+ "findcover"
+ {
+ "windows" "105"
+ "linux" "105"
+ "mac" "105"
+ }
+
+ "coverradius"
+ {
+ "windows" "107"
+ "linux" "107"
+ "mac" "107"
+ }
+
+ "fcancheckattacks"
+ {
+ "windows" "108"
+ "linux" "108"
+ "mac" "108"
+ }
+
+ "checkammo"
+ {
+ "windows" "109"
+ "linux" "109"
+ "mac" "109"
+ }
+
+ "ignoreconditions"
+ {
+ "windows" "110"
+ "linux" "110"
+ "mac" "110"
+ }
+
+ "fvalidatehinttype"
+ {
+ "windows" "111"
+ "linux" "111"
+ "mac" "111"
+ }
+
+ "fcanactiveidle"
+ {
+ "windows" "112"
+ "linux" "112"
+ "mac" "112"
+ }
+
+ "isoundmask"
+ {
+ "windows" "113"
+ "linux" "113"
+ "mac" "113"
+ }
+
+ "hearingsensitivity"
+ {
+ "windows" "116"
+ "linux" "116"
+ "mac" "116"
+ }
+
+ "barnaclevictimbitten"
+ {
+ "windows" "117"
+ "linux" "117"
+ "mac" "117"
+ }
+
+ "barnaclevictimreleased"
+ {
+ "windows" "118"
+ "linux" "118"
+ "mac" "118"
+ }
+
+ "preschedulethink"
+ {
+ "windows" "120"
+ "linux" "120"
+ "mac" "120"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "121"
+ "linux" "121"
+ "mac" "121"
+ }
+
+ "gibmonster"
+ {
+ "windows" "122"
+ "linux" "122"
+ "mac" "122"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "123"
+ "linux" "123"
+ "mac" "123"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "124"
+ "linux" "124"
+ "mac" "124"
+ }
+
+ "fademonster"
+ {
+ "windows" "125"
+ "linux" "125"
+ "mac" "125"
+ }
+
+ "deathsound"
+ {
+ "windows" "127"
+ "linux" "127"
+ "mac" "127"
+ }
+
+ "alertsound"
+ {
+ "windows" "128"
+ "linux" "128"
+ "mac" "128"
+ }
+
+ "idlesound"
+ {
+ "windows" "129"
+ "linux" "129"
+ "mac" "129"
+ }
+
+ "painsound"
+ {
+ "windows" "130"
+ "linux" "130"
+ "mac" "130"
+ }
+
+ "stopfollowing"
+ {
+ "windows" "131"
+ "linux" "131"
+ "mac" "131"
+ }
+
+ "player_jump"
+ {
+ "windows" "134"
+ "linux" "134"
+ "mac" "134"
+ }
+
+ "player_duck"
+ {
+ "windows" "135"
+ "linux" "135"
+ "mac" "135"
+ }
+
+ "player_prethink"
+ {
+ "windows" "132"
+ "linux" "132"
+ "mac" "132"
+ }
+
+ "player_postthink"
+ {
+ "windows" "133"
+ "linux" "133"
+ "mac" "133"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "126"
+ "linux" "126"
+ "mac" "126"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "66"
+ "linux" "66"
+ "mac" "66"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "137"
+ "linux" "137"
+ "mac" "137"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "136"
+ "linux" "136"
+ "mac" "136"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "64"
+ "linux" "64"
+ "mac" "64"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "65"
+ "linux" "65"
+ "mac" "65"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "66"
+ "linux" "66"
+ "mac" "66"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "67"
+ "linux" "67"
+ "mac" "67"
+ }
+
+ "item_deploy"
+ {
+ "windows" "68"
+ "linux" "68"
+ "mac" "68"
+ }
+
+ "item_canholster"
+ {
+ "windows" "73"
+ "linux" "73"
+ "mac" "73"
+ }
+
+ "item_holster"
+ {
+ "windows" "74"
+ "linux" "74"
+ "mac" "74"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "75"
+ "linux" "75"
+ "mac" "75"
+ }
+
+ "item_preframe"
+ {
+ "windows" "76"
+ "linux" "76"
+ "mac" "76"
+ }
+
+ "item_postframe"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "77"
+ }
+
+ "item_drop"
+ {
+ "windows" "78"
+ "linux" "78"
+ "mac" "78"
+ }
+
+ "item_kill"
+ {
+ "windows" "79"
+ "linux" "79"
+ "mac" "79"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "80"
+ "linux" "80"
+ "mac" "80"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "81"
+ "linux" "81"
+ "mac" "81"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "82"
+ "linux" "82"
+ "mac" "82"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "83"
+ "linux" "83"
+ "mac" "83"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "84"
+ "linux" "84"
+ "mac" "84"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "85"
+ "linux" "85"
+ "mac" "85"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "86"
+ "linux" "86"
+ "mac" "86"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "87"
+ "linux" "87"
+ "mac" "87"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "88"
+ "linux" "88"
+ "mac" "88"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "89"
+ "linux" "89"
+ "mac" "89"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "90"
+ "linux" "90"
+ "mac" "90"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "92"
+ "linux" "92"
+ "mac" "92"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "102"
+ "linux" "102"
+ "mac" "102"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "103"
+ "linux" "103"
+ "mac" "103"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "104"
+ "linux" "104"
+ "mac" "104"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "105"
+ "linux" "105"
+ "mac" "105"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "106"
+ "linux" "106"
+ "mac" "106"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "107"
+ "linux" "107"
+ "mac" "107"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "108"
+ "linux" "108"
+ "mac" "108"
+ }
+
+ "dod_roundrespawn"
+ {
+ "windows" "0"
+ "linux" "0"
+ "mac" "0"
+ }
+
+ "dod_roundrespawnent"
+ {
+ "windows" "1"
+ "linux" "1"
+ "mac" "1"
+ }
+
+ "dod_roundstore"
+ {
+ "windows" "2"
+ "linux" "2"
+ "mac" "2"
+ }
+
+ "dod_areasetindex"
+ {
+ "windows" "10"
+ "linux" "10"
+ "mac" "10"
+ }
+
+ "dod_areasendstatus"
+ {
+ "windows" "11"
+ "linux" "11"
+ "mac" "11"
+ }
+
+ "dod_getstate"
+ {
+ "windows" "16"
+ "linux" "15"
+ "mac" "15"
+ }
+
+ "dod_getstateent"
+ {
+ "windows" "15"
+ "linux" "16"
+ "mac" "16"
+ }
+
+ "dod_setscriptreset"
+ {
+ "windows" "119"
+ "linux" "119"
+ "mac" "119"
+ }
+
+ "dod_item_candrop"
+ {
+ "windows" "70"
+ "linux" "70"
+ "mac" "70"
+ }
+
+ "dod_item_spawndeploy"
+ {
+ "windows" "69"
+ "linux" "69"
+ "mac" "69"
+ }
+
+ "dod_item_setdmgtime"
+ {
+ "windows" "71"
+ "linux" "71"
+ "mac" "71"
+ }
+
+ "dod_item_dropgren"
+ {
+ "windows" "72"
+ "linux" "72"
+ "mac" "72"
+ }
+
+ "dod_weapon_sendweaponanim"
+ {
+ "windows" "91"
+ "linux" "91"
+ "mac" "91"
+ }
+
+ "dod_weapon_isuseable"
+ {
+ "windows" "92"
+ "linux" "92"
+ "mac" "92"
+ }
+
+ "dod_weapon_aim"
+ {
+ "windows" "93"
+ "linux" "93"
+ "mac" "93"
+ }
+
+ "dod_weapon_flaim"
+ {
+ "windows" "94"
+ "linux" "94"
+ "mac" "94"
+ }
+
+ "dod_weapon_removestamina"
+ {
+ "windows" "95"
+ "linux" "95"
+ "mac" "95"
+ }
+
+ "dod_weapon_changefov"
+ {
+ "windows" "96"
+ "linux" "96"
+ "mac" "96"
+ }
+
+ "dod_weapon_zoomout"
+ {
+ "windows" "97"
+ "linux" "97"
+ "mac" "97"
+ }
+
+ "dod_weapon_zoomin"
+ {
+ "windows" "98"
+ "linux" "98"
+ "mac" "98"
+ }
+
+ "dod_weapon_getfov"
+ {
+ "windows" "99"
+ "linux" "99"
+ "mac" "99"
+ }
+
+ "dod_weapon_playeriswatersniping"
+ {
+ "windows" "100"
+ "linux" "100"
+ "mac" "100"
+ }
+
+ "dod_weapon_updatezoomspeed"
+ {
+ "windows" "101"
+ "linux" "101"
+ "mac" "101"
+ }
+
+ "dod_weapon_special"
+ {
+ "windows" "105"
+ "linux" "105"
+ "mac" "105"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/esf/offsets-common.txt b/gamedata/common.games/virtual.games/esf/offsets-common.txt
new file mode 100644
index 00000000..98ed1d6a
--- /dev/null
+++ b/gamedata/common.games/virtual.games/esf/offsets-common.txt
@@ -0,0 +1,902 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "0"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x60"
+ }
+
+ "spawn"
+ {
+ "windows" "0"
+ "linux" "2"
+ }
+
+ "precache"
+ {
+ "windows" "1"
+ "linux" "3"
+ }
+
+ "keyvalue"
+ {
+ "windows" "2"
+ "linux" "4"
+ }
+
+ "objectcaps"
+ {
+ "windows" "5"
+ "linux" "7"
+ }
+
+ "activate"
+ {
+ "windows" "6"
+ "linux" "8"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "7"
+ "linux" "9"
+ }
+
+ "classify"
+ {
+ "windows" "8"
+ "linux" "10"
+ }
+
+ "deathnotice"
+ {
+ "windows" "9"
+ "linux" "11"
+ }
+
+ "traceattack"
+ {
+ "windows" "10"
+ "linux" "12"
+ }
+
+ "takedamage"
+ {
+ "windows" "11"
+ "linux" "13"
+ }
+
+ "takehealth"
+ {
+ "windows" "12"
+ "linux" "14"
+ }
+
+ "killed"
+ {
+ "windows" "13"
+ "linux" "15"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "14"
+ "linux" "16"
+ }
+
+ "tracebleed"
+ {
+ "windows" "15"
+ "linux" "17"
+ }
+
+ "istriggered"
+ {
+ "windows" "16"
+ "linux" "18"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "17"
+ "linux" "19"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "18"
+ "linux" "20"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "19"
+ "linux" "21"
+ }
+
+ "addpoints"
+ {
+ "windows" "20"
+ "linux" "22"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "21"
+ "linux" "23"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "22"
+ "linux" "24"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "23"
+ "linux" "25"
+ }
+
+ "getdelay"
+ {
+ "windows" "24"
+ "linux" "26"
+ }
+
+ "ismoving"
+ {
+ "windows" "25"
+ "linux" "27"
+ }
+
+ "overridereset"
+ {
+ "windows" "26"
+ "linux" "28"
+ }
+
+ "damagedecal"
+ {
+ "windows" "27"
+ "linux" "29"
+ }
+
+ "settogglestate"
+ {
+ "windows" "28"
+ "linux" "30"
+ }
+
+ "startsneaking"
+ {
+ "windows" "29"
+ "linux" "31"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "30"
+ "linux" "32"
+ }
+
+ "oncontrols"
+ {
+ "windows" "31"
+ "linux" "33"
+ }
+
+ "issneaking"
+ {
+ "windows" "32"
+ "linux" "34"
+ }
+
+ "isalive"
+ {
+ "windows" "33"
+ "linux" "35"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "34"
+ "linux" "36"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "35"
+ "linux" "37"
+ }
+
+ "hastarget"
+ {
+ "windows" "36"
+ "linux" "38"
+ }
+
+ "isinworld"
+ {
+ "windows" "37"
+ "linux" "39"
+ }
+
+ "isplayer"
+ {
+ "windows" "38"
+ "linux" "40"
+ }
+
+ "isnetclient"
+ {
+ "windows" "39"
+ "linux" "41"
+ }
+
+ "teamid"
+ {
+ "windows" "40"
+ "linux" "42"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "41"
+ "linux" "43"
+ }
+
+ "think"
+ {
+ "windows" "42"
+ "linux" "44"
+ }
+
+ "touch"
+ {
+ "windows" "43"
+ "linux" "45"
+ }
+
+ "use"
+ {
+ "windows" "44"
+ "linux" "46"
+ }
+
+ "blocked"
+ {
+ "windows" "45"
+ "linux" "47"
+ }
+
+ "respawn"
+ {
+ "windows" "46"
+ "linux" "48"
+ }
+
+ "updateowner"
+ {
+ "windows" "47"
+ "linux" "49"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "48"
+ "linux" "50"
+ }
+
+ "center"
+ {
+ "windows" "49"
+ "linux" "51"
+ }
+
+ "eyeposition"
+ {
+ "windows" "50"
+ "linux" "52"
+ }
+
+ "earposition"
+ {
+ "windows" "51"
+ "linux" "53"
+ }
+
+ "bodytarget"
+ {
+ "windows" "52"
+ "linux" "54"
+ }
+
+ "illumination"
+ {
+ "windows" "53"
+ "linux" "55"
+ }
+
+ "fvisible"
+ {
+ "windows" "54"
+ "linux" "56"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "55"
+ "linux" "57"
+ }
+
+ "look"
+ {
+ "windows" "57"
+ "linux" "59"
+ }
+
+ "changeyaw"
+ {
+ "windows" "60"
+ "linux" "62"
+ }
+
+ "irelationship"
+ {
+ "windows" "62"
+ "linux" "64"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "64"
+ "linux" "66"
+ }
+
+ "becomedead"
+ {
+ "windows" "65"
+ "linux" "67"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "67"
+ "linux" "69"
+ }
+
+ "finviewcone"
+ {
+ "windows" "68"
+ "linux" "70"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "69"
+ "linux" "71"
+ }
+
+ "runai"
+ {
+ "windows" "58"
+ "linux" "60"
+ }
+
+ "monsterthink"
+ {
+ "windows" "61"
+ "linux" "63"
+ }
+
+ "monsterinit"
+ {
+ "windows" "63"
+ "linux" "65"
+ }
+
+ "checklocalmove"
+ {
+ "windows" "70"
+ "linux" "72"
+ }
+
+ "move"
+ {
+ "windows" "71"
+ "linux" "73"
+ }
+
+ "moveexecute"
+ {
+ "windows" "72"
+ "linux" "74"
+ }
+
+ "shouldadvanceroute"
+ {
+ "windows" "73"
+ "linux" "75"
+ }
+
+ "getstoppedactivity"
+ {
+ "windows" "74"
+ "linux" "76"
+ }
+
+ "stop"
+ {
+ "windows" "75"
+ "linux" "77"
+ }
+
+ "checkrangeattack1"
+ {
+ "windows" "76"
+ "linux" "78"
+ }
+
+ "checkrangeattack2"
+ {
+ "windows" "77"
+ "linux" "79"
+ }
+
+ "checkmeleeattack1"
+ {
+ "windows" "78"
+ "linux" "80"
+ }
+
+ "checkmeleeattack2"
+ {
+ "windows" "79"
+ "linux" "81"
+ }
+
+ "schedulechange"
+ {
+ "windows" "85"
+ "linux" "87"
+ }
+
+ "canplaysequence"
+ {
+ "windows" "86"
+ "linux" "88"
+ }
+
+ "canplaysentence"
+ {
+ "windows" "87"
+ "linux" "89"
+ }
+
+ "playsentence"
+ {
+ "windows" "88"
+ "linux" "90"
+ }
+
+ "playscriptedsentence"
+ {
+ "windows" "89"
+ "linux" "91"
+ }
+
+ "sentencestop"
+ {
+ "windows" "90"
+ "linux" "92"
+ }
+
+ "getidealstate"
+ {
+ "windows" "91"
+ "linux" "93"
+ }
+
+ "setactivity"
+ {
+ "windows" "92"
+ "linux" "94"
+ }
+
+ "reportaistate"
+ {
+ "windows" "93"
+ "linux" "95"
+ }
+
+ "checkenemy"
+ {
+ "windows" "94"
+ "linux" "96"
+ }
+
+ "ftriangulate"
+ {
+ "windows" "95"
+ "linux" "97"
+ }
+
+ "setyawspeed"
+ {
+ "windows" "96"
+ "linux" "98"
+ }
+
+ "buildnearestroute"
+ {
+ "windows" "97"
+ "linux" "99"
+ }
+
+ "findcover"
+ {
+ "windows" "98"
+ "linux" "100"
+ }
+
+ "coverradius"
+ {
+ "windows" "100"
+ "linux" "102"
+ }
+
+ "fcancheckattacks"
+ {
+ "windows" "101"
+ "linux" "103"
+ }
+
+ "checkammo"
+ {
+ "windows" "102"
+ "linux" "104"
+ }
+
+ "ignoreconditions"
+ {
+ "windows" "103"
+ "linux" "105"
+ }
+
+ "fvalidatehinttype"
+ {
+ "windows" "104"
+ "linux" "106"
+ }
+
+ "fcanactiveidle"
+ {
+ "windows" "105"
+ "linux" "107"
+ }
+
+ "isoundmask"
+ {
+ "windows" "106"
+ "linux" "108"
+ }
+
+ "hearingsensitivity"
+ {
+ "windows" "109"
+ "linux" "111"
+ }
+
+ "barnaclevictimbitten"
+ {
+ "windows" "110"
+ "linux" "112"
+ }
+
+ "barnaclevictimreleased"
+ {
+ "windows" "111"
+ "linux" "113"
+ }
+
+ "preschedulethink"
+ {
+ "windows" "112"
+ "linux" "114"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "113"
+ "linux" "115"
+ }
+
+ "gibmonster"
+ {
+ "windows" "114"
+ "linux" "116"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "115"
+ "linux" "117"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "116"
+ "linux" "118"
+ }
+
+ "fademonster"
+ {
+ "windows" "117"
+ "linux" "119"
+ }
+
+ "deathsound"
+ {
+ "windows" "119"
+ "linux" "121"
+ }
+
+ "alertsound"
+ {
+ "windows" "120"
+ "linux" "122"
+ }
+
+ "idlesound"
+ {
+ "windows" "121"
+ "linux" "123"
+ }
+
+ "painsound"
+ {
+ "windows" "122"
+ "linux" "124"
+ }
+
+ "stopfollowing"
+ {
+ "windows" "123"
+ "linux" "125"
+ }
+
+ "player_jump"
+ {
+ "windows" "124"
+ "linux" "126"
+ }
+
+ "player_prethink"
+ {
+ "windows" "125"
+ "linux" "127"
+ }
+
+ "player_postthink"
+ {
+ "windows" "126"
+ "linux" "128"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "118"
+ "linux" "120"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "59"
+ "linux" "61"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "128"
+ "linux" "130"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "127"
+ "linux" "129"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "57"
+ "linux" "59"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "58"
+ "linux" "60"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "59"
+ "linux" "61"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "60"
+ "linux" "62"
+ }
+
+ "item_deploy"
+ {
+ "windows" "61"
+ "linux" "63"
+ }
+
+ "item_canholster"
+ {
+ "windows" "62"
+ "linux" "64"
+ }
+
+ "item_holster"
+ {
+ "windows" "63"
+ "linux" "65"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "64"
+ "linux" "66"
+ }
+
+ "item_preframe"
+ {
+ "windows" "65"
+ "linux" "67"
+ }
+
+ "item_postframe"
+ {
+ "windows" "66"
+ "linux" "68"
+ }
+
+ "item_drop"
+ {
+ "windows" "67"
+ "linux" "69"
+ }
+
+ "item_kill"
+ {
+ "windows" "68"
+ "linux" "70"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "69"
+ "linux" "71"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "70"
+ "linux" "72"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "71"
+ "linux" "73"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "72"
+ "linux" "74"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "73"
+ "linux" "75"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "74"
+ "linux" "76"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "75"
+ "linux" "77"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "76"
+ "linux" "78"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "77"
+ "linux" "79"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "78"
+ "linux" "80"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "79"
+ "linux" "81"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "80"
+ "linux" "82"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "81"
+ "linux" "83"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "82"
+ "linux" "84"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "83"
+ "linux" "85"
+ }
+
+ "esf_weapon_holsterwhenmeleed"
+ {
+ "windows" "84"
+ "linux" "86"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/esf_openbeta/offsets-common.txt b/gamedata/common.games/virtual.games/esf_openbeta/offsets-common.txt
new file mode 100644
index 00000000..ea081813
--- /dev/null
+++ b/gamedata/common.games/virtual.games/esf_openbeta/offsets-common.txt
@@ -0,0 +1,1388 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "4"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x0"
+ }
+
+ "spawn"
+ {
+ "windows" "0"
+ "linux" "0"
+ }
+
+ "precache"
+ {
+ "windows" "1"
+ "linux" "1"
+ }
+
+ "keyvalue"
+ {
+ "windows" "2"
+ "linux" "2"
+ }
+
+ "objectcaps"
+ {
+ "windows" "5"
+ "linux" "5"
+ }
+
+ "activate"
+ {
+ "windows" "6"
+ "linux" "6"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "7"
+ "linux" "7"
+ }
+
+ "classify"
+ {
+ "windows" "8"
+ "linux" "8"
+ }
+
+ "deathnotice"
+ {
+ "windows" "9"
+ "linux" "9"
+ }
+
+ "traceattack"
+ {
+ "windows" "10"
+ "linux" "10"
+ }
+
+ "takedamage"
+ {
+ "windows" "11"
+ "linux" "11"
+ }
+
+ "takehealth"
+ {
+ "windows" "13"
+ "linux" "13"
+ }
+
+ "killed"
+ {
+ "windows" "14"
+ "linux" "14"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "15"
+ "linux" "15"
+ }
+
+ "tracebleed"
+ {
+ "windows" "16"
+ "linux" "16"
+ }
+
+ "istriggered"
+ {
+ "windows" "17"
+ "linux" "17"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "18"
+ "linux" "18"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "19"
+ "linux" "19"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "20"
+ "linux" "20"
+ }
+
+ "addpoints"
+ {
+ "windows" "21"
+ "linux" "21"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "22"
+ "linux" "22"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "23"
+ "linux" "23"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "24"
+ "linux" "24"
+ }
+
+ "getdelay"
+ {
+ "windows" "25"
+ "linux" "25"
+ }
+
+ "ismoving"
+ {
+ "windows" "26"
+ "linux" "26"
+ }
+
+ "overridereset"
+ {
+ "windows" "27"
+ "linux" "27"
+ }
+
+ "damagedecal"
+ {
+ "windows" "28"
+ "linux" "28"
+ }
+
+ "settogglestate"
+ {
+ "windows" "29"
+ "linux" "29"
+ }
+
+ "startsneaking"
+ {
+ "windows" "30"
+ "linux" "30"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "31"
+ "linux" "31"
+ }
+
+ "oncontrols"
+ {
+ "windows" "32"
+ "linux" "32"
+ }
+
+ "issneaking"
+ {
+ "windows" "33"
+ "linux" "33"
+ }
+
+ "isalive"
+ {
+ "windows" "34"
+ "linux" "34"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "35"
+ "linux" "35"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "36"
+ "linux" "36"
+ }
+
+ "hastarget"
+ {
+ "windows" "37"
+ "linux" "37"
+ }
+
+ "isinworld"
+ {
+ "windows" "38"
+ "linux" "38"
+ }
+
+ "isplayer"
+ {
+ "windows" "39"
+ "linux" "39"
+ }
+
+ "isnetclient"
+ {
+ "windows" "43"
+ "linux" "43"
+ }
+
+ "teamid"
+ {
+ "windows" "44"
+ "linux" "44"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "47"
+ "linux" "47"
+ }
+
+ "think"
+ {
+ "windows" "48"
+ "linux" "48"
+ }
+
+ "touch"
+ {
+ "windows" "49"
+ "linux" "49"
+ }
+
+ "use"
+ {
+ "windows" "50"
+ "linux" "50"
+ }
+
+ "blocked"
+ {
+ "windows" "51"
+ "linux" "51"
+ }
+
+ "respawn"
+ {
+ "windows" "52"
+ "linux" "52"
+ }
+
+ "updateowner"
+ {
+ "windows" "53"
+ "linux" "53"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "54"
+ "linux" "54"
+ }
+
+ "center"
+ {
+ "windows" "55"
+ "linux" "55"
+ }
+
+ "eyeposition"
+ {
+ "windows" "56"
+ "linux" "56"
+ }
+
+ "earposition"
+ {
+ "windows" "57"
+ "linux" "57"
+ }
+
+ "bodytarget"
+ {
+ "windows" "58"
+ "linux" "58"
+ }
+
+ "illumination"
+ {
+ "windows" "59"
+ "linux" "59"
+ }
+
+ "fvisible"
+ {
+ "windows" "60"
+ "linux" "60"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "61"
+ "linux" "61"
+ }
+
+ "look"
+ {
+ "windows" "63"
+ "linux" "63"
+ }
+
+ "changeyaw"
+ {
+ "windows" "66"
+ "linux" "66"
+ }
+
+ "irelationship"
+ {
+ "windows" "68"
+ "linux" "68"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "70"
+ "linux" "70"
+ }
+
+ "becomedead"
+ {
+ "windows" "71"
+ "linux" "71"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "73"
+ "linux" "73"
+ }
+
+ "finviewcone"
+ {
+ "windows" "74"
+ "linux" "74"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "75"
+ "linux" "75"
+ }
+
+ "runai"
+ {
+ "windows" "64"
+ "linux" "64"
+ }
+
+ "monsterthink"
+ {
+ "windows" "67"
+ "linux" "67"
+ }
+
+ "monsterinit"
+ {
+ "windows" "69"
+ "linux" "69"
+ }
+
+ "checklocalmove"
+ {
+ "windows" "76"
+ "linux" "76"
+ }
+
+ "move"
+ {
+ "windows" "77"
+ "linux" "77"
+ }
+
+ "moveexecute"
+ {
+ "windows" "78"
+ "linux" "78"
+ }
+
+ "shouldadvanceroute"
+ {
+ "windows" "79"
+ "linux" "79"
+ }
+
+ "getstoppedactivity"
+ {
+ "windows" "80"
+ "linux" "80"
+ }
+
+ "stop"
+ {
+ "windows" "81"
+ "linux" "81"
+ }
+
+ "checkrangeattack1"
+ {
+ "windows" "82"
+ "linux" "82"
+ }
+
+ "checkrangeattack2"
+ {
+ "windows" "83"
+ "linux" "83"
+ }
+
+ "checkmeleeattack1"
+ {
+ "windows" "84"
+ "linux" "84"
+ }
+
+ "checkmeleeattack2"
+ {
+ "windows" "85"
+ "linux" "85"
+ }
+
+ "schedulechange"
+ {
+ "windows" "91"
+ "linux" "91"
+ }
+
+ "canplaysequence"
+ {
+ "windows" "92"
+ "linux" "92"
+ }
+
+ "canplaysentence"
+ {
+ "windows" "93"
+ "linux" "93"
+ }
+
+ "playsentence"
+ {
+ "windows" "94"
+ "linux" "94"
+ }
+
+ "playscriptedsentence"
+ {
+ "windows" "95"
+ "linux" "95"
+ }
+
+ "sentencestop"
+ {
+ "windows" "96"
+ "linux" "96"
+ }
+
+ "getidealstate"
+ {
+ "windows" "97"
+ "linux" "97"
+ }
+
+ "setactivity"
+ {
+ "windows" "98"
+ "linux" "98"
+ }
+
+ "reportaistate"
+ {
+ "windows" "99"
+ "linux" "99"
+ }
+
+ "checkenemy"
+ {
+ "windows" "100"
+ "linux" "100"
+ }
+
+ "ftriangulate"
+ {
+ "windows" "101"
+ "linux" "101"
+ }
+
+ "setyawspeed"
+ {
+ "windows" "102"
+ "linux" "102"
+ }
+
+ "buildnearestroute"
+ {
+ "windows" "103"
+ "linux" "103"
+ }
+
+ "findcover"
+ {
+ "windows" "104"
+ "linux" "104"
+ }
+
+ "coverradius"
+ {
+ "windows" "106"
+ "linux" "106"
+ }
+
+ "fcancheckattacks"
+ {
+ "windows" "107"
+ "linux" "107"
+ }
+
+ "checkammo"
+ {
+ "windows" "108"
+ "linux" "108"
+ }
+
+ "ignoreconditions"
+ {
+ "windows" "109"
+ "linux" "109"
+ }
+
+ "fvalidatehinttype"
+ {
+ "windows" "110"
+ "linux" "110"
+ }
+
+ "fcanactiveidle"
+ {
+ "windows" "111"
+ "linux" "111"
+ }
+
+ "isoundmask"
+ {
+ "windows" "112"
+ "linux" "112"
+ }
+
+ "hearingsensitivity"
+ {
+ "windows" "115"
+ "linux" "115"
+ }
+
+ "barnaclevictimbitten"
+ {
+ "windows" "116"
+ "linux" "116"
+ }
+
+ "barnaclevictimreleased"
+ {
+ "windows" "117"
+ "linux" "117"
+ }
+
+ "preschedulethink"
+ {
+ "windows" "118"
+ "linux" "118"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "119"
+ "linux" "119"
+ }
+
+ "gibmonster"
+ {
+ "windows" "120"
+ "linux" "120"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "121"
+ "linux" "121"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "122"
+ "linux" "122"
+ }
+
+ "fademonster"
+ {
+ "windows" "123"
+ "linux" "123"
+ }
+
+ "deathsound"
+ {
+ "windows" "125"
+ "linux" "125"
+ }
+
+ "alertsound"
+ {
+ "windows" "126"
+ "linux" "126"
+ }
+
+ "idlesound"
+ {
+ "windows" "127"
+ "linux" "127"
+ }
+
+ "painsound"
+ {
+ "windows" "128"
+ "linux" "128"
+ }
+
+ "stopfollowing"
+ {
+ "windows" "129"
+ "linux" "129"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "186"
+ "linux" "186"
+ }
+
+ "player_jump"
+ {
+ "windows" "187"
+ "linux" "187"
+ }
+
+ "player_prethink"
+ {
+ "windows" "189"
+ "linux" "189"
+ }
+
+ "player_postthink"
+ {
+ "windows" "190"
+ "linux" "190"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "124"
+ "linux" "124"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "65"
+ "linux" "65"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "193"
+ "linux" "193"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "63"
+ "linux" "63"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "64"
+ "linux" "64"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "65"
+ "linux" "65"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "66"
+ "linux" "66"
+ }
+
+ "item_deploy"
+ {
+ "windows" "67"
+ "linux" "67"
+ }
+
+ "item_canholster"
+ {
+ "windows" "68"
+ "linux" "68"
+ }
+
+ "item_holster"
+ {
+ "windows" "69"
+ "linux" "69"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "70"
+ "linux" "70"
+ }
+
+ "item_preframe"
+ {
+ "windows" "71"
+ "linux" "71"
+ }
+
+ "item_postframe"
+ {
+ "windows" "72"
+ "linux" "72"
+ }
+
+ "item_drop"
+ {
+ "windows" "73"
+ "linux" "73"
+ }
+
+ "item_kill"
+ {
+ "windows" "74"
+ "linux" "74"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "75"
+ "linux" "75"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "76"
+ "linux" "76"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "77"
+ "linux" "77"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "78"
+ "linux" "78"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "79"
+ "linux" "79"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "80"
+ "linux" "80"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "81"
+ "linux" "81"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "82"
+ "linux" "82"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "83"
+ "linux" "83"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "84"
+ "linux" "84"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "85"
+ "linux" "85"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "86"
+ "linux" "86"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "87"
+ "linux" "87"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "88"
+ "linux" "88"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "89"
+ "linux" "89"
+ }
+
+ "esf_isenvmodel"
+ {
+ "windows" "40"
+ "linux" "40"
+ }
+
+ "esf_takedamage2"
+ {
+ "windows" "12"
+ "linux" "12"
+ }
+
+ "esf_isfighter"
+ {
+ "windows" "41"
+ "linux" "41"
+ }
+
+ "esf_isbuddy"
+ {
+ "windows" "42"
+ "linux" "42"
+ }
+
+ "esf_emitsound"
+ {
+ "windows" "45"
+ "linux" "45"
+ }
+
+ "esf_emitnullsound"
+ {
+ "windows" "46"
+ "linux" "46"
+ }
+
+ "esf_increasestrength"
+ {
+ "windows" "130"
+ "linux" "130"
+ }
+
+ "esf_increasepl"
+ {
+ "windows" "131"
+ "linux" "131"
+ }
+
+ "esf_setpowerlevel"
+ {
+ "windows" "132"
+ "linux" "132"
+ }
+
+ "esf_setmaxpowerlevel"
+ {
+ "windows" "133"
+ "linux" "133"
+ }
+
+ "esf_stopanitrigger"
+ {
+ "windows" "134"
+ "linux" "134"
+ }
+
+ "esf_stopfly"
+ {
+ "windows" "135"
+ "linux" "135"
+ }
+
+ "esf_hideweapon"
+ {
+ "windows" "136"
+ "linux" "136"
+ }
+
+ "esf_clientremoveweapon"
+ {
+ "windows" "137"
+ "linux" "137"
+ }
+
+ "esf_sendclientcustommodel"
+ {
+ "windows" "138"
+ "linux" "138"
+ }
+
+ "esf_canturbo"
+ {
+ "windows" "139"
+ "linux" "139"
+ }
+
+ "esf_canprimaryfire"
+ {
+ "windows" "140"
+ "linux" "140"
+ }
+
+ "esf_cansecondaryfire"
+ {
+ "windows" "141"
+ "linux" "141"
+ }
+
+ "esf_canstopfly"
+ {
+ "windows" "142"
+ "linux" "142"
+ }
+
+ "esf_canblock"
+ {
+ "windows" "143"
+ "linux" "143"
+ }
+
+ "esf_canraiseKi"
+ {
+ "windows" "144"
+ "linux" "144"
+ }
+
+ "esf_canraisestamina"
+ {
+ "windows" "145"
+ "linux" "145"
+ }
+
+ "esf_canteleport"
+ {
+ "windows" "146"
+ "linux" "146"
+ }
+
+ "esf_canstartfly"
+ {
+ "windows" "147"
+ "linux" "147"
+ }
+
+ "esf_canstartpowerup"
+ {
+ "windows" "148"
+ "linux" "148"
+ }
+
+ "esf_canjump"
+ {
+ "windows" "149"
+ "linux" "149"
+ }
+
+ "esf_canwalljump"
+ {
+ "windows" "150"
+ "linux" "150"
+ }
+
+ "esf_issuperjump"
+ {
+ "windows" "151"
+ "linux" "151"
+ }
+
+ "esf_ismoveback"
+ {
+ "windows" "152"
+ "linux" "152"
+ }
+
+ "esf_checkwalljump"
+ {
+ "windows" "153"
+ "linux" "153"
+ }
+
+ "esf_enablewalljump"
+ {
+ "windows" "154"
+ "linux" "154"
+ }
+
+ "esf_disablewalljump"
+ {
+ "windows" "155"
+ "linux" "155"
+ }
+
+ "esf_resetwalljumpvars"
+ {
+ "windows" "156"
+ "linux" "156"
+ }
+
+ "esf_getwalljumpanim"
+ {
+ "windows" "157"
+ "linux" "157"
+ }
+
+ "esf_getwalljumpanim2"
+ {
+ "windows" "158"
+ "linux" "158"
+ }
+
+ "esf_setwalljumpanimation"
+ {
+ "windows" "159"
+ "linux" "159"
+ }
+
+ "esf_setflymovetype"
+ {
+ "windows" "160"
+ "linux" "160"
+ }
+
+ "esf_isflymovetype"
+ {
+ "windows" "161"
+ "linux" "161"
+ }
+
+ "esf_iswalkmovetype"
+ {
+ "windows" "162"
+ "linux" "162"
+ }
+
+ "esf_setwalkmovetype"
+ {
+ "windows" "163"
+ "linux" "163"
+ }
+
+ "esf_drawchargebar"
+ {
+ "windows" "164"
+ "linux" "164"
+ }
+
+ "esf_startblock"
+ {
+ "windows" "165"
+ "linux" "165"
+ }
+
+ "esf_stopblock"
+ {
+ "windows" "166"
+ "linux" "166"
+ }
+
+ "esf_startfly"
+ {
+ "windows" "167"
+ "linux" "167"
+ }
+
+ "esf_getmaxspeed"
+ {
+ "windows" "168"
+ "linux" "168"
+ }
+
+ "esf_setanimation"
+ {
+ "windows" "169"
+ "linux" "169"
+ }
+
+ "esf_playanimation"
+ {
+ "windows" "170"
+ "linux" "170"
+ }
+
+ "esf_getmoveforward"
+ {
+ "windows" "171"
+ "linux" "171"
+ }
+
+ "esf_getmoveright"
+ {
+ "windows" "172"
+ "linux" "172"
+ }
+
+ "esf_getmoveup"
+ {
+ "windows" "173"
+ "linux" "173"
+ }
+
+ "esf_addblindfx"
+ {
+ "windows" "174"
+ "linux" "174"
+ }
+
+ "esf_removeblindfx"
+ {
+ "windows" "175"
+ "linux" "175"
+ }
+
+ "esf_disablepsbar"
+ {
+ "windows" "176"
+ "linux" "176"
+ }
+
+ "esf_addbeamboxcrosshair"
+ {
+ "windows" "177"
+ "linux" "177"
+ }
+
+ "esf_removebeamboxcrosshair"
+ {
+ "windows" "178"
+ "linux" "178"
+ }
+
+ "esf_drawpswinbonus"
+ {
+ "windows" "179"
+ "linux" "179"
+ }
+
+ "esf_drawpsbar"
+ {
+ "windows" "180"
+ "linux" "180"
+ }
+
+ "esf_lockcrosshair"
+ {
+ "windows" "181"
+ "linux" "181"
+ }
+
+ "esf_unlockcrosshair"
+ {
+ "windows" "182"
+ "linux" "182"
+ }
+
+ "esf_rotatecrosshair"
+ {
+ "windows" "183"
+ "linux" "183"
+ }
+
+ "esf_unrotatecrosshair"
+ {
+ "windows" "184"
+ "linux" "184"
+ }
+
+ "esf_watermove"
+ {
+ "windows" "185"
+ "linux" "185"
+ }
+
+ "esf_checktimebaseddamage"
+ {
+ "windows" "188"
+ "linux" "188"
+ }
+
+ "esf_doessecondaryattack"
+ {
+ "windows" "191"
+ "linux" "191"
+ }
+
+ "esf_doesprimaryattack"
+ {
+ "windows" "192"
+ "linux" "192"
+ }
+
+ "esf_removespecialmodes"
+ {
+ "windows" "194"
+ "linux" "194"
+ }
+
+ "esf_stopturbo"
+ {
+ "windows" "195"
+ "linux" "195"
+ }
+
+ "esf_takebean"
+ {
+ "windows" "196"
+ "linux" "196"
+ }
+
+ "esf_getpowerlevel"
+ {
+ "windows" "197"
+ "linux" "197"
+ }
+
+ "esf_removeallotherweapons"
+ {
+ "windows" "198"
+ "linux" "198"
+ }
+
+ "esf_stopswoop"
+ {
+ "windows" "199"
+ "linux" "199"
+ }
+
+ "esf_setdeathanimation"
+ {
+ "windows" "201"
+ "linux" "201"
+ }
+
+ "esf_setmodel"
+ {
+ "windows" "202"
+ "linux" "202"
+ }
+
+ "esf_addattacks"
+ {
+ "windows" "203"
+ "linux" "203"
+ }
+
+ "esf_emitclasssound"
+ {
+ "windows" "205"
+ "linux" "205"
+ }
+
+ "esf_checklightning"
+ {
+ "windows" "206"
+ "linux" "206"
+ }
+
+ "esf_freezecontrols"
+ {
+ "windows" "207"
+ "linux" "207"
+ }
+
+ "esf_unfreezecontrols"
+ {
+ "windows" "208"
+ "linux" "208"
+ }
+
+ "esf_updateki"
+ {
+ "windows" "209"
+ "linux" "209"
+ }
+
+ "esf_updatehealth"
+ {
+ "windows" "210"
+ "linux" "210"
+ }
+
+ "esf_getteleportdir"
+ {
+ "windows" "211"
+ "linux" "211"
+ }
+
+ "esf_weapon_holsterwhenmeleed"
+ {
+ "windows" "90"
+ "linux" "90"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/gearbox/offsets-common.txt b/gamedata/common.games/virtual.games/gearbox/offsets-common.txt
new file mode 100644
index 00000000..df1f9909
--- /dev/null
+++ b/gamedata/common.games/virtual.games/gearbox/offsets-common.txt
@@ -0,0 +1,1105 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "4"
+ "mac" "4"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x0"
+ "mac" "0x0"
+ }
+
+ "spawn"
+ {
+ "windows" "0"
+ "linux" "0"
+ "mac" "0"
+ }
+
+ "precache"
+ {
+ "windows" "1"
+ "linux" "1"
+ "mac" "1"
+ }
+
+ "keyvalue"
+ {
+ "windows" "2"
+ "linux" "2"
+ "mac" "2"
+ }
+
+ "objectcaps"
+ {
+ "windows" "5"
+ "linux" "5"
+ "mac" "5"
+ }
+
+ "activate"
+ {
+ "windows" "6"
+ "linux" "6"
+ "mac" "6"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "7"
+ "linux" "7"
+ "mac" "7"
+ }
+
+ "classify"
+ {
+ "windows" "8"
+ "linux" "8"
+ "mac" "8"
+ }
+
+ "deathnotice"
+ {
+ "windows" "9"
+ "linux" "9"
+ "mac" "9"
+ }
+
+ "traceattack"
+ {
+ "windows" "10"
+ "linux" "10"
+ "mac" "10"
+ }
+
+ "takedamage"
+ {
+ "windows" "11"
+ "linux" "11"
+ "mac" "11"
+ }
+
+ "takehealth"
+ {
+ "windows" "12"
+ "linux" "12"
+ "mac" "12"
+ }
+
+ "killed"
+ {
+ "windows" "13"
+ "linux" "13"
+ "mac" "13"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "14"
+ "linux" "14"
+ "mac" "14"
+ }
+
+ "tracebleed"
+ {
+ "windows" "15"
+ "linux" "15"
+ "mac" "15"
+ }
+
+ "istriggered"
+ {
+ "windows" "16"
+ "linux" "16"
+ "mac" "16"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "17"
+ "linux" "17"
+ "mac" "17"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "18"
+ "linux" "18"
+ "mac" "18"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "20"
+ "linux" "20"
+ "mac" "20"
+ }
+
+ "addpoints"
+ {
+ "windows" "21"
+ "linux" "21"
+ "mac" "21"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "22"
+ "linux" "22"
+ "mac" "22"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "23"
+ "linux" "23"
+ "mac" "23"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "24"
+ "linux" "24"
+ "mac" "24"
+ }
+
+ "giveammo"
+ {
+ "windows" "25"
+ "linux" "25"
+ "mac" "25"
+ }
+
+ "getdelay"
+ {
+ "windows" "26"
+ "linux" "26"
+ "mac" "26"
+ }
+
+ "ismoving"
+ {
+ "windows" "27"
+ "linux" "27"
+ "mac" "27"
+ }
+
+ "overridereset"
+ {
+ "windows" "28"
+ "linux" "28"
+ "mac" "28"
+ }
+
+ "damagedecal"
+ {
+ "windows" "29"
+ "linux" "29"
+ "mac" "29"
+ }
+
+ "settogglestate"
+ {
+ "windows" "30"
+ "linux" "30"
+ "mac" "30"
+ }
+
+ "startsneaking"
+ {
+ "windows" "31"
+ "linux" "31"
+ "mac" "31"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "32"
+ "linux" "32"
+ "mac" "32"
+ }
+
+ "oncontrols"
+ {
+ "windows" "33"
+ "linux" "33"
+ "mac" "33"
+ }
+
+ "issneaking"
+ {
+ "windows" "34"
+ "linux" "34"
+ "mac" "34"
+ }
+
+ "isalive"
+ {
+ "windows" "35"
+ "linux" "35"
+ "mac" "35"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "36"
+ "linux" "36"
+ "mac" "36"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "37"
+ "linux" "37"
+ "mac" "37"
+ }
+
+ "hastarget"
+ {
+ "windows" "38"
+ "linux" "38"
+ "mac" "38"
+ }
+
+ "isinworld"
+ {
+ "windows" "39"
+ "linux" "39"
+ "mac" "39"
+ }
+
+ "isplayer"
+ {
+ "windows" "40"
+ "linux" "40"
+ "mac" "40"
+ }
+
+ "isnetclient"
+ {
+ "windows" "41"
+ "linux" "41"
+ "mac" "41"
+ }
+
+ "teamid"
+ {
+ "windows" "42"
+ "linux" "42"
+ "mac" "42"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "43"
+ "linux" "43"
+ "mac" "43"
+ }
+
+ "think"
+ {
+ "windows" "44"
+ "linux" "44"
+ "mac" "44"
+ }
+
+ "touch"
+ {
+ "windows" "45"
+ "linux" "45"
+ "mac" "45"
+ }
+
+ "use"
+ {
+ "windows" "46"
+ "linux" "46"
+ "mac" "46"
+ }
+
+ "blocked"
+ {
+ "windows" "47"
+ "linux" "47"
+ "mac" "47"
+ }
+
+ "respawn"
+ {
+ "windows" "48"
+ "linux" "48"
+ "mac" "48"
+ }
+
+ "updateowner"
+ {
+ "windows" "49"
+ "linux" "49"
+ "mac" "49"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "50"
+ "linux" "50"
+ "mac" "50"
+ }
+
+ "center"
+ {
+ "windows" "51"
+ "linux" "51"
+ "mac" "51"
+ }
+
+ "eyeposition"
+ {
+ "windows" "52"
+ "linux" "52"
+ "mac" "52"
+ }
+
+ "earposition"
+ {
+ "windows" "53"
+ "linux" "53"
+ "mac" "53"
+ }
+
+ "bodytarget"
+ {
+ "windows" "54"
+ "linux" "54"
+ "mac" "54"
+ }
+
+ "illumination"
+ {
+ "windows" "55"
+ "linux" "55"
+ "mac" "55"
+ }
+
+ "fvisible"
+ {
+ "windows" "57"
+ "linux" "56"
+ "mac" "56"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "56"
+ "linux" "57"
+ "mac" "57"
+ }
+
+ "look"
+ {
+ "windows" "60"
+ "linux" "60"
+ "mac" "60"
+ }
+
+ "changeyaw"
+ {
+ "windows" "63"
+ "linux" "63"
+ "mac" "63"
+ }
+
+ "irelationship"
+ {
+ "windows" "65"
+ "linux" "65"
+ "mac" "65"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "67"
+ "linux" "67"
+ "mac" "67"
+ }
+
+ "becomedead"
+ {
+ "windows" "68"
+ "linux" "68"
+ "mac" "68"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "70"
+ "linux" "70"
+ "mac" "70"
+ }
+
+ "finviewcone"
+ {
+ "windows" "72"
+ "linux" "71"
+ "mac" "71"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "71"
+ "linux" "72"
+ "mac" "72"
+ }
+
+ "runai"
+ {
+ "windows" "61"
+ "linux" "61"
+ "mac" "61"
+ }
+
+ "monsterthink"
+ {
+ "windows" "64"
+ "linux" "64"
+ "mac" "64"
+ }
+
+ "monsterinit"
+ {
+ "windows" "66"
+ "linux" "66"
+ "mac" "66"
+ }
+
+ "checklocalmove"
+ {
+ "windows" "73"
+ "linux" "73"
+ "mac" "73"
+ }
+
+ "move"
+ {
+ "windows" "74"
+ "linux" "74"
+ "mac" "74"
+ }
+
+ "moveexecute"
+ {
+ "windows" "75"
+ "linux" "75"
+ "mac" "75"
+ }
+
+ "shouldadvanceroute"
+ {
+ "windows" "76"
+ "linux" "76"
+ "mac" "76"
+ }
+
+ "getstoppedactivity"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "77"
+ }
+
+ "stop"
+ {
+ "windows" "78"
+ "linux" "78"
+ "mac" "78"
+ }
+
+ "checkrangeattack1"
+ {
+ "windows" "79"
+ "linux" "79"
+ "mac" "79"
+ }
+
+ "checkrangeattack2"
+ {
+ "windows" "80"
+ "linux" "80"
+ "mac" "80"
+ }
+
+ "checkmeleeattack1"
+ {
+ "windows" "81"
+ "linux" "81"
+ "mac" "81"
+ }
+
+ "checkmeleeattack2"
+ {
+ "windows" "82"
+ "linux" "82"
+ "mac" "82"
+ }
+
+ "schedulechange"
+ {
+ "windows" "88"
+ "linux" "88"
+ "mac" "88"
+ }
+
+ "canplaysequence"
+ {
+ "windows" "89"
+ "linux" "89"
+ "mac" "89"
+ }
+
+ "canplaysentence"
+ {
+ "windows" "90"
+ "linux" "90"
+ "mac" "90"
+ }
+
+ "playsentence"
+ {
+ "windows" "91"
+ "linux" "91"
+ "mac" "91"
+ }
+
+ "playscriptedsentence"
+ {
+ "windows" "92"
+ "linux" "92"
+ "mac" "92"
+ }
+
+ "sentencestop"
+ {
+ "windows" "93"
+ "linux" "93"
+ "mac" "93"
+ }
+
+ "getidealstate"
+ {
+ "windows" "94"
+ "linux" "94"
+ "mac" "94"
+ }
+
+ "setactivity"
+ {
+ "windows" "95"
+ "linux" "95"
+ "mac" "95"
+ }
+
+ "reportaistate"
+ {
+ "windows" "96"
+ "linux" "96"
+ "mac" "96"
+ }
+
+ "checkenemy"
+ {
+ "windows" "97"
+ "linux" "97"
+ "mac" "97"
+ }
+
+ "ftriangulate"
+ {
+ "windows" "98"
+ "linux" "98"
+ "mac" "98"
+ }
+
+ "setyawspeed"
+ {
+ "windows" "99"
+ "linux" "99"
+ "mac" "99"
+ }
+
+ "buildnearestroute"
+ {
+ "windows" "100"
+ "linux" "100"
+ "mac" "100"
+ }
+
+ "findcover"
+ {
+ "windows" "101"
+ "linux" "101"
+ "mac" "101"
+ }
+
+ "coverradius"
+ {
+ "windows" "103"
+ "linux" "103"
+ "mac" "103"
+ }
+
+ "fcancheckattacks"
+ {
+ "windows" "104"
+ "linux" "104"
+ "mac" "104"
+ }
+
+ "checkammo"
+ {
+ "windows" "105"
+ "linux" "105"
+ "mac" "105"
+ }
+
+ "ignoreconditions"
+ {
+ "windows" "106"
+ "linux" "106"
+ "mac" "106"
+ }
+
+ "fvalidatehinttype"
+ {
+ "windows" "107"
+ "linux" "107"
+ "mac" "107"
+ }
+
+ "fcanactiveidle"
+ {
+ "windows" "108"
+ "linux" "108"
+ "mac" "108"
+ }
+
+ "isoundmask"
+ {
+ "windows" "109"
+ "linux" "109"
+ "mac" "109"
+ }
+
+ "hearingsensitivity"
+ {
+ "windows" "112"
+ "linux" "112"
+ "mac" "112"
+ }
+
+ "barnaclevictimbitten"
+ {
+ "windows" "113"
+ "linux" "113"
+ "mac" "113"
+ }
+
+ "barnaclevictimreleased"
+ {
+ "windows" "114"
+ "linux" "114"
+ "mac" "114"
+ }
+
+ "preschedulethink"
+ {
+ "windows" "115"
+ "linux" "115"
+ "mac" "115"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "116"
+ "linux" "116"
+ "mac" "116"
+ }
+
+ "gibmonster"
+ {
+ "windows" "117"
+ "linux" "117"
+ "mac" "117"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "118"
+ "linux" "118"
+ "mac" "118"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "119"
+ "linux" "119"
+ "mac" "119"
+ }
+
+ "fademonster"
+ {
+ "windows" "120"
+ "linux" "120"
+ "mac" "120"
+ }
+
+ "deathsound"
+ {
+ "windows" "123"
+ "linux" "123"
+ "mac" "123"
+ }
+
+ "alertsound"
+ {
+ "windows" "124"
+ "linux" "124"
+ "mac" "124"
+ }
+
+ "idlesound"
+ {
+ "windows" "125"
+ "linux" "125"
+ "mac" "125"
+ }
+
+ "painsound"
+ {
+ "windows" "126"
+ "linux" "126"
+ "mac" "126"
+ }
+
+ "stopfollowing"
+ {
+ "windows" "127"
+ "linux" "127"
+ "mac" "127"
+ }
+
+ "player_jump"
+ {
+ "windows" "127"
+ "linux" "127"
+ "mac" "127"
+ }
+
+ "player_duck"
+ {
+ "windows" "128"
+ "linux" "128"
+ "mac" "128"
+ }
+
+ "player_prethink"
+ {
+ "windows" "129"
+ "linux" "129"
+ "mac" "129"
+ }
+
+ "player_postthink"
+ {
+ "windows" "130"
+ "linux" "130"
+ "mac" "130"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "121"
+ "linux" "121"
+ "mac" "121"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "62"
+ "linux" "62"
+ "mac" "62"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "132"
+ "linux" "132"
+ "mac" "132"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "131"
+ "linux" "131"
+ "mac" "131"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "60"
+ "linux" "60"
+ "mac" "60"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "61"
+ "linux" "61"
+ "mac" "61"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "62"
+ "linux" "62"
+ "mac" "62"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "63"
+ "linux" "63"
+ "mac" "63"
+ }
+
+ "item_deploy"
+ {
+ "windows" "64"
+ "linux" "64"
+ "mac" "64"
+ }
+
+ "item_canholster"
+ {
+ "windows" "65"
+ "linux" "65"
+ "mac" "65"
+ }
+
+ "item_holster"
+ {
+ "windows" "66"
+ "linux" "66"
+ "mac" "66"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "67"
+ "linux" "67"
+ "mac" "67"
+ }
+
+ "item_preframe"
+ {
+ "windows" "68"
+ "linux" "68"
+ "mac" "68"
+ }
+
+ "item_postframe"
+ {
+ "windows" "69"
+ "linux" "69"
+ "mac" "69"
+ }
+
+ "item_drop"
+ {
+ "windows" "70"
+ "linux" "70"
+ "mac" "70"
+ }
+
+ "item_kill"
+ {
+ "windows" "71"
+ "linux" "71"
+ "mac" "71"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "72"
+ "linux" "72"
+ "mac" "72"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "73"
+ "linux" "73"
+ "mac" "73"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "74"
+ "linux" "74"
+ "mac" "74"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "76"
+ "linux" "76"
+ "mac" "76"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "77"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "78"
+ "linux" "78"
+ "mac" "78"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "79"
+ "linux" "79"
+ "mac" "79"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "80"
+ "linux" "80"
+ "mac" "80"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "81"
+ "linux" "81"
+ "mac" "81"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "82"
+ "linux" "82"
+ "mac" "82"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "83"
+ "linux" "83"
+ "mac" "83"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "84"
+ "linux" "84"
+ "mac" "84"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "85"
+ "linux" "85"
+ "mac" "85"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "86"
+ "linux" "86"
+ "mac" "86"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "87"
+ "linux" "87"
+ "mac" "87"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "88"
+ "linux" "88"
+ "mac" "88"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "89"
+ "linux" "89"
+ "mac" "89"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "90"
+ "linux" "90"
+ "mac" "90"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "91"
+ "linux" "91"
+ "mac" "91"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "92"
+ "linux" "92"
+ "mac" "92"
+ }
+
+ "gearbox_mysquadtalkmonsterpointer"
+ {
+ "windows" "19"
+ "linux" "19"
+ "mac" "19"
+ }
+
+ "gearbox_weapontimebase"
+ {
+ "windows" "58"
+ "linux" "58"
+ "mac" "58"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/ns/offsets-common.txt b/gamedata/common.games/virtual.games/ns/offsets-common.txt
new file mode 100644
index 00000000..6ae2eaeb
--- /dev/null
+++ b/gamedata/common.games/virtual.games/ns/offsets-common.txt
@@ -0,0 +1,878 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "4"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x0"
+ }
+
+ "spawn"
+ {
+ "windows" "0"
+ "linux" "0"
+ }
+
+ "precache"
+ {
+ "windows" "1"
+ "linux" "1"
+ }
+
+ "keyvalue"
+ {
+ "windows" "2"
+ "linux" "2"
+ }
+
+ "objectcaps"
+ {
+ "windows" "5"
+ "linux" "5"
+ }
+
+ "activate"
+ {
+ "windows" "6"
+ "linux" "6"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "7"
+ "linux" "7"
+ }
+
+ "classify"
+ {
+ "windows" "8"
+ "linux" "8"
+ }
+
+ "deathnotice"
+ {
+ "windows" "9"
+ "linux" "9"
+ }
+
+ "traceattack"
+ {
+ "windows" "10"
+ "linux" "10"
+ }
+
+ "takedamage"
+ {
+ "windows" "11"
+ "linux" "11"
+ }
+
+ "takehealth"
+ {
+ "windows" "12"
+ "linux" "12"
+ }
+
+ "killed"
+ {
+ "windows" "14"
+ "linux" "14"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "16"
+ "linux" "16"
+ }
+
+ "tracebleed"
+ {
+ "windows" "17"
+ "linux" "17"
+ }
+
+ "istriggered"
+ {
+ "windows" "18"
+ "linux" "18"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "19"
+ "linux" "19"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "20"
+ "linux" "20"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "21"
+ "linux" "21"
+ }
+
+ "addpoints"
+ {
+ "windows" "22"
+ "linux" "22"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "23"
+ "linux" "23"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "24"
+ "linux" "24"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "25"
+ "linux" "25"
+ }
+
+ "giveammo"
+ {
+ "windows" "26"
+ "linux" "26"
+ }
+
+ "getdelay"
+ {
+ "windows" "27"
+ "linux" "27"
+ }
+
+ "ismoving"
+ {
+ "windows" "28"
+ "linux" "28"
+ }
+
+ "overridereset"
+ {
+ "windows" "29"
+ "linux" "29"
+ }
+
+ "damagedecal"
+ {
+ "windows" "30"
+ "linux" "30"
+ }
+
+ "settogglestate"
+ {
+ "windows" "31"
+ "linux" "31"
+ }
+
+ "startsneaking"
+ {
+ "windows" "32"
+ "linux" "32"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "33"
+ "linux" "33"
+ }
+
+ "oncontrols"
+ {
+ "windows" "34"
+ "linux" "34"
+ }
+
+ "issneaking"
+ {
+ "windows" "35"
+ "linux" "35"
+ }
+
+ "isalive"
+ {
+ "windows" "36"
+ "linux" "36"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "37"
+ "linux" "37"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "38"
+ "linux" "38"
+ }
+
+ "hastarget"
+ {
+ "windows" "39"
+ "linux" "39"
+ }
+
+ "isinworld"
+ {
+ "windows" "40"
+ "linux" "40"
+ }
+
+ "isplayer"
+ {
+ "windows" "41"
+ "linux" "41"
+ }
+
+ "isnetclient"
+ {
+ "windows" "42"
+ "linux" "42"
+ }
+
+ "teamid"
+ {
+ "windows" "43"
+ "linux" "43"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "46"
+ "linux" "46"
+ }
+
+ "think"
+ {
+ "windows" "47"
+ "linux" "47"
+ }
+
+ "touch"
+ {
+ "windows" "48"
+ "linux" "48"
+ }
+
+ "use"
+ {
+ "windows" "49"
+ "linux" "49"
+ }
+
+ "blocked"
+ {
+ "windows" "50"
+ "linux" "50"
+ }
+
+ "respawn"
+ {
+ "windows" "52"
+ "linux" "52"
+ }
+
+ "updateowner"
+ {
+ "windows" "53"
+ "linux" "53"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "54"
+ "linux" "54"
+ }
+
+ "center"
+ {
+ "windows" "55"
+ "linux" "55"
+ }
+
+ "eyeposition"
+ {
+ "windows" "56"
+ "linux" "56"
+ }
+
+ "earposition"
+ {
+ "windows" "57"
+ "linux" "57"
+ }
+
+ "bodytarget"
+ {
+ "windows" "58"
+ "linux" "58"
+ }
+
+ "illumination"
+ {
+ "windows" "59"
+ "linux" "59"
+ }
+
+ "fvisible"
+ {
+ "windows" "60"
+ "linux" "60"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "61"
+ "linux" "61"
+ }
+
+ "changeyaw"
+ {
+ "windows" "65"
+ "linux" "65"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "66"
+ "linux" "66"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "67"
+ "linux" "67"
+ }
+
+ "fademonster"
+ {
+ "windows" "68"
+ "linux" "68"
+ }
+
+ "gibmonster"
+ {
+ "windows" "69"
+ "linux" "69"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "70"
+ "linux" "70"
+ }
+
+ "becomedead"
+ {
+ "windows" "71"
+ "linux" "71"
+ }
+
+ "irelationship"
+ {
+ "windows" "73"
+ "linux" "73"
+ }
+
+ "painsound"
+ {
+ "windows" "74"
+ "linux" "74"
+ }
+
+ "reportaistate"
+ {
+ "windows" "75"
+ "linux" "75"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "76"
+ "linux" "76"
+ }
+
+ "look"
+ {
+ "windows" "77"
+ "linux" "77"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "78"
+ "linux" "78"
+ }
+
+ "finviewcone"
+ {
+ "windows" "80"
+ "linux" "80"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "81"
+ "linux" "81"
+ }
+
+ "player_jump"
+ {
+ "windows" "83"
+ "linux" "83"
+ }
+
+ "player_duck"
+ {
+ "windows" "84"
+ "linux" "84"
+ }
+
+ "player_prethink"
+ {
+ "windows" "85"
+ "linux" "85"
+ }
+
+ "player_postthink"
+ {
+ "windows" "86"
+ "linux" "86"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "87"
+ "linux" "87"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "72"
+ "linux" "72"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "101"
+ "linux" "101"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "99"
+ "linux" "99"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "64"
+ "linux" "64"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "65"
+ "linux" "65"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "68"
+ "linux" "68"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "69"
+ "linux" "69"
+ }
+
+ "item_deploy"
+ {
+ "windows" "70"
+ "linux" "70"
+ }
+
+ "item_canholster"
+ {
+ "windows" "71"
+ "linux" "71"
+ }
+
+ "item_holster"
+ {
+ "windows" "72"
+ "linux" "72"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "74"
+ "linux" "74"
+ }
+
+ "item_preframe"
+ {
+ "windows" "75"
+ "linux" "75"
+ }
+
+ "item_postframe"
+ {
+ "windows" "76"
+ "linux" "76"
+ }
+
+ "item_drop"
+ {
+ "windows" "77"
+ "linux" "77"
+ }
+
+ "item_kill"
+ {
+ "windows" "78"
+ "linux" "78"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "79"
+ "linux" "79"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "80"
+ "linux" "80"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "81"
+ "linux" "81"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "82"
+ "linux" "82"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "83"
+ "linux" "83"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "84"
+ "linux" "84"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "85"
+ "linux" "85"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "86"
+ "linux" "86"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "87"
+ "linux" "87"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "88"
+ "linux" "88"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "89"
+ "linux" "89"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "94"
+ "linux" "94"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "73"
+ "linux" "73"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "98"
+ "linux" "98"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "99"
+ "linux" "99"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "100"
+ "linux" "100"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "101"
+ "linux" "101"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "102"
+ "linux" "102"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "103"
+ "linux" "103"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "104"
+ "linux" "104"
+ }
+
+ "ns_getpointvalue"
+ {
+ "windows" "13"
+ "linux" "13"
+ }
+
+ "ns_awardkill"
+ {
+ "windows" "15"
+ "linux" "15"
+ }
+
+ "ns_resetentity"
+ {
+ "windows" "45"
+ "linux" "45"
+ }
+
+ "ns_updateonremove"
+ {
+ "windows" "51"
+ "linux" "51"
+ }
+
+ "ns_setbonecontroller"
+ {
+ "windows" "63"
+ "linux" "63"
+ }
+
+ "ns_savedataforreset"
+ {
+ "windows" "64"
+ "linux" "64"
+ }
+
+ "ns_gethull"
+ {
+ "windows" "79"
+ "linux" "79"
+ }
+
+ "ns_getmaxwalkspeed"
+ {
+ "windows" "88"
+ "linux" "88"
+ }
+
+ "ns_setteamid"
+ {
+ "windows" "90"
+ "linux" "90"
+ }
+
+ "ns_geteffectiveplayerclass"
+ {
+ "windows" "91"
+ "linux" "91"
+ }
+
+ "ns_getauthenticationmask"
+ {
+ "windows" "92"
+ "linux" "92"
+ }
+
+ "ns_effectiveplayerclasschanged"
+ {
+ "windows" "93"
+ "linux" "93"
+ }
+
+ "ns_needsteamupdate"
+ {
+ "windows" "94"
+ "linux" "94"
+ }
+
+ "ns_sendteamupdate"
+ {
+ "windows" "95"
+ "linux" "95"
+ }
+
+ "ns_sendweaponupdate"
+ {
+ "windows" "96"
+ "linux" "96"
+ }
+
+ "ns_initplayerfromspawn"
+ {
+ "windows" "97"
+ "linux" "97"
+ }
+
+ "ns_packdeadplayeritems"
+ {
+ "windows" "98"
+ "linux" "98"
+ }
+
+ "ns_getanimationforactivity"
+ {
+ "windows" "100"
+ "linux" "100"
+ }
+
+ "ns_startobserver"
+ {
+ "windows" "102"
+ "linux" "102"
+ }
+
+ "ns_stopobserver"
+ {
+ "windows" "103"
+ "linux" "103"
+ }
+
+ "ns_getadrenalinefactor"
+ {
+ "windows" "104"
+ "linux" "104"
+ }
+
+ "ns_givenameditem"
+ {
+ "windows" "106"
+ "linux" "106"
+ }
+
+ "ns_suicide"
+ {
+ "windows" "107"
+ "linux" "107"
+ }
+
+ "ns_getcanuseweapon"
+ {
+ "windows" "108"
+ "linux" "108"
+ }
+
+ "ns_weapon_getweaponprimetime"
+ {
+ "windows" "90"
+ "linux" "90"
+ }
+
+ "ns_weapon_primeweapon"
+ {
+ "windows" "91"
+ "linux" "91"
+ }
+
+ "ns_weapon_getisweaponprimed"
+ {
+ "windows" "92"
+ "linux" "92"
+ }
+
+ "ns_weapon_getisweaponpriming"
+ {
+ "windows" "93"
+ "linux" "93"
+ }
+
+ "ns_weapon_defaultdeploy"
+ {
+ "windows" "95"
+ "linux" "95"
+ }
+
+ "ns_weapon_defaultreload"
+ {
+ "windows" "96"
+ "linux" "96"
+ }
+
+ "ns_weapon_getdeploytime"
+ {
+ "windows" "97"
+ "linux" "97"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/svencoop/offsets-common.txt b/gamedata/common.games/virtual.games/svencoop/offsets-common.txt
new file mode 100644
index 00000000..29a6e172
--- /dev/null
+++ b/gamedata/common.games/virtual.games/svencoop/offsets-common.txt
@@ -0,0 +1,1466 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "4"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x0"
+ }
+
+ "spawn"
+ {
+ "windows" "0"
+ "linux" "0"
+ }
+
+ "precache"
+ {
+ "windows" "1"
+ "linux" "1"
+ }
+
+ "keyvalue"
+ {
+ "windows" "2"
+ "linux" "2"
+ }
+
+ "objectcaps"
+ {
+ "windows" "6"
+ "linux" "6"
+ }
+
+ "activate"
+ {
+ "windows" "7"
+ "linux" "7"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "8"
+ "linux" "8"
+ }
+
+ "irelationship"
+ {
+ "windows" "10"
+ "linux" "10"
+ }
+
+ "classify"
+ {
+ "windows" "11"
+ "linux" "11"
+ }
+
+ "deathnotice"
+ {
+ "windows" "12"
+ "linux" "12"
+ }
+
+ "traceattack"
+ {
+ "windows" "13"
+ "linux" "13"
+ }
+
+ "takedamage"
+ {
+ "windows" "14"
+ "linux" "14"
+ }
+
+ "killed"
+ {
+ "windows" "17"
+ "linux" "17"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "18"
+ "linux" "18"
+ }
+
+ "tracebleed"
+ {
+ "windows" "19"
+ "linux" "19"
+ }
+
+ "istriggered"
+ {
+ "windows" "20"
+ "linux" "20"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "21"
+ "linux" "21"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "22"
+ "linux" "22"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "23"
+ "linux" "23"
+ }
+
+ "addpoints"
+ {
+ "windows" "24"
+ "linux" "24"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "25"
+ "linux" "25"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "26"
+ "linux" "26"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "27"
+ "linux" "27"
+ }
+
+ "getdelay"
+ {
+ "windows" "29"
+ "linux" "29"
+ }
+
+ "ismoving"
+ {
+ "windows" "30"
+ "linux" "30"
+ }
+
+ "overridereset"
+ {
+ "windows" "31"
+ "linux" "31"
+ }
+
+ "damagedecal"
+ {
+ "windows" "32"
+ "linux" "32"
+ }
+
+ "settogglestate"
+ {
+ "windows" "33"
+ "linux" "33"
+ }
+
+ "startsneaking"
+ {
+ "windows" "34"
+ "linux" "34"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "35"
+ "linux" "35"
+ }
+
+ "oncontrols"
+ {
+ "windows" "36"
+ "linux" "36"
+ }
+
+ "issneaking"
+ {
+ "windows" "37"
+ "linux" "37"
+ }
+
+ "isalive"
+ {
+ "windows" "38"
+ "linux" "38"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "39"
+ "linux" "39"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "40"
+ "linux" "40"
+ }
+
+ "hastarget"
+ {
+ "windows" "41"
+ "linux" "41"
+ }
+
+ "isinworld"
+ {
+ "windows" "42"
+ "linux" "42"
+ }
+
+ "isplayer"
+ {
+ "windows" "44"
+ "linux" "44"
+ }
+
+ "isnetclient"
+ {
+ "windows" "46"
+ "linux" "46"
+ }
+
+ "teamid"
+ {
+ "windows" "49"
+ "linux" "49"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "51"
+ "linux" "51"
+ }
+
+ "think"
+ {
+ "windows" "52"
+ "linux" "52"
+ }
+
+ "touch"
+ {
+ "windows" "53"
+ "linux" "53"
+ }
+
+ "use"
+ {
+ "windows" "54"
+ "linux" "54"
+ }
+
+ "blocked"
+ {
+ "windows" "55"
+ "linux" "55"
+ }
+
+ "respawn"
+ {
+ "windows" "57"
+ "linux" "57"
+ }
+
+ "updateowner"
+ {
+ "windows" "58"
+ "linux" "58"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "59"
+ "linux" "59"
+ }
+
+ "center"
+ {
+ "windows" "60"
+ "linux" "60"
+ }
+
+ "eyeposition"
+ {
+ "windows" "61"
+ "linux" "61"
+ }
+
+ "earposition"
+ {
+ "windows" "62"
+ "linux" "62"
+ }
+
+ "bodytarget"
+ {
+ "windows" "63"
+ "linux" "63"
+ }
+
+ "illumination"
+ {
+ "windows" "64"
+ "linux" "64"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "65"
+ "linux" "66"
+ }
+
+ "look"
+ {
+ "windows" "76"
+ "linux" "77"
+ }
+
+ "runai"
+ {
+ "windows" "77"
+ "linux" "78"
+ }
+
+ "changeyaw"
+ {
+ "windows" "79"
+ "linux" "80"
+ }
+
+ "monsterthink"
+ {
+ "windows" "80"
+ "linux" "81"
+ }
+
+ "monsterinit"
+ {
+ "windows" "82"
+ "linux" "83"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "83"
+ "linux" "84"
+ }
+
+ "becomedead"
+ {
+ "windows" "84"
+ "linux" "85"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "87"
+ "linux" "88"
+ }
+
+ "finviewcone"
+ {
+ "windows" "88"
+ "linux" "89"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "89"
+ "linux" "90"
+ }
+
+ "checklocalmove"
+ {
+ "windows" "90"
+ "linux" "91"
+ }
+
+ "move"
+ {
+ "windows" "91"
+ "linux" "92"
+ }
+
+ "moveexecute"
+ {
+ "windows" "92"
+ "linux" "93"
+ }
+
+ "shouldadvanceroute"
+ {
+ "windows" "93"
+ "linux" "94"
+ }
+
+ "getstoppedactivity"
+ {
+ "windows" "94"
+ "linux" "95"
+ }
+
+ "stop"
+ {
+ "windows" "95"
+ "linux" "96"
+ }
+
+ "checkrangeattack1"
+ {
+ "windows" "96"
+ "linux" "97"
+ }
+
+ "checkrangeattack2"
+ {
+ "windows" "98"
+ "linux" "99"
+ }
+
+ "checkmeleeattack1"
+ {
+ "windows" "100"
+ "linux" "101"
+ }
+
+ "checkmeleeattack2"
+ {
+ "windows" "102"
+ "linux" "103"
+ }
+
+ "schedulechange"
+ {
+ "windows" "110"
+ "linux" "111"
+ }
+
+ "canplaysequence"
+ {
+ "windows" "111"
+ "linux" "112"
+ }
+
+ "canplaysentence"
+ {
+ "windows" "112"
+ "linux" "113"
+ }
+
+ "playsentence"
+ {
+ "windows" "113"
+ "linux" "114"
+ }
+
+ "playscriptedsentence"
+ {
+ "windows" "114"
+ "linux" "115"
+ }
+
+ "sentencestop"
+ {
+ "windows" "115"
+ "linux" "116"
+ }
+
+ "getidealstate"
+ {
+ "windows" "116"
+ "linux" "117"
+ }
+
+ "setactivity"
+ {
+ "windows" "117"
+ "linux" "118"
+ }
+
+ "reportaistate"
+ {
+ "windows" "119"
+ "linux" "120"
+ }
+
+ "checkenemy"
+ {
+ "windows" "120"
+ "linux" "121"
+ }
+
+ "setyawspeed"
+ {
+ "windows" "123"
+ "linux" "124"
+ }
+
+ "buildnearestroute"
+ {
+ "windows" "124"
+ "linux" "125"
+ }
+
+ "findcover"
+ {
+ "windows" "125"
+ "linux" "126"
+ }
+
+ "coverradius"
+ {
+ "windows" "130"
+ "linux" "131"
+ }
+
+ "fcancheckattacks"
+ {
+ "windows" "131"
+ "linux" "132"
+ }
+
+ "checkammo"
+ {
+ "windows" "133"
+ "linux" "134"
+ }
+
+ "ignoreconditions"
+ {
+ "windows" "134"
+ "linux" "135"
+ }
+
+ "fvalidatehinttype"
+ {
+ "windows" "135"
+ "linux" "136"
+ }
+
+ "fcanactiveidle"
+ {
+ "windows" "136"
+ "linux" "137"
+ }
+
+ "isoundmask"
+ {
+ "windows" "137"
+ "linux" "138"
+ }
+
+ "hearingsensitivity"
+ {
+ "windows" "140"
+ "linux" "141"
+ }
+
+ "barnaclevictimbitten"
+ {
+ "windows" "141"
+ "linux" "142"
+ }
+
+ "barnaclevictimreleased"
+ {
+ "windows" "142"
+ "linux" "143"
+ }
+
+ "preschedulethink"
+ {
+ "windows" "149"
+ "linux" "150"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "150"
+ "linux" "151"
+ }
+
+ "gibmonster"
+ {
+ "windows" "151"
+ "linux" "152"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "153"
+ "linux" "154"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "154"
+ "linux" "155"
+ }
+
+ "fademonster"
+ {
+ "windows" "155"
+ "linux" "156"
+ }
+
+ "deathsound"
+ {
+ "windows" "158"
+ "linux" "159"
+ }
+
+ "alertsound"
+ {
+ "windows" "159"
+ "linux" "160"
+ }
+
+ "idlesound"
+ {
+ "windows" "160"
+ "linux" "161"
+ }
+
+ "painsound"
+ {
+ "windows" "161"
+ "linux" "162"
+ }
+
+ "stopfollowing"
+ {
+ "windows" "162"
+ "linux" "163"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "156"
+ "linux" "157"
+ }
+
+ "player_jump"
+ {
+ "windows" "178"
+ "linux" "179"
+ }
+
+ "player_duck"
+ {
+ "windows" "179"
+ "linux" "180"
+ }
+
+ "player_prethink"
+ {
+ "windows" "180"
+ "linux" "181"
+ }
+
+ "player_postthink"
+ {
+ "windows" "181"
+ "linux" "182"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "183"
+ "linux" "184"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "184"
+ "linux" "185"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "76"
+ "linux" "77"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "77"
+ "linux" "78"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "79"
+ "linux" "80"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "80"
+ "linux" "81"
+ }
+
+ "item_deploy"
+ {
+ "windows" "81"
+ "linux" "82"
+ }
+
+ "item_canholster"
+ {
+ "windows" "82"
+ "linux" "83"
+ }
+
+ "item_holster"
+ {
+ "windows" "83"
+ "linux" "84"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "84"
+ "linux" "85"
+ }
+
+ "item_preframe"
+ {
+ "windows" "85"
+ "linux" "86"
+ }
+
+ "item_postframe"
+ {
+ "windows" "86"
+ "linux" "87"
+ }
+
+ "item_drop"
+ {
+ "windows" "87"
+ "linux" "88"
+ }
+
+ "item_kill"
+ {
+ "windows" "88"
+ "linux" "89"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "89"
+ "linux" "90"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "90"
+ "linux" "91"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "91"
+ "linux" "92"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "92"
+ "linux" "93"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "93"
+ "linux" "94"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "94"
+ "linux" "95"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "95"
+ "linux" "96"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "96"
+ "linux" "97"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "97"
+ "linux" "98"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "98"
+ "linux" "99"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "99"
+ "linux" "100"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "100"
+ "linux" "101"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "102"
+ "linux" "103"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "103"
+ "linux" "104"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "104"
+ "linux" "105"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "106"
+ "linux" "107"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "107"
+ "linux" "108"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "108"
+ "linux" "109"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "109"
+ "linux" "110"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "110"
+ "linux" "111"
+ }
+
+ "sc_getclassification"
+ {
+ "windows" "9"
+ "linux" "9"
+ }
+
+ "sc_takehealth"
+ {
+ "windows" "15"
+ "linux" "15"
+ }
+
+ "sc_takearmor"
+ {
+ "windows" "16"
+ "linux" "16"
+ }
+
+ "sc_giveammo"
+ {
+ "windows" "28"
+ "linux" "28"
+ }
+
+ "sc_ismonster"
+ {
+ "windows" "43"
+ "linux" "43"
+ }
+
+ "sc_isphysx"
+ {
+ "windows" "45"
+ "linux" "45"
+ }
+
+ "sc_ispointentity"
+ {
+ "windows" "47"
+ "linux" "47"
+ }
+
+ "sc_ismachine"
+ {
+ "windows" "48"
+ "linux" "48"
+ }
+
+ "sc_criticalremove"
+ {
+ "windows" "50"
+ "linux" "50"
+ }
+
+ "sc_updateonremove"
+ {
+ "windows" "56"
+ "linux" "56"
+ }
+
+ "sc_fvisible"
+ {
+ "windows" "66"
+ "linux" "65"
+ }
+
+ "sc_fvisiblefrompos"
+ {
+ "windows" "67"
+ "linux" "67"
+ }
+
+ "sc_isfacing"
+ {
+ "windows" "68"
+ "linux" "68"
+ }
+
+ "sc_getpointsfordamage"
+ {
+ "windows" "69"
+ "linux" "69"
+ }
+
+ "sc_getdamagepoints"
+ {
+ "windows" "70"
+ "linux" "70"
+ }
+
+ "sc_oncreate"
+ {
+ "windows" "72"
+ "linux" "73"
+ }
+
+ "sc_ondestroy"
+ {
+ "windows" "73"
+ "linux" "74"
+ }
+
+ "sc_isvalidentity"
+ {
+ "windows" "74"
+ "linux" "75"
+ }
+
+ "sc_shouldfadeondeath"
+ {
+ "windows" "78"
+ "linux" "79"
+ }
+
+ "sc_setupfriendly"
+ {
+ "windows" "79"
+ "linux" "80"
+ }
+
+ "sc_revivethink"
+ {
+ "windows" "84"
+ "linux" "85"
+ }
+
+ "sc_revive"
+ {
+ "windows" "85"
+ "linux" "86"
+ }
+
+ "sc_startmonster"
+ {
+ "windows" "86"
+ "linux" "87"
+ }
+
+ "sc_checkrangeattack1_move"
+ {
+ "windows" "97"
+ "linux" "98"
+ }
+
+ "sc_checkrangeattack2_move"
+ {
+ "windows" "99"
+ "linux" "100"
+ }
+
+ "sc_checkmeleeattack1_move"
+ {
+ "windows" "101"
+ "linux" "102"
+ }
+
+ "sc_checkmeleeattack2_move"
+ {
+ "windows" "103"
+ "linux" "104"
+ }
+
+ "sc_checktankusage"
+ {
+ "windows" "104"
+ "linux" "105"
+ }
+
+ "sc_setgaitactivity"
+ {
+ "windows" "118"
+ "linux" "119"
+ }
+
+ "sc_ftriangulate"
+ {
+ "windows" "121"
+ "linux" "122"
+ }
+
+ "sc_ftriangulateextension"
+ {
+ "windows" "122"
+ "linux" "123"
+ }
+
+ "sc_findcovergrenade"
+ {
+ "windows" "126"
+ "linux" "127"
+ }
+
+ "sc_findcoverdistance"
+ {
+ "windows" "127"
+ "linux" "128"
+ }
+
+ "sc_findattackpoint"
+ {
+ "windows" "128"
+ "linux" "129"
+ }
+
+ "sc_fvalidatecover"
+ {
+ "windows" "129"
+ "linux" "130"
+ }
+
+ "sc_checkattacker"
+ {
+ "windows" "132"
+ "linux" "133"
+ }
+
+ "sc_nofriendlyfire1"
+ {
+ "windows" "145"
+ "linux" "144"
+ }
+
+ "sc_nofriendlyfire2"
+ {
+ "windows" "144"
+ "linux" "145"
+ }
+
+ "sc_nofriendlyfire3"
+ {
+ "windows" "143"
+ "linux" "146"
+ }
+
+ "sc_nofriendlyfiretopos"
+ {
+ "windows" "146"
+ "linux" "147"
+ }
+
+ "sc_fvisiblegunpos"
+ {
+ "windows" "147"
+ "linux" "148"
+ }
+
+ "sc_finbulletcone"
+ {
+ "windows" "148"
+ "linux" "149"
+ }
+
+ "sc_callgibmonster"
+ {
+ "windows" "152"
+ "linux" "153"
+ }
+
+ "sc_checktimebaseddamage"
+ {
+ "windows" "156"
+ "linux" "157"
+ }
+
+ "sc_ismoving"
+ {
+ "windows" "157"
+ "linux" "158"
+ }
+
+ "sc_isplayerfollowing"
+ {
+ "windows" "163"
+ "linux" "164"
+ }
+
+ "sc_startplayerfollowing"
+ {
+ "windows" "164"
+ "linux" "165"
+ }
+
+ "sc_stopplayerfollowing"
+ {
+ "windows" "165"
+ "linux" "166"
+ }
+
+ "sc_usesound"
+ {
+ "windows" "166"
+ "linux" "167"
+ }
+
+ "sc_unusesound"
+ {
+ "windows" "167"
+ "linux" "168"
+ }
+
+ "sc_ridemonster"
+ {
+ "windows" "168"
+ "linux" "169"
+ }
+
+ "sc_checkandapplygenericattacks"
+ {
+ "windows" "169"
+ "linux" "170"
+ }
+
+ "sc_checkscared"
+ {
+ "windows" "170"
+ "linux" "171"
+ }
+
+ "sc_checkcreaturedanger"
+ {
+ "windows" "171"
+ "linux" "172"
+ }
+
+ "sc_checkfalldamage"
+ {
+ "windows" "172"
+ "linux" "173"
+ }
+
+ "sc_checkrevival"
+ {
+ "windows" "173"
+ "linux" "174"
+ }
+
+ "sc_mediccallsound"
+ {
+ "windows" "174"
+ "linux" "175"
+ }
+
+ "sc_player_menuinputperformed"
+ {
+ "windows" "175"
+ "linux" "176"
+ }
+
+ "sc_player_ismenuinputdone"
+ {
+ "windows" "176"
+ "linux" "177"
+ }
+
+ "sc_player_specialspawn"
+ {
+ "windows" "177"
+ "linux" "178"
+ }
+
+ "sc_player_isconnected"
+ {
+ "windows" "181"
+ "linux" "182"
+ }
+
+ "sc_player_isvalidinfoentity"
+ {
+ "windows" "185"
+ "linux" "186"
+ }
+
+ "sc_player_levelend"
+ {
+ "windows" "186"
+ "linux" "187"
+ }
+
+ "sc_player_votestarted"
+ {
+ "windows" "187"
+ "linux" "188"
+ }
+
+ "sc_player_canstartnextvote"
+ {
+ "windows" "188"
+ "linux" "189"
+ }
+
+ "sc_player_vote"
+ {
+ "windows" "189"
+ "linux" "190"
+ }
+
+ "sc_player_hasvoted"
+ {
+ "windows" "190"
+ "linux" "191"
+ }
+
+ "sc_player_resetvote"
+ {
+ "windows" "191"
+ "linux" "192"
+ }
+
+ "sc_player_lastvoteinput"
+ {
+ "windows" "192"
+ "linux" "193"
+ }
+
+ "sc_player_initvote"
+ {
+ "windows" "193"
+ "linux" "194"
+ }
+
+ "sc_player_timetostartnextvote"
+ {
+ "windows" "194"
+ "linux" "195"
+ }
+
+ "sc_player_resetview"
+ {
+ "windows" "195"
+ "linux" "196"
+ }
+
+ "sc_player_getlogfrequency"
+ {
+ "windows" "196"
+ "linux" "197"
+ }
+
+ "sc_player_logplayerstats"
+ {
+ "windows" "197"
+ "linux" "198"
+ }
+
+ "sc_player_disablecollisionwithplayer"
+ {
+ "windows" "198"
+ "linux" "199"
+ }
+
+ "sc_player_enablecollisionwithplayer"
+ {
+ "windows" "199"
+ "linux" "200"
+ }
+
+ "sc_player_cantouchplayer"
+ {
+ "windows" "200"
+ "linux" "201"
+ }
+
+ "sc_item_materialize"
+ {
+ "windows" "78"
+ "linux" "79"
+ }
+
+ "sc_weapon_bulletaccuracy"
+ {
+ "windows" "101"
+ "linux" "102"
+ }
+
+ "sc_weapon_tertiaryattack"
+ {
+ "windows" "105"
+ "linux" "106"
+ }
+
+ "sc_weapon_burstsupplement"
+ {
+ "windows" "111"
+ "linux" "112"
+ }
+
+ "sc_weapon_getp_model"
+ {
+ "windows" "112"
+ "linux" "113"
+ }
+
+ "sc_weapon_getw_model"
+ {
+ "windows" "113"
+ "linux" "114"
+ }
+
+ "sc_weapon_getv_model"
+ {
+ "windows" "114"
+ "linux" "115"
+ }
+
+ "sc_weapon_precachecustommodels"
+ {
+ "windows" "115"
+ "linux" "116"
+ }
+
+ "sc_weapon_ismultiplayer"
+ {
+ "windows" "116"
+ "linux" "117"
+ }
+
+ "sc_weapon_frunfuncs"
+ {
+ "windows" "117"
+ "linux" "118"
+ }
+
+ "sc_weapon_setfov"
+ {
+ "windows" "118"
+ "linux" "119"
+ }
+
+ "sc_weapon_fcanrun"
+ {
+ "windows" "119"
+ "linux" "120"
+ }
+
+ "sc_weapon_customdecrement"
+ {
+ "windows" "120"
+ "linux" "121"
+ }
+
+ "sc_weapon_setv_model"
+ {
+ "windows" "121"
+ "linux" "122"
+ }
+
+ "sc_weapon_setp_model"
+ {
+ "windows" "122"
+ "linux" "123"
+ }
+
+ "sc_weapon_changeweaponskin"
+ {
+ "windows" "123"
+ "linux" "124"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/tfc/offsets-common.txt b/gamedata/common.games/virtual.games/tfc/offsets-common.txt
new file mode 100644
index 00000000..70b97656
--- /dev/null
+++ b/gamedata/common.games/virtual.games/tfc/offsets-common.txt
@@ -0,0 +1,1133 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "4"
+ "mac" "4"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x0"
+ "mac" "0x0"
+ }
+
+ "spawn"
+ {
+ "windows" "1"
+ "linux" "2"
+ "mac" "1"
+ }
+
+ "precache"
+ {
+ "windows" "2"
+ "linux" "3"
+ "mac" "2"
+ }
+
+ "keyvalue"
+ {
+ "windows" "3"
+ "linux" "4"
+ "mac" "3"
+ }
+
+ "objectcaps"
+ {
+ "windows" "6"
+ "linux" "7"
+ "mac" "6"
+ }
+
+ "activate"
+ {
+ "windows" "7"
+ "linux" "8"
+ "mac" "7"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "8"
+ "linux" "9"
+ "mac" "8"
+ }
+
+ "classify"
+ {
+ "windows" "9"
+ "linux" "10"
+ "mac" "9"
+ }
+
+ "deathnotice"
+ {
+ "windows" "10"
+ "linux" "11"
+ "mac" "10"
+ }
+
+ "traceattack"
+ {
+ "windows" "11"
+ "linux" "12"
+ "mac" "11"
+ }
+
+ "takedamage"
+ {
+ "windows" "12"
+ "linux" "13"
+ "mac" "12"
+ }
+
+ "takehealth"
+ {
+ "windows" "13"
+ "linux" "14"
+ "mac" "13"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "15"
+ "linux" "16"
+ "mac" "15"
+ }
+
+ "tracebleed"
+ {
+ "windows" "16"
+ "linux" "17"
+ "mac" "16"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "18"
+ "linux" "19"
+ "mac" "18"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "19"
+ "linux" "20"
+ "mac" "19"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "20"
+ "linux" "21"
+ "mac" "20"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "21"
+ "linux" "22"
+ "mac" "21"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "22"
+ "linux" "23"
+ "mac" "22"
+ }
+
+ "getdelay"
+ {
+ "windows" "24"
+ "linux" "25"
+ "mac" "24"
+ }
+
+ "ismoving"
+ {
+ "windows" "25"
+ "linux" "26"
+ "mac" "25"
+ }
+
+ "overridereset"
+ {
+ "windows" "26"
+ "linux" "27"
+ "mac" "26"
+ }
+
+ "damagedecal"
+ {
+ "windows" "27"
+ "linux" "28"
+ "mac" "27"
+ }
+
+ "settogglestate"
+ {
+ "windows" "28"
+ "linux" "29"
+ "mac" "28"
+ }
+
+ "startsneaking"
+ {
+ "windows" "29"
+ "linux" "30"
+ "mac" "29"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "30"
+ "linux" "31"
+ "mac" "30"
+ }
+
+ "oncontrols"
+ {
+ "windows" "31"
+ "linux" "32"
+ "mac" "31"
+ }
+
+ "issneaking"
+ {
+ "windows" "32"
+ "linux" "33"
+ "mac" "32"
+ }
+
+ "isalive"
+ {
+ "windows" "33"
+ "linux" "34"
+ "mac" "33"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "34"
+ "linux" "35"
+ "mac" "34"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "35"
+ "linux" "36"
+ "mac" "35"
+ }
+
+ "hastarget"
+ {
+ "windows" "36"
+ "linux" "37"
+ "mac" "36"
+ }
+
+ "isinworld"
+ {
+ "windows" "37"
+ "linux" "38"
+ "mac" "37"
+ }
+
+ "isplayer"
+ {
+ "windows" "38"
+ "linux" "39"
+ "mac" "38"
+ }
+
+ "isnetclient"
+ {
+ "windows" "39"
+ "linux" "40"
+ "mac" "39"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "41"
+ "linux" "42"
+ "mac" "41"
+ }
+
+ "think"
+ {
+ "windows" "42"
+ "linux" "43"
+ "mac" "42"
+ }
+
+ "touch"
+ {
+ "windows" "43"
+ "linux" "44"
+ "mac" "43"
+ }
+
+ "use"
+ {
+ "windows" "44"
+ "linux" "45"
+ "mac" "44"
+ }
+
+ "blocked"
+ {
+ "windows" "45"
+ "linux" "46"
+ "mac" "45"
+ }
+
+ "respawn"
+ {
+ "windows" "46"
+ "linux" "47"
+ "mac" "46"
+ }
+
+ "updateowner"
+ {
+ "windows" "47"
+ "linux" "48"
+ "mac" "47"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "48"
+ "linux" "49"
+ "mac" "48"
+ }
+
+ "center"
+ {
+ "windows" "49"
+ "linux" "50"
+ "mac" "49"
+ }
+
+ "eyeposition"
+ {
+ "windows" "50"
+ "linux" "51"
+ "mac" "50"
+ }
+
+ "earposition"
+ {
+ "windows" "51"
+ "linux" "52"
+ "mac" "51"
+ }
+
+ "bodytarget"
+ {
+ "windows" "52"
+ "linux" "53"
+ "mac" "52"
+ }
+
+ "illumination"
+ {
+ "windows" "53"
+ "linux" "54"
+ "mac" "53"
+ }
+
+ "fvisible"
+ {
+ "windows" "55"
+ "linux" "55"
+ "mac" "54"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "54"
+ "linux" "56"
+ "mac" "55"
+ }
+
+ "look"
+ {
+ "windows" "65"
+ "linux" "66"
+ "mac" "65"
+ }
+
+ "changeyaw"
+ {
+ "windows" "68"
+ "linux" "69"
+ "mac" "68"
+ }
+
+ "irelationship"
+ {
+ "windows" "70"
+ "linux" "71"
+ "mac" "70"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "72"
+ "linux" "73"
+ "mac" "72"
+ }
+
+ "becomedead"
+ {
+ "windows" "73"
+ "linux" "74"
+ "mac" "73"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "75"
+ "linux" "76"
+ "mac" "75"
+ }
+
+ "finviewcone"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "76"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "76"
+ "linux" "78"
+ "mac" "77"
+ }
+
+ "runai"
+ {
+ "windows" "66"
+ "linux" "67"
+ "mac" "66"
+ }
+
+ "monsterthink"
+ {
+ "windows" "69"
+ "linux" "70"
+ "mac" "69"
+ }
+
+ "monsterinit"
+ {
+ "windows" "71"
+ "linux" "72"
+ "mac" "71"
+ }
+
+ "checklocalmove"
+ {
+ "windows" "78"
+ "linux" "79"
+ "mac" "78"
+ }
+
+ "move"
+ {
+ "windows" "79"
+ "linux" "80"
+ "mac" "79"
+ }
+
+ "moveexecute"
+ {
+ "windows" "80"
+ "linux" "81"
+ "mac" "80"
+ }
+
+ "shouldadvanceroute"
+ {
+ "windows" "81"
+ "linux" "82"
+ "mac" "81"
+ }
+
+ "getstoppedactivity"
+ {
+ "windows" "82"
+ "linux" "83"
+ "mac" "82"
+ }
+
+ "stop"
+ {
+ "windows" "83"
+ "linux" "84"
+ "mac" "83"
+ }
+
+ "checkrangeattack1"
+ {
+ "windows" "84"
+ "linux" "85"
+ "mac" "84"
+ }
+
+ "checkrangeattack2"
+ {
+ "windows" "85"
+ "linux" "86"
+ "mac" "85"
+ }
+
+ "checkmeleeattack1"
+ {
+ "windows" "86"
+ "linux" "87"
+ "mac" "86"
+ }
+
+ "checkmeleeattack2"
+ {
+ "windows" "87"
+ "linux" "88"
+ "mac" "87"
+ }
+
+ "schedulechange"
+ {
+ "windows" "93"
+ "linux" "94"
+ "mac" "93"
+ }
+
+ "canplaysequence"
+ {
+ "windows" "94"
+ "linux" "95"
+ "mac" "94"
+ }
+
+ "canplaysentence"
+ {
+ "windows" "95"
+ "linux" "96"
+ "mac" "95"
+ }
+
+ "playsentence"
+ {
+ "windows" "96"
+ "linux" "97"
+ "mac" "96"
+ }
+
+ "playscriptedsentence"
+ {
+ "windows" "97"
+ "linux" "98"
+ "mac" "97"
+ }
+
+ "sentencestop"
+ {
+ "windows" "98"
+ "linux" "99"
+ "mac" "98"
+ }
+
+ "getidealstate"
+ {
+ "windows" "99"
+ "linux" "100"
+ "mac" "99"
+ }
+
+ "setactivity"
+ {
+ "windows" "100"
+ "linux" "101"
+ "mac" "100"
+ }
+
+ "reportaistate"
+ {
+ "windows" "101"
+ "linux" "102"
+ "mac" "101"
+ }
+
+ "checkenemy"
+ {
+ "windows" "102"
+ "linux" "103"
+ "mac" "102"
+ }
+
+ "ftriangulate"
+ {
+ "windows" "103"
+ "linux" "104"
+ "mac" "103"
+ }
+
+ "setyawspeed"
+ {
+ "windows" "104"
+ "linux" "105"
+ "mac" "104"
+ }
+
+ "buildnearestroute"
+ {
+ "windows" "105"
+ "linux" "106"
+ "mac" "105"
+ }
+
+ "findcover"
+ {
+ "windows" "106"
+ "linux" "107"
+ "mac" "106"
+ }
+
+ "coverradius"
+ {
+ "windows" "108"
+ "linux" "109"
+ "mac" "108"
+ }
+
+ "fcancheckattacks"
+ {
+ "windows" "109"
+ "linux" "110"
+ "mac" "109"
+ }
+
+ "checkammo"
+ {
+ "windows" "110"
+ "linux" "111"
+ "mac" "110"
+ }
+
+ "ignoreconditions"
+ {
+ "windows" "111"
+ "linux" "112"
+ "mac" "111"
+ }
+
+ "fvalidatehinttype"
+ {
+ "windows" "112"
+ "linux" "113"
+ "mac" "112"
+ }
+
+ "fcanactiveidle"
+ {
+ "windows" "113"
+ "linux" "114"
+ "mac" "113"
+ }
+
+ "isoundmask"
+ {
+ "windows" "114"
+ "linux" "115"
+ "mac" "114"
+ }
+
+ "hearingsensitivity"
+ {
+ "windows" "117"
+ "linux" "118"
+ "mac" "117"
+ }
+
+ "barnaclevictimbitten"
+ {
+ "windows" "118"
+ "linux" "119"
+ "mac" "118"
+ }
+
+ "barnaclevictimreleased"
+ {
+ "windows" "119"
+ "linux" "120"
+ "mac" "119"
+ }
+
+ "preschedulethink"
+ {
+ "windows" "120"
+ "linux" "121"
+ "mac" "120"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "121"
+ "linux" "122"
+ "mac" "121"
+ }
+
+ "gibmonster"
+ {
+ "windows" "122"
+ "linux" "123"
+ "mac" "122"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "123"
+ "linux" "124"
+ "mac" "123"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "124"
+ "linux" "125"
+ "mac" "124"
+ }
+
+ "fademonster"
+ {
+ "windows" "125"
+ "linux" "126"
+ "mac" "125"
+ }
+
+ "deathsound"
+ {
+ "windows" "128"
+ "linux" "129"
+ "mac" "128"
+ }
+
+ "alertsound"
+ {
+ "windows" "129"
+ "linux" "130"
+ "mac" "129"
+ }
+
+ "idlesound"
+ {
+ "windows" "130"
+ "linux" "131"
+ "mac" "130"
+ }
+
+ "painsound"
+ {
+ "windows" "131"
+ "linux" "132"
+ "mac" "131"
+ }
+
+ "stopfollowing"
+ {
+ "windows" "132"
+ "linux" "133"
+ "mac" "132"
+ }
+
+ "player_jump"
+ {
+ "windows" "133"
+ "linux" "134"
+ "mac" "133"
+ }
+
+ "player_duck"
+ {
+ "windows" "134"
+ "linux" "135"
+ "mac" "134"
+ }
+
+ "player_prethink"
+ {
+ "windows" "135"
+ "linux" "136"
+ "mac" "135"
+ }
+
+ "player_postthink"
+ {
+ "windows" "136"
+ "linux" "137"
+ "mac" "136"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "67"
+ "linux" "68"
+ "mac" "67"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "137"
+ "linux" "138"
+ "mac" "137"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "65"
+ "linux" "66"
+ "mac" "65"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "66"
+ "linux" "67"
+ "mac" "66"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "68"
+ "linux" "69"
+ "mac" "68"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "69"
+ "linux" "70"
+ "mac" "69"
+ }
+
+ "item_deploy"
+ {
+ "windows" "70"
+ "linux" "71"
+ "mac" "70"
+ }
+
+ "item_canholster"
+ {
+ "windows" "71"
+ "linux" "72"
+ "mac" "71"
+ }
+
+ "item_holster"
+ {
+ "windows" "72"
+ "linux" "73"
+ "mac" "72"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "73"
+ "linux" "74"
+ "mac" "73"
+ }
+
+ "item_preframe"
+ {
+ "windows" "74"
+ "linux" "75"
+ "mac" "74"
+ }
+
+ "item_postframe"
+ {
+ "windows" "75"
+ "linux" "76"
+ "mac" "75"
+ }
+
+ "item_drop"
+ {
+ "windows" "76"
+ "linux" "77"
+ "mac" "76"
+ }
+
+ "item_kill"
+ {
+ "windows" "77"
+ "linux" "78"
+ "mac" "77"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "78"
+ "linux" "79"
+ "mac" "78"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "79"
+ "linux" "80"
+ "mac" "79"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "80"
+ "linux" "81"
+ "mac" "80"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "81"
+ "linux" "82"
+ "mac" "81"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "82"
+ "linux" "83"
+ "mac" "82"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "67"
+ "linux" "68"
+ "mac" "67"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "83"
+ "linux" "84"
+ "mac" "83"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "84"
+ "linux" "85"
+ "mac" "84"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "85"
+ "linux" "86"
+ "mac" "85"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "86"
+ "linux" "87"
+ "mac" "86"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "87"
+ "linux" "88"
+ "mac" "87"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "88"
+ "linux" "89"
+ "mac" "88"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "89"
+ "linux" "90"
+ "mac" "89"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "90"
+ "linux" "91"
+ "mac" "90"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "91"
+ "linux" "92"
+ "mac" "91"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "92"
+ "linux" "93"
+ "mac" "92"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "93"
+ "linux" "94"
+ "mac" "93"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "94"
+ "linux" "95"
+ "mac" "94"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "95"
+ "linux" "96"
+ "mac" "95"
+ }
+
+ "weapon_getnextattackdelay"
+ {
+ "windows" "96"
+ "linux" "97"
+ "mac" "96"
+ }
+
+ "tfc_killed"
+ {
+ "windows" "14"
+ "linux" "15"
+ "mac" "14"
+ }
+
+ "tfc_istriggered"
+ {
+ "windows" "17"
+ "linux" "18"
+ "mac" "17"
+ }
+
+ "tfc_giveammo"
+ {
+ "windows" "23"
+ "linux" "24"
+ "mac" "23"
+ }
+
+ "tfc_dbgetitemname"
+ {
+ "windows" "40"
+ "linux" "41"
+ "mac" "40"
+ }
+
+ "tfc_engineeruse"
+ {
+ "windows" "56"
+ "linux" "57"
+ "mac" "56"
+ }
+
+ "tfc_finished"
+ {
+ "windows" "57"
+ "linux" "58"
+ "mac" "57"
+ }
+
+ "tfc_empexplode"
+ {
+ "windows" "58"
+ "linux" "59"
+ "mac" "58"
+ }
+
+ "tfc_calcempdmgrad"
+ {
+ "windows" "59"
+ "linux" "60"
+ "mac" "59"
+ }
+
+ "tfc_takeempblast"
+ {
+ "windows" "60"
+ "linux" "61"
+ "mac" "60"
+ }
+
+ "tfc_empremove"
+ {
+ "windows" "61"
+ "linux" "62"
+ "mac" "61"
+ }
+
+ "tfc_takeconcussionblast"
+ {
+ "windows" "62"
+ "linux" "63"
+ "mac" "62"
+ }
+
+ "tfc_concuss"
+ {
+ "windows" "63"
+ "linux" "64"
+ "mac" "63"
+ }
+
+ "tfc_radiusdamage"
+ {
+ "windows" "127"
+ "linux" "127"
+ "mac" "126"
+ }
+
+ "tfc_radiusdamage2"
+ {
+ "windows" "126"
+ "linux" "128"
+ "mac" "127"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/ts/offsets-common.txt b/gamedata/common.games/virtual.games/ts/offsets-common.txt
new file mode 100644
index 00000000..2cead359
--- /dev/null
+++ b/gamedata/common.games/virtual.games/ts/offsets-common.txt
@@ -0,0 +1,746 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "0"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x60"
+ }
+
+ "spawn"
+ {
+ "windows" "7"
+ "linux" "9"
+ }
+
+ "precache"
+ {
+ "windows" "8"
+ "linux" "10"
+ }
+
+ "keyvalue"
+ {
+ "windows" "9"
+ "linux" "11"
+ }
+
+ "objectcaps"
+ {
+ "windows" "12"
+ "linux" "14"
+ }
+
+ "activate"
+ {
+ "windows" "13"
+ "linux" "15"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "16"
+ "linux" "18"
+ }
+
+ "classify"
+ {
+ "windows" "17"
+ "linux" "19"
+ }
+
+ "deathnotice"
+ {
+ "windows" "18"
+ "linux" "20"
+ }
+
+ "traceattack"
+ {
+ "windows" "19"
+ "linux" "21"
+ }
+
+ "takedamage"
+ {
+ "windows" "20"
+ "linux" "22"
+ }
+
+ "takehealth"
+ {
+ "windows" "21"
+ "linux" "23"
+ }
+
+ "killed"
+ {
+ "windows" "22"
+ "linux" "24"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "23"
+ "linux" "25"
+ }
+
+ "tracebleed"
+ {
+ "windows" "24"
+ "linux" "26"
+ }
+
+ "istriggered"
+ {
+ "windows" "25"
+ "linux" "27"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "26"
+ "linux" "28"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "27"
+ "linux" "29"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "28"
+ "linux" "30"
+ }
+
+ "addpoints"
+ {
+ "windows" "29"
+ "linux" "31"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "30"
+ "linux" "32"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "31"
+ "linux" "33"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "32"
+ "linux" "34"
+ }
+
+ "giveammo"
+ {
+ "windows" "33"
+ "linux" "35"
+ }
+
+ "getdelay"
+ {
+ "windows" "34"
+ "linux" "36"
+ }
+
+ "ismoving"
+ {
+ "windows" "35"
+ "linux" "37"
+ }
+
+ "overridereset"
+ {
+ "windows" "36"
+ "linux" "38"
+ }
+
+ "damagedecal"
+ {
+ "windows" "37"
+ "linux" "39"
+ }
+
+ "settogglestate"
+ {
+ "windows" "38"
+ "linux" "40"
+ }
+
+ "startsneaking"
+ {
+ "windows" "39"
+ "linux" "41"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "40"
+ "linux" "42"
+ }
+
+ "oncontrols"
+ {
+ "windows" "41"
+ "linux" "43"
+ }
+
+ "issneaking"
+ {
+ "windows" "42"
+ "linux" "44"
+ }
+
+ "isalive"
+ {
+ "windows" "43"
+ "linux" "45"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "44"
+ "linux" "46"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "45"
+ "linux" "47"
+ }
+
+ "hastarget"
+ {
+ "windows" "46"
+ "linux" "48"
+ }
+
+ "isinworld"
+ {
+ "windows" "47"
+ "linux" "49"
+ }
+
+ "isplayer"
+ {
+ "windows" "48"
+ "linux" "50"
+ }
+
+ "isnetclient"
+ {
+ "windows" "49"
+ "linux" "51"
+ }
+
+ "teamid"
+ {
+ "windows" "50"
+ "linux" "52"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "51"
+ "linux" "53"
+ }
+
+ "think"
+ {
+ "windows" "52"
+ "linux" "54"
+ }
+
+ "touch"
+ {
+ "windows" "53"
+ "linux" "55"
+ }
+
+ "use"
+ {
+ "windows" "54"
+ "linux" "56"
+ }
+
+ "blocked"
+ {
+ "windows" "55"
+ "linux" "57"
+ }
+
+ "respawn"
+ {
+ "windows" "57"
+ "linux" "59"
+ }
+
+ "updateowner"
+ {
+ "windows" "58"
+ "linux" "60"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "59"
+ "linux" "61"
+ }
+
+ "center"
+ {
+ "windows" "60"
+ "linux" "62"
+ }
+
+ "eyeposition"
+ {
+ "windows" "61"
+ "linux" "63"
+ }
+
+ "earposition"
+ {
+ "windows" "62"
+ "linux" "64"
+ }
+
+ "bodytarget"
+ {
+ "windows" "63"
+ "linux" "65"
+ }
+
+ "illumination"
+ {
+ "windows" "64"
+ "linux" "66"
+ }
+
+ "fvisible"
+ {
+ "windows" "65"
+ "linux" "67"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "66"
+ "linux" "68"
+ }
+
+ "changeyaw"
+ {
+ "windows" "68"
+ "linux" "70"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "69"
+ "linux" "71"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "70"
+ "linux" "72"
+ }
+
+ "fademonster"
+ {
+ "windows" "71"
+ "linux" "73"
+ }
+
+ "gibmonster"
+ {
+ "windows" "72"
+ "linux" "74"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "73"
+ "linux" "75"
+ }
+
+ "becomedead"
+ {
+ "windows" "74"
+ "linux" "76"
+ }
+
+ "irelationship"
+ {
+ "windows" "76"
+ "linux" "78"
+ }
+
+ "painsound"
+ {
+ "windows" "77"
+ "linux" "79"
+ }
+
+ "reportaistate"
+ {
+ "windows" "78"
+ "linux" "80"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "79"
+ "linux" "81"
+ }
+
+ "look"
+ {
+ "windows" "80"
+ "linux" "82"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "81"
+ "linux" "83"
+ }
+
+ "finviewcone"
+ {
+ "windows" "82"
+ "linux" "84"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "83"
+ "linux" "85"
+ }
+
+ "player_jump"
+ {
+ "windows" "84"
+ "linux" "86"
+ }
+
+ "player_duck"
+ {
+ "windows" "85"
+ "linux" "87"
+ }
+
+ "player_prethink"
+ {
+ "windows" "86"
+ "linux" "88"
+ }
+
+ "player_postthink"
+ {
+ "windows" "87"
+ "linux" "89"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "88"
+ "linux" "90"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "75"
+ "linux" "77"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "90"
+ "linux" "92"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "89"
+ "linux" "91"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "68"
+ "linux" "70"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "69"
+ "linux" "71"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "71"
+ "linux" "73"
+ }
+
+ "item_deploy"
+ {
+ "windows" "72"
+ "linux" "74"
+ }
+
+ "item_canholster"
+ {
+ "windows" "73"
+ "linux" "75"
+ }
+
+ "item_holster"
+ {
+ "windows" "74"
+ "linux" "76"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "75"
+ "linux" "77"
+ }
+
+ "item_preframe"
+ {
+ "windows" "76"
+ "linux" "78"
+ }
+
+ "item_postframe"
+ {
+ "windows" "77"
+ "linux" "79"
+ }
+
+ "item_drop"
+ {
+ "windows" "78"
+ "linux" "80"
+ }
+
+ "item_kill"
+ {
+ "windows" "79"
+ "linux" "81"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "80"
+ "linux" "82"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "81"
+ "linux" "83"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "82"
+ "linux" "84"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "83"
+ "linux" "85"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "84"
+ "linux" "86"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "85"
+ "linux" "87"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "86"
+ "linux" "88"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "87"
+ "linux" "89"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "88"
+ "linux" "90"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "89"
+ "linux" "91"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "90"
+ "linux" "92"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "91"
+ "linux" "93"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "92"
+ "linux" "94"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "93"
+ "linux" "95"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "94"
+ "linux" "96"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "96"
+ "linux" "98"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "97"
+ "linux" "99"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "98"
+ "linux" "100"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "99"
+ "linux" "101"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "100"
+ "linux" "102"
+ }
+
+ "ts_breakablerespawn"
+ {
+ "windows" "0"
+ "linux" "2"
+ }
+
+ "ts_canusedthroughwalls"
+ {
+ "windows" "1"
+ "linux" "3"
+ }
+
+ "ts_giveslowmul"
+ {
+ "windows" "2"
+ "linux" "4"
+ }
+
+ "ts_goslow"
+ {
+ "windows" "3"
+ "linux" "5"
+ }
+
+ "ts_inslow"
+ {
+ "windows" "4"
+ "linux" "6"
+ }
+
+ "ts_isobjective"
+ {
+ "windows" "5"
+ "linux" "7"
+ }
+
+ "ts_enableobjective"
+ {
+ "windows" "6"
+ "linux" "8"
+ }
+
+ "ts_onfreeentprivatedata"
+ {
+ "windows" "10"
+ "linux" "12"
+ }
+
+ "ts_shouldcollide"
+ {
+ "windows" "11"
+ "linux" "13"
+ }
+
+ "ts_weapon_alternateattack"
+ {
+ "windows" "95"
+ "linux" "97"
+ }
+
+ }
+ }
+}
diff --git a/gamedata/common.games/virtual.games/valve/offsets-common.txt b/gamedata/common.games/virtual.games/valve/offsets-common.txt
new file mode 100644
index 00000000..360ddd52
--- /dev/null
+++ b/gamedata/common.games/virtual.games/valve/offsets-common.txt
@@ -0,0 +1,1091 @@
+/**
+ * Do not edit this file. Any changes will be overwritten by the gamedata
+ * updater or by upgrading your AMX Mod X install.
+ *
+ * To override data in this file, create a subdirectory named "custom" and
+ * place your own gamedata file(s) inside of it. Such files will be parsed
+ * after AMXX's own.
+ *
+ * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(AMX_Mod_X)
+ */
+
+"Games"
+{
+ "#default"
+ {
+ "Offsets"
+ {
+ "pev"
+ {
+ "windows" "4"
+ "linux" "4"
+ "mac" "4"
+ }
+
+ "base"
+ {
+ "windows" "0x0"
+ "linux" "0x0"
+ "mac" "0x0"
+ }
+
+ "spawn"
+ {
+ "windows" "0"
+ "linux" "0"
+ "mac" "0"
+ }
+
+ "precache"
+ {
+ "windows" "1"
+ "linux" "1"
+ "mac" "1"
+ }
+
+ "keyvalue"
+ {
+ "windows" "2"
+ "linux" "2"
+ "mac" "2"
+ }
+
+ "objectcaps"
+ {
+ "windows" "5"
+ "linux" "5"
+ "mac" "5"
+ }
+
+ "activate"
+ {
+ "windows" "6"
+ "linux" "6"
+ "mac" "6"
+ }
+
+ "setobjectcollisionbox"
+ {
+ "windows" "7"
+ "linux" "7"
+ "mac" "7"
+ }
+
+ "classify"
+ {
+ "windows" "8"
+ "linux" "8"
+ "mac" "8"
+ }
+
+ "deathnotice"
+ {
+ "windows" "9"
+ "linux" "9"
+ "mac" "9"
+ }
+
+ "traceattack"
+ {
+ "windows" "10"
+ "linux" "10"
+ "mac" "10"
+ }
+
+ "takedamage"
+ {
+ "windows" "11"
+ "linux" "11"
+ "mac" "11"
+ }
+
+ "takehealth"
+ {
+ "windows" "12"
+ "linux" "12"
+ "mac" "12"
+ }
+
+ "killed"
+ {
+ "windows" "13"
+ "linux" "13"
+ "mac" "13"
+ }
+
+ "bloodcolor"
+ {
+ "windows" "14"
+ "linux" "14"
+ "mac" "14"
+ }
+
+ "tracebleed"
+ {
+ "windows" "15"
+ "linux" "15"
+ "mac" "15"
+ }
+
+ "istriggered"
+ {
+ "windows" "16"
+ "linux" "16"
+ "mac" "16"
+ }
+
+ "mymonsterpointer"
+ {
+ "windows" "17"
+ "linux" "17"
+ "mac" "17"
+ }
+
+ "mysquadmonsterpointer"
+ {
+ "windows" "18"
+ "linux" "18"
+ "mac" "18"
+ }
+
+ "gettogglestate"
+ {
+ "windows" "19"
+ "linux" "19"
+ "mac" "19"
+ }
+
+ "addpoints"
+ {
+ "windows" "20"
+ "linux" "20"
+ "mac" "20"
+ }
+
+ "addpointstoteam"
+ {
+ "windows" "21"
+ "linux" "21"
+ "mac" "21"
+ }
+
+ "addplayeritem"
+ {
+ "windows" "22"
+ "linux" "22"
+ "mac" "22"
+ }
+
+ "removeplayeritem"
+ {
+ "windows" "23"
+ "linux" "23"
+ "mac" "23"
+ }
+
+ "giveammo"
+ {
+ "windows" "24"
+ "linux" "24"
+ "mac" "24"
+ }
+
+ "getdelay"
+ {
+ "windows" "25"
+ "linux" "25"
+ "mac" "25"
+ }
+
+ "ismoving"
+ {
+ "windows" "26"
+ "linux" "26"
+ "mac" "26"
+ }
+
+ "overridereset"
+ {
+ "windows" "27"
+ "linux" "27"
+ "mac" "27"
+ }
+
+ "damagedecal"
+ {
+ "windows" "28"
+ "linux" "28"
+ "mac" "28"
+ }
+
+ "settogglestate"
+ {
+ "windows" "29"
+ "linux" "29"
+ "mac" "29"
+ }
+
+ "startsneaking"
+ {
+ "windows" "30"
+ "linux" "30"
+ "mac" "30"
+ }
+
+ "stopsneaking"
+ {
+ "windows" "31"
+ "linux" "31"
+ "mac" "31"
+ }
+
+ "oncontrols"
+ {
+ "windows" "32"
+ "linux" "32"
+ "mac" "32"
+ }
+
+ "issneaking"
+ {
+ "windows" "33"
+ "linux" "33"
+ "mac" "33"
+ }
+
+ "isalive"
+ {
+ "windows" "34"
+ "linux" "34"
+ "mac" "34"
+ }
+
+ "isbspmodel"
+ {
+ "windows" "35"
+ "linux" "35"
+ "mac" "35"
+ }
+
+ "reflectgauss"
+ {
+ "windows" "36"
+ "linux" "36"
+ "mac" "36"
+ }
+
+ "hastarget"
+ {
+ "windows" "37"
+ "linux" "37"
+ "mac" "37"
+ }
+
+ "isinworld"
+ {
+ "windows" "38"
+ "linux" "38"
+ "mac" "38"
+ }
+
+ "isplayer"
+ {
+ "windows" "39"
+ "linux" "39"
+ "mac" "39"
+ }
+
+ "isnetclient"
+ {
+ "windows" "40"
+ "linux" "40"
+ "mac" "40"
+ }
+
+ "teamid"
+ {
+ "windows" "41"
+ "linux" "41"
+ "mac" "41"
+ }
+
+ "getnexttarget"
+ {
+ "windows" "42"
+ "linux" "42"
+ "mac" "42"
+ }
+
+ "think"
+ {
+ "windows" "43"
+ "linux" "43"
+ "mac" "43"
+ }
+
+ "touch"
+ {
+ "windows" "44"
+ "linux" "44"
+ "mac" "44"
+ }
+
+ "use"
+ {
+ "windows" "45"
+ "linux" "45"
+ "mac" "45"
+ }
+
+ "blocked"
+ {
+ "windows" "46"
+ "linux" "46"
+ "mac" "46"
+ }
+
+ "respawn"
+ {
+ "windows" "47"
+ "linux" "47"
+ "mac" "47"
+ }
+
+ "updateowner"
+ {
+ "windows" "48"
+ "linux" "48"
+ "mac" "48"
+ }
+
+ "fbecomeprone"
+ {
+ "windows" "49"
+ "linux" "49"
+ "mac" "49"
+ }
+
+ "center"
+ {
+ "windows" "50"
+ "linux" "50"
+ "mac" "50"
+ }
+
+ "eyeposition"
+ {
+ "windows" "51"
+ "linux" "51"
+ "mac" "51"
+ }
+
+ "earposition"
+ {
+ "windows" "52"
+ "linux" "52"
+ "mac" "52"
+ }
+
+ "bodytarget"
+ {
+ "windows" "53"
+ "linux" "53"
+ "mac" "53"
+ }
+
+ "illumination"
+ {
+ "windows" "54"
+ "linux" "54"
+ "mac" "54"
+ }
+
+ "fvisible"
+ {
+ "windows" "55"
+ "linux" "55"
+ "mac" "55"
+ }
+
+ "fvecvisible"
+ {
+ "windows" "56"
+ "linux" "56"
+ "mac" "56"
+ }
+
+ "look"
+ {
+ "windows" "58"
+ "linux" "58"
+ "mac" "58"
+ }
+
+ "changeyaw"
+ {
+ "windows" "61"
+ "linux" "61"
+ "mac" "61"
+ }
+
+ "irelationship"
+ {
+ "windows" "63"
+ "linux" "63"
+ "mac" "63"
+ }
+
+ "monsterinitdead"
+ {
+ "windows" "65"
+ "linux" "65"
+ "mac" "65"
+ }
+
+ "becomedead"
+ {
+ "windows" "66"
+ "linux" "66"
+ "mac" "66"
+ }
+
+ "bestvisibleenemy"
+ {
+ "windows" "68"
+ "linux" "68"
+ "mac" "68"
+ }
+
+ "finviewcone"
+ {
+ "windows" "69"
+ "linux" "69"
+ "mac" "69"
+ }
+
+ "fvecinviewcone"
+ {
+ "windows" "70"
+ "linux" "70"
+ "mac" "70"
+ }
+
+ "runai"
+ {
+ "windows" "59"
+ "linux" "59"
+ "mac" "59"
+ }
+
+ "monsterthink"
+ {
+ "windows" "62"
+ "linux" "62"
+ "mac" "62"
+ }
+
+ "monsterinit"
+ {
+ "windows" "64"
+ "linux" "64"
+ "mac" "64"
+ }
+
+ "checklocalmove"
+ {
+ "windows" "71"
+ "linux" "71"
+ "mac" "71"
+ }
+
+ "move"
+ {
+ "windows" "72"
+ "linux" "72"
+ "mac" "72"
+ }
+
+ "moveexecute"
+ {
+ "windows" "73"
+ "linux" "73"
+ "mac" "73"
+ }
+
+ "shouldadvanceroute"
+ {
+ "windows" "74"
+ "linux" "74"
+ "mac" "74"
+ }
+
+ "getstoppedactivity"
+ {
+ "windows" "75"
+ "linux" "75"
+ "mac" "75"
+ }
+
+ "stop"
+ {
+ "windows" "76"
+ "linux" "76"
+ "mac" "76"
+ }
+
+ "checkrangeattack1"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "77"
+ }
+
+ "checkrangeattack2"
+ {
+ "windows" "78"
+ "linux" "78"
+ "mac" "78"
+ }
+
+ "checkmeleeattack1"
+ {
+ "windows" "79"
+ "linux" "79"
+ "mac" "79"
+ }
+
+ "checkmeleeattack2"
+ {
+ "windows" "80"
+ "linux" "80"
+ "mac" "80"
+ }
+
+ "schedulechange"
+ {
+ "windows" "86"
+ "linux" "86"
+ "mac" "86"
+ }
+
+ "canplaysequence"
+ {
+ "windows" "87"
+ "linux" "87"
+ "mac" "87"
+ }
+
+ "canplaysentence"
+ {
+ "windows" "88"
+ "linux" "88"
+ "mac" "88"
+ }
+
+ "playsentence"
+ {
+ "windows" "89"
+ "linux" "89"
+ "mac" "89"
+ }
+
+ "playscriptedsentence"
+ {
+ "windows" "90"
+ "linux" "90"
+ "mac" "90"
+ }
+
+ "sentencestop"
+ {
+ "windows" "91"
+ "linux" "91"
+ "mac" "91"
+ }
+
+ "getidealstate"
+ {
+ "windows" "92"
+ "linux" "92"
+ "mac" "92"
+ }
+
+ "setactivity"
+ {
+ "windows" "93"
+ "linux" "93"
+ "mac" "93"
+ }
+
+ "reportaistate"
+ {
+ "windows" "94"
+ "linux" "94"
+ "mac" "94"
+ }
+
+ "checkenemy"
+ {
+ "windows" "95"
+ "linux" "95"
+ "mac" "95"
+ }
+
+ "ftriangulate"
+ {
+ "windows" "96"
+ "linux" "96"
+ "mac" "96"
+ }
+
+ "setyawspeed"
+ {
+ "windows" "97"
+ "linux" "97"
+ "mac" "97"
+ }
+
+ "buildnearestroute"
+ {
+ "windows" "98"
+ "linux" "98"
+ "mac" "98"
+ }
+
+ "findcover"
+ {
+ "windows" "99"
+ "linux" "99"
+ "mac" "99"
+ }
+
+ "coverradius"
+ {
+ "windows" "101"
+ "linux" "101"
+ "mac" "101"
+ }
+
+ "fcancheckattacks"
+ {
+ "windows" "102"
+ "linux" "102"
+ "mac" "102"
+ }
+
+ "checkammo"
+ {
+ "windows" "103"
+ "linux" "103"
+ "mac" "103"
+ }
+
+ "ignoreconditions"
+ {
+ "windows" "104"
+ "linux" "104"
+ "mac" "104"
+ }
+
+ "fvalidatehinttype"
+ {
+ "windows" "105"
+ "linux" "105"
+ "mac" "105"
+ }
+
+ "fcanactiveidle"
+ {
+ "windows" "106"
+ "linux" "106"
+ "mac" "106"
+ }
+
+ "isoundmask"
+ {
+ "windows" "107"
+ "linux" "107"
+ "mac" "107"
+ }
+
+ "hearingsensitivity"
+ {
+ "windows" "110"
+ "linux" "110"
+ "mac" "110"
+ }
+
+ "barnaclevictimbitten"
+ {
+ "windows" "111"
+ "linux" "111"
+ "mac" "111"
+ }
+
+ "barnaclevictimreleased"
+ {
+ "windows" "112"
+ "linux" "112"
+ "mac" "112"
+ }
+
+ "preschedulethink"
+ {
+ "windows" "113"
+ "linux" "113"
+ "mac" "113"
+ }
+
+ "getdeathactivity"
+ {
+ "windows" "114"
+ "linux" "114"
+ "mac" "114"
+ }
+
+ "gibmonster"
+ {
+ "windows" "115"
+ "linux" "115"
+ "mac" "115"
+ }
+
+ "hashumangibs"
+ {
+ "windows" "116"
+ "linux" "116"
+ "mac" "116"
+ }
+
+ "hasaliengibs"
+ {
+ "windows" "117"
+ "linux" "117"
+ "mac" "117"
+ }
+
+ "fademonster"
+ {
+ "windows" "118"
+ "linux" "118"
+ "mac" "118"
+ }
+
+ "deathsound"
+ {
+ "windows" "120"
+ "linux" "120"
+ "mac" "120"
+ }
+
+ "alertsound"
+ {
+ "windows" "121"
+ "linux" "121"
+ "mac" "121"
+ }
+
+ "idlesound"
+ {
+ "windows" "122"
+ "linux" "122"
+ "mac" "122"
+ }
+
+ "painsound"
+ {
+ "windows" "123"
+ "linux" "123"
+ "mac" "123"
+ }
+
+ "stopfollowing"
+ {
+ "windows" "124"
+ "linux" "124"
+ "mac" "124"
+ }
+
+ "player_jump"
+ {
+ "windows" "125"
+ "linux" "125"
+ "mac" "125"
+ }
+
+ "player_duck"
+ {
+ "windows" "126"
+ "linux" "126"
+ "mac" "126"
+ }
+
+ "player_prethink"
+ {
+ "windows" "127"
+ "linux" "127"
+ "mac" "127"
+ }
+
+ "player_postthink"
+ {
+ "windows" "128"
+ "linux" "128"
+ "mac" "128"
+ }
+
+ "player_getgunposition"
+ {
+ "windows" "119"
+ "linux" "119"
+ "mac" "119"
+ }
+
+ "player_shouldfadeondeath"
+ {
+ "windows" "60"
+ "linux" "60"
+ "mac" "60"
+ }
+
+ "player_impulsecommands"
+ {
+ "windows" "130"
+ "linux" "130"
+ "mac" "130"
+ }
+
+ "player_updateclientdata"
+ {
+ "windows" "129"
+ "linux" "129"
+ "mac" "129"
+ }
+
+ "item_addtoplayer"
+ {
+ "windows" "58"
+ "linux" "58"
+ "mac" "58"
+ }
+
+ "item_addduplicate"
+ {
+ "windows" "59"
+ "linux" "59"
+ "mac" "59"
+ }
+
+ "item_getiteminfo"
+ {
+ "windows" "60"
+ "linux" "60"
+ "mac" "60"
+ }
+
+ "item_candeploy"
+ {
+ "windows" "61"
+ "linux" "61"
+ "mac" "61"
+ }
+
+ "item_deploy"
+ {
+ "windows" "62"
+ "linux" "62"
+ "mac" "62"
+ }
+
+ "item_canholster"
+ {
+ "windows" "63"
+ "linux" "63"
+ "mac" "63"
+ }
+
+ "item_holster"
+ {
+ "windows" "64"
+ "linux" "64"
+ "mac" "64"
+ }
+
+ "item_updateiteminfo"
+ {
+ "windows" "65"
+ "linux" "65"
+ "mac" "65"
+ }
+
+ "item_preframe"
+ {
+ "windows" "66"
+ "linux" "66"
+ "mac" "66"
+ }
+
+ "item_postframe"
+ {
+ "windows" "67"
+ "linux" "67"
+ "mac" "67"
+ }
+
+ "item_drop"
+ {
+ "windows" "68"
+ "linux" "68"
+ "mac" "68"
+ }
+
+ "item_kill"
+ {
+ "windows" "69"
+ "linux" "69"
+ "mac" "69"
+ }
+
+ "item_attachtoplayer"
+ {
+ "windows" "70"
+ "linux" "70"
+ "mac" "70"
+ }
+
+ "item_primaryammoindex"
+ {
+ "windows" "71"
+ "linux" "71"
+ "mac" "71"
+ }
+
+ "item_secondaryammoindex"
+ {
+ "windows" "72"
+ "linux" "72"
+ "mac" "72"
+ }
+
+ "item_updateclientdata"
+ {
+ "windows" "73"
+ "linux" "73"
+ "mac" "73"
+ }
+
+ "item_getweaponptr"
+ {
+ "windows" "74"
+ "linux" "74"
+ "mac" "74"
+ }
+
+ "item_itemslot"
+ {
+ "windows" "75"
+ "linux" "75"
+ "mac" "75"
+ }
+
+ "weapon_extractammo"
+ {
+ "windows" "76"
+ "linux" "76"
+ "mac" "76"
+ }
+
+ "weapon_extractclipammo"
+ {
+ "windows" "77"
+ "linux" "77"
+ "mac" "77"
+ }
+
+ "weapon_addweapon"
+ {
+ "windows" "78"
+ "linux" "78"
+ "mac" "78"
+ }
+
+ "weapon_playemptysound"
+ {
+ "windows" "79"
+ "linux" "79"
+ "mac" "79"
+ }
+
+ "weapon_resetemptysound"
+ {
+ "windows" "80"
+ "linux" "80"
+ "mac" "80"
+ }
+
+ "weapon_sendweaponanim"
+ {
+ "windows" "81"
+ "linux" "81"
+ "mac" "81"
+ }
+
+ "weapon_isusable"
+ {
+ "windows" "82"
+ "linux" "82"
+ "mac" "82"
+ }
+
+ "weapon_primaryattack"
+ {
+ "windows" "83"
+ "linux" "83"
+ "mac" "83"
+ }
+
+ "weapon_secondaryattack"
+ {
+ "windows" "84"
+ "linux" "84"
+ "mac" "84"
+ }
+
+ "weapon_reload"
+ {
+ "windows" "85"
+ "linux" "85"
+ "mac" "85"
+ }
+
+ "weapon_weaponidle"
+ {
+ "windows" "86"
+ "linux" "86"
+ "mac" "86"
+ }
+
+ "weapon_retireweapon"
+ {
+ "windows" "87"
+ "linux" "87"
+ "mac" "87"
+ }
+
+ "weapon_shouldweaponidle"
+ {
+ "windows" "88"
+ "linux" "88"
+ "mac" "88"
+ }
+
+ "weapon_usedecrement"
+ {
+ "windows" "89"
+ "linux" "89"
+ "mac" "89"
+ }
+
+ }
+ }
+}
diff --git a/installer/amxmodx-installer.nsi b/installer/amxmodx-installer.nsi
index 5c62d4e7..39fdd0f4 100755
--- a/installer/amxmodx-installer.nsi
+++ b/installer/amxmodx-installer.nsi
@@ -110,7 +110,6 @@ Section "MainSection" SEC01
File "installer\files\base\addons\amxmodx\configs\core.ini"
File "installer\files\base\addons\amxmodx\configs\custommenuitems.cfg"
File "installer\files\base\addons\amxmodx\configs\cvars.ini"
- File "installer\files\base\addons\amxmodx\configs\hamdata.ini"
File "installer\files\base\addons\amxmodx\configs\maps.ini"
File "installer\files\base\addons\amxmodx\configs\modules.ini"
File "installer\files\base\addons\amxmodx\configs\plugins.ini"
diff --git a/modules/cstrike/cstrike/AMBuilder b/modules/cstrike/cstrike/AMBuilder
index 18a9b842..a1b7ea26 100644
--- a/modules/cstrike/cstrike/AMBuilder
+++ b/modules/cstrike/cstrike/AMBuilder
@@ -6,7 +6,7 @@ binary = AMXX.MetaModule(builder, 'cstrike')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
-
+
binary.sources = [
'../../../public/sdk/amxxmodule.cpp',
'CstrikeMain.cpp',
@@ -25,5 +25,9 @@ binary.sources = [
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
-
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/cstrike/cstrike/CstrikeHacks.cpp b/modules/cstrike/cstrike/CstrikeHacks.cpp
index 7f07e96a..2e0f27ad 100644
--- a/modules/cstrike/cstrike/CstrikeHacks.cpp
+++ b/modules/cstrike/cstrike/CstrikeHacks.cpp
@@ -721,9 +721,9 @@ void InitFuncsAddresses()
MF_Log("UTIL_FindEntByString is not available - native cs_find_ent_by_class() has been disabled");
}
- if (!AddEntityHashValue || !AddEntityHashValue)
+ if (!AddEntityHashValue || !RemoveEntityHashValue)
{
- MF_Log("AddEntityHashValue or AddEntityHashValue is not available - native cs_set_ent_class() has been disabled");
+ MF_Log("AddEntityHashValue or RemoveEntityHashValue is not available - native cs_set_ent_class() has been disabled");
}
if (!HasReGameDll && !GetWeaponInfo)
@@ -735,6 +735,7 @@ void InitFuncsAddresses()
void InitClassMembers()
{
+ // CBasePlayer members.
CommonConfig->GetOffsetByClass("CBasePlayer", "m_iTeam" , &TeamDesc );
CommonConfig->GetOffsetByClass("CBasePlayer", "m_iMenu" , &MenuDesc );
CommonConfig->GetOffsetByClass("CBasePlayer", "m_bHasNightVision", &NvgsDesc );
@@ -742,12 +743,16 @@ void InitClassMembers()
CommonConfig->GetOffsetByClass("CBasePlayer", "m_signals" , &SignalsDesc);
CommonConfig->GetOffsetByClass("CBasePlayer", "m_iAccount" , &MoneyDesc );
+ // GameRules members.
+ CommonConfig->GetOffsetByClass("CHalfLifeMultiplay", "m_bMapHasBombTarget", &BombTargetDesc);
+
if (!TeamDesc.fieldOffset ||
!MenuDesc.fieldOffset ||
!NvgsDesc.fieldOffset ||
!DefuserDesc.fieldOffset ||
!SignalsDesc.fieldOffset ||
- !MoneyDesc.fieldOffset)
+ !MoneyDesc.fieldOffset ||
+ !BombTargetDesc.fieldOffset)
{
MF_Log("Invalid or missing entity gamedata files - forwards CS_OnBuy[Attempt] have been disabled");
ToggleHook_BuyCommands(false);
diff --git a/modules/cstrike/cstrike/CstrikeItemsInfos.cpp b/modules/cstrike/cstrike/CstrikeItemsInfos.cpp
index 72934985..bf20b937 100644
--- a/modules/cstrike/cstrike/CstrikeItemsInfos.cpp
+++ b/modules/cstrike/cstrike/CstrikeItemsInfos.cpp
@@ -17,7 +17,7 @@
#include
CsItemInfo ItemsManager;
-ItemInfo WeaponsList[MAX_WEAPONS];
+ItemInfos WeaponsList[MAX_WEAPONS];
#define PSTATE_ALIASES_TYPE 0
#define PSTATE_ALIASES_ALIAS 1
diff --git a/modules/cstrike/cstrike/CstrikeItemsInfos.h b/modules/cstrike/cstrike/CstrikeItemsInfos.h
index 294843a9..49223e89 100644
--- a/modules/cstrike/cstrike/CstrikeItemsInfos.h
+++ b/modules/cstrike/cstrike/CstrikeItemsInfos.h
@@ -20,12 +20,12 @@
#include
#include
-struct ItemInfo
+struct ItemInfos
{
- ItemInfo() : name("Empty"), ammoIndex1(-1), maxAmmo1(0), ammoIndex2(-1), maxAmmo2(0), slot(0), position(0), id(0), flags(0)
+ ItemInfos() : name("Empty"), ammoIndex1(-1), maxAmmo1(0), ammoIndex2(-1), maxAmmo2(0), slot(0), position(0), id(0), flags(0)
{}
- ItemInfo &operator = (ItemInfo &other)
+ ItemInfos &operator = (ItemInfos &other)
{
name = other.name;
ammoIndex1 = other.ammoIndex1;
@@ -133,7 +133,7 @@ class CsItemInfo : public ITextListener_SMC
int m_EquipmentsPrice[static_cast(Equipments::Count)];
};
-extern ItemInfo WeaponsList[MAX_WEAPONS];
+extern ItemInfos WeaponsList[MAX_WEAPONS];
extern CsItemInfo ItemsManager;
#endif // _CSTRIKE_WEAPONS_INFOS_H_
diff --git a/modules/cstrike/cstrike/CstrikeMain.cpp b/modules/cstrike/cstrike/CstrikeMain.cpp
index be63441a..e6d28218 100644
--- a/modules/cstrike/cstrike/CstrikeMain.cpp
+++ b/modules/cstrike/cstrike/CstrikeMain.cpp
@@ -37,30 +37,6 @@ int AmxxCheckGame(const char *game)
return AMXX_GAME_BAD;
}
-void SV_ActivateServer_RH(IRehldsHook_SV_ActivateServer *chain, int runPhysics)
-{
- chain->callNext(runPhysics);
-
- auto numResources = RehldsData->GetResourcesNum();
-
- if (!numResources)
- {
- return;
- }
-
- ModelsList.clear();
-
- for (auto i = 0; i < numResources; ++i) // Saves all the precached models into a list.
- {
- auto resource = RehldsData->GetResource(i);
-
- if (resource->type == t_model)
- {
- ModelsList.insert(resource->szFileName, i);
- }
- }
-}
-
void OnAmxxAttach()
{
MF_AddNatives(CstrikeNatives);
@@ -85,11 +61,6 @@ void OnAmxxAttach()
}
InitializeHacks();
-
- if (HasReHlds)
- {
- RehldsHookchains->SV_ActivateServer()->registerHook(SV_ActivateServer_RH);
- }
}
void OnPluginsLoaded()
@@ -131,6 +102,8 @@ void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
ToggleHook_BuyCommands(HasOnBuyForward);
ToggleHook_GiveDefaultItems(false);
+ ModelsList.clear();
+
RETURN_META(MRES_IGNORED);
}
diff --git a/modules/cstrike/cstrike/CstrikeNatives.cpp b/modules/cstrike/cstrike/CstrikeNatives.cpp
index 004b0c5a..4931993e 100644
--- a/modules/cstrike/cstrike/CstrikeNatives.cpp
+++ b/modules/cstrike/cstrike/CstrikeNatives.cpp
@@ -856,15 +856,33 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params)
if (*params / sizeof(cell) >= 3 && params[3] != 0)
{
- if (!Server)
+ if (!HasReHlds && !Server)
{
MF_Log("cs_set_user_model is disabled with update_index parameter set");
return 0;
}
+ if (!ModelsList.elements())
+ {
+ auto numResources = HasReHlds ? RehldsData->GetResourcesNum() : Server->num_resources;
+
+ if (numResources)
+ {
+ for (auto i = 0; i < numResources; ++i) // Saves all the precached models into a list.
+ {
+ auto resource = HasReHlds ? RehldsData->GetResource(i) : &Server->resourcelist[i];
+
+ if (resource->type == t_model)
+ {
+ ModelsList.insert(resource->szFileName, resource->nIndex);
+ }
+ }
+ }
+ }
+
GET_OFFSET("CBasePlayer", m_modelIndexPlayer);
- char modelpath[260];
+ char modelpath[PLATFORM_MAX_PATH];
ke::SafeSprintf(modelpath, sizeof(modelpath), "models/player/%s/%s.mdl", newModel, newModel);
auto modelIndex = 0;
@@ -1663,7 +1681,7 @@ static cell AMX_NATIVE_CALL cs_set_c4_defusing(AMX* amx, cell* params)
// cs_create_entity(const classname[])
static cell AMX_NATIVE_CALL cs_create_entity(AMX* amx, cell* params)
{
- if (CS_CreateNamedEntity <= 0)
+ if (!CS_CreateNamedEntity)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Native cs_create_entity() is disabled. Check your amxx logs.");
return 0;
@@ -1685,7 +1703,7 @@ static cell AMX_NATIVE_CALL cs_create_entity(AMX* amx, cell* params)
// cs_find_ent_by_class(start_index, const classname[])
static cell AMX_NATIVE_CALL cs_find_ent_by_class(AMX* amx, cell* params)
{
- if (CS_UTIL_FindEntityByString <= 0)
+ if (!CS_UTIL_FindEntityByString)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Native cs_find_ent_by_class() is disabled. Check your amxx logs.");
return 0;
@@ -1708,7 +1726,7 @@ static cell AMX_NATIVE_CALL cs_find_ent_by_class(AMX* amx, cell* params)
// cs_find_ent_by_owner(start_index, const classname[], owner)
static cell AMX_NATIVE_CALL cs_find_ent_by_owner(AMX* amx, cell* params)
{
- if (CS_UTIL_FindEntityByString <= 0)
+ if (!CS_UTIL_FindEntityByString)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Native cs_find_ent_by_owner() is disabled. Check your amxx logs.");
return 0;
@@ -1744,7 +1762,7 @@ static cell AMX_NATIVE_CALL cs_find_ent_by_owner(AMX* amx, cell* params)
// cs_set_ent_class(index, const classname[])
static cell AMX_NATIVE_CALL cs_set_ent_class(AMX* amx, cell* params)
{
- if (AddEntityHashValue <= 0 || RemoveEntityHashValue <= 0)
+ if (!AddEntityHashValue || !RemoveEntityHashValue)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Native cs_set_ent_class() is disabled. Check your amxx logs.");
return 0;
@@ -1876,7 +1894,7 @@ static cell AMX_NATIVE_CALL cs_get_translated_item_alias(AMX* amx, cell* params)
// native cs_get_weapon_info(weapon_id, CsWeaponInfo:type);
static cell AMX_NATIVE_CALL cs_get_weapon_info(AMX* amx, cell* params)
{
- if (!HasReGameDll && GetWeaponInfo <= 0)
+ if (!HasReGameDll && !GetWeaponInfo)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Native cs_get_weapon_info() is disabled. Check your amxx logs.");
return 0;
@@ -1980,6 +1998,34 @@ static cell AMX_NATIVE_CALL cs_get_user_weapon(AMX *amx, cell *params)
return 0;
}
+// native cs_get_weaponbox_item(weaponboxIndex);
+static cell AMX_NATIVE_CALL cs_get_weaponbox_item(AMX *amx, cell *params)
+{
+ GET_OFFSET("CWeaponBox", m_rgpPlayerItems);
+
+ int weaponboxIndex = params[1];
+ CHECK_NONPLAYER(weaponboxIndex);
+ edict_t *pWeaponBox = TypeConversion.id_to_edict(weaponboxIndex);
+
+ if (strcmp(STRING(pWeaponBox->v.classname), "weaponbox") != 0)
+ {
+ MF_LogError(amx, AMX_ERR_NATIVE, "Not a weaponbox entity! (%d)", weaponboxIndex);
+ return 0;
+ }
+
+ edict_t *pWeapon;
+ for (int i = 1; i < MAX_ITEM_TYPES; i++)
+ {
+ pWeapon = TypeConversion.cbase_to_edict(get_pdata(pWeaponBox, m_rgpPlayerItems, i));
+ if (!FNullEnt(pWeapon))
+ {
+ return TypeConversion.edict_to_id(pWeapon);
+ }
+ }
+
+ return 0;
+}
+
AMX_NATIVE_INFO CstrikeNatives[] =
{
{"cs_set_user_money", cs_set_user_money},
@@ -2052,5 +2098,6 @@ AMX_NATIVE_INFO CstrikeNatives[] =
{"cs_get_weapon_info", cs_get_weapon_info},
{"cs_get_user_weapon_entity", cs_get_user_weapon_entity},
{"cs_get_user_weapon", cs_get_user_weapon},
+ {"cs_get_weaponbox_item", cs_get_weaponbox_item},
{nullptr, nullptr}
};
diff --git a/modules/cstrike/cstrike/CstrikeUserMessages.cpp b/modules/cstrike/cstrike/CstrikeUserMessages.cpp
index e05329d1..c1995eae 100644
--- a/modules/cstrike/cstrike/CstrikeUserMessages.cpp
+++ b/modules/cstrike/cstrike/CstrikeUserMessages.cpp
@@ -22,7 +22,7 @@ bool ShouldBlock;
bool ShouldBlockHLTV;
bool ShouldDisableHooks;
bool RetrieveWeaponList;
-ItemInfo CurrentWeaponList;
+ItemInfos CurrentWeaponList;
int ArgPosition;
int MessageIdArmorType;
diff --git a/modules/cstrike/cstrike/CstrikeUtils.cpp b/modules/cstrike/cstrike/CstrikeUtils.cpp
index b0992f62..863b9d62 100644
--- a/modules/cstrike/cstrike/CstrikeUtils.cpp
+++ b/modules/cstrike/cstrike/CstrikeUtils.cpp
@@ -13,12 +13,13 @@
#include "amxxmodule.h"
#include
+#include
extern int MessageIdTextMsg;
bool UTIL_IsPlayer(edict_t *pPlayer)
{
- return strcmp(STRING(pPlayer->v.classname), "player") == 0;
+ return pPlayer && strcmp(STRING(pPlayer->v.classname), "player") == 0;
}
void UTIL_TextMsg_Generic(edict_t* pPlayer, const char* message)
@@ -36,7 +37,7 @@ bool UTIL_CheckForPublic(const char *publicname)
int i = 0;
char blah[64];
- strncpy(blah, publicname, sizeof(blah) - 1);
+ ke::SafeStrcpy(blah, sizeof(blah), publicname);
while ((amx = MF_GetScriptAmx(i++)))
{
diff --git a/modules/cstrike/cstrike/CstrikeUtils.h b/modules/cstrike/cstrike/CstrikeUtils.h
index c5b9acdc..d0a7a2ec 100644
--- a/modules/cstrike/cstrike/CstrikeUtils.h
+++ b/modules/cstrike/cstrike/CstrikeUtils.h
@@ -49,6 +49,10 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength);
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
return 0; \
} \
+ else if (!MF_GetPlayerEdict(x)->pvPrivateData) { \
+ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (no private data)", x); \
+ return 0; \
+ } \
} else { \
if (x != 0 && FNullEnt(TypeConversion.id_to_edict(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
@@ -62,8 +66,12 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength);
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
return 0; \
} else { \
- if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
- MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
+ if (!MF_IsPlayerIngame(x)) { \
+ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
+ return 0; \
+ } \
+ else if (!MF_GetPlayerEdict(x)->pvPrivateData) { \
+ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (no private data)", x); \
return 0; \
} \
}
diff --git a/modules/cstrike/cstrike/moduleconfig.h b/modules/cstrike/cstrike/moduleconfig.h
index 40c9d222..d32a9740 100644
--- a/modules/cstrike/cstrike/moduleconfig.h
+++ b/modules/cstrike/cstrike/moduleconfig.h
@@ -25,7 +25,7 @@
#define MODULE_LIBRARY "cstrike"
#define MODULE_LIBCLASS ""
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
-#define MODULE_RELOAD_ON_MAPCHANGE
+// #define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
diff --git a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj
index a6cafce3..f26b3ce7 100644
--- a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj
+++ b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj
@@ -95,6 +95,8 @@
Windows
LIBCMT;
false
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+ .data,RW
@@ -138,6 +140,8 @@
.\Release/cstrike_amx.lib
MachineX86
Windows
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+ .data,RW
@@ -161,9 +165,18 @@
+
+
+
+
+
-
+
+
+
+
+
@@ -181,6 +194,12 @@
+
+
+ ../../../../public;
+ ../../../../public;
+
+
diff --git a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters
index 784cc11c..9db0f2ba 100644
--- a/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters
+++ b/modules/cstrike/cstrike/msvc12/cstrike.vcxproj.filters
@@ -39,6 +39,12 @@
{ba0b72ba-25d8-48c3-af84-c1d4d7436636}
+
+ {67de85cb-b8e7-4cd6-b8cf-2ff7ed540c2b}
+
+
+ {1b196636-b242-45a8-ad14-3fb21eb799f7}
+
@@ -127,9 +133,6 @@
ReSDK\cstrike
-
- ReSDK\cstrike
-
ReSDK\engine
@@ -142,6 +145,36 @@
ReSDK
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\engine
+
+
+ ReSDK\engine
+
+
+ ReSDK\engine
+
+
+ ReSDK\engine
+
+
+ ReSDK\engine
+
@@ -151,4 +184,9 @@
Pawn Includes
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/cstrike/csx/AMBuilder b/modules/cstrike/csx/AMBuilder
index c4f76d57..fdb2a105 100644
--- a/modules/cstrike/csx/AMBuilder
+++ b/modules/cstrike/csx/AMBuilder
@@ -14,5 +14,9 @@ binary.sources = [
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/cstrike/csx/CRank.cpp b/modules/cstrike/csx/CRank.cpp
index b05bccfe..433b581b 100644
--- a/modules/cstrike/csx/CRank.cpp
+++ b/modules/cstrike/csx/CRank.cpp
@@ -139,9 +139,9 @@ void RankSystem::clear(){
-bool RankSystem::loadCalc(const char* filename, char* error)
+bool RankSystem::loadCalc(const char* filename, char* error, size_t maxLength)
{
- if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)||
+ if ((MF_LoadAmxScriptEx(&calc.amx,&calc.code,filename, error, maxLength, 0)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 11 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
diff --git a/modules/cstrike/csx/CRank.h b/modules/cstrike/csx/CRank.h
index ec5e8248..af076612 100644
--- a/modules/cstrike/csx/CRank.h
+++ b/modules/cstrike/csx/CRank.h
@@ -110,7 +110,7 @@ public:
void saveRank( const char* filename );
void loadRank( const char* filename );
RankStats* findEntryInRank(const char* unique, const char* name, bool isip=false);
- bool loadCalc(const char* filename, char* error);
+ bool loadCalc(const char* filename, char* error, size_t maxLength);
inline int getRankNum( ) const { return rankNum; }
void clear();
void unloadCalc();
diff --git a/modules/cstrike/csx/meta_api.cpp b/modules/cstrike/csx/meta_api.cpp
index 19f0f495..ca0ff231 100644
--- a/modules/cstrike/csx/meta_api.cpp
+++ b/modules/cstrike/csx/meta_api.cpp
@@ -178,14 +178,18 @@ void PlayerPreThink_Post( edict_t *pEntity ) {
RETURN_META(MRES_IGNORED);
}
-void ServerDeactivate() {
+void ServerDeactivate()
+{
int i;
- for( i = 1;i<=gpGlobals->maxClients; ++i){
- CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
- if (pPlayer->rank) pPlayer->Disconnect();
+
+ for( i = 1; i <= gpGlobals->maxClients; ++i)
+ {
+ GET_PLAYER_POINTER_I(i)->Disconnect();
}
- if ( (g_rank.getRankNum() >= (int)csstats_maxsize->value) || ((int)csstats_reset->value == 1 ) ) {
- CVAR_SET_FLOAT("csstats_reset",0.0);
+
+ if (static_cast(csstats_maxsize->value) <= 0 || g_rank.getRankNum() >= static_cast(csstats_maxsize->value) || static_cast(csstats_reset->value) != 0)
+ {
+ CVAR_SET_FLOAT("csstats_reset", 0.0f);
g_rank.clear(); // clear before save to file
}
g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("csstats")) );
@@ -197,27 +201,26 @@ void ServerDeactivate() {
RETURN_META(MRES_IGNORED);
}
-BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){
+BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128])
+{
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
- if (pPlayer->pEdict == NULL)
- {
- pPlayer->Init(ENTINDEX(pEntity), pEntity);
- }
-
pPlayer->Connect(pszAddress);
RETURN_META_VALUE(MRES_IGNORED, TRUE);
}
-void ClientDisconnect( edict_t *pEntity ) {
- CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
- if (pPlayer->rank) pPlayer->Disconnect();
+void ClientDisconnect( edict_t *pEntity )
+{
+ GET_PLAYER_POINTER(pEntity)->Disconnect();
+
RETURN_META(MRES_IGNORED);
}
-void ClientPutInServer_Post( edict_t *pEntity ) {
+void ClientPutInServer_Post( edict_t *pEntity )
+{
GET_PLAYER_POINTER(pEntity)->PutInServer();
+
RETURN_META(MRES_IGNORED);
}
@@ -418,7 +421,7 @@ void OnAmxxAttach(){
if ( path && *path )
{
char error[128];
- g_rank.loadCalc( MF_BuildPathname("%s",path) , error );
+ g_rank.loadCalc( MF_BuildPathname("%s",path) , error, sizeof(error));
}
if ( !g_rank.begin() )
diff --git a/modules/cstrike/csx/moduleconfig.h b/modules/cstrike/csx/moduleconfig.h
index 6f0ad412..774f15f6 100644
--- a/modules/cstrike/csx/moduleconfig.h
+++ b/modules/cstrike/csx/moduleconfig.h
@@ -25,7 +25,7 @@
#define MODULE_LIBRARY "csx"
#define MODULE_LIBCLASS "xstats"
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
-#define MODULE_RELOAD_ON_MAPCHANGE
+// #define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
diff --git a/modules/cstrike/csx/msvc12/csx.vcxproj b/modules/cstrike/csx/msvc12/csx.vcxproj
index 1201408d..baf4c398 100644
--- a/modules/cstrike/csx/msvc12/csx.vcxproj
+++ b/modules/cstrike/csx/msvc12/csx.vcxproj
@@ -93,6 +93,8 @@
.\Release/csx_amxx.lib
MachineX86
Windows
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -137,6 +139,8 @@
Windows
LIBCMT;
false
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -156,8 +160,15 @@
+
+
+
+ ../../../../public;
+ ../../../../public;
+
+
diff --git a/modules/cstrike/csx/msvc12/csx.vcxproj.filters b/modules/cstrike/csx/msvc12/csx.vcxproj.filters
index e0865b43..cc0710c6 100644
--- a/modules/cstrike/csx/msvc12/csx.vcxproj.filters
+++ b/modules/cstrike/csx/msvc12/csx.vcxproj.filters
@@ -18,6 +18,9 @@
{3f559917-fcbd-4cd3-8136-8a7a769af465}
+
+ {95e872b8-d195-4d02-8a88-aed2894c54fe}
+
@@ -60,8 +63,16 @@
Pawn Includes
+
+ Pawn Includes
+
Pawn Includes
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/dod/dodfun/AMBuilder b/modules/dod/dodfun/AMBuilder
index ed9bbb00..7599c5e1 100644
--- a/modules/dod/dodfun/AMBuilder
+++ b/modules/dod/dodfun/AMBuilder
@@ -15,5 +15,9 @@ binary.sources = [
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
-
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/dod/dodfun/moduleconfig.h b/modules/dod/dodfun/moduleconfig.h
index c536673f..63540232 100644
--- a/modules/dod/dodfun/moduleconfig.h
+++ b/modules/dod/dodfun/moduleconfig.h
@@ -25,7 +25,7 @@
#define MODULE_LIBRARY "dodfun"
#define MODULE_LIBCLASS ""
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
-#define MODULE_RELOAD_ON_MAPCHANGE
+// #define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
diff --git a/modules/dod/dodfun/msvc12/dodfun.vcxproj b/modules/dod/dodfun/msvc12/dodfun.vcxproj
index 185e9234..5c66baf0 100644
--- a/modules/dod/dodfun/msvc12/dodfun.vcxproj
+++ b/modules/dod/dodfun/msvc12/dodfun.vcxproj
@@ -92,6 +92,8 @@
.\Release/dodfun_amxx.lib
MachineX86
Windows
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -136,6 +138,8 @@
Windows
LIBCMT;
false
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -157,6 +161,12 @@
+
+
+ ../../../../public;
+ ../../../../public;
+
+
diff --git a/modules/dod/dodfun/msvc12/dodfun.vcxproj.filters b/modules/dod/dodfun/msvc12/dodfun.vcxproj.filters
index b13a9b2c..285863b7 100644
--- a/modules/dod/dodfun/msvc12/dodfun.vcxproj.filters
+++ b/modules/dod/dodfun/msvc12/dodfun.vcxproj.filters
@@ -18,6 +18,9 @@
{2deb0e1f-fb04-4734-ae4a-39fa3d4eab86}
+
+ {1441a5c1-9b0c-4dc7-b898-7236588e5f98}
+
@@ -64,4 +67,9 @@
Pawn Includes
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/dod/dodx/AMBuilder b/modules/dod/dodx/AMBuilder
index 5df82d46..ded8f6f0 100644
--- a/modules/dod/dodx/AMBuilder
+++ b/modules/dod/dodx/AMBuilder
@@ -16,5 +16,9 @@ binary.sources = [
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
-
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/dod/dodx/CRank.cpp b/modules/dod/dodx/CRank.cpp
index 8a5b7462..e8f49272 100644
--- a/modules/dod/dodx/CRank.cpp
+++ b/modules/dod/dodx/CRank.cpp
@@ -128,9 +128,9 @@ void RankSystem::clear(){
}
}
-bool RankSystem::loadCalc(const char* filename, char* error)
+bool RankSystem::loadCalc(const char* filename, char* error, size_t maxLength)
{
- if ((MF_LoadAmxScript(&calc.amx,&calc.code,filename,error,0)!=AMX_ERR_NONE)||
+ if ((MF_LoadAmxScriptEx(&calc.amx,&calc.code,filename, error, maxLength, 0)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=AMX_ERR_NONE)||
(MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){
diff --git a/modules/dod/dodx/CRank.h b/modules/dod/dodx/CRank.h
index f354eedc..265f6eb1 100644
--- a/modules/dod/dodx/CRank.h
+++ b/modules/dod/dodx/CRank.h
@@ -104,7 +104,7 @@ public:
void saveRank( const char* filename );
void loadRank( const char* filename );
RankStats* findEntryInRank(const char* unique, const char* name , bool isip = false);
- bool loadCalc(const char* filename, char* error);
+ bool loadCalc(const char* filename, char* error, size_t maxLength);
inline int getRankNum( ) const { return rankNum; }
void clear();
void unloadCalc();
diff --git a/modules/dod/dodx/moduleconfig.cpp b/modules/dod/dodx/moduleconfig.cpp
index ffa0e2e8..00606bfb 100644
--- a/modules/dod/dodx/moduleconfig.cpp
+++ b/modules/dod/dodx/moduleconfig.cpp
@@ -471,7 +471,7 @@ void OnAmxxAttach()
if ( path && *path )
{
char error[128];
- g_rank.loadCalc( MF_BuildPathname("%s",path) , error );
+ g_rank.loadCalc( MF_BuildPathname("%s",path) , error, sizeof(error));
}
if ( !g_rank.begin() )
diff --git a/modules/dod/dodx/moduleconfig.h b/modules/dod/dodx/moduleconfig.h
index b58dff95..e3f710a9 100644
--- a/modules/dod/dodx/moduleconfig.h
+++ b/modules/dod/dodx/moduleconfig.h
@@ -25,7 +25,7 @@
#define MODULE_LIBRARY "dodx"
#define MODULE_LIBCLASS "xstats"
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
-#define MODULE_RELOAD_ON_MAPCHANGE
+// #define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
diff --git a/modules/dod/dodx/msvc12/dodx.vcxproj b/modules/dod/dodx/msvc12/dodx.vcxproj
index 2994fcfb..2101f2c0 100644
--- a/modules/dod/dodx/msvc12/dodx.vcxproj
+++ b/modules/dod/dodx/msvc12/dodx.vcxproj
@@ -92,6 +92,8 @@
.\Release/dodx_amxx.lib
MachineX86
Windows
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -136,6 +138,8 @@
Windows
LIBCMT;
false
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -160,6 +164,12 @@
+
+
+ ../../../../public;
+ ../../../../public;
+
+
diff --git a/modules/dod/dodx/msvc12/dodx.vcxproj.filters b/modules/dod/dodx/msvc12/dodx.vcxproj.filters
index 0052797e..644229de 100644
--- a/modules/dod/dodx/msvc12/dodx.vcxproj.filters
+++ b/modules/dod/dodx/msvc12/dodx.vcxproj.filters
@@ -18,6 +18,9 @@
{d13b95f6-bd1e-4c68-a7f1-57e4f39ffde3}
+
+ {0f02323b-c637-4625-aa3c-03f1424de34c}
+
@@ -73,4 +76,9 @@
Pawn Includes
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/engine/AMBuilder b/modules/engine/AMBuilder
index 12715fb0..dd18fd22 100644
--- a/modules/engine/AMBuilder
+++ b/modules/engine/AMBuilder
@@ -6,7 +6,7 @@ binary = AMXX.MetaModule(builder, 'engine')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
-
+
binary.sources = [
'../../public/sdk/amxxmodule.cpp',
'amxxapi.cpp',
@@ -18,8 +18,12 @@ binary.sources = [
'../../public/memtools/CDetour/detours.cpp',
'../../public/memtools/CDetour/asm/asm.c',
]
-
+
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
-
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/engine/amxxapi.cpp b/modules/engine/amxxapi.cpp
index 3202f063..b92e7108 100644
--- a/modules/engine/amxxapi.cpp
+++ b/modules/engine/amxxapi.cpp
@@ -232,8 +232,7 @@ DETOUR_DECL_STATIC2(LightStyle, void, int, style, const char *, val) // void (*p
DETOUR_STATIC_CALL(LightStyle)(style, val);
if (!style && strcmp(val, glinfo.szRealLights)) {
- memset(glinfo.szRealLights, 0x0, 128);
- memcpy(glinfo.szRealLights, val, ke::Min(strlen(val), (size_t)127));
+ ke::SafeStrcpy(glinfo.szRealLights, sizeof(glinfo.szRealLights), val);
}
if (glinfo.bCheckLights && strcmp(val, glinfo.szLastLights))
@@ -280,4 +279,4 @@ void CreateDetours()
void DestroyDetours()
{
LightStyleDetour->Destroy();
-}
\ No newline at end of file
+}
diff --git a/modules/engine/engine.cpp b/modules/engine/engine.cpp
index 2d5ef90f..f574bfca 100644
--- a/modules/engine/engine.cpp
+++ b/modules/engine/engine.cpp
@@ -456,6 +456,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
plinfo[iIndex].iViewType = CAMERA_3RDPERSON;
pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target"));
+
+ if (!pNewCamera)
+ {
+ MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity.");
+ return 0;
+ }
+
pNewCamera->v.classname = MAKE_STRING("VexdCam");
SET_MODEL(pNewCamera, "models/rpgrocket.mdl");
@@ -486,6 +493,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
plinfo[iIndex].iViewType = CAMERA_UPLEFT;
pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target"));
+
+ if (!pNewCamera)
+ {
+ MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity.");
+ return 0;
+ }
+
pNewCamera->v.classname = MAKE_STRING("VexdCam");
SET_MODEL(pNewCamera, "models/rpgrocket.mdl");
@@ -516,6 +530,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
plinfo[iIndex].iViewType = CAMERA_TOPDOWN;
pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target"));
+
+ if (!pNewCamera)
+ {
+ MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity.");
+ return 0;
+ }
+
pNewCamera->v.classname = MAKE_STRING("VexdCam");
SET_MODEL(pNewCamera, "models/rpgrocket.mdl");
@@ -557,11 +578,10 @@ static cell AMX_NATIVE_CALL set_lights(AMX *amx, cell *params) {
glinfo.bCheckLights = true;
//Reset LastLights and store custom lighting
- memset(glinfo.szLastLights, 0x0, 128);
- memcpy(glinfo.szLastLights, szLights, ke::Min(iLength, 127));
+ ke::SafeStrcpy(glinfo.szLastLights, sizeof(glinfo.szLastLights), szLights);
LightStyleDetour->DisableDetour();
- LIGHT_STYLE(0, szLights);
+ LIGHT_STYLE(0, glinfo.szLastLights);
LightStyleDetour->EnableDetour();
// These make it so that players/weaponmodels look like whatever the lighting is
diff --git a/modules/engine/moduleconfig.h b/modules/engine/moduleconfig.h
index 64bf82ba..12e356c3 100644
--- a/modules/engine/moduleconfig.h
+++ b/modules/engine/moduleconfig.h
@@ -25,7 +25,7 @@
#define MODULE_LIBRARY "engine"
#define MODULE_LIBCLASS ""
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
-#define MODULE_RELOAD_ON_MAPCHANGE
+// #define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
diff --git a/modules/engine/msvc12/engine.vcxproj b/modules/engine/msvc12/engine.vcxproj
index c02f70b1..cc214aa7 100644
--- a/modules/engine/msvc12/engine.vcxproj
+++ b/modules/engine/msvc12/engine.vcxproj
@@ -74,6 +74,8 @@
MachineX86
LIBCMT;
false
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+ .data,RW
@@ -95,6 +97,8 @@
true
$(OutDir)engine.lib
MachineX86
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+ .data,RW
@@ -126,6 +130,12 @@
+
+
+ ../../../public;
+ ../../../public;
+
+
diff --git a/modules/engine/msvc12/engine.vcxproj.filters b/modules/engine/msvc12/engine.vcxproj.filters
index 29888fb8..d79bc1d6 100644
--- a/modules/engine/msvc12/engine.vcxproj.filters
+++ b/modules/engine/msvc12/engine.vcxproj.filters
@@ -27,6 +27,9 @@
{6c2c3c74-4dc3-45bf-b3a5-6224971eee69}
+
+ {766da9da-a13a-4f01-a886-570fc28772a6}
+
@@ -103,4 +106,9 @@
Pawn Includes
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/fakemeta/AMBuilder b/modules/fakemeta/AMBuilder
index 92dde599..a95d56ba 100644
--- a/modules/fakemeta/AMBuilder
+++ b/modules/fakemeta/AMBuilder
@@ -27,5 +27,9 @@ binary.sources = [
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
-
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/fakemeta/engfunc.cpp b/modules/fakemeta/engfunc.cpp
index efcf35ac..4bec6225 100644
--- a/modules/fakemeta/engfunc.cpp
+++ b/modules/fakemeta/engfunc.cpp
@@ -12,9 +12,12 @@
//
#include "fakemeta_amxx.h"
+#include
TraceResult g_tr;
+ke::AString LightStyleBuffers[MAX_LIGHTSTYLES];
+
//by mahnsawce from his NS module
static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
{
@@ -595,8 +598,13 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
case EngFunc_LightStyle: // void ) (int style, const char* val);
cRet = MF_GetAmxAddr(amx,params[2]);
iparam1=cRet[0];
- temp = MF_GetAmxString(amx,params[3],0,&len);
- (*g_engfuncs.pfnLightStyle)(iparam1,temp);
+ if (iparam1 < 0 || iparam1 >= ARRAYSIZE(LightStyleBuffers))
+ {
+ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid style %d", iparam1);
+ return 0;
+ }
+ LightStyleBuffers[iparam1] = MF_GetAmxString(amx, params[3], 0, &len);
+ (*g_engfuncs.pfnLightStyle)(iparam1, LightStyleBuffers[iparam1].chars());
return 1;
diff --git a/modules/fakemeta/fakemeta_amxx.cpp b/modules/fakemeta/fakemeta_amxx.cpp
index d27ed422..ab8130f4 100644
--- a/modules/fakemeta/fakemeta_amxx.cpp
+++ b/modules/fakemeta/fakemeta_amxx.cpp
@@ -107,6 +107,11 @@ void OnAmxxDetach()
ConfigManager->CloseGameConfigFile(CommonConfig);
ConfigManager->CloseGameConfigFile(GamerulesConfig);
+ if (HasRegameDll)
+ {
+ ReGameHookchains->InstallGameRules()->unregisterHook(InstallGameRules);
+ }
+
while (!g_FreeTRs.empty())
{
delete g_FreeTRs.front();
diff --git a/modules/fakemeta/fakemeta_amxx.h b/modules/fakemeta/fakemeta_amxx.h
index 9b7b084b..6fb0518c 100644
--- a/modules/fakemeta/fakemeta_amxx.h
+++ b/modules/fakemeta/fakemeta_amxx.h
@@ -50,6 +50,16 @@
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(TypeConversion.id_to_edict(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity"); return 0; }
#define CHECK_OFFSET(x) if (x < 0) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset"); return 0; }
+#define CHECK_ENTITY_PDATA(x) \
+ if (FNullEnt(TypeConversion.id_to_edict(x))) { \
+ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
+ return 0; \
+ } \
+ else if (!TypeConversion.id_to_edict(x)->pvPrivateData) { \
+ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d (no private data)", x); \
+ return 0; \
+ }
+
extern AMX_NATIVE_INFO engfunc_natives[];
extern AMX_NATIVE_INFO dllfunc_natives[];
diff --git a/modules/fakemeta/fm_tr.cpp b/modules/fakemeta/fm_tr.cpp
index fa002c9e..1bd9d671 100644
--- a/modules/fakemeta/fm_tr.cpp
+++ b/modules/fakemeta/fm_tr.cpp
@@ -27,7 +27,6 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
}
cell *ptr = MF_GetAmxAddr(amx, params[2]);
- edict_t *e;
switch (type)
{
@@ -85,12 +84,13 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
}
case TR_pHit:
{
- e = TypeConversion.id_to_edict(*ptr);
- if (!e || FNullEnt(e))
- return 0; //TODO: return error
- gfm_tr->pHit = e;
+ const auto pEdict = TypeConversion.id_to_edict(*ptr);
+ if (pEdict == nullptr)
+ {
+ return 0;
+ }
+ gfm_tr->pHit = pEdict;
return 1;
- break;
}
case TR_iHitgroup:
{
@@ -167,7 +167,7 @@ static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params)
}
case TR_pHit:
{
- if (gfm_tr->pHit == NULL || FNullEnt(gfm_tr->pHit))
+ if (FNullEnt(gfm_tr->pHit))
return -1;
return ENTINDEX(gfm_tr->pHit);
break;
diff --git a/modules/fakemeta/fm_tr2.cpp b/modules/fakemeta/fm_tr2.cpp
index e9305191..4b5a0e07 100644
--- a/modules/fakemeta/fm_tr2.cpp
+++ b/modules/fakemeta/fm_tr2.cpp
@@ -98,12 +98,13 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params)
}
case TR_pHit:
{
- edict_t *e = TypeConversion.id_to_edict(*ptr);
- if (!e || FNullEnt(e))
- return 0; //TODO: return error
- tr->pHit = e;
+ const auto pEdict = TypeConversion.id_to_edict(*ptr);
+ if (pEdict == nullptr)
+ {
+ return 0;
+ }
+ tr->pHit = pEdict;
return 1;
- break;
}
case TR_iHitgroup:
{
@@ -187,7 +188,7 @@ static cell AMX_NATIVE_CALL get_tr2(AMX *amx, cell *params)
}
case TR_pHit:
{
- if (tr->pHit == NULL || FNullEnt(tr->pHit))
+ if (FNullEnt(tr->pHit))
return -1;
return ENTINDEX(tr->pHit);
break;
diff --git a/modules/fakemeta/misc.cpp b/modules/fakemeta/misc.cpp
index 8c38c4c6..4a3f5a5e 100644
--- a/modules/fakemeta/misc.cpp
+++ b/modules/fakemeta/misc.cpp
@@ -18,7 +18,7 @@ static cell AMX_NATIVE_CALL copy_infokey_buffer(AMX *amx, cell *params)
{
char *infobuffer = reinterpret_cast(params[1]);
- return MF_SetAmxString(amx, params[2], infobuffer, params[3]);
+ return MF_SetAmxString(amx, params[2], infobuffer ? infobuffer : "", params[3]);
}
// lookup_sequence(entid, "sequence name", &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0);
@@ -149,42 +149,6 @@ enum
Model_CurrentSequence = -1,
};
-// GetModelCollisionBox( index, Float:mins[3], Float:maxs[3] );
-static cell AMX_NATIVE_CALL GetModelCollisionBox(AMX *amx, cell *params)
-{
- int entityIndex = params[1];
-
- CHECK_ENTITY(entityIndex);
-
- edict_t *pEdict = TypeConversion.id_to_edict(entityIndex);
-
- if (!FNullEnt(pEdict))
- {
- studiohdr_t *pStudiohdr = static_cast(GET_MODEL_PTR(pEdict));
-
- if (!pStudiohdr)
- {
- MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
- return 0;
- }
-
- cell *cmins = MF_GetAmxAddr(amx, params[2]);
- cell *cmaxs = MF_GetAmxAddr(amx, params[3]);
-
- cmins[0] = amx_ftoc(pStudiohdr->bbmin.x);
- cmins[1] = amx_ftoc(pStudiohdr->bbmin.y);
- cmins[2] = amx_ftoc(pStudiohdr->bbmin.z);
-
- cmaxs[0] = amx_ftoc(pStudiohdr->bbmax.x);
- cmaxs[1] = amx_ftoc(pStudiohdr->bbmax.y);
- cmaxs[2] = amx_ftoc(pStudiohdr->bbmax.z);
-
- return 1;
- }
-
- return 0;
-};
-
// GetModelBoundingBox( index, Float:mins[3], Float:maxs[3], sequence = Model_DefaultSize );
static cell AMX_NATIVE_CALL GetModelBoundingBox(AMX *amx, cell *params)
{
@@ -242,82 +206,11 @@ static cell AMX_NATIVE_CALL GetModelBoundingBox(AMX *amx, cell *params)
return 0;
};
-// SetModelCollisionBox( index );
-static cell AMX_NATIVE_CALL SetModelCollisionBox(AMX *amx, cell *params)
-{
- int entityIndex = params[1];
-
- CHECK_ENTITY(entityIndex);
-
- edict_t *pentModel = TypeConversion.id_to_edict(entityIndex);
-
- if (!FNullEnt(pentModel))
- {
- studiohdr_t *pStudiohdr = static_cast(GET_MODEL_PTR(pentModel));
-
- if (!pStudiohdr)
- {
- MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
- return 0;
- }
-
- SET_SIZE(pentModel, pStudiohdr->bbmin, pStudiohdr->bbmax);
-
- return 1;
- }
-
- return 0;
-};
-
-// SetModelBoudingBox( index, sequence = Model_DefaultSize );
-static cell AMX_NATIVE_CALL SetModelBoundingBox(AMX *amx, cell *params)
-{
- int entityIndex = params[1];
-
- CHECK_ENTITY(entityIndex);
-
- edict_t *pentModel = TypeConversion.id_to_edict(entityIndex);
-
- if (!FNullEnt(pentModel))
- {
- studiohdr_t *pStudiohdr = static_cast(GET_MODEL_PTR(pentModel));
-
- if (!pStudiohdr)
- {
- MF_LogError(amx, AMX_ERR_NATIVE, "Could not find the model pointer for the entity.");
- return 0;
- }
-
- int sequence = params[2];
-
- if (sequence <= Model_DefaultSize)
- {
- SET_SIZE(pentModel, pStudiohdr->min, pStudiohdr->max);
- }
- else
- {
- if (sequence <= Model_CurrentSequence || sequence >= pStudiohdr->numseq)
- sequence = pentModel->v.sequence;
-
- mstudioseqdesc_t *pSeqdesc;
- pSeqdesc = (mstudioseqdesc_t*)((byte*)pStudiohdr + pStudiohdr->seqindex);
-
- SET_SIZE(pentModel, pSeqdesc[sequence].bbmin, pSeqdesc[sequence].bbmax);
-
- return 1;
- }
- }
-
- return 0;
-}
AMX_NATIVE_INFO misc_natives[] = {
{ "copy_infokey_buffer", copy_infokey_buffer },
{ "lookup_sequence", lookup_sequence },
{ "set_controller", set_controller },
- { "GetModelCollisionBox", GetModelCollisionBox },
- { "SetModelCollisionBox", SetModelCollisionBox },
{ "GetModelBoundingBox", GetModelBoundingBox },
- { "SetModelBoundingBox", SetModelBoundingBox },
{NULL, NULL},
};
diff --git a/modules/fakemeta/moduleconfig.h b/modules/fakemeta/moduleconfig.h
index 052ead4b..b02728fd 100644
--- a/modules/fakemeta/moduleconfig.h
+++ b/modules/fakemeta/moduleconfig.h
@@ -25,7 +25,7 @@
#define MODULE_LIBRARY "fakemeta"
#define MODULE_LIBCLASS ""
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
-#define MODULE_RELOAD_ON_MAPCHANGE
+// #define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
diff --git a/modules/fakemeta/msvc12/fakemeta.vcxproj b/modules/fakemeta/msvc12/fakemeta.vcxproj
index 8b1a6fed..2798db0b 100644
--- a/modules/fakemeta/msvc12/fakemeta.vcxproj
+++ b/modules/fakemeta/msvc12/fakemeta.vcxproj
@@ -73,6 +73,8 @@
MachineX86
LIBCMT;
false
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -93,6 +95,8 @@
true
$(OutDir)fakemeta.lib
MachineX86
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -116,11 +120,14 @@
+
+
+
+
+
-
-
@@ -141,6 +148,12 @@
+
+
+ ../../../public;
+ ../../../public;
+
+
diff --git a/modules/fakemeta/msvc12/fakemeta.vcxproj.filters b/modules/fakemeta/msvc12/fakemeta.vcxproj.filters
index 4c16bd55..859e079d 100644
--- a/modules/fakemeta/msvc12/fakemeta.vcxproj.filters
+++ b/modules/fakemeta/msvc12/fakemeta.vcxproj.filters
@@ -45,6 +45,12 @@
{0d1c5025-071d-43aa-b19a-2eee0d34a906}
+
+ {2800175e-06bf-42bf-b3c1-f86561471531}
+
+
+ {c5065ec5-3262-49dd-825b-2cf3956e79ac}
+
@@ -145,14 +151,23 @@
ReSDK\cstrike
-
- ReSDK\cstrike
-
ReSDK
-
- ReSDK
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\cstrike\API
+
+
+ ReSDK\cstrike\API
@@ -174,4 +189,9 @@
PEV
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/fakemeta/pdata.cpp b/modules/fakemeta/pdata.cpp
index b69dfbe0..870be62e 100644
--- a/modules/fakemeta/pdata.cpp
+++ b/modules/fakemeta/pdata.cpp
@@ -32,18 +32,18 @@
//implement these with setjmp later.
bool IsBadReadPtr(void *l, size_t size)
{
- return false;
+ return l ? false : true;
}
bool IsBadWritePtr(void *l, size_t size)
{
- return false;
+ return l ? false : true;
}
#endif
static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
{
int index=params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
@@ -65,7 +65,7 @@ static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params)
{
int index=params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
@@ -87,7 +87,7 @@ static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
{
int index=params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
@@ -109,7 +109,7 @@ static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
{
int index=params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
@@ -130,7 +130,7 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
{
int index=params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
@@ -167,7 +167,7 @@ static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
{
int index=params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
@@ -192,30 +192,35 @@ static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params)
szData = get_pdata_direct(pEdict, iOffset);
if (IsBadWritePtr(szData, 1))
return 0;
- strcpy(szData, data);
} else {
szData = get_pdata(pEdict, iOffset);
if (IsBadWritePtr(szData, 1))
return 0;
- if (params[4] == 1)
+
+ if (len > static_cast(strlen(szData)))
{
- free(szData);
- szData = (char *)malloc(len + 1);
- } else if (params[4] == 2) {
- delete [] szData;
- szData = new char[len + 1];
+ if (params[4] == 1)
+ {
+ free(szData);
+ szData = (char *)malloc(len + 1);
+ }
+ else if (params[4] == 2) {
+ delete[] szData;
+ szData = new char[len + 1];
+ }
+ set_pdata(pEdict, iOffset, szData);
}
- strcpy(szData, data);
- set_pdata(pEdict, iOffset, szData);
}
+ strncopy(szData, data, len + 1);
+
return 1;
}
static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params)
{
int index=params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int iOffset=params[2];
CHECK_OFFSET(iOffset);
@@ -256,7 +261,7 @@ static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -282,7 +287,7 @@ static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -303,7 +308,7 @@ static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -328,7 +333,7 @@ static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -349,7 +354,7 @@ static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -374,7 +379,7 @@ static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -395,7 +400,7 @@ static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -420,7 +425,7 @@ static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -449,7 +454,7 @@ static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -476,7 +481,7 @@ static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
@@ -524,7 +529,7 @@ static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_pdata_ehandle(AMX *amx, cell *params)
{
int index = params[1];
- CHECK_ENTITY(index);
+ CHECK_ENTITY_PDATA(index);
int offset = params[2];
CHECK_OFFSET(offset);
diff --git a/modules/fakemeta/pdata_entities.cpp b/modules/fakemeta/pdata_entities.cpp
index 039e3fca..c2420264 100644
--- a/modules/fakemeta/pdata_entities.cpp
+++ b/modules/fakemeta/pdata_entities.cpp
@@ -18,7 +18,7 @@
static cell AMX_NATIVE_CALL get_ent_data(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
@@ -33,7 +33,7 @@ static cell AMX_NATIVE_CALL get_ent_data(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_ent_data(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
@@ -57,7 +57,7 @@ static cell AMX_NATIVE_CALL set_ent_data(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_ent_data_float(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
@@ -72,7 +72,7 @@ static cell AMX_NATIVE_CALL get_ent_data_float(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_ent_data_float(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
@@ -90,7 +90,7 @@ static cell AMX_NATIVE_CALL set_ent_data_float(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_ent_data_vector(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
@@ -107,7 +107,7 @@ static cell AMX_NATIVE_CALL get_ent_data_vector(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_ent_data_vector(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
@@ -125,7 +125,7 @@ static cell AMX_NATIVE_CALL set_ent_data_vector(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_ent_data_entity(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
@@ -142,7 +142,7 @@ static cell AMX_NATIVE_CALL set_ent_data_entity(AMX *amx, cell *params)
int entity = params[1];
int value = params[4];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
if (value != -1)
{
@@ -165,7 +165,7 @@ static cell AMX_NATIVE_CALL set_ent_data_entity(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL get_ent_data_string(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
@@ -190,7 +190,7 @@ static cell AMX_NATIVE_CALL get_ent_data_string(AMX *amx, cell *params)
static cell AMX_NATIVE_CALL set_ent_data_string(AMX *amx, cell *params)
{
int entity = params[1];
- CHECK_ENTITY(entity);
+ CHECK_ENTITY_PDATA(entity);
TypeDescription data;
GET_TYPE_DESCRIPTION(2, data, CommonConfig);
diff --git a/modules/fun/AMBuilder b/modules/fun/AMBuilder
index 06d81f5c..758f2d21 100644
--- a/modules/fun/AMBuilder
+++ b/modules/fun/AMBuilder
@@ -2,7 +2,7 @@
import os.path
binary = AMXX.MetaModule(builder, 'fun')
-
+
binary.sources = [
'../../public/sdk/amxxmodule.cpp',
'../../public/memtools/MemoryUtils.cpp',
@@ -11,5 +11,9 @@ binary.sources = [
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
-
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/fun/fun.cpp b/modules/fun/fun.cpp
index 86f00fd8..53be8696 100644
--- a/modules/fun/fun.cpp
+++ b/modules/fun/fun.cpp
@@ -11,563 +11,462 @@
// Fun Module
//
-#include
#include "fun.h"
#include
-/*
- JGHG says:
-
- Ok this is what I use below, it may probably not be right with all natives etc but I try to maintain this style to natives.
- Note that this is still very much subject to change, regarding return values etc!
- (Ok I haven't checked all natives that they comply with this yet, this is just a model I'm working on and which I might implement soon.)
-
- static cell AMX_NATIVE_CALL nativename(AMX *amx, cell *params) // nativename(argument1, argument2); = 2 params
- {
- // Description what this native does. <--- Description what this native does
- // params[1] = argument1 <--- Description of each argument, so we don't have to allocate new variables and can
- // params[2] = argument2 <--- use the ones in params[n] directly, to save some time.
-
- // Check receiver and sender validity. <--- Check ents, maybe need to do this better and more proper later?
- CHECK_PLAYER(params[1])
- CHECK_PLAYER(params[2])
-
- // Get * pointer.
- edict_t *pPlayer = MF_GetPlayerEdict(params[1]); <--- Players require a different function than INDEXENT because of an HLSDK bug
-
- return 1 <--- If native succeeded, return 1, if the native isn't supposed to return a specific value.
- Note: Should be able to do: if (thenative()) and it should return false when it fails, and true when succeeds... is -1 treated as false, or is 0 a must?
- }
-*/
-
-char g_bodyhits[33][33]; // where can the guy in the first dimension hit the people in the 2nd dimension? :-)
-bool g_silent[33]; // used for set_user_footsteps()
-
HLTypeConversion TypeConversion;
+CPlayers Players;
-// ######## Utils:
-void FUNUTIL_ResetPlayer(int index)
+// native get_client_listen(receiver, sender)
+static cell AMX_NATIVE_CALL get_client_listening(AMX *amx, cell *params)
{
- //MF_PrintSrvConsole("Resetting player index %d! maxclients: %d\n", index, gpGlobals->maxClients);
- for (int i = 1; i <= gpGlobals->maxClients; i++) {
- g_bodyhits[index][i] = (char)((1<v.takedamage = 0.0; // 0.0, the player doesn't seem to be able to get hurt.
- }
- else {
- // Disable godmode
- pPlayer->v.takedamage = 2.0; // 2.0 seems to be standard value?
- }
+ pPlayer->v.takedamage = params[arg_godmode] != 0 ? DAMAGE_NO : DAMAGE_AIM;
return 1;
}
-static cell AMX_NATIVE_CALL get_user_godmode(AMX *amx, cell *params) // get_user_godmode(index); = 1 param
+// native get_user_godmode(index)
+static cell AMX_NATIVE_CALL get_user_godmode(AMX *amx, cell *params)
{
- /* Returns 1 if godmode is set. */
- // params[1] = index
+ enum args { arg_count, arg_user };
- // Check index.
- CHECK_PLAYER(params[1]);
+ CHECK_PLAYER(params[arg_user]);
- // Get player pointer.
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_user]);
- int godmode = 0;
-
- if (pPlayer->v.takedamage == 0.0) {
- // God mode is enabled
- godmode = 1;
- }
-
- return godmode;
+ return pPlayer->v.takedamage == DAMAGE_NO;
}
-static cell AMX_NATIVE_CALL give_item(AMX *amx, cell *params) // native give_item(index, const item[]); = 2 params
+// native give_item(index, const item[])
+static cell AMX_NATIVE_CALL give_item(AMX *amx, cell *params)
{
- /* Gives item to player, name of item can start
- * with weapon_, ammo_ and item_. This event
- * is announced with proper message to all players. */
- // params[1] = index
- // params[2] = item...
+ enum args { arg_count, arg_index, arg_item };
- // Check index.
- CHECK_PLAYER(params[1]);
+ CHECK_PLAYER(params[arg_index]);
- // Get player pointer.
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ auto itemLength = 0;
+ const auto item = MF_GetAmxString(amx, params[arg_item], 1, &itemLength);
- // Create item entity pointer
- edict_t *pItemEntity;
-
- // Make an "intstring" out of 2nd parameter
- int length;
- const char *szItem = MF_GetAmxString(amx, params[2], 1, &length);
-
- //check for valid item
- if (strncmp(szItem, "weapon_", 7) &&
- strncmp(szItem, "ammo_", 5) &&
- strncmp(szItem, "item_", 5) &&
- strncmp(szItem, "tf_weapon_", 10)
- ) {
+ if (!itemLength
+ ||(strncmp(item, "weapon_", 7) != 0
+ && strncmp(item, "ammo_", 5) != 0
+ && strncmp(item, "item_", 5) != 0
+ && strncmp(item, "tf_weapon_", 10) != 0))
+ {
return 0;
}
- //string_t item = MAKE_STRING(szItem);
- string_t item = ALLOC_STRING(szItem); // Using MAKE_STRING makes "item" contents get lost when we leave this scope! ALLOC_STRING seems to allocate properly...
- // Create the entity, returns to pointer
- pItemEntity = CREATE_NAMED_ENTITY(item);
+ auto pEntity = CREATE_NAMED_ENTITY(ALLOC_STRING(item));
- if (FNullEnt(pItemEntity)) {
- MF_LogError(amx, AMX_ERR_NATIVE, "Item \"%s\" failed to create", szItem);
+ if (FNullEnt(pEntity))
+ {
+ MF_LogError(amx, AMX_ERR_NATIVE, "Item \"%s\" failed to create", item);
return 0;
}
- //VARS(pItemEntity)->origin = VARS(pPlayer)->origin; // nice to do VARS(ent)->origin instead of ent->v.origin? :-I
- //I'm not sure, normally I use macros too =P
- pItemEntity->v.origin = pPlayer->v.origin;
- pItemEntity->v.spawnflags |= SF_NORESPAWN; //SF_NORESPAWN;
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
- MDLL_Spawn(pItemEntity);
+ pEntity->v.origin = pPlayer->v.origin;
+ pEntity->v.spawnflags |= SF_NORESPAWN;
- int save = pItemEntity->v.solid;
+ MDLL_Spawn(pEntity);
- MDLL_Touch(pItemEntity, ENT(pPlayer));
+ const auto oldSolid = pEntity->v.solid;
- //The problem with the original give_item was the
- // item was not removed. I had tried this but it
- // did not work. OLO's implementation is better.
- /*
- int iEnt = ENTINDEX(pItemEntity->v.owner);
- if (iEnt > 32 || iEnt <1 ) {
- MDLL_Think(pItemEntity);
- }*/
+ MDLL_Touch(pEntity, pPlayer);
- if (pItemEntity->v.solid == save) {
- REMOVE_ENTITY(pItemEntity);
- //the function did not fail - we're just deleting the item
+ if (pEntity->v.solid == oldSolid)
+ {
+ REMOVE_ENTITY(pEntity); // The function did not fail - we're just deleting the item
return -1;
}
- return ENTINDEX(pItemEntity);
+ return TypeConversion.edict_to_id(pEntity);
}
-static cell AMX_NATIVE_CALL spawn(AMX *amx, cell *params) // spawn(id) = 1 param
+// native spawn(index)
+static cell AMX_NATIVE_CALL spawn(AMX *amx, cell *params)
{
- // Spawns an entity, this can be a user/player -> spawns at spawnpoints, or created entities seems to need this as a final "kick" into the game? :-)
- // params[1] = entity to spawn
+ enum args { arg_count, arg_index };
- CHECK_ENTITY(params[1]);
+ CHECK_ENTITY(params[arg_index]);
- edict_t *pEnt = TypeConversion.id_to_edict(params[1]);
+ const auto pEntity = TypeConversion.id_to_edict(params[arg_index]);
- MDLL_Spawn(pEnt);
+ MDLL_Spawn(pEntity);
return 1;
}
-static cell AMX_NATIVE_CALL set_user_health(AMX *amx, cell *params) // set_user_health(index, health); = 2 arguments
+// native set_user_health(index, health)
+static cell AMX_NATIVE_CALL set_user_health(AMX *amx, cell *params)
{
- // Sets user health. If health is 0 and below, also kill...
- // params[1] = index
- // params[2] = health
+ enum args { arg_count, arg_index, arg_health };
- // Check index
- CHECK_PLAYER(params[1]);
+ CHECK_PLAYER(params[arg_index]);
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
+ const auto health = float(params[arg_health]);
- // Kill if health too low.
- if (params[2] > 0)
- pPlayer->v.health = float(params[2]);
+ if (health > 0.0f)
+ {
+ pPlayer->v.health = health;
+ }
else
+ {
MDLL_ClientKill(pPlayer);
+ }
return 1;
}
-static cell AMX_NATIVE_CALL set_user_frags(AMX *amx, cell *params) // set_user_frags(index, frags); = 2 arguments
+// native set_user_frags(index, frags)
+static cell AMX_NATIVE_CALL set_user_frags(AMX *amx, cell *params)
{
- // Sets user frags.
- // params[1] = index
- // params[2] = frags
+ enum args { arg_count, arg_index, arg_frags };
- // Check index
- CHECK_PLAYER(params[1]);
+ CHECK_PLAYER(params[arg_index]);
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
- pPlayer->v.frags = params[2];
+ pPlayer->v.frags = float(params[arg_frags]);
return 1;
}
-static cell AMX_NATIVE_CALL set_user_armor(AMX *amx, cell *params) // set_user_armor(index, armor); = 2 arguments
+// native set_user_armor(index, armor)
+static cell AMX_NATIVE_CALL set_user_armor(AMX *amx, cell *params)
{
- // Sets user armor.
- // params[1] = index
- // params[2] = armor
+ enum args { arg_count, arg_index, arg_armor };
- // Check index
- CHECK_PLAYER(params[1]);
+ CHECK_PLAYER(params[arg_index]);
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
- pPlayer->v.armorvalue = params[2];
+ pPlayer->v.armorvalue = float(params[arg_armor]);
return 1;
}
-static cell AMX_NATIVE_CALL set_user_origin(AMX *amx, cell *params) // set_user_origin(index, origin[3]); = 2 arguments
+// native set_user_origin(index, const origin[3])
+static cell AMX_NATIVE_CALL set_user_origin(AMX *amx, cell *params)
{
- // Sets user origin.
- // params[1] = index
- // params[2] = origin
+ enum args { arg_count, arg_index, arg_origin };
- // Check index
- CHECK_PLAYER(params[1]);
+ CHECK_PLAYER(params[arg_index]);
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
-
- cell *newVectorCell = MF_GetAmxAddr(amx, params[2]);
+ auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
+ const auto pVector = MF_GetAmxAddr(amx, params[arg_origin]);
SET_SIZE(pPlayer, pPlayer->v.mins, pPlayer->v.maxs);
- SET_ORIGIN(pPlayer, Vector((float)newVectorCell[0], (float)newVectorCell[1], (float)newVectorCell[2]));
-
- return 1;
-}
-
-static cell AMX_NATIVE_CALL set_user_rendering(AMX *amx, cell *params) // set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16); = 7 arguments
-{
- // Sets user rendering.
- // params[1] = index
- // params[2] = fx
- // params[3] = r
- // params[4] = g
- // params[5] = b
- // params[6] = render
- // params[7] = amount
-
- // Check index
- CHECK_PLAYER(params[1]);
-
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
-
- pPlayer->v.renderfx = params[2];
- Vector newVector = Vector(float(params[3]), float(params[4]), float(params[5]));
- pPlayer->v.rendercolor = newVector;
- pPlayer->v.rendermode = params[6];
- pPlayer->v.renderamt = params[7];
-
- return 1;
-}
-
-
-static cell AMX_NATIVE_CALL set_user_maxspeed(AMX *amx, cell *params) // set_user_maxspeed(index, Float:speed = -1.0) = 2 arguments
-{
- // Sets user maxspeed.
- // params[1] = index
- // params[2] = speed (should be -1.0 if not specified) (JGHG: unspecified parameters seems to always be -1.0!)
-
- REAL fNewSpeed = amx_ctof(params[2]);
-
- // Check index
- CHECK_PLAYER(params[1]);
-
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
-
- SETCLIENTMAXSPEED(pPlayer, fNewSpeed);
- pPlayer->v.maxspeed = fNewSpeed;
+ SET_ORIGIN(pPlayer, Vector(float(pVector[0]), float(pVector[1]), float(pVector[2])));
return 1;
}
-static cell AMX_NATIVE_CALL get_user_maxspeed(AMX *amx, cell *params) // Float:get_user_maxspeed(index) = 1 argument
+// native set_user_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0)
+static cell AMX_NATIVE_CALL set_user_rendering(AMX *amx, cell *params)
{
- // Gets user maxspeed.
- // params[1] = index
+ enum args { arg_count, arg_index, arg_fx, arg_red, arg_green, arg_blue, arg_render, arg_amount };
- // Check index
- CHECK_PLAYER(params[1]);
+ CHECK_PLAYER(params[arg_index]);
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
+
+ pPlayer->v.renderfx = params[arg_fx];
+ pPlayer->v.rendercolor = Vector(float(params[arg_red]), float(params[arg_green]), float(params[arg_blue]));
+ pPlayer->v.rendermode = params[arg_render];
+ pPlayer->v.renderamt = float(params[arg_amount]);
+
+ return 1;
+}
+
+// get_user_rendering(index, &fx = kRenderFxNone, &r = 0, &g = 0, &b = 0, &render = kRenderNormal, &amount = 0);
+static cell AMX_NATIVE_CALL get_user_rendering(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_index, arg_fx, arg_red, arg_green, arg_blue, arg_render, arg_amount };
+
+ CHECK_PLAYER(params[arg_index]);
+
+ auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
+
+ *MF_GetAmxAddr(amx, params[arg_fx]) = pPlayer->v.renderfx;
+ *MF_GetAmxAddr(amx, params[arg_red]) = pPlayer->v.rendercolor[0];
+ *MF_GetAmxAddr(amx, params[arg_green]) = pPlayer->v.rendercolor[1];
+ *MF_GetAmxAddr(amx, params[arg_blue]) = pPlayer->v.rendercolor[2];
+ *MF_GetAmxAddr(amx, params[arg_render]) = pPlayer->v.rendermode;
+ *MF_GetAmxAddr(amx, params[arg_amount]) = pPlayer->v.renderamt;
+
+ return 1;
+}
+
+// native set_user_maxspeed(index, Float:speed = -1.0)
+static cell AMX_NATIVE_CALL set_user_maxspeed(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_index, arg_speed };
+
+ CHECK_PLAYER(params[arg_index]);
+
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
+ const auto newSpeed = amx_ctof(params[arg_speed]);
+
+ SETCLIENTMAXSPEED(pPlayer, newSpeed);
+ pPlayer->v.maxspeed = newSpeed;
+
+ return 1;
+}
+
+// native Float:get_user_maxspeed(index)
+static cell AMX_NATIVE_CALL get_user_maxspeed(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_index };
+
+ CHECK_PLAYER(params[arg_index]);
+
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
return amx_ftoc(pPlayer->v.maxspeed);
}
-static cell AMX_NATIVE_CALL set_user_gravity(AMX *amx, cell *params) // set_user_gravity(index, Float:gravity = 1.0) = 2 arguments
+// native set_user_gravity(index, Float:gravity = 1.0)
+static cell AMX_NATIVE_CALL set_user_gravity(AMX *amx, cell *params)
{
- // Sets user gravity.
- // params[1] = index
- // params[2] = gravity (=-1.0)
- // Check index
- CHECK_PLAYER(params[1]);
+ enum args { arg_count, arg_index, arg_gravity };
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ CHECK_PLAYER(params[arg_index]);
- pPlayer->v.gravity = amx_ctof(params[2]);
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
+
+ pPlayer->v.gravity = amx_ctof(params[arg_gravity]);
return 1;
}
-static cell AMX_NATIVE_CALL get_user_gravity(AMX *amx, cell *params) // Float:get_user_gravity(index) = 1 argument
+// native Float:get_user_gravity(index)
+static cell AMX_NATIVE_CALL get_user_gravity(AMX *amx, cell *params)
{
- // Gets user gravity.
- // params[1] = index
+ enum args { arg_count, arg_index };
- // Check index
- CHECK_PLAYER(params[1]);
+ CHECK_PLAYER(params[arg_index]);
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
- return amx_ftoc(pPlayer->v.gravity);
+ return amx_ftoc(pPlayer->v.gravity);
}
-static cell AMX_NATIVE_CALL set_user_hitzones(AMX *amx, cell *params) // set_user_hitzones(index = 0, target = 0, body = 255); = 3 arguments
+// native set_user_hitzones(index = 0, target = 0, body = HITZONES_DEFAULT)
+static cell AMX_NATIVE_CALL set_user_hitzones(AMX *amx, cell *params)
{
- // Sets user hitzones.
- // params[1] = the one(s) who shoot(s), shooter
- int shooter = params[1];
+ enum args { arg_count, arg_attacker, arg_target, arg_hitzones };
- // params[2] = the one getting hit
- int gettingHit = params[2];
+ const int attacker = params[arg_attacker];
+ const int target = params[arg_target];
+ const int hitzones = params[arg_hitzones];
- // params[3] = specified hit zones
- int hitzones = params[3];
-
- //set_user_hitzones(id, 0, 0) // Makes ID not able to shoot EVERYONE - id can shoot on 0 (all) at 0
- //set_user_hitzones(0, id, 0) // Makes EVERYONE not able to shoot ID - 0 (all) can shoot id at 0
- if (shooter == 0 && gettingHit == 0) {
- for (int i = 1; i <= gpGlobals->maxClients; i++) {
- for (int j = 1; j <= gpGlobals->maxClients; j++) {
- g_bodyhits[i][j] = hitzones;
- }
- //g_zones_toHit[i] = hitzones;
- //g_zones_getHit[i] = hitzones;
- }
+ if (attacker == 0 && target == 0)
+ {
+ Players.SetEveryoneBodyHits(hitzones);
}
- else if (shooter == 0 && gettingHit != 0) {
- // "All" shooters, target (gettingHit) should be existing player id
- CHECK_PLAYER(gettingHit);
- // Where can all hit gettingHit?
- for (int i = 1; i <= gpGlobals->maxClients; i++)
- g_bodyhits[i][gettingHit] = hitzones;
+ else if (attacker == 0 && target != 0)
+ {
+ CHECK_PLAYER(target);
+
+ Players.SetAttackersBodyHits(target, hitzones);
}
- else if (shooter != 0 && gettingHit == 0) {
- // Shooter can hit all in bodyparts.
- CHECK_PLAYER(shooter);
- for (int i = 1; i <= gpGlobals->maxClients; i++)
- g_bodyhits[shooter][i] = hitzones;
+ else if (attacker != 0 && target == 0)
+ {
+ CHECK_PLAYER(attacker);
+
+ Players.SetTargetsBodyHits(attacker, hitzones);
}
- else {
- // Specified, where can player A hit player B?
- CHECK_PLAYER(shooter);
- CHECK_PLAYER(gettingHit);
- g_bodyhits[shooter][gettingHit] = hitzones;
- }
-
- return 1;
-}
-
-static cell AMX_NATIVE_CALL get_user_hitzones(AMX *amx, cell *params) // get_user_hitzones(index, target); = 2 arguments
-{
- int shooter = params[1];
- CHECK_PLAYER(shooter);
- int target = params[2];
- CHECK_PLAYER(target);
- return g_bodyhits[shooter][target];
-}
-
-static cell AMX_NATIVE_CALL set_user_noclip(AMX *amx, cell *params) // set_user_noclip(index, noclip = 0); = 2 arguments
-{
- // Sets user to no clipping mode.
- // params[1] = index
- // params[2] = no clip or not...
-
- // Check index
- CHECK_PLAYER(params[1]);
-
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
-
- if (params[2] == 1)
- pPlayer->v.movetype = MOVETYPE_NOCLIP;
else
- pPlayer->v.movetype = MOVETYPE_WALK;
+ {
+ CHECK_PLAYER(attacker);
+ CHECK_PLAYER(target);
+
+ Players.SetBodyHits(attacker, target, hitzones);
+ }
return 1;
}
-static cell AMX_NATIVE_CALL get_user_noclip(AMX *amx, cell *params) // get_user_noclip(index); = 1 argument
+// native get_user_hitzones(index, target)
+static cell AMX_NATIVE_CALL get_user_hitzones(AMX *amx, cell *params)
{
- // Gets user noclip.
- // params[1] = index
+ enum args { arg_count, arg_attacker, arg_target };
- // Check index
- CHECK_PLAYER(params[1]);
+ const auto attacker = params[arg_attacker];
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ CHECK_PLAYER(attacker);
+
+ const auto target = params[arg_target];
+
+ CHECK_PLAYER(target);
+
+ return Players[attacker].GetBodyHits(target);
+}
+
+// native set_user_noclip(index, noclip = 0)
+static cell AMX_NATIVE_CALL set_user_noclip(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_index, arg_noclip };
+
+ CHECK_PLAYER(params[arg_index]);
+
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
+
+ pPlayer->v.movetype = params[arg_noclip] != 0 ? MOVETYPE_NOCLIP : MOVETYPE_WALK;
+
+ return 1;
+}
+
+// native get_user_noclip(index)
+static cell AMX_NATIVE_CALL get_user_noclip(AMX *amx, cell *params)
+{
+ enum args { arg_count, arg_index };
+
+ CHECK_PLAYER(params[arg_index]);
+
+ const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
return pPlayer->v.movetype == MOVETYPE_NOCLIP;
}
-// JustinHoMi made this one originally
-static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params) // set_user_footsteps(id, set = 1); = 2 params
+// native set_user_footsteps(id, set = 1)
+static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params)
{
- // Gives player silent footsteps.
- // if set=0 it will return footsteps to normal
- // params[1] = index of player
- // params[2] = 0 = normal footstep sound, 1 = silent slippers
+ enum args { arg_count, arg_index, arg_footsteps };
- // Check index
- CHECK_PLAYER(params[1]);
+ const auto index = params[arg_index];
- // Fetch player pointer
- edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
+ CHECK_PLAYER(index);
- if (params[2]) {
+ const auto pPlayer = TypeConversion.id_to_edict(index);
+
+ if (params[arg_footsteps] != 0)
+ {
pPlayer->v.flTimeStepSound = 999;
- g_silent[params[1]] = true;
+ Players[index].SetSilentFootsteps(true);
+
+ g_pFunctionTable->pfnPlayerPreThink = PlayerPreThink;
}
- else {
+ else
+ {
pPlayer->v.flTimeStepSound = STANDARDTIMESTEPSOUND;
- g_silent[params[1]] = false;
+ Players[index].SetSilentFootsteps(false);
+
+ if (g_pFunctionTable->pfnPlayerPreThink && !Players.HaveSilentFootsteps())
+ {
+ g_pFunctionTable->pfnPlayerPreThink = nullptr;
+ }
}
return 1;
}
+// native get_user_footsteps(index)
static cell AMX_NATIVE_CALL get_user_footsteps(AMX *amx, cell *params)
{
- CHECK_PLAYER(params[1]);
+ enum args { arg_count, arg_index };
- return g_silent[params[1]];
+ const auto index = params[arg_index];
+
+ CHECK_PLAYER(index);
+
+ return Players[index].HasSilentFootsteps();
}
-// SidLuke
-static cell AMX_NATIVE_CALL strip_user_weapons(AMX *amx, cell *params) // index
+// native strip_user_weapons(index)
+static cell AMX_NATIVE_CALL strip_user_weapons(AMX *amx, cell *params)
{
- CHECK_PLAYER(params[1]);
+ enum args { arg_count, arg_index };
- edict_t* pPlayer = TypeConversion.id_to_edict(params[1]);
+ const auto index = params[arg_index];
- string_t item = MAKE_STRING("player_weaponstrip");
- edict_t *pent = CREATE_NAMED_ENTITY(item);
+ CHECK_PLAYER(index);
- if (FNullEnt(pent))
+ const auto pPlayer = TypeConversion.id_to_edict(index);
+ const auto pEntity = CREATE_NAMED_ENTITY(MAKE_STRING("player_weaponstrip"));
+
+ if (FNullEnt(pEntity))
{
return 0;
}
- MDLL_Spawn(pent);
- MDLL_Use(pent, pPlayer);
- REMOVE_ENTITY(pent);
+ MDLL_Spawn(pEntity);
+ MDLL_Use(pEntity, pPlayer);
+ REMOVE_ENTITY(pEntity);
- *reinterpret_cast(MF_PlayerPropAddr(params[1], Player_CurrentWeapon)) = 0;
+ *reinterpret_cast(MF_PlayerPropAddr(index, Player_CurrentWeapon)) = 0;
return 1;
}
-AMX_NATIVE_INFO fun_Exports[] = {
- {"get_client_listen", get_client_listening},
- {"set_client_listen", set_client_listening},
- {"set_user_godmode", set_user_godmode},
- {"get_user_godmode", get_user_godmode},
- {"set_user_health", set_user_health},
- {"give_item", give_item},
- {"spawn", spawn},
- {"set_user_frags", set_user_frags},
- {"set_user_armor", set_user_armor},
- {"set_user_origin", set_user_origin},
- {"set_user_rendering", set_user_rendering},
- {"set_user_maxspeed", set_user_maxspeed},
- {"get_user_maxspeed", get_user_maxspeed},
- {"set_user_gravity", set_user_gravity},
- {"get_user_gravity", get_user_gravity},
- {"get_user_footsteps", get_user_footsteps},
- {"set_user_hitzones", set_user_hitzones},
- {"get_user_hitzones", get_user_hitzones},
- {"set_user_noclip", set_user_noclip},
- {"get_user_noclip", get_user_noclip},
- {"set_user_footsteps", set_user_footsteps},
- {"strip_user_weapons", strip_user_weapons},
- /////////////////// <--- 19 chars max in current small version
- {NULL, NULL}
+
+AMX_NATIVE_INFO fun_Exports[] =
+{
+ { "get_client_listen" , get_client_listening },
+ { "set_client_listen" , set_client_listening },
+ { "set_user_godmode" , set_user_godmode },
+ { "get_user_godmode" , get_user_godmode },
+ { "set_user_health" , set_user_health },
+ { "give_item" , give_item },
+ { "spawn" , spawn },
+ { "set_user_frags" , set_user_frags },
+ { "set_user_armor" , set_user_armor },
+ { "set_user_origin" , set_user_origin },
+ { "set_user_rendering", set_user_rendering },
+ { "get_user_rendering", get_user_rendering },
+ { "set_user_maxspeed" , set_user_maxspeed },
+ { "get_user_maxspeed" , get_user_maxspeed },
+ { "set_user_gravity" , set_user_gravity },
+ { "get_user_gravity" , get_user_gravity },
+ { "get_user_footsteps", get_user_footsteps },
+ { "set_user_hitzones" , set_user_hitzones },
+ { "get_user_hitzones" , get_user_hitzones },
+ { "set_user_noclip" , set_user_noclip },
+ { "get_user_noclip" , get_user_noclip },
+ { "set_user_footsteps", set_user_footsteps },
+ { "strip_user_weapons", strip_user_weapons },
+ { nullptr , nullptr }
};
-/******************************************************************************************/
+
void PlayerPreThink(edict_t *pEntity)
{
- if (g_silent[ENTINDEX(pEntity)]) {
- pEntity->v.flTimeStepSound = 999;
+ const auto index = TypeConversion.edict_to_id(pEntity);
+
+ if (Players[index].HasSilentFootsteps())
+ {
+ pEntity->v.flTimeStepSound = 999;
RETURN_META(MRES_HANDLED);
}
@@ -576,76 +475,53 @@ void PlayerPreThink(edict_t *pEntity)
int ClientConnect(edict_t *pPlayer, const char *pszName, const char *pszAddress, char szRejectReason[128])
{
- // Reset stuff:
- FUNUTIL_ResetPlayer(ENTINDEX(pPlayer));
+ const auto index = TypeConversion.edict_to_id(pPlayer);
+
+ Players[index].Clear();
RETURN_META_VALUE(MRES_IGNORED, 0);
}
-void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *shooter, TraceResult *ptr) {
+void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *shooter, TraceResult *ptr)
+{
TRACE_LINE(v1, v2, fNoMonsters, shooter, ptr);
- if ( ptr->pHit && (ptr->pHit->v.flags& (FL_CLIENT | FL_FAKECLIENT))
- && shooter && (shooter->v.flags & (FL_CLIENT | FL_FAKECLIENT)) ) {
- int shooterIndex = ENTINDEX(shooter);
- if ( !(g_bodyhits[shooterIndex][ENTINDEX(ptr->pHit)] & (1<iHitgroup)) )
+
+ if (ptr->pHit && (ptr->pHit->v.flags & (FL_CLIENT | FL_FAKECLIENT))
+ && shooter && (shooter->v.flags & (FL_CLIENT | FL_FAKECLIENT)) )
+ {
+ const auto shooterIndex = TypeConversion.edict_to_id(shooter);
+ const auto targetIndex = TypeConversion.edict_to_id(ptr->pHit);
+
+ if (!(Players[shooterIndex].GetBodyHits(targetIndex) & (1 << ptr->iHitgroup)))
+ {
ptr->flFraction = 1.0;
+ RETURN_META(MRES_HANDLED);
+ }
}
+
RETURN_META(MRES_SUPERCEDE);
}
-//int g_hitIndex, g_canTargetGetHit, g_canShooterHitThere;
-//void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *shooter, TraceResult *ptr) {
-// if (!pentToSkip || (pentToSkip->v.flags & (FL_CLIENT | FL_FAKECLIENT)) == false || pentToSkip->v.deadflag != DEAD_NO)
-// RETURN_META(MRES_IGNORED);
-//
-// TRACE_LINE(v1, v2, fNoMonsters, shooter, ptr); // Filter shooter
-//
-// if (!ptr->pHit || (ptr->pHit->v.flags & (FL_CLIENT | FL_FAKECLIENT)) == false )
-// RETURN_META(MRES_SUPERCEDE);
-//
-// g_hitIndex = ENTINDEX(ptr->pHit);
-// //bool blocked = false;
-// g_canTargetGetHit = g_zones_getHit[g_hitIndex] & (1 << ptr->iHitgroup);
-// g_canShooterHitThere = g_zones_toHit[ENTINDEX(shooter)] & (1 << ptr->iHitgroup);
-//
-// if (!g_canTargetGetHit || !g_canShooterHitThere) {
-// ptr->flFraction = 1.0; // set to not hit anything (1.0 = shot doesn't hit anything)
-// //blocked = true;
-// }
-// /*
-// if (blocked) {
-// MF_PrintSrvConsole("%s was blocked from hitting %s: %d and %d\n", MF_GetPlayerName(ENTINDEX(pentToSkip)), MF_GetPlayerName(hitIndex), canTargetGetHit, canShooterHitThere);
-// }
-// else {
-// MF_PrintSrvConsole("%s was NOT blocked from hitting %s: %d and %d\n", MF_GetPlayerName(ENTINDEX(pentToSkip)), MF_GetPlayerName(hitIndex), canTargetGetHit, canShooterHitThere);
-// }
-// */
-//
-// RETURN_META(MRES_SUPERCEDE);
-//}
-
void OnAmxxAttach()
{
MF_AddNatives(fun_Exports);
}
-// The content of OnPluginsLoaded() was moved from OnAmxxAttach with AMXx 1.5 because for some reason gpGlobals->maxClients wasn't
-// initialized to its proper value until some time after OnAmxxAttach(). In OnAmxxAttach() it always showed 0. /JGHG
-void OnPluginsLoaded() {
- // Reset stuff - hopefully this should
- for (int i = 1; i <= gpGlobals->maxClients; i++) {
- // Reset all hitzones
- FUNUTIL_ResetPlayer(i);
- }
+void OnPluginsLoaded()
+{
+ Players.Clear();
TypeConversion.init();
+
+ g_pFunctionTable->pfnPlayerPreThink = nullptr;
+ g_pengfuncsTable_Post->pfnTraceLine = nullptr;
}
-/*
-void ClientConnectFakeBot(int index)
+
+void ServerDeactivate()
{
- FUNUTIL_ResetPlayer(index);
- //MF_Log("A bot connects, forwarded to fun! The bot is %d!", index);
- //CPlayer* player;
+ g_pFunctionTable->pfnPlayerPreThink = nullptr;
+ g_pengfuncsTable_Post->pfnTraceLine = nullptr;
+
+ RETURN_META(MRES_IGNORED);
}
-*/
diff --git a/modules/fun/fun.h b/modules/fun/fun.h
index 7b9f4fdc..014591de 100644
--- a/modules/fun/fun.h
+++ b/modules/fun/fun.h
@@ -11,7 +11,9 @@
// Fun Module
//
-#include "amxxmodule.h"
+#pragma once
+
+#include
// Fun-specific defines below
#define GETCLIENTLISTENING (*g_engfuncs.pfnVoice_GetClientListening)
@@ -29,19 +31,181 @@
#define HITGROUP_RIGHTARM 5 // 32
#define HITGROUP_LEFTLEG 6 // 64
#define HITGROUP_RIGHTLEG 7 // 128
+#define HITGROUP_MAX 8
+
+extern DLL_FUNCTIONS *g_pFunctionTable;
+extern enginefuncs_t *g_pengfuncsTable_Post;
+
+void PlayerPreThink(edict_t *pEntity);
+void TraceLine_Post(const float *v1, const float *v2, int fNoMonsters, edict_t *shooter, TraceResult *ptr);
+
+static const auto kHitGroupsBits = (1 << HITGROUP_MAX) - 1;
+static const auto kMaxClients = 32u;
+
+class CPlayer
+{
+ public:
+
+ CPlayer()
+ {
+ Clear();
+ }
+
+ public:
+
+ bool HasBodyHits() const
+ {
+ for (auto i = 1; i <= gpGlobals->maxClients; ++i)
+ {
+ if (GetBodyHits(i) != kHitGroupsBits)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ int GetBodyHits(const int other) const
+ {
+ return bodyHits_[other];
+ }
+
+ void SetBodyHits(const int other, const int flags)
+ {
+ bodyHits_[other] = flags;
+ }
+
+ void SetBodyHits(const int flags)
+ {
+ memset(bodyHits_, flags, sizeof bodyHits_);
+ }
+
+ public:
+
+ bool HasSilentFootsteps() const
+ {
+ return silentFootsteps_;
+ }
+
+ void SetSilentFootsteps(const bool state)
+ {
+ silentFootsteps_ = state;
+ }
+
+ public:
+
+ void Clear()
+ {
+ SetBodyHits(kHitGroupsBits);
+ SetSilentFootsteps(false);
+ }
+
+ private:
+
+ int bodyHits_[kMaxClients + 1];
+ bool silentFootsteps_ {};
+};
+
+class CPlayers
+{
+ using Internal = CPlayer;
+
+ public:
+
+ bool HaveBodyHits() const
+ {
+ for (auto i = 1; i <= gpGlobals->maxClients; ++i)
+ {
+ if (players_[i].HasBodyHits())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void SetBodyHits(const int attacker, const int target, const int flags)
+ {
+ players_[attacker].SetBodyHits(target, flags);
+ }
+
+ void SetTargetsBodyHits(const int attacker, const int flags)
+ {
+ players_[attacker].SetBodyHits(flags);
+ }
+
+ void SetAttackersBodyHits(const int target, const int flags)
+ {
+ for (auto i = 1; i <= gpGlobals->maxClients; ++i)
+ {
+ players_[i].SetBodyHits(target, flags);
+ }
+ }
+
+ void SetEveryoneBodyHits(const int flags)
+ {
+ for (auto i = 1; i <= gpGlobals->maxClients; ++i)
+ {
+ players_[i].SetBodyHits(flags);
+ }
+ }
+
+ public:
+
+ bool HaveSilentFootsteps() const
+ {
+ for (auto i = 1; i <= gpGlobals->maxClients; ++i)
+ {
+ if (players_[i].HasSilentFootsteps())
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public:
+
+ void Clear()
+ {
+ for (auto i = 1; i <= gpGlobals->maxClients; ++i)
+ {
+ players_[i].Clear();
+ }
+ }
+
+ public:
+
+ Internal& operator [](const size_t index)
+ {
+ return players_[index];
+ }
+
+ const Internal& operator [](const size_t index) const
+ {
+ return players_[index];
+ }
+
+ private:
+
+ Internal players_[kMaxClients + 1];
+};
#define CHECK_ENTITY(x) \
- if (x < 0 || x > gpGlobals->maxEntities) { \
+ if ((x) < 0 || (x) > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
return 0; \
} else { \
- if (x <= gpGlobals->maxClients) { \
+ if ((x) <= gpGlobals->maxClients) { \
if (!MF_IsPlayerIngame(x)) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
return 0; \
} \
} else { \
- if (x != 0 && FNullEnt(TypeConversion.id_to_edict(x))) { \
+ if ((x) != 0 && FNullEnt(TypeConversion.id_to_edict(x))) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \
} \
@@ -49,7 +213,7 @@
}
#define CHECK_PLAYER(x) \
- if (x < 1 || x > gpGlobals->maxClients) { \
+ if ((x) < 1 || (x) > gpGlobals->maxClients) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
return 0; \
} else { \
diff --git a/modules/fun/moduleconfig.h b/modules/fun/moduleconfig.h
index 0e492a7a..75216a8e 100644
--- a/modules/fun/moduleconfig.h
+++ b/modules/fun/moduleconfig.h
@@ -26,7 +26,7 @@
#define MODULE_LIBRARY "fun"
#define MODULE_LIBCLASS ""
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
-#define MODULE_RELOAD_ON_MAPCHANGE
+// #define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
@@ -119,8 +119,8 @@
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
-// #define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
-#define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
+#define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
+// #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
// #define FN_StartFrame StartFrame /* pfnStartFrame() */
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
diff --git a/modules/fun/msvc12/fun.vcxproj b/modules/fun/msvc12/fun.vcxproj
index bb70d392..7791b435 100644
--- a/modules/fun/msvc12/fun.vcxproj
+++ b/modules/fun/msvc12/fun.vcxproj
@@ -19,7 +19,7 @@
DynamicLibrary
false
MultiByte
- v120_xp
+ v140_xp
DynamicLibrary
@@ -93,6 +93,8 @@
.\Release/fun.lib
MachineX86
Windows
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+ .data,RW
@@ -138,6 +140,8 @@
Windows
LIBCMT;
false
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+ .data,RW
@@ -155,6 +159,12 @@
+
+
+ ../../../public;
+ ../../../public;
+
+
diff --git a/modules/fun/msvc12/fun.vcxproj.filters b/modules/fun/msvc12/fun.vcxproj.filters
index a4b5a414..eb94e2da 100644
--- a/modules/fun/msvc12/fun.vcxproj.filters
+++ b/modules/fun/msvc12/fun.vcxproj.filters
@@ -21,6 +21,9 @@
{d2522a66-df9f-49c8-9f74-ee3738ae3d98}
+
+ {200a07a6-c1a4-4ad1-bda3-3fb5ea7c106a}
+
@@ -55,4 +58,9 @@
Pawn Includes
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/geoip/AMBuilder b/modules/geoip/AMBuilder
index 4d0bc7b7..2e79c52e 100644
--- a/modules/geoip/AMBuilder
+++ b/modules/geoip/AMBuilder
@@ -13,6 +13,7 @@ binary.compiler.defines += [
binary.sources = [
'../../public/sdk/amxxmodule.cpp',
+ '../../third_party/libmaxminddb/data-pool.c',
'../../third_party/libmaxminddb/maxminddb.c',
'geoip_main.cpp',
'geoip_natives.cpp',
@@ -21,8 +22,10 @@ binary.sources = [
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
-
-if builder.target_platform == 'windows':
- binary.compiler.postlink += ['ws2_32.lib']
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+ binary.compiler.postlink += ['ws2_32.lib']
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/geoip/geoip_main.cpp b/modules/geoip/geoip_main.cpp
index 3e9370de..46273bd5 100644
--- a/modules/geoip/geoip_main.cpp
+++ b/modules/geoip/geoip_main.cpp
@@ -18,12 +18,15 @@
MMDB_s HandleDB;
ke::Vector LangList;
+bool NativesRegistered;
void OnAmxxAttach()
{
if (loadDatabase())
{
MF_AddNatives(GeoipNatives);
+
+ NativesRegistered = true;
}
REG_SVR_COMMAND("geoip", OnGeoipCommand);
@@ -38,7 +41,7 @@ void OnAmxxDetach()
void OnGeoipCommand()
{
- const char *cmd = CMD_ARGV(1);
+ const auto cmd = CMD_ARGV(1);
if (!strcmp(cmd, "version"))
{
@@ -48,7 +51,7 @@ void OnGeoipCommand()
return;
}
- const char *meta_dump = "\n"
+ const auto meta_dump = "\n"
" Database metadata\n"
" Node count: %i\n"
" Record size: %i bits\n"
@@ -59,7 +62,7 @@ void OnGeoipCommand()
" Languages: ";
char date[40];
- strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S UTC", gmtime((const time_t *)&HandleDB.metadata.build_epoch));
+ strftime(date, sizeof date, "%Y-%m-%d %H:%M:%S UTC", gmtime(reinterpret_cast(&HandleDB.metadata.build_epoch)));
fprintf(stdout, meta_dump,
HandleDB.metadata.node_count,
@@ -100,7 +103,7 @@ void OnGeoipCommand()
return;
}
- int num_args = CMD_ARGC();
+ const auto num_args = CMD_ARGC();
if (num_args < 3)
{
@@ -108,12 +111,12 @@ void OnGeoipCommand()
return;
}
- char *ip = stripPort((char *)CMD_ARGV(2));
+ const auto ip = stripPort(const_cast(CMD_ARGV(2)));
- int gai_error = 0;
- int mmdb_error = 0;
+ auto gai_error = 0;
+ auto mmdb_error = 0;
- MMDB_lookup_result_s result = MMDB_lookup_string(&HandleDB, ip, &gai_error, &mmdb_error);
+ auto result = MMDB_lookup_string(&HandleDB, ip, &gai_error, &mmdb_error);
if (gai_error != 0 || mmdb_error != MMDB_SUCCESS || !result.found_entry)
{
@@ -121,17 +124,17 @@ void OnGeoipCommand()
return;
}
- MMDB_entry_data_list_s *entry_data_list = NULL;
- int status = -1;
+ MMDB_entry_data_list_s *entry_data_list = nullptr;
+ int status;
- if ((status = MMDB_get_entry_data_list(&result.entry, &entry_data_list)) != MMDB_SUCCESS || entry_data_list == NULL)
+ if ((status = MMDB_get_entry_data_list(&result.entry, &entry_data_list)) != MMDB_SUCCESS || entry_data_list == nullptr)
{
MF_PrintSrvConsole("\n Could not retrieve data list - %s.\n\n", MMDB_strerror(status));
return;
}
- const char *file = NULL;
- FILE *fp = NULL;
+ const char *file = nullptr;
+ FILE *fp = nullptr;
if (num_args > 3)
{
@@ -141,7 +144,7 @@ void OnGeoipCommand()
if (!fp)
{
- file = NULL;
+ file = nullptr;
fp = stdout;
}
@@ -156,12 +159,29 @@ void OnGeoipCommand()
MMDB_free_entry_data_list(entry_data_list);
}
+ else if (!strcmp(cmd, "reload"))
+ {
+ const auto isDatabaseLoaded = HandleDB.filename != nullptr;
+
+ if (isDatabaseLoaded)
+ {
+ MMDB_close(&HandleDB);
+ }
+
+ if (loadDatabase() && !NativesRegistered)
+ {
+ MF_AddNatives(GeoipNatives);
+
+ NativesRegistered = true;
+ }
+ }
else
{
MF_PrintSrvConsole("\n");
MF_PrintSrvConsole(" Usage: geoip [argument]\n");
MF_PrintSrvConsole(" Commands:\n");
MF_PrintSrvConsole(" version - display geoip database metadata\n");
+ MF_PrintSrvConsole(" reload - reload geoip database\n");
MF_PrintSrvConsole(" dump [output file] - dump all data from an IP address formatted in a JSON-ish fashion.\n");
MF_PrintSrvConsole(" An output file is mod-based and if not provided, it will print in the console.\n");
MF_PrintSrvConsole("\n");
@@ -170,7 +190,9 @@ void OnGeoipCommand()
bool loadDatabase()
{
- if (HandleDB.filename) // Already loaded.
+ const auto isDatabaseLoaded = HandleDB.filename != nullptr;
+
+ if (isDatabaseLoaded)
{
return true;
}
@@ -181,18 +203,18 @@ bool loadDatabase()
"Country" // Is the default shipped database with AMXX.
};
- const char *modName = MF_GetModname();
- const char *dataDir = MF_GetLocalInfo("amxx_datadir", "addons/amxmodx/data");
+ const auto modName = MF_GetModname();
+ const auto dataDir = MF_GetLocalInfo("amxx_datadir", "addons/amxmodx/data");
- char file[255];
- int status = -1;
+ char file[260];
+ auto status = -1;
- for (size_t i = 0; i < ARRAYSIZE(databases); ++i)
+ for (auto& database : databases)
{
// MF_BuildPathname not used because backslash
// makes CreateFileMapping failing under windows.
- ke::SafeSprintf(file, sizeof(file), "%s/%s/GeoLite2-%s.mmdb", modName, dataDir, databases[i]);
+ ke::SafeSprintf(file, sizeof file, "%s/%s/GeoLite2-%s.mmdb", modName, dataDir, database);
status = MMDB_open(file, MMDB_MODE_MMAP, &HandleDB);
@@ -200,7 +222,8 @@ bool loadDatabase()
{
break;
}
- else if (status != MMDB_FILE_OPEN_ERROR)
+
+ if (status != MMDB_FILE_OPEN_ERROR)
{
MF_Log("Could not open %s - %s", file, MMDB_strerror(status));
diff --git a/modules/geoip/moduleconfig.h b/modules/geoip/moduleconfig.h
index 67fd54fa..b29ab017 100644
--- a/modules/geoip/moduleconfig.h
+++ b/modules/geoip/moduleconfig.h
@@ -25,7 +25,7 @@
#define MODULE_LIBRARY "geoip"
#define MODULE_LIBCLASS ""
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
-#define MODULE_RELOAD_ON_MAPCHANGE
+// #define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
diff --git a/modules/geoip/msvc12/geoip.vcxproj b/modules/geoip/msvc12/geoip.vcxproj
index c9ac7869..b86a84f5 100644
--- a/modules/geoip/msvc12/geoip.vcxproj
+++ b/modules/geoip/msvc12/geoip.vcxproj
@@ -74,6 +74,8 @@
$(OutDir)geoip.lib
MachineX86
false
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
@@ -95,9 +97,12 @@
true
$(OutDir)geoip.lib
MachineX86
+ .data,RW
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+
@@ -105,6 +110,7 @@
+
@@ -117,6 +123,12 @@
+
+
+ ../../../public;
+ ../../../public;
+
+
diff --git a/modules/geoip/msvc12/geoip.vcxproj.filters b/modules/geoip/msvc12/geoip.vcxproj.filters
index ee2e53ea..e1a731d7 100644
--- a/modules/geoip/msvc12/geoip.vcxproj.filters
+++ b/modules/geoip/msvc12/geoip.vcxproj.filters
@@ -21,6 +21,9 @@
{0bd4b9fb-f847-4fe5-af3e-9000fc854c5c}
+
+ {cfe982b9-749c-4d98-ac7b-207290a68c7e}
+
@@ -38,6 +41,9 @@
GeoIP2
+
+ GeoIP2
+
@@ -64,10 +70,18 @@
GeoIP2
+
+ GeoIP2
+
Pawn Includes
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/hamsandwich/AMBuilder b/modules/hamsandwich/AMBuilder
index 6181a91b..64a068a2 100644
--- a/modules/hamsandwich/AMBuilder
+++ b/modules/hamsandwich/AMBuilder
@@ -24,5 +24,9 @@ binary.sources = [
if builder.target_platform == 'windows':
binary.sources += ['version.rc']
-
+ binary.compiler.linkflags += [
+ '/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
+ '/SECTION:.data,RW',
+ ]
+
AMXX.modules += [builder.Add(binary)]
diff --git a/modules/hamsandwich/DataHandler.cpp b/modules/hamsandwich/DataHandler.cpp
index 2b6fc55e..9e286a62 100644
--- a/modules/hamsandwich/DataHandler.cpp
+++ b/modules/hamsandwich/DataHandler.cpp
@@ -238,20 +238,32 @@ static cell AMX_NATIVE_CALL SetHamParamVector(AMX *amx, cell *params)
int ret=dat->SetVector(MF_GetAmxAddr(amx, params[2]));
PARSE_RETURN();
}
-static cell AMX_NATIVE_CALL SetHamParamEntity(AMX *amx, cell *params)
+
+cell SetParamEntity(AMX *amx, cell *params, bool updateIndex)
{
CHECK_STACK(ParamStack);
ke::Vector *vec = ParamStack.front();
- if (vec->length() < (unsigned)params[1])
- {
- MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
- return 0;
- }
- Data *dat=vec->at(params[1] - 1);
+ if (vec->length() < (unsigned)params[1])
+ {
+ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter number, got %d, expected %d", params[1], vec->length());
+ return 0;
+ }
+ Data *dat = vec->at(params[1] - 1);
- int ret=dat->SetEntity(¶ms[2]);
+ int ret = dat->SetEntity(¶ms[2], updateIndex);
PARSE_RETURN();
}
+
+static cell AMX_NATIVE_CALL SetHamParamEntity(AMX *amx, cell *params)
+{
+ return SetParamEntity(amx, params, false);
+}
+
+static cell AMX_NATIVE_CALL SetHamParamEntity2(AMX *amx, cell *params)
+{
+ return SetParamEntity(amx, params, true);
+}
+
static cell AMX_NATIVE_CALL SetHamParamString(AMX *amx, cell *params)
{
CHECK_STACK(ParamStack);
@@ -318,19 +330,19 @@ static cell AMX_NATIVE_CALL GetHamItemInfo(AMX *amx, cell *params)
return pItem->iPosition;
case ItemInfo_pszAmmo1:
- return MF_SetAmxString( amx, params[3], pItem->pszAmmo1 > 0 ? pItem->pszAmmo1 : "", params[4] );
+ return MF_SetAmxString( amx, params[3], pItem->pszAmmo1 ? pItem->pszAmmo1 : "", params[4] );
case ItemInfo_iMaxAmmo1:
return pItem->iMaxAmmo1;
case ItemInfo_pszAmmo2:
- return MF_SetAmxString( amx, params[3], pItem->pszAmmo2 > 0 ? pItem->pszAmmo2 : "", params[4] );
+ return MF_SetAmxString( amx, params[3], pItem->pszAmmo2 ? pItem->pszAmmo2 : "", params[4] );
case ItemInfo_iMaxAmmo2:
return pItem->iMaxAmmo2;
case ItemInfo_pszName:
- return MF_SetAmxString( amx, params[3], pItem->pszName > 0 ? pItem->pszName : "", params[4] );
+ return MF_SetAmxString( amx, params[3], pItem->pszName ? pItem->pszName : "", params[4] );
case ItemInfo_iMaxClip:
return pItem->iMaxClip;
@@ -483,6 +495,7 @@ AMX_NATIVE_INFO ReturnNatives[] =
{ "SetHamParamFloat", SetHamParamFloat },
{ "SetHamParamVector", SetHamParamVector },
{ "SetHamParamEntity", SetHamParamEntity },
+ { "SetHamParamEntity2", SetHamParamEntity2 },
{ "SetHamParamString", SetHamParamString },
{ "SetHamParamTraceResult", SetHamParamTraceResult },
{ "SetHamParamItemInfo", SetHamParamItemInfo },
diff --git a/modules/hamsandwich/DataHandler.h b/modules/hamsandwich/DataHandler.h
index 40fe970e..d38499b3 100644
--- a/modules/hamsandwich/DataHandler.h
+++ b/modules/hamsandwich/DataHandler.h
@@ -210,7 +210,7 @@ public:
return 0;
};
- int SetEntity(cell *data)
+ int SetEntity(cell *data, bool updateIndex = false)
{
if (!IsSet())
{
@@ -219,7 +219,7 @@ public:
if (IsType(RET_CBASE))
{
*(reinterpret_cast(m_data))= TypeConversion.id_to_cbase(*data);
- if (m_index != 0)
+ if (updateIndex && m_index)
{
*m_index=*data;
}
@@ -229,7 +229,7 @@ public:
else if (IsType(RET_ENTVAR))
{
*(reinterpret_cast(m_data))= TypeConversion.id_to_entvars(*data);
- if (m_index != 0)
+ if (updateIndex && m_index)
{
*m_index=*data;
}
@@ -239,7 +239,7 @@ public:
else if (IsType(RET_EDICT))
{
*(reinterpret_cast(m_data)) = TypeConversion.id_to_edict(*data);
- if (m_index != 0)
+ if (updateIndex && m_index)
{
*m_index = *data;
}
diff --git a/modules/hamsandwich/amxx_api.cpp b/modules/hamsandwich/amxx_api.cpp
index fc11c972..0cd66d3a 100644
--- a/modules/hamsandwich/amxx_api.cpp
+++ b/modules/hamsandwich/amxx_api.cpp
@@ -63,6 +63,10 @@ void OnAmxxAttach(void)
assert(strcmp(hooklist[Ham_SC_Weapon_ChangeWeaponSkin].name, "sc_weapon_changeweaponskin")==0);
assert(strcmp(hooklist[Ham_Item_GetItemInfo].name, "item_getiteminfo") == 0);
+ assert(strcmp(hooklist[Ham_SC_Item_AddToPlayer].name, "sc_item_addtoplayer") == 0);
+ assert(strcmp(hooklist[Ham_SC_Weapon_ExtractAmmoFromItem].name, "sc_weapon_extractammofromitem") == 0);
+ assert(strcmp(hooklist[Ham_SC_Player_EnteredObserver].name, "sc_player_enteredobserver") == 0);
+
MF_AddNatives(pdata_natives_safe);
if (ReadConfig() > 0)
diff --git a/modules/hamsandwich/call_funcs.cpp b/modules/hamsandwich/call_funcs.cpp
index 97504b70..d3ed798f 100644
--- a/modules/hamsandwich/call_funcs.cpp
+++ b/modules/hamsandwich/call_funcs.cpp
@@ -173,7 +173,22 @@ cell Call_Int_Float_Int_Int(AMX *amx, cell *params)
return reinterpret_cast(__func)(pv, f3, i4, i5);
#endif
}
-
+
+cell Call_Bool_Float_Int_Int(AMX *amx, cell *params)
+{
+ SETUP(3);
+
+ float f3 = amx_ctof(*MF_GetAmxAddr(amx, params[3]));
+ int i4 = *MF_GetAmxAddr(amx, params[4]);
+ int i5 = *MF_GetAmxAddr(amx, params[5]);
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, f3, i4, i5) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, f3, i4, i5) ? TRUE : FALSE;
+#endif
+}
+
cell Call_Void_Entvar_Int(AMX *amx, cell *params)
{
SETUP(2);
@@ -248,6 +263,36 @@ cell Call_Void_Int_Int(AMX *amx, cell *params)
return 1;
}
+cell Call_Void_Int_Bool(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ int i3 = *MF_GetAmxAddr(amx, params[3]);
+ bool i4 = *MF_GetAmxAddr(amx, params[4]) != 0;
+
+#if defined(_WIN32)
+ reinterpret_cast(__func)(pv, 0, i3, i4);
+#elif defined(__linux__) || defined(__APPLE__)
+ reinterpret_cast(__func)(pv, i3, i4);
+#endif
+ return 1;
+}
+
+cell Call_Void_Bool_Bool(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ bool i3 = *MF_GetAmxAddr(amx, params[3]) != 0;
+ bool i4 = *MF_GetAmxAddr(amx, params[4]) != 0;
+
+#if defined(_WIN32)
+ reinterpret_cast(__func)(pv, 0, i3, i4);
+#elif defined(__linux__) || defined(__APPLE__)
+ reinterpret_cast(__func)(pv, i3, i4);
+#endif
+ return 1;
+}
+
cell Call_Int_Int_Str_Int(AMX *amx, cell *params)
{
SETUP(3);
@@ -279,6 +324,22 @@ cell Call_Int_Int_Str_Int_Int(AMX *amx, cell *params)
#endif
}
+cell Call_Int_Int_Str_Int_Bool(AMX *amx, cell *params)
+{
+ SETUP(4);
+
+ int i3 = *MF_GetAmxAddr(amx, params[3]);
+ char *sz4 = MF_GetAmxString(amx, params[4], 0, NULL);
+ int i5 = *MF_GetAmxAddr(amx, params[5]);
+ bool i6 = *MF_GetAmxAddr(amx, params[6]) != 0;
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, i3, sz4, i5, i6);
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, i3, sz4, i5, i6);
+#endif
+}
+
cell Call_Int_Int(AMX *amx, cell *params)
{
SETUP(1);
@@ -292,6 +353,19 @@ cell Call_Int_Int(AMX *amx, cell *params)
#endif
}
+cell Call_Bool_Bool(AMX *amx, cell *params)
+{
+ SETUP(1);
+
+ bool i3 = *MF_GetAmxAddr(amx, params[3]) != 0;
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, i3) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, i3) ? TRUE : FALSE;
+#endif
+}
+
cell Call_Int_Entvar(AMX *amx, cell *params)
{
SETUP(1);
@@ -591,6 +665,29 @@ cell Call_Int_pVector(AMX *amx, cell *params)
return ret;
}
+cell Call_Bool_pVector(AMX *amx, cell *params)
+{
+ SETUP(1);
+
+ Vector v3;
+ float *fl3 = (float *)MF_GetAmxAddr(amx, params[3]);
+ v3.x = fl3[0];
+ v3.y = fl3[1];
+ v3.z = fl3[2];
+
+#if defined(_WIN32)
+ bool ret = reinterpret_cast(__func)(pv, 0, &v3);
+#elif defined(__linux__) || defined(__APPLE__)
+ bool ret = reinterpret_cast(__func)(pv, &v3);
+#endif
+
+ fl3[0] = v3.x;
+ fl3[1] = v3.y;
+ fl3[2] = v3.z;
+
+ return ret ? TRUE : FALSE;
+}
+
cell Call_Void_Entvar_Float_Float(AMX *amx, cell *params)
{
SETUP(3);
@@ -665,7 +762,7 @@ cell Call_Void_Int_Int_Int(AMX *amx, cell *params)
return 1;
}
-cell Call_Void_ItemInfo(AMX *amx, cell *params)
+cell Call_Int_ItemInfo(AMX *amx, cell *params)
{
SETUP(1);
@@ -677,11 +774,28 @@ cell Call_Void_ItemInfo(AMX *amx, cell *params)
return 0;
}
#if defined(_WIN32)
- reinterpret_cast(__func)(pv, 0, ptr);
+ return reinterpret_cast(__func)(pv, 0, ptr);
#elif defined(__linux__) || defined(__APPLE__)
- reinterpret_cast(__func)(pv, ptr);
+ return reinterpret_cast(__func)(pv, ptr);
+#endif
+}
+
+cell Call_Bool_ItemInfo(AMX *amx, cell *params)
+{
+ SETUP(1);
+
+ void *ptr = reinterpret_cast(*MF_GetAmxAddr(amx, params[3]));
+
+ if (!ptr)
+ {
+ MF_LogError(amx, AMX_ERR_NATIVE, "Null ItemInfo handle!");
+ return 0;
+ }
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, ptr) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, ptr) ? TRUE : FALSE;
#endif
- return 1;
}
cell Call_Float_Void(AMX *amx, cell *params)
@@ -845,6 +959,34 @@ cell Call_Int_Int_Int(AMX *amx, cell *params)
#endif
}
+cell Call_Bool_Bool_Int(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ bool i3 = *MF_GetAmxAddr(amx, params[3]) != 0;
+ int i4 = *MF_GetAmxAddr(amx, params[4]);
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, i3, i4) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, i3, i4) ? TRUE : FALSE;
+#endif
+}
+
+cell Call_Int_Bool_Int(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ bool i3 = *MF_GetAmxAddr(amx, params[3]) != 0;
+ int i4 = *MF_GetAmxAddr(amx, params[4]);
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, i3, i4);
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, i3, i4);
+#endif
+}
+
cell Call_Void_Str_Float_Float_Float(AMX *amx, cell *params)
{
SETUP(4);
@@ -887,6 +1029,30 @@ cell Call_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, cell *params)
return 1;
}
+cell Call_Void_Str_Float_Float_Float_Bool_Cbase(AMX *amx, cell *params)
+{
+ SETUP(6);
+
+ char *sz3=MF_GetAmxString(amx, params[3], 0, NULL);
+ float f4=amx_ctof(*MF_GetAmxAddr(amx, params[4]));
+ float f5=amx_ctof(*MF_GetAmxAddr(amx, params[5]));
+ float f6=amx_ctof(*MF_GetAmxAddr(amx, params[6]));
+ bool i7=*MF_GetAmxAddr(amx, params[7]) != 0;
+ int id8=*MF_GetAmxAddr(amx, params[8]);
+
+ CHECK_ENTITY(id8);
+
+ void *p8 = TypeConversion.id_to_cbase(id8);
+
+#if defined(_WIN32)
+ reinterpret_cast(__func)(pv, 0, sz3, f4, f5, f6, i7, p8);
+#elif defined(__linux__) || defined(__APPLE__)
+ reinterpret_cast(__func)(pv, sz3, f4, f5, f6, i7, p8);
+#endif
+
+ return 1;
+}
+
cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params)
{
SETUP(4);
@@ -1144,6 +1310,24 @@ cell Call_Void_Str_Int(AMX *amx, cell *params)
return 1;
}
+cell Call_Bool_Cbase_Int(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ int id3 = *MF_GetAmxAddr(amx, params[3]);
+ CHECK_ENTITY(id3);
+
+ void *p8 = TypeConversion.id_to_cbase(id3);
+
+ int i4 = *MF_GetAmxAddr(amx, params[4]);
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, p8, i4) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, p8, i4) ? TRUE : FALSE;
+#endif
+}
+
cell Call_Void_Cbase_Int(AMX *amx, cell *params)
{
SETUP(2);
@@ -1164,6 +1348,27 @@ cell Call_Void_Cbase_Int(AMX *amx, cell *params)
return 1;
}
+cell Call_Void_Cbase_Int_Float(AMX *amx, cell *params)
+{
+ SETUP(3);
+
+ int id3 = *MF_GetAmxAddr(amx, params[3]);
+ CHECK_ENTITY(id3);
+
+ void *p8 = TypeConversion.id_to_cbase(id3);
+
+ int i4 = *MF_GetAmxAddr(amx, params[4]);
+ float f5 = amx_ctof(*MF_GetAmxAddr(amx, params[5]));
+
+#if defined(_WIN32)
+ reinterpret_cast(__func)(pv, 0, p8, i4, f5);
+#elif defined(__linux__) || defined(__APPLE__)
+ reinterpret_cast(__func)(pv, p8, i4, f5);
+#endif
+
+ return 1;
+}
+
cell Call_Void_Str(AMX *amx, cell *params)
{
SETUP(1);
@@ -1402,7 +1607,7 @@ cell Call_Int_Cbase_Bool(AMX *amx, cell *params)
void *pv1 = TypeConversion.id_to_cbase(id3);
- bool b4=*MF_GetAmxAddr(amx, params[4]) ? true : false;
+ bool b4= *MF_GetAmxAddr(amx, params[4]) != 0;
#if defined(_WIN32)
return reinterpret_cast(__func)(pv, 0, pv1, b4);
@@ -1411,6 +1616,25 @@ cell Call_Int_Cbase_Bool(AMX *amx, cell *params)
#endif
}
+cell Call_Bool_Cbase_Bool(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ int id3 = *MF_GetAmxAddr(amx, params[3]);
+
+ CHECK_ENTITY(id3);
+
+ void *pv1 = TypeConversion.id_to_cbase(id3);
+
+ bool b4 = *MF_GetAmxAddr(amx, params[4]) != 0;
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, pv1, b4) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, pv1, b4) ? TRUE : FALSE;
+#endif
+}
+
cell Call_Int_Vector_Vector(AMX *amx, cell *params)
{
SETUP(2);
@@ -1435,6 +1659,54 @@ cell Call_Int_Vector_Vector(AMX *amx, cell *params)
#endif
}
+cell Call_Int_pVector_pVector(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ Vector v3;
+ Vector v4;
+
+ float *fl3 = (float *)MF_GetAmxAddr(amx, params[3]);
+ v3.x = fl3[0];
+ v3.y = fl3[1];
+ v3.z = fl3[2];
+
+ float *fl4 = (float *)MF_GetAmxAddr(amx, params[4]);
+ v4.x = fl4[0];
+ v4.y = fl4[1];
+ v4.z = fl4[2];
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, &v3, &v4);
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, &v3, &v4);
+#endif
+}
+
+cell Call_Bool_pVector_pVector(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ Vector v3;
+ Vector v4;
+
+ float *fl3 = (float *)MF_GetAmxAddr(amx, params[3]);
+ v3.x = fl3[0];
+ v3.y = fl3[1];
+ v3.z = fl3[2];
+
+ float *fl4 = (float *)MF_GetAmxAddr(amx, params[4]);
+ v4.x = fl4[0];
+ v4.y = fl4[1];
+ v4.z = fl4[2];
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, &v3, &v4) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, &v3, &v4) ? TRUE : FALSE;
+#endif
+}
+
cell Call_Int_Entvar_Float(AMX *amx, cell *params)
{
SETUP(2);
@@ -1454,6 +1726,25 @@ cell Call_Int_Entvar_Float(AMX *amx, cell *params)
#endif
}
+cell Call_Bool_Entvar_Float(AMX *amx, cell *params)
+{
+ SETUP(2);
+
+ int id3 = *MF_GetAmxAddr(amx, params[3]);
+
+ CHECK_ENTITY(id3);
+
+ entvars_t *ev3 = TypeConversion.id_to_entvars(id3);
+
+ float f4 = amx_ctof(*MF_GetAmxAddr(amx, params[4]));
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, ev3, f4) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, ev3, f4) ? TRUE : FALSE;
+#endif
+}
+
cell Call_Float_Float(AMX *amx, cell *params)
{
SETUP(2);
@@ -1498,9 +1789,9 @@ cell Call_Bool_Void(AMX *amx, cell *params)
SETUP(0);
#if defined(_WIN32)
- return reinterpret_cast(__func)(pv, 0);
+ return reinterpret_cast(__func)(pv, 0) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
- return reinterpret_cast(__func)(pv);
+ return reinterpret_cast(__func)(pv) ? TRUE : FALSE;
#endif
}
@@ -1666,9 +1957,9 @@ cell Call_Bool_Cbase(AMX *amx, cell *params)
void *pv1 = TypeConversion.id_to_cbase(id3);
#if defined(_WIN32)
- return reinterpret_cast(__func)(pv, 0, pv1);
+ return reinterpret_cast(__func)(pv, 0, pv1) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
- return reinterpret_cast(__func)(pv, pv1);
+ return reinterpret_cast(__func)(pv, pv1) ? TRUE : FALSE;
#endif
}
@@ -1679,9 +1970,24 @@ cell Call_Bool_Int(AMX *amx, cell *params)
int id3=*MF_GetAmxAddr(amx, params[3]);
#if defined(_WIN32)
- return reinterpret_cast(__func)(pv, 0, id3);
+ return reinterpret_cast(__func)(pv, 0, id3) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
- return reinterpret_cast(__func)(pv, id3);
+ return reinterpret_cast(__func)(pv, id3) ? TRUE : FALSE;
+#endif
+}
+
+cell Call_Bool_Entvar(AMX *amx, cell *params)
+{
+ SETUP(1);
+
+ int id3 = *MF_GetAmxAddr(amx, params[3]);
+ CHECK_ENTITY(id3);
+ entvars_t *ev3 = TypeConversion.id_to_entvars(id3);
+
+#if defined(_WIN32)
+ return reinterpret_cast(__func)(pv, 0, ev3) ? TRUE : FALSE;
+#elif defined(__linux__) || defined(__APPLE__)
+ return reinterpret_cast(__func)(pv, ev3) ? TRUE : FALSE;
#endif
}
@@ -1712,7 +2018,7 @@ cell Call_Void_Cbase_Bool(AMX *amx, cell *params)
CHECK_ENTITY(id3);
void *p8 = TypeConversion.id_to_cbase(id3);
- bool b4 = *MF_GetAmxAddr(amx, params[4]) ? true : false;
+ bool b4 = *MF_GetAmxAddr(amx, params[4]) != 0;
#if defined(_WIN32)
reinterpret_cast(__func)(pv, 0, p8, b4);
diff --git a/modules/hamsandwich/call_funcs.h b/modules/hamsandwich/call_funcs.h
index 93cde151..b252632f 100644
--- a/modules/hamsandwich/call_funcs.h
+++ b/modules/hamsandwich/call_funcs.h
@@ -27,6 +27,8 @@ cell Call_Int_Float_Int(AMX *amx, cell *params);
cell Call_Int_Float_Int_Int(AMX *amx, cell *params);
+cell Call_Bool_Float_Int_Int(AMX *amx, cell *params);
+
cell Call_Void_Entvar_Int(AMX *amx, cell *params);
cell Call_Void_Entvar_Entvar_Int(AMX *amx, cell *params);
@@ -35,12 +37,20 @@ cell Call_Int_Cbase(AMX *amx, cell *params);
cell Call_Void_Int_Int(AMX *amx, cell *params);
+cell Call_Void_Int_Bool(AMX *amx, cell *params);
+
+cell Call_Void_Bool_Bool(AMX *amx, cell *params);
+
cell Call_Int_Int_Str_Int(AMX *amx, cell *params);
cell Call_Int_Int_Str_Int_Int(AMX *amx, cell *params);
+cell Call_Int_Int_Str_Int_Bool(AMX *amx, cell *params);
+
cell Call_Int_Int(AMX *amx, cell *params);
+cell Call_Bool_Bool(AMX *amx, cell *params);
+
cell Call_Int_Entvar(AMX *amx, cell *params);
cell Call_Int_Entvar_Entvar_Float_Int(AMX *amx, cell *params);
@@ -67,6 +77,8 @@ cell Call_Vector_pVector(AMX *amx, cell *params);
cell Call_Int_pVector(AMX *amx, cell *params);
+cell Call_Bool_pVector(AMX *amx, cell *params);
+
cell Call_Void_Entvar_Float_Float(AMX *amx, cell *params);
cell Call_Void_pFloat_pFloat(AMX *amx, cell *params);
@@ -75,7 +87,9 @@ cell Call_Void_Entvar_Float(AMX *amx, cell *params);
cell Call_Void_Int_Int_Int(AMX *amx, cell *params);
-cell Call_Void_ItemInfo(AMX *amx, cell *params);
+cell Call_Int_ItemInfo(AMX *amx, cell *params);
+
+cell Call_Bool_ItemInfo(AMX *amx, cell *params);
cell Call_Float_Void(AMX *amx, cell *params);
@@ -99,10 +113,14 @@ cell Call_Int_Float(AMX *amx, cell *params);
cell Call_Int_Int_Int(AMX *amx, cell *params);
+cell Call_Bool_Bool_Int(AMX *amx, cell *params);
+
cell Call_Void_Str_Float_Float_Float(AMX *amx, cell *params);
cell Call_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, cell *params);
+cell Call_Void_Str_Float_Float_Float_Bool_Cbase(AMX *amx, cell *params);
+
cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params);
cell Call_Int_Short(AMX *amx, cell *params);
@@ -129,8 +147,12 @@ cell Call_Int_Int_Int_Float_Int(AMX* amx, cell* params);
cell Call_Void_Str_Int(AMX* amx, cell* params);
+cell Call_Bool_Cbase_Int(AMX* amx, cell* params);
+
cell Call_Void_Cbase_Int(AMX* amx, cell* params);
+cell Call_Void_Cbase_Int_Float(AMX* amx, cell* params);
+
cell Call_Void_Str(AMX* amx, cell* params);
cell Call_Void_Vector(AMX* amx, cell* params);
@@ -151,10 +173,18 @@ cell Call_Int_pVector_pVector_Float_Cbase_pVector(AMX* amx, cell* params);
cell Call_Int_Cbase_Bool(AMX* amx, cell* params);
+cell Call_Bool_Cbase_Bool(AMX* amx, cell* params);
+
cell Call_Int_Vector_Vector(AMX *amx, cell *params);
+cell Call_Int_pVector_pVector(AMX *amx, cell *params);
+
+cell Call_Bool_pVector_pVector(AMX *amx, cell *params);
+
cell Call_Int_Entvar_Float(AMX *amx, cell *params);
+cell Call_Bool_Entvar_Float(AMX *amx, cell *params);
+
cell Call_Float_Float(AMX* amx, cell* params);
cell Call_Void_Entvar_Entvar_Float(AMX *amx, cell *params);
@@ -173,6 +203,8 @@ cell Call_Void_Bool(AMX *amx, cell *params);
cell Call_Bool_Cbase(AMX *amx, cell *params);
+cell Call_Bool_Entvar(AMX *amx, cell *params);
+
cell Call_Bool_Int(AMX *amx, cell *params);
cell Call_Void_Cbase_Float(AMX* amx, cell* params);
diff --git a/modules/hamsandwich/config_parser.cpp b/modules/hamsandwich/config_parser.cpp
index a2b54b94..411956a7 100644
--- a/modules/hamsandwich/config_parser.cpp
+++ b/modules/hamsandwich/config_parser.cpp
@@ -11,381 +11,46 @@
// Ham Sandwich Module
//
-#include "amxxmodule.h"
-
+#include
#include "ham_const.h"
#include "hooklist.h"
#include "offsets.h"
-#include
-extern hook_t hooklist[];
+IGameConfig *CommonConfig;
+IGameConfigManager *ConfigManager;
-enum
-{
- LEX_INVALID = 0,
-
- LEX_UNKNOWN,
-
- LEX_START_SEC,
- LEX_END_SEC,
-
- LEX_MIRROR,
-
- LEX_PEV,
- LEX_BASE,
-
- LEX_END
-};
-
-const char *tokens[] =
-{
- "", // LEX_INVALID
-
- "", // LEX_UNKNOWN
-
- "@section", // LEX_START_SEC
- "@end", // LEX_END_SEC
-
- "@mirror", // LEX_MIRROR
-
- "pev", // LEX_PEV
- "base", // LEX_BASE
-
- "", // LEX_END
-};
-
-static void trim_line(char *input);
-static void read_mirror(char *input);
-static void skip_to_end_of_section(FILE *fp);
-static int lex(char*& buffer);
-
-int lex(char*& buffer)
-{
- trim_line(buffer);
-
- size_t len;
-
- for (int i=0; i= oldinput &&
- ( *start == '\0' ||
- *start == ' ' ||
- *start == '\r' ||
- *start == '\n' ||
- *start == '\t'))
- {
- start--;
- }
- start++;
- *start='\0';
-
- // Now find any comments and cut off at the start
-
- while (*start != '\0')
- {
- if (*start == ';')
- {
- *start='\0';
- break;
- }
-
- start++;
- }
-}
-
-void skip_to_end_of_section(FILE *fp)
-{
- char buffer[1024];
-
- while (!feof(fp))
- {
- buffer[0]='\0';
-
- fgets(buffer, sizeof(buffer)-1, fp);
-
- trim_line(buffer);
-
- char *b=&buffer[0];
- if (lex(b)==LEX_END_SEC)
- {
- break;
- }
- }
-}
-static const char* get_localinfo( const char* name , const char* def = 0 )
-{
- const char* b = LOCALINFO( (char*)name );
- if (((b==0)||(*b==0)) && def )
- SET_LOCALINFO((char*)name,(char*)(b = def) );
- return b;
-}
-int read_start_section(char *data)
-{
- if (strncasecmp(data, CurrentModName, strlen(CurrentModName))==0)
- {
- data+=strlen(CurrentModName)+1;
- trim_line(data);
-
-#ifdef _WIN32
- if (strcmp(data, "windows")==0)
-#elif defined(__linux__)
- if (strcmp(data, "linux")==0)
-#elif defined(__APPLE__)
- if (strcmp(data, "mac")==0)
-#endif
- {
- return 1;
- }
- }
- return 0;
-}
-int read_number(char *input)
-{
- char *end; /* Temporary pointer, needed for strtoul(). */
-
- // if begins with 0x or 0X it's to be interpretted as hex
- if (*input=='0' &&
- (*(input+1)=='x' || *(input+1)=='X'))
- {
- return strtoul(input,&end,16);
- }
-
- // otherwise it's to be interpretted as base 10
- return strtoul(input,&end,10);
-}
-void process_pev(char *data)
-{
- trim_line(data);
- Offsets.SetPev(read_number(data));
-}
-void process_base(char *data)
-{
- trim_line(data);
- Offsets.SetBase(read_number(data));
-}
-void process_key(char *data)
-{
- size_t size=0;
-
- char *a=data;
-
- while (*a != ' ' && *a != '\t' && *a != '\0')
- {
- a++;
- size++;
- }
-
- if (size==0)
- {
- return;
- }
- int set=0;
- for (int i=0; i< HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
- {
- if (strncmp(data, hooklist[i].name, size)==0)
- {
- data+=size+1;
-
- trim_line(data);
- int value=read_number(data);
-
- hooklist[i].isset=1;
- hooklist[i].vtid=value;
-
-
- set=1;
- break;
-
- }
- }
-
- if (set==0)
- {
- printf("stray key in process_key: %s\n", data);
- }
-
-}
int ReadConfig(void)
{
- char FileName[512];
+ ConfigManager = MF_GetConfigManager();
- MF_BuildPathnameR(FileName,sizeof(FileName),"%s",get_localinfo("amxx_configsdir","addons/amxmodx/configs"));
+ char error[256] = "";
- strncat(FileName,"/hamdata.ini",sizeof(FileName)-1);
-
- FILE *fp=fopen(FileName,"r");
-
-
- ke::SafeSprintf(CurrentModName, sizeof(CurrentModName), "%s", MF_GetModname());
-
- if (!fp)
+ if (!ConfigManager->LoadGameConfigFile("common.games", &CommonConfig, error, sizeof error))
{
- MF_Log("Unable to open \"%s\" for reading.", FileName);
-
+ MF_Log("common.games gamedata could not be read: %s", error);
return -1;
}
- char data[2048];
+ TypeDescription value;
- int insec=0;
-
- while (!feof(fp))
+ if (CommonConfig->GetOffset("pev", &value))
{
- data[0]='\0';
-
- fgets(data, sizeof(data)-1, fp);
-
- char *b=&data[0];
-
- switch(lex(b))
- {
- case LEX_PEV:
- {
- if (insec)
- {
- process_pev(b);
- }
- break;
- };
- case LEX_BASE:
- {
- if (insec)
- {
- process_base(b);
- }
- break;
- };
- case LEX_MIRROR:
- {
- read_mirror(b);
- break;
- };
- case LEX_START_SEC:
- {
- insec=read_start_section(b);
-
- if (!insec)
- {
- skip_to_end_of_section(fp);
- }
- break;
- };
- case LEX_END_SEC:
- {
- insec=0;
- break;
- };
- case LEX_UNKNOWN:
- {
- if (insec)
- {
- process_key(b);
- }
- };
- }
-
-
+ Offsets.SetPev(value.fieldOffset);
}
- fclose(fp);
+ if (CommonConfig->GetOffset("base", &value))
+ {
+ Offsets.SetBase(value.fieldOffset);
+ }
+
+ for (auto index = 0; index < HAM_LAST_ENTRY_DONT_USE_ME_LOL; ++index)
+ {
+ if (CommonConfig->GetOffset(hooklist[index].name, &value))
+ {
+ hooklist[index].isset = 1;
+ hooklist[index].vtid = value.fieldOffset;
+ }
+ }
return 1;
}
diff --git a/modules/hamsandwich/ham_const.h b/modules/hamsandwich/ham_const.h
index e196dd7c..817b9e79 100644
--- a/modules/hamsandwich/ham_const.h
+++ b/modules/hamsandwich/ham_const.h
@@ -203,7 +203,7 @@ enum
Ham_CheckMeleeAttack2,
Ham_ScheduleChange,
Ham_CanPlaySequence,
- Ham_CanPlaySentence,
+ Ham_CanPlaySentence2,
Ham_PlaySentence,
Ham_PlayScriptedSentence,
Ham_SentenceStop,
@@ -484,6 +484,72 @@ enum
Ham_Item_GetItemInfo,
+ //
+ // New addition - 20117
+ //
+
+ Ham_SC_PreSpawn,
+ Ham_SC_PostSpawn,
+ Ham_SC_OnKeyValueUpdate,
+ Ham_SC_SetClassification,
+ Ham_SC_IsTriggered,
+ Ham_SC_MyCustomPointer,
+ Ham_SC_MyItemPointer,
+ Ham_SC_AddPoints,
+ Ham_SC_AddPointsToTeam,
+ Ham_SC_RemovePlayerItem,
+ Ham_SC_OnControls,
+ Ham_SC_IsSneaking,
+ Ham_SC_IsAlive,
+ Ham_SC_IsBSPModel,
+ Ham_SC_ReflectGauss,
+ Ham_SC_HasTarget,
+ Ham_SC_IsInWorld,
+ Ham_SC_IsPlayer,
+ Ham_SC_IsNetClient,
+ Ham_SC_IsBreakable,
+ Ham_SC_SUB_UseTargets,
+ Ham_SC_IsLockedByMaster,
+ Ham_SC_FBecomeProne,
+ Ham_SC_FVecVisible,
+ Ham_SC_SetPlayerAlly,
+ Ham_SC_OnSetOriginByMap,
+ Ham_SC_IsRevivable,
+ Ham_SC_BeginRevive,
+ Ham_SC_EndRevive,
+ Ham_SC_CanPlaySequence,
+ Ham_SC_CanPlaySentence2,
+ Ham_SC_PlayScriptedSentence,
+ Ham_SC_Item_AddToPlayer,
+ Ham_SC_Item_AddDuplicate,
+ Ham_SC_Item_AddAmmoFromItem,
+ Ham_SC_Item_GetPickupSound,
+ Ham_SC_Item_CanCollect,
+ Ham_SC_Item_Collect,
+ Ham_SC_Item_GetItemInfo,
+ Ham_SC_Item_CanDeploy,
+ Ham_SC_Item_Deploy,
+ Ham_SC_Item_CanHolster,
+ Ham_SC_Item_InactiveItemPreFrame,
+ Ham_SC_Item_InactiveItemPostFrame,
+ Ham_SC_Item_DetachFromPlayer,
+ Ham_SC_Item_UpdateClientData,
+ Ham_SC_Item_GetRespawnTime,
+ Ham_SC_Item_CanHaveDuplicates,
+ Ham_SC_Weapon_ExtractAmmoFromItem,
+ Ham_SC_Weapon_AddWeapon,
+ Ham_SC_Weapon_GetAmmo1Drop,
+ Ham_SC_Weapon_GetAmmo2Drop,
+ Ham_SC_Weapon_PlayEmptySound,
+ Ham_SC_Weapon_IsUsable,
+ Ham_SC_Weapon_FinishReload,
+ Ham_SC_Weapon_ShouldReload,
+ Ham_SC_Weapon_ShouldWeaponIdle,
+ Ham_SC_Weapon_UseDecrement,
+ Ham_SC_Player_EnteredObserver,
+ Ham_SC_Player_LeftObserver,
+ Ham_SC_Player_IsObserver,
+
HAM_LAST_ENTRY_DONT_USE_ME_LOL
};
@@ -492,8 +558,9 @@ enum
HAM_OK = 0,
HAM_INVALID_FUNC, // The function is not valid
- HAM_FUNC_NOT_CONFIGURED, // This function is not configured in hamdata.ini
-
+ HAM_FUNC_NOT_CONFIGURED, // This function is not configured in gamedata
+ HAM_FUNC_NOT_AVAILABLE, // This function is not more available in the mod
+
HAM_ERR_END
};
diff --git a/modules/hamsandwich/ham_utils.h b/modules/hamsandwich/ham_utils.h
index a30f415f..9b8dfa34 100644
--- a/modules/hamsandwich/ham_utils.h
+++ b/modules/hamsandwich/ham_utils.h
@@ -24,16 +24,23 @@ extern HLTypeConversion TypeConversion;
if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \
char msg[1024]; \
ke::SafeSprintf(msg, sizeof(msg), "Function out of bounds. Got: %d Max: %d", x, HAM_LAST_ENTRY_DONT_USE_ME_LOL - 1); \
- FailPlugin(amx, x, HAM_INVALID_FUNC, msg); \
+ FailPlugin(amx, x, HAM_INVALID_FUNC, msg); \
+ return 0; \
+ } else if (hooklist[x].isremoved) { \
+ char msg[1024]; \
+ ke::SafeSprintf(msg, sizeof(msg), "Function %s is no more available in the mod.", hooklist[x].name); \
+ FailPlugin(amx, x, HAM_FUNC_NOT_AVAILABLE, msg); \
return 0; \
} else if (hooklist[x].isset == 0) { \
char msg[1024]; \
- ke::SafeSprintf(msg, sizeof(msg), "Function %s is not configured in hamdata.ini.", hooklist[x].name); \
+ ke::SafeSprintf(msg, sizeof(msg), "Function %s is not configured in gamedata.", hooklist[x].name); \
FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \
return 0; \
}
+
+
#define CHECK_ENTITY(x) \
if (x < 0 || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
diff --git a/modules/hamsandwich/hook.h b/modules/hamsandwich/hook.h
index 4024bdea..744d69be 100644
--- a/modules/hamsandwich/hook.h
+++ b/modules/hamsandwich/hook.h
@@ -39,7 +39,7 @@ public:
char *ent; // ent name that's being hooked
int trampSize;
- Hook(void **vtable_, int entry_, void *target_, bool voidcall, bool retbuf, int paramcount, char *name) :
+ Hook(void **vtable_, int entry_, void *target_, bool voidcall, bool retbuf, int paramcount, const char *name) :
func(NULL), vtable(vtable_), entry(entry_), target(target_), exec(0), del(0), tramp(NULL), trampSize(0)
{
// original function is vtable[entry]
diff --git a/modules/hamsandwich/hook_callbacks.cpp b/modules/hamsandwich/hook_callbacks.cpp
index 3a1a13cd..9ba1dab9 100644
--- a/modules/hamsandwich/hook_callbacks.cpp
+++ b/modules/hamsandwich/hook_callbacks.cpp
@@ -313,6 +313,39 @@ int Hook_Int_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2)
return ret;
}
+bool Hook_Bool_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2)
+{
+ bool ret = false;
+ bool origret = false;
+
+ PUSH_BOOL()
+
+ MAKE_VECTOR()
+
+ P_FLOAT(f1)
+ P_INT(i1)
+ P_INT(i2)
+
+ PRE_START()
+ , f1, i1, i2
+ PRE_END()
+
+#if defined(_WIN32)
+ origret=reinterpret_cast(hook->func)(pthis, 0, f1, i1, i2);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret=reinterpret_cast(hook->func)(pthis, f1, i1, i2);
+#endif
+
+ POST_START()
+ , f1, i1, i2
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+
+ return ret;
+}
void Hook_Void_Entvar_Int(Hook *hook, void *pthis, entvars_t *ev1, int i1)
{
PUSH_VOID()
@@ -429,6 +462,58 @@ void Hook_Void_Int_Int(Hook *hook, void *pthis, int i1, int i2)
POP()
}
+void Hook_Void_Int_Bool(Hook *hook, void *pthis, int i1, bool i2)
+{
+ PUSH_VOID()
+
+ MAKE_VECTOR()
+
+ P_INT(i1)
+ P_BOOL(i2)
+
+ PRE_START()
+ , i1, i2
+ PRE_END()
+#if defined(_WIN32)
+ reinterpret_cast(hook->func)(pthis, 0, i1, i2);
+#elif defined(__linux__) || defined(__APPLE__)
+ reinterpret_cast(hook->func)(pthis, i1, i2);
+#endif
+
+ POST_START()
+ , i1, i2
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+}
+
+void Hook_Void_Bool_Bool(Hook *hook, void *pthis, bool i1, bool i2)
+{
+ PUSH_VOID()
+
+ MAKE_VECTOR()
+
+ P_BOOL(i1)
+ P_BOOL(i2)
+
+ PRE_START()
+ , i1, i2
+ PRE_END()
+#if defined(_WIN32)
+ reinterpret_cast(hook->func)(pthis, 0, i1, i2);
+#elif defined(__linux__) || defined(__APPLE__)
+ reinterpret_cast(hook->func)(pthis, i1, i2);
+#endif
+
+ POST_START()
+ , i1, i2
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+}
+
int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i2)
{
int ret=0;
@@ -500,6 +585,42 @@ int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, i
return ret;
}
+int Hook_Int_Int_Str_Int_Bool(Hook *hook, void *pthis, int i1, const char *sz1, int i2, bool i3)
+{
+ int ret = 0;
+ int origret = 0;
+ ke::AString a;
+
+ PUSH_INT()
+
+ a = sz1;
+
+ MAKE_VECTOR()
+
+ P_INT(i1)
+ P_STR(a)
+ P_INT(i2)
+ P_BOOL(i3)
+
+ PRE_START()
+ , i1, a.chars(), i2, i3
+ PRE_END()
+#if defined(_WIN32)
+ origret = reinterpret_cast(hook->func)(pthis, 0, i1, a.chars(), i2, i3);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret = reinterpret_cast(hook->func)(pthis, i1, a.chars(), i2, i3);
+#endif
+
+ POST_START()
+ , i1, a.chars(), i2, i3
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+ return ret;
+}
+
int Hook_Int_Int(Hook *hook, void *pthis, int i1)
{
int ret=0;
@@ -531,6 +652,38 @@ int Hook_Int_Int(Hook *hook, void *pthis, int i1)
return ret;
}
+bool Hook_Bool_Bool(Hook *hook, void *pthis, bool i1)
+{
+ bool ret = false;
+ bool origret = false;
+
+ PUSH_BOOL()
+ MAKE_VECTOR()
+
+ P_BOOL(i1)
+
+ PRE_START()
+ ,i1
+ PRE_END()
+
+#if defined(_WIN32)
+ origret = reinterpret_cast(hook->func)(pthis, 0, i1);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret = reinterpret_cast(hook->func)(pthis, i1);
+#endif
+
+ POST_START()
+ ,i1
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+
+ return ret;
+}
+
+
int Hook_Int_Entvar(Hook *hook, void *pthis, entvars_t *ev1)
{
int ret=0;
@@ -973,6 +1126,36 @@ int Hook_Int_pVector(Hook *hook, void *pthis, Vector *v1)
return ret;
}
+bool Hook_Bool_pVector(Hook *hook, void *pthis, Vector *v1)
+{
+ bool ret = false;
+ bool origret = false;
+
+ PUSH_BOOL()
+
+ MAKE_VECTOR()
+ P_PTRVECTOR(v1)
+
+ PRE_START()
+ , MF_PrepareCellArrayA(reinterpret_cast(v1), 3, false)
+ PRE_END()
+
+#if defined(_WIN32)
+ origret = reinterpret_cast(hook->func)(pthis, 0, v1);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret = reinterpret_cast(hook->func)(pthis, v1);
+#endif
+
+ POST_START()
+ , MF_PrepareCellArrayA(reinterpret_cast(v1), 3, false)
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+ return ret;
+}
+
void Hook_Void_Entvar_Float_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1, float f2)
{
PUSH_VOID()
@@ -1080,9 +1263,13 @@ void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3)
KILL_VECTOR()
POP()
}
-void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
+
+int Hook_Int_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
{
- PUSH_VOID()
+ int ret = 0;
+ int origret = 0;
+
+ PUSH_INT()
MAKE_VECTOR()
@@ -1092,9 +1279,9 @@ void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
,iteminfo
PRE_END()
#if defined(_WIN32)
- reinterpret_cast(hook->func)(pthis, 0, iteminfo);
+ origret = reinterpret_cast(hook->func)(pthis, 0, iteminfo);
#elif defined(__linux__) || defined(__APPLE__)
- reinterpret_cast(hook->func)(pthis, iteminfo);
+ origret = reinterpret_cast(hook->func)(pthis, iteminfo);
#endif
POST_START()
@@ -1103,6 +1290,41 @@ void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
KILL_VECTOR()
POP()
+
+ CHECK_RETURN()
+ return ret;
+}
+
+bool Hook_Bool_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
+{
+ bool ret = false;
+ bool origret = false;
+
+ PUSH_BOOL()
+
+ MAKE_VECTOR()
+
+ P_ITEMINFO(iteminfo)
+
+ PRE_START()
+ ,iteminfo
+ PRE_END()
+#if defined(_WIN32)
+ origret = reinterpret_cast(hook->func)(pthis, 0, iteminfo);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret = reinterpret_cast(hook->func)(pthis, iteminfo);
+#endif
+
+ POST_START()
+ ,iteminfo
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+
+ CHECK_RETURN()
+
+ return ret;
}
float Hook_Float_Void(Hook *hook, void *pthis)
@@ -1404,6 +1626,39 @@ int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2)
return ret;
}
+bool Hook_Bool_Bool_Int(Hook *hook, void *pthis, bool i1, int i2)
+{
+ bool ret = false;
+ bool origret = false;
+
+ PUSH_BOOL()
+
+ MAKE_VECTOR()
+
+ P_BOOL(i1)
+ P_INT(i2)
+
+ PRE_START()
+ ,i1, i2
+ PRE_END()
+
+#if defined(_WIN32)
+ origret = reinterpret_cast(hook->func)(pthis, 0, i1, i2);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret = reinterpret_cast(hook->func)(pthis, i1, i2);
+#endif
+
+ POST_START()
+ ,i1, i2
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+
+ return ret;
+}
+
void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3)
{
ke::AString a;
@@ -1473,6 +1728,42 @@ void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const ch
POP()
}
+void Hook_Void_Str_Float_Float_Float_Bool_Cbase(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3, bool i1, void *cb)
+{
+ ke::AString a;
+
+ PUSH_VOID()
+
+ a = sz1;
+ int iEnt=TypeConversion.cbase_to_id(cb);
+
+ MAKE_VECTOR()
+
+ P_STR(a)
+ P_FLOAT(f1)
+ P_FLOAT(f2)
+ P_FLOAT(f3)
+ P_BOOL(i1)
+ P_CBASE(cb, iEnt)
+
+ PRE_START()
+ ,a.chars(), f1, f2, f3, i1, iEnt
+ PRE_END()
+
+#if defined(_WIN32)
+ reinterpret_cast(hook->func)(pthis, 0, a.chars(), f1, f2, f3, i1, cb);
+#elif defined(__linux__) || defined(__APPLE__)
+ reinterpret_cast(hook->func)(pthis, a.chars(), f1, f2, f3, i1, cb);
+#endif
+
+ POST_START()
+ ,a.chars(), f1, f2, f3, i1, iEnt
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+}
+
int Hook_Int_Vector_Vector_Float_Float(Hook *hook, void *pthis, Vector v1, Vector v2, float f1, float f2)
{
int ret=0;
@@ -1901,6 +2192,42 @@ void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2)
POP()
}
+bool Hook_Bool_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1)
+{
+ bool ret = false;
+ bool origret = false;
+
+ PUSH_BOOL()
+
+ int iEnt =TypeConversion.cbase_to_id(p1);
+
+ MAKE_VECTOR()
+
+ P_CBASE(p1, iEnt)
+ P_INT(i1)
+
+ PRE_START()
+ , iEnt, i1
+ PRE_END()
+
+#if defined(_WIN32)
+ origret = reinterpret_cast(hook->func)(pthis, 0, p1, i1);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret = reinterpret_cast(hook->func)(pthis, p1, i1);
+#endif
+
+ POST_START()
+ , iEnt, i1
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+
+ CHECK_RETURN()
+
+ return ret;
+}
+
void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1)
{
PUSH_VOID()
@@ -1929,6 +2256,35 @@ void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1)
POP()
}
+void Hook_Void_Cbase_Int_Float(Hook *hook, void *pthis, void *p1, int i1, float f1)
+{
+ PUSH_VOID()
+ int iEnt = TypeConversion.cbase_to_id(p1);
+
+ MAKE_VECTOR()
+
+ P_CBASE(p1, iEnt)
+ P_INT(i1)
+ P_FLOAT(f1)
+
+ PRE_START()
+ , iEnt, i1, f1
+ PRE_END()
+
+#if defined(_WIN32)
+ reinterpret_cast(hook->func)(pthis, 0, p1, i1, f1);
+#elif defined(__linux__) || defined(__APPLE__)
+ reinterpret_cast(hook->func)(pthis, p1, i1, f1);
+#endif
+
+ POST_START()
+ , iEnt, i1, f1
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+}
+
void Hook_Void_Str(Hook *hook, void *pthis, const char *sz1)
{
ke::AString a;
@@ -2268,6 +2624,39 @@ int Hook_Int_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1)
return ret;
}
+bool Hook_Bool_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1)
+{
+ bool ret=false;
+ bool origret=false;
+
+ PUSH_BOOL()
+
+ int i1=TypeConversion.cbase_to_id(cb1);
+
+ MAKE_VECTOR()
+
+ P_CBASE(cb1, i1)
+ P_BOOL(b1)
+
+ PRE_START()
+ , i1, b1
+ PRE_END()
+#if defined(_WIN32)
+ origret=reinterpret_cast(hook->func)(pthis, 0, cb1, b1);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret=reinterpret_cast(hook->func)(pthis, cb1, b1);
+#endif
+
+ POST_START()
+ , i1, b1
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+ return ret;
+}
+
int Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2)
{
int ret=0;
@@ -2303,6 +2692,76 @@ int Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2)
return ret;
}
+int Hook_Int_pVector_pVector(Hook *hook, void *pthis, Vector *v1, Vector *v2)
+{
+ int ret=0;
+ int origret=0;
+
+ PUSH_INT()
+
+ MAKE_VECTOR()
+
+ P_PTRVECTOR(v1)
+ P_PTRVECTOR(v2)
+
+ PRE_START()
+ , MF_PrepareCellArrayA(reinterpret_cast(v1), 3, false)
+ , MF_PrepareCellArrayA(reinterpret_cast(v2), 3, false)
+ PRE_END()
+
+#if defined(_WIN32)
+ origret=reinterpret_cast(hook->func)(pthis, 0, v1, v2);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret=reinterpret_cast(hook->func)(pthis, v1, v2);
+#endif
+
+ POST_START()
+ , MF_PrepareCellArrayA(reinterpret_cast(v1), 3, false)
+ , MF_PrepareCellArrayA(reinterpret_cast(v2), 3, false)
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+
+ return ret;
+}
+
+bool Hook_Bool_pVector_pVector(Hook *hook, void *pthis, Vector *v1, Vector *v2)
+{
+ bool ret=false;
+ bool origret=false;
+
+ PUSH_BOOL()
+
+ MAKE_VECTOR()
+
+ P_PTRVECTOR(v1)
+ P_PTRVECTOR(v2)
+
+ PRE_START()
+ , MF_PrepareCellArrayA(reinterpret_cast(v1), 3, false)
+ , MF_PrepareCellArrayA(reinterpret_cast(v2), 3, false)
+ PRE_END()
+
+#if defined(_WIN32)
+ origret=reinterpret_cast(hook->func)(pthis, 0, v1, v2);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret=reinterpret_cast(hook->func)(pthis, v1, v2);
+#endif
+
+ POST_START()
+ , MF_PrepareCellArrayA(reinterpret_cast(v1), 3, false)
+ , MF_PrepareCellArrayA(reinterpret_cast(v2), 3, false)
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+
+ return ret;
+}
+
int Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1)
{
int ret=0;
@@ -2335,6 +2794,38 @@ int Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1)
return ret;
}
+bool Hook_Bool_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1)
+{
+ bool ret=false;
+ bool origret=false;
+
+ PUSH_BOOL()
+ int i1=TypeConversion.entvars_to_id(ev1);
+
+ MAKE_VECTOR()
+ P_ENTVAR(ev1, i1)
+ P_FLOAT(f1)
+
+ PRE_START()
+ ,i1, f1
+ PRE_END()
+
+#if defined(_WIN32)
+ origret=reinterpret_cast(hook->func)(pthis, 0, ev1, f1);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret=reinterpret_cast(hook->func)(pthis, ev1, f1);
+#endif
+
+ POST_START()
+ , i1, f1
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+ CHECK_RETURN()
+ return ret;
+}
+
float Hook_Float_Float(Hook *hook, void *pthis, float f1)
{
float ret=0.0;
@@ -2637,6 +3128,40 @@ bool Hook_Bool_Cbase(Hook *hook, void *pthis, void *cb)
return ret;
}
+bool Hook_Bool_Entvar(Hook *hook, void *pthis, entvars_t *ev1)
+{
+ bool ret = 0;
+ bool origret = 0;
+
+ PUSH_BOOL()
+
+ int e1 = TypeConversion.entvars_to_id(ev1);
+
+ MAKE_VECTOR()
+
+ P_ENTVAR(ev1, e1)
+
+ PRE_START()
+ , e1
+ PRE_END()
+
+#if defined(_WIN32)
+ origret = reinterpret_cast(hook->func)(pthis, 0, ev1);
+#elif defined(__linux__) || defined(__APPLE__)
+ origret = reinterpret_cast(hook->func)(pthis, ev1);
+#endif
+
+ POST_START()
+ , e1
+ POST_END()
+
+ KILL_VECTOR()
+ POP()
+
+ CHECK_RETURN()
+ return ret;
+}
+
bool Hook_Bool_Int(Hook *hook, void *pthis, int i1)
{
bool ret=0;
diff --git a/modules/hamsandwich/hook_callbacks.h b/modules/hamsandwich/hook_callbacks.h
index d9030856..097d1445 100644
--- a/modules/hamsandwich/hook_callbacks.h
+++ b/modules/hamsandwich/hook_callbacks.h
@@ -50,6 +50,11 @@ const bool RB_Int_Float_Int_Int = false;
const int PC_Int_Float_Int_Int = 3;
int Hook_Int_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2);
+const bool RT_Bool_Float_Int_Int = false;
+const bool RB_Bool_Float_Int_Int = false;
+const int PC_Bool_Float_Int_Int = 3;
+bool Hook_Bool_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2);
+
const bool RT_Void_Entvar_Int = true;
const bool RB_Void_Entvar_Int = false;
const int PC_Void_Entvar_Int = 2;
@@ -70,6 +75,16 @@ const bool RB_Void_Int_Int = false;
const int PC_Void_Int_Int = 2;
void Hook_Void_Int_Int(Hook *hook, void *pthis, int i1, int i2);
+const bool RT_Void_Int_Bool = true;
+const bool RB_Void_Int_Bool = false;
+const int PC_Void_Int_Bool = 2;
+void Hook_Void_Int_Bool(Hook *hook, void *pthis, int i1, bool i2);
+
+const bool RT_Void_Bool_Bool = true;
+const bool RB_Void_Bool_Bool = false;
+const int PC_Void_Bool_Bool = 2;
+void Hook_Void_Bool_Bool(Hook *hook, void *pthis, bool i1, bool i2);
+
const bool RT_Int_Int_Str_Int = false;
const bool RB_Int_Int_Str_Int = false;
const int PC_Int_Int_Str_Int = 3;
@@ -81,11 +96,21 @@ const bool RB_Int_Int_Str_Int_Int = false;
const int PC_Int_Int_Str_Int_Int = 4;
int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i2, int i3);
+const bool RT_Int_Int_Str_Int_Bool = false;
+const bool RB_Int_Int_Str_Int_Bool = false;
+const int PC_Int_Int_Str_Int_Bool = 4;
+int Hook_Int_Int_Str_Int_Bool(Hook *hook, void *pthis, int i1, const char *sz1, int i2, bool i3);
+
const bool RT_Int_Int = false;
const bool RB_Int_Int = false;
const int PC_Int_Int = 1;
int Hook_Int_Int(Hook *hook, void *pthis, int i1);
+const bool RT_Bool_Bool = false;
+const bool RB_Bool_Bool = false;
+const int PC_Bool_Bool = 1;
+bool Hook_Bool_Bool(Hook *hook, void *pthis, bool i1);
+
const bool RT_Int_Entvar = false;
const bool RB_Int_Entvar = false;
const int PC_Int_Entvar = 1;
@@ -177,6 +202,11 @@ const bool RB_Int_pVector = false;
const int PC_Int_pVector = 1;
int Hook_Int_pVector(Hook *hook, void *pthis, Vector *v1);
+const bool RT_Bool_pVector = false;
+const bool RB_Bool_pVector = false;
+const int PC_Bool_pVector = 1;
+bool Hook_Bool_pVector(Hook *hook, void *pthis, Vector *v1);
+
const bool RT_Void_Entvar_Float_Float = true;
const bool RB_Void_Entvar_Float_Float = false;
const int PC_Void_Entvar_Float_Float = 3;
@@ -198,11 +228,15 @@ const bool RB_Void_Int_Int_Int = false;
const int PC_Void_Int_Int_Int = 3;
void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3);
-const bool RT_Void_ItemInfo = true;
-const bool RB_Void_ItemInfo = false;
-const int PC_Void_ItemInfo = 1;
-void Hook_Void_ItemInfo(Hook *hook, void *pthis, void *iteminfo);
+const bool RT_Int_ItemInfo = false;
+const bool RB_Int_ItemInfo = false;
+const int PC_Int_ItemInfo = 1;
+int Hook_Int_ItemInfo(Hook *hook, void *pthis, void *iteminfo);
+const bool RT_Bool_ItemInfo = false;
+const bool RB_Bool_ItemInfo = false;
+const int PC_Bool_ItemInfo = 1;
+bool Hook_Bool_ItemInfo(Hook *hook, void *pthis, void *iteminfo);
const bool RT_Float_Void = false;
const bool RB_Float_Void = false;
@@ -263,6 +297,11 @@ const bool RB_Int_Int_Int = false;
const int PC_Int_Int_Int = 2;
int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2);
+const bool RT_Bool_Bool_Int = false;
+const bool RB_Bool_Bool_Int = false;
+const int PC_Bool_Bool_Int = 2;
+bool Hook_Bool_Bool_Int(Hook *hook, void *pthis, bool i1, int i2);
+
const bool RT_Void_Str_Float_Float_Float = true;
const bool RB_Void_Str_Float_Float_Float = false;
const int PC_Void_Str_Float_Float_Float = 4;
@@ -273,6 +312,11 @@ const bool RB_Void_Str_Float_Float_Float_Int_Cbase = false;
const int PC_Void_Str_Float_Float_Float_Int_Cbase = 6;
void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3, int i1, void *cb);
+const bool RT_Void_Str_Float_Float_Float_Bool_Cbase = true;
+const bool RB_Void_Str_Float_Float_Float_Bool_Cbase = false;
+const int PC_Void_Str_Float_Float_Float_Bool_Cbase = 6;
+void Hook_Void_Str_Float_Float_Float_Bool_Cbase(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3, bool i1, void *cb);
+
const bool RT_Int_Vector_Vector_Float_Float= false;
const bool RB_Int_Vector_Vector_Float_Float = false;
const int PC_Int_Vector_Vector_Float_Float = 8;
@@ -346,11 +390,21 @@ const bool RB_Void_Str_Int = false;
const int PC_Void_Str_Int = 2;
void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2);
+const bool RT_Bool_Cbase_Int = false;
+const bool RB_Bool_Cbase_Int = false;
+const int PC_Bool_Cbase_Int = 2;
+bool Hook_Bool_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1);
+
const bool RT_Void_Cbase_Int = true;
const bool RB_Void_Cbase_Int = false;
const int PC_Void_Cbase_Int = 2;
void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1);
+const bool RT_Void_Cbase_Int_Float = true;
+const bool RB_Void_Cbase_Int_Float = false;
+const int PC_Void_Cbase_Int_Float = 3;
+void Hook_Void_Cbase_Int_Float(Hook *hook, void *pthis, void *p1, int i1, float f1);
+
const bool RT_Void_Str = true;
const bool RB_Void_Str = false;
const int PC_Void_Str = 1;
@@ -401,16 +455,36 @@ const bool RB_Int_Cbase_Bool = false;
const int PC_Int_Cbase_Bool = 2;
int Hook_Int_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1);
+const bool RT_Bool_Cbase_Bool = false;
+const bool RB_Bool_Cbase_Bool = false;
+const int PC_Bool_Cbase_Bool = 2;
+bool Hook_Bool_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1);
+
const bool RT_Int_Vector_Vector = false;
const bool RB_Int_Vector_Vector = false;
const int PC_Int_Vector_Vector = 6;
int Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2);
+const bool RT_Int_pVector_pVector = false;
+const bool RB_Int_pVector_pVector = false;
+const int PC_Int_pVector_pVector = 3;
+int Hook_Int_pVector_pVector(Hook *hook, void *pthis, Vector *v1, Vector *v2);
+
+const bool RT_Bool_pVector_pVector = false;
+const bool RB_Bool_pVector_pVector = false;
+const int PC_Bool_pVector_pVector = 3;
+bool Hook_Bool_pVector_pVector(Hook *hook, void *pthis, Vector *v1, Vector *v2);
+
const bool RT_Int_Entvar_Float = false;
const bool RB_Int_Entvar_Float = false;
const int PC_Int_Entvar_Float = 2;
int Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1);
+const bool RT_Bool_Entvar_Float = false;
+const bool RB_Bool_Entvar_Float = false;
+const int PC_Bool_Entvar_Float = 2;
+bool Hook_Bool_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1);
+
const bool RT_Float_Float = false;
const bool RB_Float_Float = false;
const int PC_Float_Float = 1;
@@ -456,6 +530,11 @@ const bool RB_Bool_Cbase = false;
const int PC_Bool_Cbase = 1;
bool Hook_Bool_Cbase(Hook *hook, void *pthis, void *cb);
+const bool RT_Bool_Entvar = false;
+const bool RB_Bool_Entvar = false;
+const int PC_Bool_Entvar = 1;
+bool Hook_Bool_Entvar(Hook *hook, void *pthis, entvars_t *ev1);
+
const bool RT_Bool_Int = false;
const bool RB_Bool_Int = false;
const int PC_Bool_Int = 1;
diff --git a/modules/hamsandwich/hook_create.cpp b/modules/hamsandwich/hook_create.cpp
index 4b356434..53942a21 100644
--- a/modules/hamsandwich/hook_create.cpp
+++ b/modules/hamsandwich/hook_create.cpp
@@ -43,6 +43,11 @@ int Create_Int_Float_Int_Int(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Bool_Float_Int_Int(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Void_Entvar_Int(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
@@ -63,6 +68,16 @@ int Create_Void_Int_Int(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Void_Int_Bool(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
+}
+
+int Create_Void_Bool_Bool(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Int_Int_Str_Int(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
@@ -73,11 +88,21 @@ int Create_Int_Int_Str_Int_Int(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Int_Int_Str_Int_Bool(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
+
+}
int Create_Int_Int(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Bool_Bool(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Int_Entvar(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
@@ -143,6 +168,11 @@ int Create_Int_pVector(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
}
+int Create_Bool_pVector(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
+}
+
int Create_Void_Entvar_Float_Float(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
@@ -163,7 +193,12 @@ int Create_Void_Int_Int_Int(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
}
-int Create_Void_ItemInfo(AMX *amx, const char *func)
+int Create_Int_ItemInfo(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
+}
+
+int Create_Bool_ItemInfo(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
}
@@ -223,6 +258,11 @@ int Create_Int_Int_Int(AMX* amx, const char* func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Bool_Bool_Int(AMX* amx, const char* func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Void_Str_Float_Float_Float(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_DONE);
@@ -233,6 +273,11 @@ int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Void_Str_Float_Float_Float_Bool_Cbase(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Int_Vector_Vector_Float_Float(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_DONE);
@@ -298,16 +343,27 @@ int Create_Void_Str_Int(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
}
+int Create_Bool_Cbase_Int(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Void_Cbase_Int(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Void_Cbase_Int_Float(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Void_Str(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
}
+
int Create_Void_Vector(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
@@ -338,6 +394,11 @@ int Create_Int_pVector_pVector_Cbase_pFloat(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_FLOAT, FP_DONE);
}
+int Create_Bool_pVector_pVector_Cbase_pFloat(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_FLOAT, FP_DONE);
+}
+
int Create_Void_Cbase_pVector_Float(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_ARRAY, FP_FLOAT, FP_DONE);
@@ -353,16 +414,36 @@ int Create_Int_Cbase_Bool(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Bool_Cbase_Bool(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Int_Vector_Vector(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
}
+int Create_Int_pVector_pVector(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
+}
+
+int Create_Bool_pVector_pVector(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
+}
+
int Create_Int_Entvar_Float(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
}
+int Create_Bool_Entvar_Float(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
+}
+
int Create_Float_Float(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
@@ -408,6 +489,11 @@ int Create_Bool_Cbase(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
}
+int Create_Bool_Entvar(AMX *amx, const char *func)
+{
+ return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
+}
+
int Create_Bool_Int(AMX *amx, const char *func)
{
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
diff --git a/modules/hamsandwich/hook_create.h b/modules/hamsandwich/hook_create.h
index 9c7045cf..b9579d9d 100644
--- a/modules/hamsandwich/hook_create.h
+++ b/modules/hamsandwich/hook_create.h
@@ -27,6 +27,8 @@ int Create_Int_Float_Int(AMX *amx, const char *func);
int Create_Int_Float_Int_Int(AMX *amx, const char *func);
+int Create_Bool_Float_Int_Int(AMX *amx, const char *func);
+
int Create_Void_Entvar_Int(AMX *amx, const char *func);
int Create_Void_Entvar_Entvar_Int(AMX *amx, const char *func);
@@ -35,12 +37,20 @@ int Create_Int_Cbase(AMX *amx, const char *func);
int Create_Void_Int_Int(AMX *amx, const char *func);
+int Create_Void_Int_Bool(AMX *amx, const char *func);
+
+int Create_Void_Bool_Bool(AMX *amx, const char *func);
+
int Create_Int_Int_Str_Int(AMX *amx, const char *func);
int Create_Int_Int_Str_Int_Int(AMX *amx, const char *func);
+int Create_Int_Int_Str_Int_Bool(AMX *amx, const char *func);
+
int Create_Int_Int(AMX *amx, const char *func);
+int Create_Bool_Bool(AMX *amx, const char *func);
+
int Create_Int_Entvar(AMX *amx, const char *func);
int Create_Int_Entvar_Entvar_Float_Int(AMX *amx, const char *func);
@@ -67,6 +77,8 @@ int Create_Vector_pVector(AMX *amx, const char *func);
int Create_Int_pVector(AMX *amx, const char *func);
+int Create_Bool_pVector(AMX *amx, const char *func);
+
int Create_Void_Entvar_Float_Float(AMX *amx, const char *func);
int Create_Void_pFloat_pFloat(AMX *amx, const char *func);
@@ -75,7 +87,9 @@ int Create_Void_Entvar_Float(AMX *amx, const char *func);
int Create_Void_Int_Int_Int(AMX *amx, const char *func);
-int Create_Void_ItemInfo(AMX *amx, const char *func);
+int Create_Int_ItemInfo(AMX *amx, const char *func);
+
+int Create_Bool_ItemInfo(AMX *amx, const char *func);
int Create_Float_Void(AMX *amx, const char *func);
@@ -99,10 +113,14 @@ int Create_Int_Float(AMX* amx, const char* func);
int Create_Int_Int_Int(AMX* amx, const char* func);
+int Create_Bool_Bool_Int(AMX* amx, const char* func);
+
int Create_Void_Str_Float_Float_Float(AMX* amx, const char* func);
int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func);
+int Create_Void_Str_Float_Float_Float_Bool_Cbase(AMX *amx, const char *func);
+
int Create_Int_Vector_Vector_Float_Float(AMX *amx, const char *func);
int Create_Int_Short(AMX* amx, const char* func);
@@ -129,8 +147,12 @@ int Create_Int_Int_Int_Float_Int(AMX *amx, const char *func);
int Create_Void_Str_Int(AMX *amx, const char *func);
+int Create_Bool_Cbase_Int(AMX *amx, const char *func);
+
int Create_Void_Cbase_Int(AMX *amx, const char *func);
+int Create_Void_Cbase_Int_Float(AMX *amx, const char *func);
+
int Create_Void_Str(AMX *amx, const char *func);
int Create_Void_Vector(AMX *amx, const char *func);
@@ -151,10 +173,18 @@ int Create_Int_pVector_pVector_Float_Cbase_pVector(AMX *amx, const char *func);
int Create_Int_Cbase_Bool(AMX *amx, const char *func);
+int Create_Bool_Cbase_Bool(AMX *amx, const char *func);
+
int Create_Int_Vector_Vector(AMX *amx, const char *func);
+int Create_Int_pVector_pVector(AMX *amx, const char *func);
+
+int Create_Bool_pVector_pVector(AMX *amx, const char *func);
+
int Create_Int_Entvar_Float(AMX *amx, const char *func);
+int Create_Bool_Entvar_Float(AMX *amx, const char *func);
+
int Create_Float_Float(AMX *amx, const char *func);
int Create_Void_Entvar_Entvar_Float(AMX *amx, const char *func);
@@ -173,6 +203,8 @@ int Create_Void_Bool(AMX *amx, const char *func);
int Create_Bool_Cbase(AMX *amx, const char *func);
+int Create_Bool_Entvar(AMX *amx, const char *func);
+
int Create_Bool_Int(AMX *amx, const char *func);
int Create_Void_Cbase_Float(AMX *amx, const char *func);
diff --git a/modules/hamsandwich/hook_native.cpp b/modules/hamsandwich/hook_native.cpp
index 4b70a492..2fc197bf 100644
--- a/modules/hamsandwich/hook_native.cpp
+++ b/modules/hamsandwich/hook_native.cpp
@@ -37,7 +37,8 @@ bool gDoForwards=true;
ke::Vector hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
CHamSpecialBotHandler SpecialbotHandler;
-#define V(__KEYNAME, __STUFF__) 0, 0, __KEYNAME, RT_##__STUFF__, RB_##__STUFF__, PC_##__STUFF__, reinterpret_cast(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__
+#define V(__KEYNAME, __STUFF__) 0, 0, __KEYNAME, false, RT_##__STUFF__, RB_##__STUFF__, PC_##__STUFF__, reinterpret_cast(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__
+#define V_REMOVED(__KEYNAME) 0, 0, __KEYNAME, true, RT_Void_Void, RB_Void_Void, PC_Void_Void, nullptr, 0, 0
hook_t hooklist[] =
{
@@ -229,7 +230,7 @@ hook_t hooklist[] =
{ V("checkmeleeattack2", Int_Float_Float) },
{ V("schedulechange", Void_Void) },
{ V("canplaysequence", Int_Int_Int) },
- { V("canplaysentence", Int_Int) },
+ { V("canplaysentence2", Int_Int) },
{ V("playsentence", Void_Str_Float_Float_Float) },
{ V("playscriptedsentence", Void_Str_Float_Float_Float_Int_Cbase) },
{ V("sentencestop", Void_Void) },
@@ -401,23 +402,23 @@ hook_t hooklist[] =
/* Sven co-op */
{ V("sc_getclassification", Int_Int) },
- { V("sc_ismonster", Int_Void) },
- { V("sc_isphysx", Int_Void) },
- { V("sc_ispointentity", Int_Void) },
- { V("sc_ismachine", Int_Void) },
- { V("sc_criticalremove", Int_Void) },
+ { V("sc_ismonster", Bool_Void) },
+ { V_REMOVED("sc_isphysx") },
+ { V("sc_ispointentity", Bool_Void) },
+ { V("sc_ismachine", Bool_Void) },
+ { V("sc_criticalremove", Bool_Void) },
{ V("sc_updateonremove", Void_Void) },
- { V("sc_fvisible", Int_Cbase_Bool) },
- { V("sc_fvisiblefrompos", Int_Vector_Vector) },
- { V("sc_isfacing", Int_Entvar_Float) },
+ { V("sc_fvisible", Bool_Cbase_Bool) },
+ { V("sc_fvisiblefrompos", Bool_pVector_pVector) },
+ { V("sc_isfacing", Bool_Entvar_Float) },
{ V("sc_getpointsfordamage", Float_Float) },
{ V("sc_getdamagepoints", Void_Entvar_Entvar_Float) },
{ V("sc_oncreate", Void_Void) },
{ V("sc_ondestroy", Void_Void) },
- { V("sc_isvalidentity", Bool_Void) },
+ { V_REMOVED("sc_isvalidentity") },
{ V("sc_shouldfadeondeath", Int_Void) },
{ V("sc_setupfriendly", Void_Void) },
- { V("sc_revivethink", Void_Void) },
+ { V_REMOVED("sc_revivethink") },
{ V("sc_revive", Void_Void) },
{ V("sc_startmonster", Void_Void) },
{ V("sc_checkrangeattack1_move",Int_Float_Float) },
@@ -440,10 +441,10 @@ hook_t hooklist[] =
{ V("sc_finbulletcone", Int_Cbase_pVector) },
{ V("sc_callgibmonster", Void_Void) },
{ V("sc_checktimebaseddamage", Void_Void) },
- { V("sc_ismoving", Int_Void) },
+ { V("sc_ismoving", Bool_Void) },
{ V("sc_isplayerfollowing", Int_Void) },
- { V("sc_startplayerfollowing", Void_Cbase) },
- { V("sc_stopplayerfollowing", Void_Int) },
+ { V("sc_startplayerfollowing", Void_Cbase_Bool) },
+ { V("sc_stopplayerfollowing", Void_Bool_Bool) },
{ V("sc_usesound", Void_Void) },
{ V("sc_unusesound", Void_Void) },
{ V("sc_ridemonster", Void_Cbase) },
@@ -454,8 +455,8 @@ hook_t hooklist[] =
{ V("sc_checkrevival", Void_Void) },
{ V("sc_mediccallsound", Void_Void) },
- { V("sc_player_menuinputperformed", Void_Bool) },
- { V("sc_player_ismenuinputdone",Bool_Void) },
+ { V_REMOVED("sc_player_menuinputperformed") },
+ { V_REMOVED("sc_player_ismenuinputdone") },
{ V("sc_player_specialspawn", Void_Void) },
{ V("sc_player_isvalidinfoentity", Bool_Void) },
{ V("sc_player_levelend", Void_Void) },
@@ -470,9 +471,9 @@ hook_t hooklist[] =
{ V("sc_player_resetview", Void_Void) },
{ V("sc_player_getlogfrequency",Float_Void) },
{ V("sc_player_logplayerstats", Bool_Void) },
- { V("sc_player_disablecollisionwithplayer", Void_Cbase_Float) },
- { V("sc_player_enablecollisionwithplayer", Void_Cbase_Bool) },
- { V("sc_player_cantouchplayer", Bool_Cbase) },
+ { V_REMOVED("sc_player_disablecollisionwithplayer") },
+ { V_REMOVED("sc_player_enablecollisionwithplayer") },
+ { V_REMOVED("sc_player_cantouchplayer") },
{ V("sc_item_materialize", Void_Void) },
@@ -483,10 +484,10 @@ hook_t hooklist[] =
{ V("sc_weapon_getw_model", Str_Str) },
{ V("sc_weapon_getv_model", Str_Str) },
{ V("sc_weapon_precachecustommodels", Void_Void) },
- { V("sc_weapon_ismultiplayer", Int_Void) },
- { V("sc_weapon_frunfuncs", Int_Void) },
+ { V("sc_weapon_ismultiplayer", Bool_Void) },
+ { V("sc_weapon_frunfuncs", Bool_Void) },
{ V("sc_weapon_setfov", Void_Int) },
- { V("sc_weapon_fcanrun", Int_Void) },
+ { V("sc_weapon_fcanrun", Bool_Void) },
{ V("sc_weapon_customdecrement",Void_Float) },
{ V("sc_weapon_setv_model", Void_Str) },
{ V("sc_weapon_setp_model", Void_Str) },
@@ -499,11 +500,11 @@ hook_t hooklist[] =
{ V("tfc_weapon_sendweaponanim", Void_Int_Int) },
{ V("tfc_weapon_getnextattackdelay", Float_Float) },
- { V("sc_takehealth",Int_Float_Int_Int) },
- { V("sc_takearmor", Int_Float_Int_Int) },
- { V("sc_giveammo", Int_Int_Str_Int_Int) },
+ { V("sc_takehealth",Bool_Float_Int_Int) },
+ { V("sc_takearmor", Bool_Float_Int_Int) },
+ { V("sc_giveammo", Int_Int_Str_Int_Bool) },
{ V("sc_checkattacker", Int_Cbase) },
- { V("sc_player_isconnected", Int_Void) },
+ { V("sc_player_isconnected", Bool_Void) },
{ V("dod_weapon_sendweaponanim", Void_Int_Int) },
@@ -514,7 +515,69 @@ hook_t hooklist[] =
{ V("ts_weapon_alternateattack", Void_Void) },
- { V("item_getiteminfo", Void_ItemInfo) }
+ { V("item_getiteminfo", Int_ItemInfo) },
+
+ { V("sc_prespawn", Void_Void) },
+ { V("sc_postspawn", Void_Void) },
+ { V("sc_onkeyvalueupdate", Void_Str) },
+ { V("sc_setclassification", Void_Int) },
+ { V("sc_istriggered", Bool_Void) },
+ { V("sc_mycustompointer", Cbase_Void) },
+ { V("sc_myitempointer", Cbase_Void) },
+ { V("sc_addpoints", Void_Int_Bool) },
+ { V("sc_addpointstoteam", Void_Int_Bool) },
+ { V("sc_removeplayeritem", Bool_Cbase) },
+ { V("sc_oncontrols", Bool_Entvar) },
+ { V("sc_issneaking", Bool_Void) },
+ { V("sc_isalive", Bool_Void) },
+ { V("sc_isbspmodel", Bool_Void) },
+ { V("sc_reflectgauss", Bool_Void) },
+ { V("sc_hastarget", Bool_Int) },
+ { V("sc_isinworld", Bool_Void) },
+ { V("sc_isplayer", Bool_Void) },
+ { V("sc_isnetclient", Bool_Void) },
+ { V("sc_isbreakable", Bool_Void) },
+ { V("sc_subusetargets", Void_Cbase_Int_Float) },
+ { V("sc_islockedbymaster", Bool_Void) },
+ { V("sc_fbecomeprone", Bool_Cbase) },
+ { V("sc_fvecvisible", Bool_pVector) },
+ { V("sc_setplayerally", Void_Bool) },
+ { V("sc_onsetoriginbymap", Void_Void) },
+ { V("sc_isrevivable", Bool_Void) },
+ { V("sc_beginrevive", Void_Float) },
+ { V("sc_endrevive", Void_Float) },
+ { V("sc_canplaysequence", Bool_Bool_Int) },
+ { V("sc_canplaysentence2", Bool_Bool) },
+ { V("sc_playscriptedsentence", Void_Str_Float_Float_Float_Bool_Cbase) },
+ { V("sc_item_addtoplayer", Bool_Cbase) },
+ { V("sc_item_addduplicate", Bool_Cbase) },
+ { V("sc_item_addammofromitem", Bool_Cbase) },
+ { V("sc_item_getpickupsound", Str_Void) },
+ { V("sc_item_cancollect", Bool_Cbase_Int) },
+ { V("sc_item_collect", Void_Cbase_Int) },
+ { V("sc_item_getiteminfo", Bool_ItemInfo) },
+ { V("sc_item_candeploy", Bool_Void) },
+ { V("sc_item_deploy", Bool_Void) },
+ { V("sc_item_canholster", Bool_Void) },
+ { V("sc_item_inactiveitempreframe", Void_Void) },
+ { V("sc_item_inactiveitempostframe",Void_Void) },
+ { V("sc_item_detachfromplayer", Void_Void) },
+ { V("sc_item_updateclientdata", Bool_Cbase) },
+ { V("sc_item_getrespawntime", Float_Void) },
+ { V("sc_item_canhaveduplicates",Bool_Void) },
+ { V("sc_weapon_extractammofromitem",Bool_Cbase) },
+ { V("sc_weapon_addweapon", Bool_Void) },
+ { V("sc_weapon_getammo1drop", Int_Void) },
+ { V("sc_weapon_getammo2drop", Int_Void) },
+ { V("sc_weapon_playemptysound", Bool_Void) },
+ { V("sc_weapon_isusable", Bool_Void) },
+ { V("sc_weapon_finishreload", Void_Void) },
+ { V("sc_weapon_shouldreload", Bool_Void) },
+ { V("sc_weapon_shouldweaponidle",Bool_Void) },
+ { V("sc_weapon_usedecrement", Bool_Void) },
+ { V("sc_player_enteredobserver",Void_Void) },
+ { V("sc_player_leftobserver", Void_Void) },
+ { V("sc_player_isobserver", Bool_Void) },
};
@@ -534,21 +597,24 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
CHECK_FUNCTION(func);
- char *function=MF_GetAmxString(amx, params[3], 0, NULL);
- char *classname=MF_GetAmxString(amx, params[2], 1, NULL);
-
+ // Fixes a buffer issue by copying locally the strings.
+ // REMOVE_ENTITY invokes pfnOnFreeEntPrivateData which plugins can hook and `function` and `classname` strings are used after that
+ // but it is pointing to the AMXX static buffer. Basically, hooking this forward and doing stuff inside could invalid all RegisterHam calls.
+ ke::AString function(MF_GetAmxString(amx, params[3], 0, NULL));
+ ke::AString classname(MF_GetAmxString(amx, params[2], 1, NULL));
+
// Check the entity
// create an entity, assign it the gamedll's class, hook it and destroy it
edict_t *Entity=CREATE_ENTITY();
- CALL_GAME_ENTITY(PLID,classname,&Entity->v);
+ CALL_GAME_ENTITY(PLID,classname.chars(),&Entity->v);
if (Entity->pvPrivateData == NULL)
{
REMOVE_ENTITY(Entity);
- MF_LogError(amx, AMX_ERR_NATIVE,"Failed to retrieve classtype for \"%s\", hook for \"%s\" not active.",classname,function);
+ MF_LogError(amx, AMX_ERR_NATIVE,"Failed to retrieve classtype for \"%s\", hook for \"%s\" not active.",classname.chars(),function.chars());
return 0;
}
@@ -558,18 +624,18 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
if (vtable == NULL)
{
- MF_LogError(amx, AMX_ERR_NATIVE,"Failed to retrieve vtable for \"%s\", hook for \"%s\" not active.",classname,function);
+ MF_LogError(amx, AMX_ERR_NATIVE,"Failed to retrieve vtable for \"%s\", hook for \"%s\" not active.",classname.chars(),function.chars());
return 0;
}
// Verify that the function is valid
// Don't fail the plugin if this fails, just emit a normal error
- int fwd=hooklist[func].makefunc(amx, function);
+ int fwd=hooklist[func].makefunc(amx, function.chars());
if (fwd == -1)
{
- MF_LogError(amx, AMX_ERR_NATIVE, "Function %s not found.", function);
+ MF_LogError(amx, AMX_ERR_NATIVE, "Function %s not found.", function.chars());
return 0;
}
@@ -586,9 +652,9 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
pfwd->AddRef();
// We've passed all tests...
- if (strcmp(classname, "player") == 0 && enableSpecialBot)
+ if (strcmp(classname.chars(), "player") == 0 && enableSpecialBot)
{
- SpecialbotHandler.RegisterHamSpecialBot(amx, func, function, post, pfwd);
+ SpecialbotHandler.RegisterHamSpecialBot(amx, func, function.chars(), post, pfwd);
}
int **ivtable=(int **)vtable;
@@ -615,7 +681,7 @@ static cell AMX_NATIVE_CALL RegisterHam(AMX *amx, cell *params)
}
// If we got here, the function is not hooked
- Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname);
+ Hook *hook = new Hook(vtable, hooklist[func].vtid, hooklist[func].targetfunc, hooklist[func].isvoid, hooklist[func].needsretbuf, hooklist[func].paramcount, classname.chars());
hooks[func].append(hook);
if (post)
diff --git a/modules/hamsandwich/hooklist.h b/modules/hamsandwich/hooklist.h
index a4b07fb7..bc48aa0e 100644
--- a/modules/hamsandwich/hooklist.h
+++ b/modules/hamsandwich/hooklist.h
@@ -19,6 +19,7 @@ typedef struct hook_s
int isset; // whether or not this hook is registered with hamdata
int vtid; // vtable index of this function
const char *name; // name used in the keys
+ bool isremoved; // whether or not this function is no more available in the mod
bool isvoid; // whether or not the target trampoline uses voids
bool needsretbuf; // whether or not a pointer to a memory buffer is needed to store a return value
int paramcount; // how many parameters are in the func
diff --git a/modules/hamsandwich/msvc12/hamsandwich.vcxproj b/modules/hamsandwich/msvc12/hamsandwich.vcxproj
index 4d68336a..5fba745b 100644
--- a/modules/hamsandwich/msvc12/hamsandwich.vcxproj
+++ b/modules/hamsandwich/msvc12/hamsandwich.vcxproj
@@ -73,6 +73,8 @@
MachineX86
LIBCMT;
false
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+ .data,RW
@@ -97,6 +99,8 @@
true
$(OutDir)hamsandwich.lib
MachineX86
+ /EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)
+ .data,RW
@@ -135,6 +139,12 @@
+
+
+ ../../../public;
+ ../../../public;
+
+
diff --git a/modules/hamsandwich/msvc12/hamsandwich.vcxproj.filters b/modules/hamsandwich/msvc12/hamsandwich.vcxproj.filters
index c453c475..5036ee1e 100644
--- a/modules/hamsandwich/msvc12/hamsandwich.vcxproj.filters
+++ b/modules/hamsandwich/msvc12/hamsandwich.vcxproj.filters
@@ -33,6 +33,9 @@
{c26eb07d-14b7-49e9-9122-6b7f5a711ecf}
+
+ {ce1c1544-036d-4339-918f-a716641a3b4f}
+
@@ -130,4 +133,9 @@
Pawn Includes
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/modules/json/AMBuilder b/modules/json/AMBuilder
new file mode 100644
index 00000000..309f4a5f
--- /dev/null
+++ b/modules/json/AMBuilder
@@ -0,0 +1,24 @@
+# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
+import os.path
+
+binary = AMXX.MetaModule(builder, 'json')
+
+binary.compiler.defines += [
+ 'HAVE_STDINT_H',
+]
+
+binary.compiler.cxxincludes += [
+ os.path.join(builder.currentSourcePath, '..', '..', 'third_party', 'parson')
+]
+
+binary.sources = [
+ '../../public/sdk/amxxmodule.cpp',
+ '../../third_party/parson/parson.c',
+ 'JsonMngr.cpp',
+ 'JsonNatives.cpp',
+]
+
+if builder.target_platform == 'windows':
+ binary.sources += ['version.rc']
+
+AMXX.modules += [builder.Add(binary)]
diff --git a/modules/json/IJsonMngr.h b/modules/json/IJsonMngr.h
new file mode 100644
index 00000000..6928c209
--- /dev/null
+++ b/modules/json/IJsonMngr.h
@@ -0,0 +1,708 @@
+// vim: set ts=4 sw=4 tw=99 noet:
+//
+// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
+// Copyright (C) The AMX Mod X Development Team.
+//
+// This software is licensed under the GNU General Public License, version 3 or higher.
+// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
+// https://alliedmods.net/amxmodx-license
+
+//
+// JSON Interface
+//
+
+//#include
+
+namespace AMXX
+{
+ /**
+ * @brief Lists of possible handle types.
+ */
+ enum JSONHandleType
+ {
+ Handle_Value = 0,
+ Handle_Array,
+ Handle_Object
+ };
+
+ /**
+ * @brief Lists of possible JSON types.
+ */
+ enum JSONType
+ {
+ JSONTypeError = -1,
+ JSONTypeNull = 1,
+ JSONTypeString = 2,
+ JSONTypeNumber = 3,
+ JSONTypeObject = 4,
+ JSONTypeArray = 5,
+ JSONTypeBoolean = 6
+ };
+
+ /**
+ * @brief Represents a Handle ID.
+ */
+ typedef size_t JS_Handle;
+
+ /**
+ * @brief Provides functions for managing JSON.
+ */
+ class IJSONMngr/* : public AMXXInterface*/
+ {
+ public:
+
+ //virtual unsigned int GetInterfaceVersion() override final { return 1; }
+ //virtual const char *GetInterfaceName() override final { return "IJsonMngr"; }
+
+ virtual ~IJSONMngr() {};
+
+ /**
+ * @brief Checks if handle with specified type is valid.
+ *
+ * @param id JSON handle
+ * @param type Handle's type
+ *
+ * @return True if handle is valid, false otherwise
+ */
+ virtual bool IsValidHandle(JS_Handle id, JSONHandleType type = Handle_Value) = 0;
+
+ /**
+ * @brief Frees handle.
+ *
+ * @param id JSON handle
+ *
+ * @noreturn
+ */
+ virtual void Free(JS_Handle id) = 0;
+
+ /**
+ * @brief Gets JSON type of passed handle.
+ *
+ * @param value JSON handle
+ *
+ * @return JSON type or JSONTypeError if error occurred
+ */
+ virtual JSONType GetHandleJSONType(JS_Handle value) = 0;
+
+ /**
+ * @brief Parses JSON string or a file that contains JSON.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param string String to parse
+ * @param handle Address to variable where value's handle will be stored
+ * @param is_file True to treat string param as filename, false otherwise
+ * @param with_comments True if parsing JSON includes comments (it will ignore them), false otherwise
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool Parse(const char *string, JS_Handle *handle, bool is_file = false, bool with_comments = false) = 0;
+
+ /**
+ * @brief Checks if the first value is the same as the second one.
+ *
+ * @param value1 JSON handle
+ * @param value2 JSON handle
+ *
+ * @return True if they are the same, false otherwise
+ */
+ virtual bool AreValuesEquals(JS_Handle value1, JS_Handle value2) = 0;
+
+ /**
+ * @brief Validates json by checking if object have identically named
+ * fields with matching types.
+ *
+ * @note Schema {"name":"", "age":0} will validate
+ * {"name":"Joe", "age":25} and {"name":"Joe", "age":25, "gender":"m"},
+ * but not {"name":"Joe"} or {"name":"Joe", "age":"Cucumber"}.
+ *
+ * @note In case of arrays, only first value in schema is checked against
+ * all values in tested array.
+ *
+ * @note Empty objects ({}) validate all objects,
+ * empty arrays ([]) validate all arrays,
+ * null validates values of every type.
+ *
+ * @param schema JSON handle
+ * @param value JSON handle
+ *
+ * @return True if passed value is valid, false otherwise
+ */
+ virtual bool IsValueValid(JS_Handle schema, JS_Handle value) = 0;
+
+ /**
+ * @brief Checks if value has parent and assigns it to variable (if provided).
+ *
+ * @note Parent's handle needs to be freed using Free().
+ *
+ * @param value JSON handle
+ * @param parent Address to variable where parent's handle will be stored
+ *
+ * @return True if value has parent, false otherwise
+ */
+ virtual bool GetValueParent(JS_Handle value, JS_Handle *parent = nullptr) = 0;
+
+ /**
+ * @brief Inits an empty object.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool InitObject(JS_Handle *handle) = 0;
+
+ /**
+ * @brief Inits an empty array.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool InitArray(JS_Handle *handle) = 0;
+
+ /**
+ * @brief Inits string data.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param string String that the handle will be initialized with
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool InitString(const char *string, JS_Handle *handle) = 0;
+
+ /**
+ * @brief Inits a number.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param number Number that the handle will be initialized with
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool InitNum(double number, JS_Handle *handle) = 0;
+
+ /**
+ * @brief Inits a boolean value.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param boolean Boolean value that the handle will be initialized with
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool InitBool(bool boolean, JS_Handle *handle) = 0;
+
+ /**
+ * @brief Inits a null.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool InitNull(JS_Handle *handle) = 0;
+
+ /**
+ * @brief Creates deep copy of passed value.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param value JSON handle to be copied
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool DeepCopyValue(JS_Handle value, JS_Handle *handle) = 0;
+
+ /**
+ * @brief Gets a string data.
+ *
+ * @param value JSON handle
+ *
+ * @return String data
+ */
+ virtual const char *ValueToString(JS_Handle value) = 0;
+
+ /**
+ * @brief Gets a number.
+ *
+ * @param value JSON handle
+ *
+ * @return Number
+ */
+ virtual double ValueToNum(JS_Handle value) = 0;
+
+ /**
+ * @brief Gets a boolean value.
+ *
+ * @param value JSON handle
+ *
+ * @return Boolean value
+ */
+ virtual bool ValueToBool(JS_Handle value) = 0;
+
+ //JSON Array API
+
+ //Get functions
+
+ /**
+ * @brief Gets a value from the array.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayGetValue(JS_Handle array, size_t index, JS_Handle *handle) = 0;
+
+ /**
+ * @brief Gets string data from the array.
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ *
+ * @return String data
+ */
+ virtual const char *ArrayGetString(JS_Handle array, size_t index) = 0;
+
+ /**
+ * @brief Gets a number from the array.
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ *
+ * @return Number
+ */
+ virtual double ArrayGetNum(JS_Handle array, size_t index) = 0;
+
+ /**
+ * @brief Gets a boolean value from the array.
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ *
+ * @return Boolean value
+ */
+ virtual bool ArrayGetBool(JS_Handle array, size_t index) = 0;
+
+ /**
+ * @brief Gets count of the elements in the array.
+ *
+ * @param array JSON handle
+ *
+ * @return Number of elements in the array
+ */
+ virtual size_t ArrayGetCount(JS_Handle array) = 0;
+
+ //Set functions
+
+ /**
+ * @brief Replaces an element in the array with value.
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ * @param value JSON handle to set
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayReplaceValue(JS_Handle array, size_t index, JS_Handle value) = 0;
+
+ /**
+ * @brief Replaces an element in the array with string.
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ * @param string String to copy
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayReplaceString(JS_Handle array, size_t index, const char *string) = 0;
+
+ /**
+ * @brief Replaces an element in the array with number.
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ * @param number Number to set
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayReplaceNum(JS_Handle array, size_t index, double number) = 0;
+
+ /**
+ * @brief Replaces an element in the array with boolean value.
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ * @param boolean Boolean value to set
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayReplaceBool(JS_Handle array, size_t index, bool boolean) = 0;
+
+ /**
+ * @brief Replaces an element in the array with null.
+ *
+ * @param array JSON handle
+ * @param index Position in the array (starting from 0)
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayReplaceNull(JS_Handle array, size_t index) = 0;
+
+ /**
+ * @brief Appends a value in the array.
+ *
+ * @param array JSON handle
+ * @param value JSON handle
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayAppendValue(JS_Handle array, JS_Handle value) = 0;
+
+ /**
+ * @brief Appends string data in the array.
+ *
+ * @param array JSON handle
+ * @param string String to copy
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayAppendString(JS_Handle array, const char *string) = 0;
+
+ /**
+ * @brief Appends a number in the array.
+ *
+ * @param array JSON handle
+ * @param string Number to set
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayAppendNum(JS_Handle array, double number) = 0;
+
+ /**
+ * @brief Appends a boolean value in the array.
+ *
+ * @param array JSON handle
+ * @param boolean Boolean value to set
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayAppendBool(JS_Handle array, bool boolean) = 0;
+
+ /**
+ * @brief Appends a null in the array.
+ *
+ * @param array JSON handle
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayAppendNull(JS_Handle array) = 0;
+
+ //Remove functions
+
+ /**
+ * @brief Removes an element from the array.
+ *
+ * @note Order of values in array may change during execution.
+ *
+ * @param array JSON handle
+ * @param position Position in the array (starting from 0)
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayRemove(JS_Handle array, size_t index) = 0;
+
+ /**
+ * @brief Removes all elements from the array.
+ *
+ * @param array JSON handle
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ArrayClear(JS_Handle array) = 0;
+
+ //Wrappers for Object API
+
+ //Get functions
+
+ /**
+ * @brief Gets a value from the object.
+ *
+ * @note Handle needs to be freed using Free().
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param handle Address to variable where value's handle will be stored
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectGetValue(JS_Handle object, const char *name, JS_Handle *handle, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Gets string data from the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return String data
+ */
+ virtual const char *ObjectGetString(JS_Handle object, const char *name, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Gets a number from the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return Number
+ */
+ virtual double ObjectGetNum(JS_Handle object, const char *name, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Gets a boolean value from the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return Boolean value
+ */
+ virtual bool ObjectGetBool(JS_Handle object, const char *name, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Gets count of the keys in the object.
+ *
+ * @param object JSON handle
+ *
+ * @return Keys count
+ */
+ virtual size_t ObjectGetCount(JS_Handle object) = 0;
+
+ /**
+ * @brief Gets name of the object's key.
+ *
+ * @param object JSON handle
+ * @param index Position from which get key name
+ *
+ * @return Key name
+ */
+ virtual const char *ObjectGetName(JS_Handle object, size_t index) = 0;
+
+ /**
+ * @brief Gets a value at the specified position from the object.
+ *
+ * @note Handle needs to be freed using Free().
+ *
+ * @param object JSON handle
+ * @param index Position from which get key name
+ * @param handle Address to variable where value's handle will be stored
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectGetValueAt(JS_Handle object, size_t index, JS_Handle *handle) = 0;
+
+ /**
+ * @brief Checks if object has a value with a specific name and type.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param type Type of value, if JSONTypeError type will not be checked
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return True if has, false if not
+ */
+ virtual bool ObjectHasValue(JS_Handle object, const char *name, JSONType type = JSONTypeError, bool dotfunc = false) = 0;
+
+ //Set functions
+
+ /**
+ * @brief Sets a value in the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ * @note It also removes the old value if any.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param value JSON handle
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectSetValue(JS_Handle object, const char *name, JS_Handle value, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Sets string data in the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ * @note It also removes the old value if any.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param string String to copy
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectSetString(JS_Handle object, const char *name, const char *string, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Sets a number in the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ * @note It also removes the old value if any.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param number Number to set
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectSetNum(JS_Handle object, const char *name, double number, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Sets a boolean value in the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ * @note It also removes the old value if any.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param boolean Boolean value to set
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectSetBool(JS_Handle object, const char *name, bool boolean, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Sets a null in the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ * @note It also removes the old value if any.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectSetNull(JS_Handle object, const char *name, bool dotfunc = false) = 0;
+
+ //Remove functions
+
+ /**
+ * @brief Removes a key and its value in the object.
+ *
+ * @note If dot notation is used some values may be inaccessible
+ * because valid names in JSON can contain dots.
+ *
+ * @param object JSON handle
+ * @param name Key name
+ * @param dotfunc True to use dot notation, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectRemove(JS_Handle object, const char *name, bool dotfunc = false) = 0;
+
+ /**
+ * @brief Removes all keys and their values in the object.
+ *
+ * @param object JSON handle
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool ObjectClear(JS_Handle object) = 0;
+
+ //Serialization API
+
+ /**
+ * @brief Gets size of serialization.
+ *
+ * @param value JSON handle
+ * @param pretty True to count size for pretty format, false to not
+ *
+ * @return Size of serialized string
+ */
+ virtual size_t SerialSize(JS_Handle value, bool pretty) = 0;
+
+ /**
+ * @brief Copies serialized string to the buffer.
+ *
+ * @note The buffer must be large enough or function will
+ * fail.
+ *
+ * @param value JSON handle
+ * @param buffer Buffer to copy string to
+ * @param size Size of the buffer
+ * @param pretty True to format pretty JSON string, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool SerialToBuffer(JS_Handle value, char *buffer, size_t size, bool pretty) = 0;
+
+ /**
+ * @brief Copies serialized string to the file.
+ *
+ * @param value JSON handle
+ * @param filepath Path to the file
+ * @param pretty True to format pretty JSON string, false to not
+ *
+ * @return True if succeed, false otherwise
+ */
+ virtual bool SerialToFile(JS_Handle value, const char *filepath, bool pretty) = 0;
+
+ /**
+ * @brief Returns serialized string.
+ *
+ * @note Must be freed using FreeString().
+ *
+ * @param value JSON handle
+ * @param pretty True to format pretty JSON string, false to not
+ *
+ * @return Serialized string, nullptr if failed
+ */
+ virtual char *SerialToString(JS_Handle value, bool pretty) = 0;
+
+ /**
+ * @brief Frees serialized string.
+ *
+ * @param string Pointer to serialized string
+ *
+ * @noreturn
+ */
+ virtual void FreeString(char *string) = 0;
+ };
+}
diff --git a/modules/json/JsonMngr.cpp b/modules/json/JsonMngr.cpp
new file mode 100644
index 00000000..c48dcfae
--- /dev/null
+++ b/modules/json/JsonMngr.cpp
@@ -0,0 +1,467 @@
+// vim: set ts=4 sw=4 tw=99 noet:
+//
+// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
+// Copyright (C) The AMX Mod X Development Team.
+//
+// This software is licensed under the GNU General Public License, version 3 or higher.
+// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
+// https://alliedmods.net/amxmodx-license
+
+//
+// JSON Class
+//
+
+#include "JsonMngr.h"
+
+JSONMngr::~JSONMngr()
+{
+ for (auto &i : m_Handles)
+ {
+ if (i)
+ {
+ _FreeHandle(i);
+ }
+ }
+}
+
+JS_Handle JSONMngr::_MakeHandle(void *value, JSONHandleType type, bool must_be_freed)
+{
+ JS_Handle id;
+
+ if (!m_OldHandles.empty())
+ {
+ id = m_OldHandles.popFrontCopy();
+ m_Handles[id] = ke::AutoPtr(new JSONHandle);
+ }
+ else
+ {
+ m_Handles.append(ke::AutoPtr(new JSONHandle));
+ id = m_Handles.length() - 1;
+ }
+
+ switch (type)
+ {
+ case Handle_Value:
+ {
+ auto getHandleType = [this](JSON_Value *jsvalue, JS_Handle id)
+ {
+ if (!(m_Handles[id]->m_pArray = json_value_get_array(jsvalue)))
+ {
+ m_Handles[id]->m_pObject = json_value_get_object(jsvalue);
+ }
+ };
+
+ auto JSValue = m_Handles[id]->m_pValue = static_cast(value);
+ getHandleType(JSValue, id);
+ break;
+ }
+ case Handle_Array:
+ {
+ auto JSArray = m_Handles[id]->m_pArray = static_cast(value);
+ m_Handles[id]->m_pValue = json_array_get_wrapping_value(JSArray);
+ break;
+ }
+ case Handle_Object:
+ {
+ auto JSObject = m_Handles[id]->m_pObject = static_cast(value);
+ m_Handles[id]->m_pValue = json_object_get_wrapping_value(JSObject);
+ break;
+ }
+ }
+
+ m_Handles[id]->m_bMustBeFreed = must_be_freed;
+
+ return id;
+}
+
+void JSONMngr::_FreeHandle(ke::AutoPtr &ptr)
+{
+ if (ptr->m_bMustBeFreed && ptr->m_pValue)
+ {
+ json_value_free(ptr->m_pValue);
+ }
+}
+
+void JSONMngr::Free(JS_Handle id)
+{
+ auto handle = ke::Move(m_Handles[id]);
+
+ if (!handle)
+ {
+ return;
+ }
+
+ _FreeHandle(handle);
+ m_OldHandles.append(id);
+}
+
+bool JSONMngr::IsValidHandle(JS_Handle handle, JSONHandleType type)
+{
+ if (handle >= m_Handles.length() || !m_Handles[handle])
+ {
+ return false;
+ }
+
+ switch (type)
+ {
+ case Handle_Array: return m_Handles[handle]->m_pArray != nullptr;
+ case Handle_Object: return m_Handles[handle]->m_pObject != nullptr;
+ default: return true;
+ }
+}
+
+bool JSONMngr::GetValueParent(JS_Handle value, JS_Handle *parent)
+{
+ auto JSParent = json_value_get_parent(m_Handles[value]->m_pValue);
+ if (!JSParent)
+ {
+ return false;
+ }
+
+ if (parent)
+ {
+ *parent = _MakeHandle(JSParent, Handle_Value);
+ }
+
+ return true;
+}
+
+bool JSONMngr::InitObject(JS_Handle *handle)
+{
+ auto JSObject = json_value_get_object(json_value_init_object());
+ if (!JSObject)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSObject, Handle_Object, true);
+ return true;
+}
+
+bool JSONMngr::InitArray(JS_Handle *handle)
+{
+ auto JSArray = json_value_get_array(json_value_init_array());
+ if (!JSArray)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSArray, Handle_Array, true);
+ return true;
+}
+
+bool JSONMngr::InitString(const char *string, JS_Handle *handle)
+{
+ auto JSValue = json_value_init_string(string);
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value, true);
+ return true;
+}
+
+bool JSONMngr::InitNum(double number, JS_Handle *handle)
+{
+ auto JSValue = json_value_init_number(number);
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value, true);
+ return true;
+}
+
+bool JSONMngr::InitBool(bool boolean, JS_Handle *handle)
+{
+ auto JSValue = json_value_init_boolean(boolean);
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value, true);
+ return true;
+}
+
+bool JSONMngr::InitNull(JS_Handle *handle)
+{
+ auto JSValue = json_value_init_null();
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value, true);
+ return true;
+}
+
+bool JSONMngr::Parse(const char *string, JS_Handle *handle, bool is_file, bool with_comments)
+{
+ auto jsonFunc = (!with_comments) ? json_parse_string : json_parse_string_with_comments;
+ if (is_file)
+ {
+ jsonFunc = (!with_comments) ? json_parse_file : json_parse_file_with_comments;
+ }
+
+ auto JSValue = jsonFunc(string);
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value, true);
+ return true;
+}
+
+bool JSONMngr::DeepCopyValue(JS_Handle value, JS_Handle *handle)
+{
+ auto JSValue = json_value_deep_copy(m_Handles[value]->m_pValue);
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value, true);
+ return true;
+}
+
+const char *JSONMngr::ValueToString(JS_Handle value)
+{
+ auto string = json_value_get_string(m_Handles[value]->m_pValue);
+ return (string) ? string : "";
+}
+
+bool JSONMngr::ArrayGetValue(JS_Handle array, size_t index, JS_Handle *handle)
+{
+ auto JSValue = json_array_get_value(m_Handles[array]->m_pArray, index);
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value);
+ return true;
+}
+
+const char *JSONMngr::ArrayGetString(JS_Handle array, size_t index)
+{
+ auto string = json_array_get_string(m_Handles[array]->m_pArray, index);
+ return (string) ? string : "";
+}
+
+bool JSONMngr::ArrayReplaceValue(JS_Handle array, size_t index, JS_Handle value)
+{
+ auto JSValue = m_Handles[value]->m_pValue;
+
+ //We cannot assign the same value to the different arrays or objects
+ //So if value is already assigned somewhere else let's create a copy of it
+ if (json_value_get_parent(JSValue))
+ {
+ JSValue = json_value_deep_copy(JSValue);
+ }
+ else
+ {
+ //Parson will take care of freeing child values
+ m_Handles[value]->m_bMustBeFreed = false;
+ }
+ return json_array_replace_value(m_Handles[array]->m_pArray, index, JSValue) == JSONSuccess;
+}
+
+bool JSONMngr::ArrayAppendValue(JS_Handle array, JS_Handle value)
+{
+ auto JSValue = m_Handles[value]->m_pValue;
+
+ //We cannot assign the same value to the different arrays or objects
+ //So if value is already assigned somewhere else let's create a copy of it
+ if (json_value_get_parent(JSValue))
+ {
+ JSValue = json_value_deep_copy(JSValue);
+ }
+ else
+ {
+ //Parson will take care of freeing child values
+ m_Handles[value]->m_bMustBeFreed = false;
+ }
+ return json_array_append_value(m_Handles[array]->m_pArray, JSValue) == JSONSuccess;
+}
+
+bool JSONMngr::ObjectGetValue(JS_Handle object, const char *name, JS_Handle *handle, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto JSValue = (!dotfunc) ? json_object_get_value(JSObject, name) :
+ json_object_dotget_value(JSObject, name);
+
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value);
+ return true;
+}
+
+const char *JSONMngr::ObjectGetString(JS_Handle object, const char *name, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto string = (!dotfunc) ? json_object_get_string(JSObject, name) :
+ json_object_dotget_string(JSObject, name);
+
+ return (string) ? string : "";
+}
+
+double JSONMngr::ObjectGetNum(JS_Handle object, const char *name, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ return (!dotfunc) ? json_object_get_number(JSObject, name) :
+ json_object_dotget_number(JSObject, name);
+}
+
+bool JSONMngr::ObjectGetBool(JS_Handle object, const char *name, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto result = (!dotfunc) ? json_object_get_boolean(JSObject, name) :
+ json_object_dotget_boolean(JSObject, name);
+
+ return result == 1;
+}
+
+const char *JSONMngr::ObjectGetName(JS_Handle object, size_t index)
+{
+ auto string = json_object_get_name(m_Handles[object]->m_pObject, index);
+ return (string) ? string : "";
+}
+
+bool JSONMngr::ObjectGetValueAt(JS_Handle object, size_t index, JS_Handle *handle)
+{
+ auto JSValue = json_object_get_value_at(m_Handles[object]->m_pObject, index);
+ if (!JSValue)
+ {
+ return false;
+ }
+
+ *handle = _MakeHandle(JSValue, Handle_Value);
+ return true;
+}
+
+bool JSONMngr::ObjectHasValue(JS_Handle object, const char *name, JSONType type, bool dotfunc)
+{
+ int result;
+ auto JSObject = m_Handles[object]->m_pObject;
+
+ if (type == JSONTypeError)
+ {
+ result = (!dotfunc) ? json_object_has_value(JSObject, name) :
+ json_object_dothas_value(JSObject, name);
+ }
+ else
+ {
+ result = (!dotfunc) ? json_object_has_value_of_type(JSObject, name, type) :
+ json_object_dothas_value_of_type(JSObject, name, type);
+ }
+ return result == 1;
+}
+
+bool JSONMngr::ObjectSetValue(JS_Handle object, const char *name, JS_Handle value, bool dotfunc)
+{
+ auto JSValue = m_Handles[value]->m_pValue;
+
+ //We cannot assign the same value to the different arrays or objects
+ //So if value is already assigned somewhere else let's create a copy of it
+ if (json_value_get_parent(JSValue))
+ {
+ JSValue = json_value_deep_copy(JSValue);
+ }
+ else
+ {
+ //Parson will take care of freeing child values
+ m_Handles[value]->m_bMustBeFreed = false;
+ }
+
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto JSResult = (!dotfunc) ? json_object_set_value(JSObject, name, JSValue) :
+ json_object_dotset_value(JSObject, name, JSValue);
+
+ return JSResult == JSONSuccess;
+}
+
+bool JSONMngr::ObjectSetString(JS_Handle object, const char *name, const char *string, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto JSResult = (!dotfunc) ? json_object_set_string(JSObject, name, string) :
+ json_object_dotset_string(JSObject, name, string);
+
+ return JSResult == JSONSuccess;
+}
+
+bool JSONMngr::ObjectSetNum(JS_Handle object, const char *name, double number, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto JSResult = (!dotfunc) ? json_object_set_number(JSObject, name, number) :
+ json_object_dotset_number(JSObject, name, number);
+
+ return JSResult == JSONSuccess;
+}
+
+bool JSONMngr::ObjectSetBool(JS_Handle object, const char *name, bool boolean, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto JSResult = (!dotfunc) ? json_object_set_boolean(JSObject, name, boolean) :
+ json_object_dotset_boolean(JSObject, name, boolean);
+
+ return JSResult == JSONSuccess;
+}
+
+bool JSONMngr::ObjectSetNull(JS_Handle object, const char *name, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto JSResult = (!dotfunc) ? json_object_set_null(JSObject, name) :
+ json_object_dotset_null(JSObject, name);
+
+ return JSResult == JSONSuccess;
+}
+
+bool JSONMngr::ObjectRemove(JS_Handle object, const char *name, bool dotfunc)
+{
+ auto JSObject = m_Handles[object]->m_pObject;
+ auto JSResult = (!dotfunc) ? json_object_remove(JSObject, name) :
+ json_object_dotremove(JSObject, name);
+
+ return JSResult == JSONSuccess;
+}
+
+size_t JSONMngr::SerialSize(JS_Handle value, bool pretty)
+{
+ auto JSValue = m_Handles[value]->m_pValue;
+ return (!pretty) ? json_serialization_size(JSValue) :
+ json_serialization_size_pretty(JSValue);
+}
+
+bool JSONMngr::SerialToBuffer(JS_Handle value, char *buffer, size_t size, bool pretty)
+{
+ auto JSValue = m_Handles[value]->m_pValue;
+ auto JSResult = (!pretty) ? json_serialize_to_buffer(JSValue, buffer, size) :
+ json_serialize_to_buffer_pretty(JSValue, buffer, size);
+
+ return JSResult == JSONSuccess;
+}
+
+bool JSONMngr::SerialToFile(JS_Handle value, const char *filepath, bool pretty)
+{
+ auto JSValue = m_Handles[value]->m_pValue;
+ auto JSResult = (!pretty) ? json_serialize_to_file(JSValue, filepath) :
+ json_serialize_to_file_pretty(JSValue, filepath);
+
+ return JSResult == JSONSuccess;
+}
+
+char *JSONMngr::SerialToString(JS_Handle value, bool pretty)
+{
+ auto JSValue = m_Handles[value]->m_pValue;
+ auto result = (!pretty) ? json_serialize_to_string(JSValue) :
+ json_serialize_to_string_pretty(JSValue);
+
+ return (result) ? result : nullptr;
+}
diff --git a/modules/json/JsonMngr.h b/modules/json/JsonMngr.h
new file mode 100644
index 00000000..eb115558
--- /dev/null
+++ b/modules/json/JsonMngr.h
@@ -0,0 +1,196 @@
+// vim: set ts=4 sw=4 tw=99 noet:
+//
+// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
+// Copyright (C) The AMX Mod X Development Team.
+//
+// This software is licensed under the GNU General Public License, version 3 or higher.
+// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
+// https://alliedmods.net/amxmodx-license
+
+//
+// JSON Class
+//
+
+#include
+#include | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |