Merge branch 'master' into menu-number-format

This commit is contained in:
Mistrick 2018-09-28 22:13:02 +07:00 committed by GitHub
commit 4cebec5d96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
172 changed files with 101776 additions and 29693 deletions

74
.github/CONTRIBUTING.md vendored Normal file
View File

@ -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.

25
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@ -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.

View File

@ -291,6 +291,9 @@ class AMXXConfig(object):
'odbccp32.lib', 'odbccp32.lib',
] ]
if cxx.version >= 1900:
cxx.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib']
if builder.options.opt == '1': if builder.options.opt == '1':
cxx.cflags += ['/Ox'] cxx.cflags += ['/Ox']
cxx.linkflags += ['/OPT:ICF', '/OPT:REF'] cxx.linkflags += ['/OPT:ICF', '/OPT:REF']

View File

@ -1,19 +1,22 @@
AMX Mod X
=========
AMX Mod X - Half-Life 1 Scripting and Server Administration <p align="center">
<img src="https://github.com/alliedmodders/amxmodx/blob/master/editor/studio/AMXXLarge.bmp"/>
</p>
**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 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 - [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 - [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 - [Latest release](https://amxmodx.org/downloads.php): The latest stable AMXX release
- [Build snapshots](http://www.amxmodx.org/snapshots.php): Builds of recent development versions - [Build snapshots](https://www.amxmodx.org/downloads-new.php): Builds of recent development versions
Development 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) - [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 - [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 - [AMXX scripting](https://wiki.alliedmods.net/Category:Scripting_(AMX_Mod_X)): Pawn examples and introduction to the language

View File

@ -325,16 +325,16 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
} }
else if (!strcmp(key, "size")) else if (!strcmp(key, "size"))
{ {
TempType.fieldSize = ke::Max<int>(0, atoi(value)); TempType.fieldSize = ke::Max<int>(0, strtol(value, nullptr, 0));
} }
else if (!strcmp(key, "unsigned")) else if (!strcmp(key, "unsigned"))
{ {
TempType.fieldUnsigned = !!atoi(value); TempType.fieldUnsigned = !!strtol(value, nullptr, 0);
} }
else if (g_LibSys.IsPlatformCompatible(key, &m_MatchedPlatform)) else if (g_LibSys.IsPlatformCompatible(key, &m_MatchedPlatform))
{ {
m_FoundOffset = true; m_FoundOffset = true;
TempType.fieldOffset = atoi(value); TempType.fieldOffset = strtol(value, nullptr, 0);
} }
break; break;
} }
@ -397,7 +397,7 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
if (m_AddressReadCount < limit) if (m_AddressReadCount < limit)
{ {
m_AddressRead[m_AddressReadCount] = atoi(value); m_AddressRead[m_AddressReadCount] = strtol(value, nullptr, 0);
m_AddressReadCount++; m_AddressReadCount++;
} }
else else

View File

@ -18,14 +18,14 @@
extern const char *no_function; 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; CPlugin** a = &head;
while (*a) while (*a)
a = &(*a)->next; a = &(*a)->next;
*a = new CPlugin(pCounter++, path, name, error, debug); *a = new CPlugin(pCounter++, path, name, error, maxLength, debug);
return (*a); return (*a);
} }
@ -137,7 +137,7 @@ int CPluginMngr::loadPluginsFromFile(const char* filename, bool warn)
continue; continue;
} }
CPlugin* plugin = loadPlugin(pluginsDir, pluginName, error, debugFlag); CPlugin* plugin = loadPlugin(pluginsDir, pluginName, error, sizeof(error), debugFlag);
if (plugin->getStatusCode() == ps_bad_load) if (plugin->getStatusCode() == ps_bad_load)
{ {
@ -267,7 +267,7 @@ const char* CPluginMngr::CPlugin::getStatus() const
return "error"; 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"; 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); char* path = build_pathname_r(file, sizeof(file), "%s/%s", p, n);
code = 0; code = 0;
memset(&amx, 0, sizeof(AMX)); 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) if (err == AMX_ERR_NONE)
{ {

View File

@ -66,7 +66,7 @@ public:
CPlugin* next; CPlugin* next;
int id; 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(); ~CPlugin();
bool m_Debug; bool m_Debug;
@ -122,7 +122,7 @@ public:
// Interface // 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); void unloadPlugin(CPlugin** a);
int loadPluginsFromFile(const char* filename, bool warn=true); int loadPluginsFromFile(const char* filename, bool warn=true);

View File

@ -1278,8 +1278,16 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
if (g_bmod_cstrike) 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); GET_OFFSET("CBasePlayer", m_iMenu);
set_pdata<int>(pPlayer->pEdict, m_iMenu, 0);
if (get_pdata<int>(pPlayer->pEdict, m_iJoiningState) == Joined || (get_pdata<int>(pPlayer->pEdict, m_iMenu) != Menu_ChooseTeam && get_pdata<int>(pPlayer->pEdict, m_iMenu) != Menu_ChooseAppearance))
{
set_pdata<int>(pPlayer->pEdict, m_iMenu, Menu_OFF);
}
} }
return 0; return 0;

View File

@ -284,6 +284,7 @@ extern "C" size_t get_amxstring_r(AMX *amx, cell amx_addr, char *destination, in
int amxstring_len(cell* cstr); int amxstring_len(cell* cstr);
int load_amxscript(AMX* amx, void** program, const char* path, char error[64], int debug); 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_amxnatives(AMX* amx, char error[64]);
int set_amxstring(AMX *amx, cell amx_addr, const char *source, int max); int set_amxstring(AMX *amx, cell amx_addr, const char *source, int max);
int set_amxstring_simple(cell *dest, const char *source, int max); int set_amxstring_simple(cell *dest, const char *source, int max);

View File

@ -108,7 +108,7 @@ static binlogfuncs_t logfuncs =
}; };
#endif #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; *error = 0;
size_t bufSize; size_t bufSize;
@ -127,7 +127,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
if (!*program) if (!*program)
{ {
strcpy(error, "Failed to allocate memory"); ke::SafeStrcpy(error, maxLength, "Failed to allocate memory");
return (amx->error = AMX_ERR_MEMORY); return (amx->error = AMX_ERR_MEMORY);
} }
@ -140,31 +140,31 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
case CAmxxReader::Err_None: case CAmxxReader::Err_None:
break; break;
case CAmxxReader::Err_FileOpen: case CAmxxReader::Err_FileOpen:
strcpy(error, "Plugin file open error"); ke::SafeStrcpy(error, maxLength, "Plugin file open error");
return (amx->error = AMX_ERR_NOTFOUND); return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_FileRead: case CAmxxReader::Err_FileRead:
strcpy(error, "Plugin file read error"); ke::SafeStrcpy(error, maxLength, "Plugin file read error");
return (amx->error = AMX_ERR_NOTFOUND); return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_InvalidParam: case CAmxxReader::Err_InvalidParam:
strcpy(error, "Internal error: Invalid parameter"); ke::SafeStrcpy(error, maxLength, "Internal error: Invalid parameter");
return (amx->error = AMX_ERR_NOTFOUND); return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_FileInvalid: case CAmxxReader::Err_FileInvalid:
strcpy(error, "Invalid Plugin"); ke::SafeStrcpy(error, maxLength, "Invalid Plugin");
return (amx->error = AMX_ERR_FORMAT); return (amx->error = AMX_ERR_FORMAT);
case CAmxxReader::Err_SectionNotFound: 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); return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_DecompressorInit: case CAmxxReader::Err_DecompressorInit:
strcpy(error, "Decompressor initialization failed"); ke::SafeStrcpy(error, maxLength, "Decompressor initialization failed");
return (amx->error = AMX_ERR_INIT); return (amx->error = AMX_ERR_INIT);
case CAmxxReader::Err_Decompress: case CAmxxReader::Err_Decompress:
strcpy(error, "Internal error: Decompress"); ke::SafeStrcpy(error, maxLength, "Internal error: Decompress");
return (amx->error = AMX_ERR_NOTFOUND); return (amx->error = AMX_ERR_NOTFOUND);
case CAmxxReader::Err_OldFile: 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); return (amx->error = AMX_ERR_FORMAT);
default: default:
strcpy(error, "Unknown error"); ke::SafeStrcpy(error, maxLength, "Unknown error");
return (amx->error = AMX_ERR_NOTFOUND); return (amx->error = AMX_ERR_NOTFOUND);
} }
} else { } else {
@ -178,7 +178,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
if (magic != AMX_MAGIC) if (magic != AMX_MAGIC)
{ {
strcpy(error, "Invalid Plugin"); ke::SafeStrcpy(error, maxLength, "Invalid Plugin");
return (amx->error = AMX_ERR_FORMAT); return (amx->error = AMX_ERR_FORMAT);
} }
@ -191,7 +191,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{ {
if ((hdr->file_version < CUR_FILE_VERSION)) 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); return (amx->error = AMX_ERR_VERSION);
} }
else if ((hdr->flags & AMX_FLAG_DEBUG) != 0) else if ((hdr->flags & AMX_FLAG_DEBUG) != 0)
@ -209,13 +209,13 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{ {
dbg_FreeInfo(pDbg); dbg_FreeInfo(pDbg);
delete 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); return (amx->error = AMX_ERR_INIT);
} }
amx->flags |= AMX_FLAG_DEBUG; amx->flags |= AMX_FLAG_DEBUG;
} else { } 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); return (amx->error = AMX_ERR_INIT);
} }
} else { } else {
@ -238,7 +238,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
delete pDbg; 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); return (amx->error = AMX_ERR_INIT);
} }
@ -276,7 +276,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{ {
delete[] np; delete[] np;
delete[] rt; 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); return (amx->error = AMX_ERR_INIT);
} }
@ -307,14 +307,14 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
if (*program == 0) if (*program == 0)
{ {
strcpy(error, "Failed to allocate memory"); ke::SafeStrcpy(error, maxLength, "Failed to allocate memory");
return (amx->error = AMX_ERR_MEMORY); return (amx->error = AMX_ERR_MEMORY);
} }
} else { } else {
delete[] np; delete[] np;
delete[] rt; 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); return (amx->error = AMX_ERR_INIT_JIT);
} }
@ -325,7 +325,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
if (!script) 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); return (amx->error = AMX_ERR_MEMORY);
} }
@ -341,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) 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); return (amx->error = AMX_ERR_NOTFOUND);
} }
} else { } else {
@ -352,6 +352,17 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
return (amx->error = AMX_ERR_NONE); 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) const char *StrCaseStr(const char *as, const char *bs)
{ {
static char a[256]; static char a[256];
@ -1759,9 +1770,10 @@ void Module_CacheFunctions()
REGISTER_FUNC("GetAmxScriptName", MNF_GetAmxScriptName) REGISTER_FUNC("GetAmxScriptName", MNF_GetAmxScriptName)
REGISTER_FUNC("FindAmxScriptByName", MNF_FindAmxScriptByName) REGISTER_FUNC("FindAmxScriptByName", MNF_FindAmxScriptByName)
REGISTER_FUNC("FindAmxScriptByAmx", MNF_FindAmxScriptByAmx) 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) REGISTER_FUNC("UnloadAmxScript", unload_amxscript)
// String / mem in amx scripts support // String / mem in amx scripts support
REGISTER_FUNC("SetAmxString", set_amxstring) REGISTER_FUNC("SetAmxString", set_amxstring)
REGISTER_FUNC("SetAmxStringUTF8Char", set_amxstring_utf8_char) REGISTER_FUNC("SetAmxStringUTF8Char", set_amxstring_utf8_char)

View File

@ -446,7 +446,10 @@ md -p JIT 2&gt;NUL
<ClInclude Include="..\..\public\sdk\moduleconfig.h" /> <ClInclude Include="..\..\public\sdk\moduleconfig.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\version.rc" /> <ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='JITDebug|Win32'">../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='JITRelease|Win32'">../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\..\plugins\include\cellstack.inc" /> <None Include="..\..\plugins\include\cellstack.inc" />
@ -454,6 +457,7 @@ md -p JIT 2&gt;NUL
<None Include="..\..\plugins\include\cvars.inc" /> <None Include="..\..\plugins\include\cvars.inc" />
<None Include="..\..\plugins\include\datapack.inc" /> <None Include="..\..\plugins\include\datapack.inc" />
<None Include="..\..\plugins\include\gameconfig.inc" /> <None Include="..\..\plugins\include\gameconfig.inc" />
<None Include="..\..\plugins\include\newmenus.inc" />
<None Include="..\..\plugins\include\string_const.inc" /> <None Include="..\..\plugins\include\string_const.inc" />
<None Include="..\..\plugins\include\string_stocks.inc" /> <None Include="..\..\plugins\include\string_stocks.inc" />
<None Include="..\..\plugins\include\textparse_ini.inc" /> <None Include="..\..\plugins\include\textparse_ini.inc" />

View File

@ -54,7 +54,7 @@
</Filter> </Filter>
<Filter Include="ReSDK\engine"> <Filter Include="ReSDK\engine">
<UniqueIdentifier>{04fab577-6f56-40d0-8f69-7ce1b8bf3bb9}</UniqueIdentifier> <UniqueIdentifier>{04fab577-6f56-40d0-8f69-7ce1b8bf3bb9}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Third Party\UTF8Rewind"> <Filter Include="Third Party\UTF8Rewind">
<UniqueIdentifier>{270f3524-564f-4154-bb35-242a6faac09e}</UniqueIdentifier> <UniqueIdentifier>{270f3524-564f-4154-bb35-242a6faac09e}</UniqueIdentifier>
</Filter> </Filter>
@ -693,10 +693,13 @@
<None Include="..\..\plugins\include\string_stocks.inc"> <None Include="..\..\plugins\include\string_stocks.inc">
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
<None Include="..\..\plugins\include\newmenus.inc">
<Filter>Pawn Includes</Filter>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Object Include="..\Jit\helpers-x86.obj"> <Object Include="..\Jit\helpers-x86.obj">
<Filter>Assembly\Builds</Filter> <Filter>Assembly\Builds</Filter>
</Object> </Object>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -10,6 +10,7 @@
#include "amxmodx.h" #include "amxmodx.h"
#include "CMenu.h" #include "CMenu.h"
#include "newmenus.h" #include "newmenus.h"
#include "format.h"
ke::Vector<Menu *> g_NewMenus; ke::Vector<Menu *> g_NewMenus;
CStack<int> g_MenuFreeStack; CStack<int> g_MenuFreeStack;
@ -90,9 +91,9 @@ bool CloseNewMenus(CPlayer *pPlayer)
return true; return true;
} }
Menu::Menu(const char *title, AMX *amx, int fid) : m_Title(title), m_ItemColor("\\r"), m_NumberFormat("%d."), Menu::Menu(const char *title, AMX *amx, int fid, bool use_ml) : m_Title(title), m_ItemColor("\\r"), m_NumberFormat("%d."),
m_NeverExit(false), m_AutoColors(g_coloredmenus), thisId(0), func(fid), m_NeverExit(false), m_AutoColors(g_coloredmenus), thisId(0), func(fid),
isDestroying(false), pageCallback(-1), showPageNumber(true), 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); CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(amx);
menuId = g_menucmds.registerMenuId(title, amx); menuId = g_menucmds.registerMenuId(title, amx);
@ -356,18 +357,32 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
m_Text = nullptr; 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]; char buffer[255];
if (showPageNumber && items_per_page && (pages != 1)) if (showPageNumber && items_per_page && (pages != 1))
{ {
if (m_AutoColors) 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 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 { } else {
if (m_AutoColors) 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 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; m_Text = m_Text + buffer;
@ -464,27 +479,40 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
option_display = 0; option_display = 0;
} }
ke::SafeSprintf(number_format, sizeof(number_format), m_NumberFormat.chars(), option_display); ke::SafeSprintf(number_format, sizeof(number_format), m_NumberFormat.chars(), option_display);
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) if (pItem->isBlank)
{ {
ke::SafeSprintf(buffer, sizeof(buffer), "%s\n", pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "%s\n", itemName);
} }
else if (enabled) else if (enabled)
{ {
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, sizeof(buffer), "%s%s\\w %s\n", m_ItemColor.chars(), number_format, itemName);
ke::SafeSprintf(buffer, sizeof(buffer), "%s%s\\w %s\n", m_ItemColor.chars(), number_format, pItem->name.chars());
} else { } else {
ke::SafeSprintf(buffer, sizeof(buffer), "%s %s\n", number_format, pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "%s %s\n", number_format, itemName);
} }
} else { } else {
if (m_AutoColors) if (m_AutoColors)
{ {
ke::SafeSprintf(buffer, sizeof(buffer), "\\d%s\\d %s\n\\w", number_format, pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "\\d%s\\d %s\n\\w", number_format, itemName);
} else { } else {
ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", pItem->name.chars()); ke::SafeSprintf(buffer, sizeof(buffer), "#. %s\n", itemName);
} }
} }
slots++; slots++;
@ -631,38 +659,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()); \ LogError(amx, AMX_ERR_NATIVE, "Invalid menu id %d(%d)", p, g_NewMenus.length()); \
return 0; } return 0; }
//Makes a new menu handle (-1 for failure) // native menu_create(const title[], const handler[], bool:ml = false);
//native csdm_makemenu(title[]);
static cell AMX_NATIVE_CALL menu_create(AMX *amx, cell *params) static cell AMX_NATIVE_CALL menu_create(AMX *amx, cell *params)
{ {
int len; enum args { arg_count, arg_title, arg_handler, arg_ml };
char *title = get_amxstring(amx, params[1], 0, len);
validate_menu_text(title);
char *handler = get_amxstring(amx, params[2], 1, len);
int func = registerSPForwardByName(amx, handler, FP_CELL, FP_CELL, FP_CELL, FP_DONE); int length;
const auto title = get_amxstring(amx, params[arg_title], 0, length);
if (func == -1) 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; 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()) if (g_MenuFreeStack.empty())
{ {
g_NewMenus.append(pMenu); g_NewMenus.append(pMenu);
pMenu->thisId = (int)g_NewMenus.length() - 1;
} else { pMenu->thisId = static_cast<int>(g_NewMenus.length()) - 1;
int pos = g_MenuFreeStack.front(); }
else
{
const auto position = g_MenuFreeStack.front();
g_MenuFreeStack.pop(); g_MenuFreeStack.pop();
g_NewMenus[pos] = pMenu; g_NewMenus[position] = pMenu;
pMenu->thisId = pos;
pMenu->thisId = position;
} }
return pMenu->thisId; return pMenu->thisId;
} }
static cell AMX_NATIVE_CALL menu_addblank(AMX *amx, cell *params) static cell AMX_NATIVE_CALL menu_addblank(AMX *amx, cell *params)
{ {
GETMENU(params[1]); GETMENU(params[1]);
@ -836,8 +871,16 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
if (g_bmod_cstrike) 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); GET_OFFSET("CBasePlayer", m_iMenu);
set_pdata<int>(pPlayer->pEdict, m_iMenu, 0);
if (get_pdata<int>(pPlayer->pEdict, m_iJoiningState) == Joined || (get_pdata<int>(pPlayer->pEdict, m_iMenu) != Menu_ChooseTeam && get_pdata<int>(pPlayer->pEdict, m_iMenu) != Menu_ChooseAppearance))
{
set_pdata<int>(pPlayer->pEdict, m_iMenu, Menu_OFF);
}
} }
int time = -1; int time = -1;

View File

@ -96,7 +96,7 @@ typedef unsigned int page_t;
class Menu class Menu
{ {
public: public:
Menu(const char *title, AMX *amx, int fid); Menu(const char *title, AMX *amx, int fid, bool use_ml);
~Menu(); ~Menu();
menuitem *GetMenuItem(item_t item); menuitem *GetMenuItem(item_t item);
@ -129,6 +129,8 @@ public:
bool isDestroying; bool isDestroying;
int pageCallback; int pageCallback;
bool showPageNumber; bool showPageNumber;
bool useMultilingual;
AMX *amx;
public: public:
unsigned int items_per_page; unsigned int items_per_page;
}; };

View File

@ -44,7 +44,12 @@ cell destroyParser(cell *handle)
// native SMCParser:SMC_CreateParser(); // native SMCParser:SMC_CreateParser();
static cell AMX_NATIVE_CALL SMC_CreateParser(AMX *amx, cell *params) 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[]); // 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(); // native INIParser:INI_CreateParser();
static cell AMX_NATIVE_CALL INI_CreateParser(AMX *amx, cell *params) 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); // native bool:INI_ParseFile(INIParser:handle, const file[], &line = 0, &col = 0, any:data = 0);

View File

@ -6,13 +6,7 @@
// Generated from the TEXTINCLUDE 2 resource. // Generated from the TEXTINCLUDE 2 resource.
// //
#include <winresrc.h> #include <winresrc.h>
#if defined AMBUILD #include <amxmodx_version.h>
# include <amxmodx_version.h>
#else
# define SVN_VERSION_DWORD 1, 8, 3, 0
# define SVN_VERSION_STRING "dev-local"
# define SVN_VERSION SVN_VERSION_STRING
#endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
@ -32,8 +26,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION SVN_VERSION_DWORD FILEVERSION AMXX_VERSION_FILE
PRODUCTVERSION SVN_VERSION_DWORD PRODUCTVERSION AMXX_VERSION_FILE
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -50,12 +44,12 @@ BEGIN
BEGIN BEGIN
VALUE "Comments", "AMX Mod X" VALUE "Comments", "AMX Mod X"
VALUE "FileDescription", "AMX Mod X" VALUE "FileDescription", "AMX Mod X"
VALUE "FileVersion", SVN_VERSION_STRING VALUE "FileVersion", AMXX_VERSION_STRING
VALUE "InternalName", "amxmodx" VALUE "InternalName", "amxmodx"
VALUE "LegalCopyright", "Copyright (c) 2004-2015, AMX Mod X Dev Team" VALUE "LegalCopyright", "Copyright (c) 2004-2015, AMX Mod X Dev Team"
VALUE "OriginalFilename", "amxmodx_mm.dll" VALUE "OriginalFilename", "amxmodx_mm.dll"
VALUE "ProductName", "AMX Mod X" VALUE "ProductName", "AMX Mod X"
VALUE "ProductVersion", SVN_VERSION VALUE "ProductVersion", AMXX_VERSION_STRING
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -12,10 +12,11 @@ install:
- git clone https://github.com/alliedmodders/ambuild - git clone https://github.com/alliedmodders/ambuild
- git clone https://github.com/alliedmodders/metamod-hl1 - git clone https://github.com/alliedmodders/metamod-hl1
- git clone https://github.com/alliedmodders/hlsdk - git clone https://github.com/alliedmodders/hlsdk
- ps: Start-FileDownload 'https://cdn.mysql.com/archives/mysql-5.5/mysql-5.5.54-win32.zip' - ps: Start-FileDownload 'https://downloads.mysql.com/archives/get/file/mysql-connector-c-6.1.1-win32.zip'
- 7z x mysql-5.5.54-win32.zip -o"mysql" - 7z x mysql-connector-c-6.1.1-win32.zip -o"mysql"
- cd mysql - cd mysql
- ren mysql-5.5.54-win32 mysql-5.5 - dir
- ren mysql-connector-c-6.1.1-win32 mysql-5.5
- move /Y mysql-5.5 ..\ - move /Y mysql-5.5 ..\
- cd ..\ambuild - cd ..\ambuild
- c:\python27\python setup.py install - c:\python27\python setup.py install
@ -24,7 +25,7 @@ cache:
- c:\projects\*.zip -> appveyor.yml - c:\projects\*.zip -> appveyor.yml
- c:\projects\mysql-5.5 -> appveyor.yml - c:\projects\mysql-5.5 -> appveyor.yml
build_script: build_script:
- '"%VS120COMNTOOLS%\vsvars32.bat"' - '"%VS140COMNTOOLS%\vsvars32.bat"'
- mkdir build - mkdir build
- cd build - cd build
- c:\python27\python ../configure.py --enable-optimize --nasm="C:\nasm\nasm-2.13.03\nasm.exe" - c:\python27\python ../configure.py --enable-optimize --nasm="C:\nasm\nasm-2.13.03\nasm.exe"

View File

@ -55,29 +55,28 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; AMX_ANSIONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_MBCS;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; AMX_ANSIONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild> <MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\public;..\..\third_party;..\..\third_party\zlib;..\..\amxmodx\;C:\Program Files (x86)\Visual Leak Detector\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\..\public;..\..\third_party;..\..\third_party\zlib;..\..\amxmodx\;C:\Program Files (x86)\Visual Leak Detector\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)amxxpc.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>
</IgnoreSpecificDefaultLibraries>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; AMX_ANSIONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_MBCS;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE; AMX_ANSIONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<StructMemberAlignment>Default</StructMemberAlignment> <StructMemberAlignment>Default</StructMemberAlignment>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>

View File

@ -521,6 +521,10 @@ SC_FUNC symbol *add_constant(char *name,cell val,int vclass,int tag);
SC_FUNC void exporttag(int tag); SC_FUNC void exporttag(int tag);
SC_FUNC void sc_attachdocumentation(symbol *sym); SC_FUNC void sc_attachdocumentation(symbol *sym);
SC_FUNC int get_actual_compound(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 */ /* function prototypes in SC2.C */
#define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); } #define PUSHSTK_P(v) { stkitem s_; s_.pv=(v); pushstk(s_); }
@ -722,8 +726,6 @@ int mfputs(MEMFILE *mf,char *string);
SC_FUNC int cp_path(const char *root,const char *directory); SC_FUNC int cp_path(const char *root,const char *directory);
SC_FUNC int cp_set(const char *name); SC_FUNC int cp_set(const char *name);
SC_FUNC cell cp_translate(const unsigned char *string,const unsigned char **endptr); 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 */ /* function prototypes in SCSTATE.C */
SC_FUNC constvalue *automaton_add(const char *name); SC_FUNC constvalue *automaton_add(const char *name);
@ -799,7 +801,6 @@ SC_VDECL int sc_status; /* read/write status */
SC_VDECL int sc_rationaltag; /* tag for rational numbers */ SC_VDECL int sc_rationaltag; /* tag for rational numbers */
SC_VDECL int rational_digits; /* number of fractional digits */ SC_VDECL int rational_digits; /* number of fractional digits */
SC_VDECL int sc_allowproccall;/* allow/detect tagnames in lex() */ 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 char *pc_deprecate; /* if non-NULL, mark next declaration as deprecated */
SC_VDECL int sc_warnings_are_errors; SC_VDECL int sc_warnings_are_errors;

View File

@ -408,11 +408,47 @@ void inst_datetime_defines()
insert_subst("__TIME__", ltime, 8); 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) static void inst_binary_name(char *binfname)
{ {
size_t i, len; size_t i, len;
char *binptr; char *binptr;
char newpath[512], newname[512]; char newname[_MAX_PATH];
int slashchar; int slashchar;
binptr = NULL; binptr = NULL;
@ -435,11 +471,9 @@ static void inst_binary_name(char *binfname)
binptr = binfname; binptr = binfname;
} }
snprintf(newpath, sizeof(newpath), "\"%s\"", binfname);
snprintf(newname, sizeof(newname), "\"%s\"", binptr); snprintf(newname, sizeof(newname), "\"%s\"", binptr);
insert_subst("__BINARY_PATH__", newpath, 15); insert_subst("__BINARY__", newname, 10);
insert_subst("__BINARY_NAME__", newname, 15);
} }
/* "main" of the compiler /* "main" of the compiler
@ -598,6 +632,7 @@ int pc_compile(int argc, char *argv[])
delete_substtable(); delete_substtable();
inst_datetime_defines(); inst_datetime_defines();
inst_binary_name(binfname); inst_binary_name(binfname);
inst_file_name(inpfname, TRUE);
#endif #endif
resetglobals(); resetglobals();
sc_ctrlchar=sc_ctrlchar_org; sc_ctrlchar=sc_ctrlchar_org;
@ -663,6 +698,7 @@ int pc_compile(int argc, char *argv[])
delete_substtable(); delete_substtable();
inst_datetime_defines(); inst_datetime_defines();
inst_binary_name(binfname); inst_binary_name(binfname);
inst_file_name(inpfname, TRUE);
#endif #endif
resetglobals(); resetglobals();
sc_ctrlchar=sc_ctrlchar_org; sc_ctrlchar=sc_ctrlchar_org;

View File

@ -152,7 +152,6 @@ static char *extensions[] = { ".inc", ".p", ".pawn" };
PUSHSTK_I(iflevel); PUSHSTK_I(iflevel);
assert(!SKIPPING); assert(!SKIPPING);
assert(skiplevel==iflevel); /* these two are always the same when "parsing" */ assert(skiplevel==iflevel); /* these two are always the same when "parsing" */
PUSHSTK_I(sc_is_utf8);
PUSHSTK_I(icomment); PUSHSTK_I(icomment);
PUSHSTK_I(fcurrent); PUSHSTK_I(fcurrent);
PUSHSTK_I(fline); PUSHSTK_I(fline);
@ -169,7 +168,6 @@ static char *extensions[] = { ".inc", ".p", ".pawn" };
assert(sc_status == statFIRST || strcmp(get_inputfile(fcurrent), inpfname) == 0); assert(sc_status == statFIRST || strcmp(get_inputfile(fcurrent), inpfname) == 0);
setfiledirect(inpfname); /* (optionally) set in the list file */ setfiledirect(inpfname); /* (optionally) set in the list file */
listline=-1; /* force a #line directive when changing the file */ listline=-1; /* force a #line directive when changing the file */
sc_is_utf8=(short)scan_utf8(inpf,name);
return TRUE; return TRUE;
} }
@ -270,6 +268,11 @@ static void doinclude(int silent)
result=plungefile(name,(c!='>'),TRUE); result=plungefile(name,(c!='>'),TRUE);
if (!result && !silent) if (!result && !silent)
error(100,name); /* cannot read from ... (fatal error) */ error(100,name); /* cannot read from ... (fatal error) */
#if !defined NO_DEFINE
if (result) {
inst_file_name(name, FALSE);
}
#endif
} }
/* readline /* readline
@ -314,7 +317,6 @@ static void readline(unsigned char *line)
fline=i; fline=i;
fcurrent=(short)POPSTK_I(); fcurrent=(short)POPSTK_I();
icomment=(short)POPSTK_I(); icomment=(short)POPSTK_I();
sc_is_utf8=(short)POPSTK_I();
iflevel=(short)POPSTK_I(); iflevel=(short)POPSTK_I();
skiplevel=iflevel; /* this condition held before including the file */ skiplevel=iflevel; /* this condition held before including the file */
assert(!SKIPPING); /* idem ditto */ assert(!SKIPPING); /* idem ditto */
@ -324,6 +326,9 @@ static void readline(unsigned char *line)
inpf=(FILE *)POPSTK_P(); inpf=(FILE *)POPSTK_P();
insert_dbgfile(inpfname); insert_dbgfile(inpfname);
setfiledirect(inpfname); setfiledirect(inpfname);
#if !defined NO_DEFINE
inst_file_name(inpfname, TRUE);
#endif
assert(sc_status==statFIRST || strcmp(get_inputfile(fcurrent),inpfname)==0); assert(sc_status==statFIRST || strcmp(get_inputfile(fcurrent),inpfname)==0);
listline=-1; /* force a #line directive when changing the file */ listline=-1; /* force a #line directive when changing the file */
} /* if */ } /* if */
@ -972,8 +977,14 @@ static int command(void)
if (strlen(pathname)>0) { if (strlen(pathname)>0) {
free(inpfname); free(inpfname);
inpfname=duplicatestring(pathname); inpfname=duplicatestring(pathname);
if (inpfname==NULL) if (inpfname==NULL) {
error(103); /* insufficient memory */ error(103); /* insufficient memory */
}
#if !defined NO_DEFINE
else {
inst_file_name(inpfname, TRUE);
}
#endif
} /* if */ } /* if */
} /* if */ } /* if */
check_empty(lptr); check_empty(lptr);
@ -2381,21 +2392,12 @@ static cell litchar(const unsigned char **lptr,int flags)
cptr=*lptr; cptr=*lptr;
if ((flags & RAWMODE)!=0 || *cptr!=sc_ctrlchar) { /* no escape character */ 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 #if !defined NO_CODEPAGE
c=cp_translate(cptr,&cptr); c=cp_translate(cptr,&cptr);
#else #else
c=*cptr; c=*cptr;
cptr+=1; cptr+=1;
#endif #endif
#if !defined NO_UTF8
} /* if */
#endif
} else { } else {
cptr+=1; cptr+=1;
if (*cptr==sc_ctrlchar) { if (*cptr==sc_ctrlchar) {

View File

@ -2058,7 +2058,8 @@ static int nesting=0;
error(35,argidx+1); /* argument type mismatch */ error(35,argidx+1); /* argument type mismatch */
/* Verify that the dimensions match with those in arg[argidx]. /* Verify that the dimensions match with those in arg[argidx].
* A literal array always has a single dimension. * 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 (lval.sym==NULL || lval.ident==iARRAYCELL) {
if (arg[argidx].numdim!=1) { if (arg[argidx].numdim!=1) {
@ -2066,7 +2067,8 @@ static int nesting=0;
} else if (arg[argidx].dim[0]!=0) { } else if (arg[argidx].dim[0]!=0) {
assert(arg[argidx].dim[0]>0); assert(arg[argidx].dim[0]>0);
if (lval.ident==iARRAYCELL) { 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 { } else {
assert(lval.constval!=0); /* literal array must have a size */ assert(lval.constval!=0); /* literal array must have a size */
/* A literal array must have exactly the same size as the /* A literal array must have exactly the same size as the

View File

@ -309,120 +309,3 @@ SC_FUNC cell cp_translate(const unsigned char *string,const unsigned char **endp
} }
#endif /* NO_CODEPAGE */ #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<lowmark)
return -1;
/* the code positions 0xd800--0xdfff and 0xfffe & 0xffff do not
* exist in UCS-4 (and hence, they do not exist in Unicode)
*/
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 */
}

View File

@ -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 sc_rationaltag=0; /* tag for rational numbers */
SC_VDEFINE int rational_digits=0; /* number of fractional digits */ SC_VDEFINE int rational_digits=0; /* number of fractional digits */
SC_VDEFINE int sc_allowproccall=0; /* allow/detect tagnames in lex() */ 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 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_showincludes=0; /* show include files */
SC_VDEFINE int sc_warnings_are_errors=0; SC_VDEFINE int sc_warnings_are_errors=0;

File diff suppressed because it is too large Load Diff

View File

@ -1566,7 +1566,7 @@
// //
// Team Fortress Classic // Team Fortress Classic
// //
"entities.games/tfc/offsets-cbaseentity.txt" "entities.games/tfc/offsets-cbaseentity.txt"
{ {
"game" "tfc" "game" "tfc"
@ -3404,7 +3404,7 @@
// //
// Half-Life: Deathmatch // Half-Life: Deathmatch
// //
"entities.games/valve/offsets-cbaseentity.txt" "entities.games/valve/offsets-cbaseentity.txt"
{ {
"game" "valve" "game" "valve"
@ -4105,4 +4105,67 @@
"game" "valve" "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"
}
} }

View File

@ -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"
}
}
}
}

View File

@ -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"
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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"
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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"
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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"
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -110,7 +110,6 @@ Section "MainSection" SEC01
File "installer\files\base\addons\amxmodx\configs\core.ini" 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\custommenuitems.cfg"
File "installer\files\base\addons\amxmodx\configs\cvars.ini" 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\maps.ini"
File "installer\files\base\addons\amxmodx\configs\modules.ini" File "installer\files\base\addons\amxmodx\configs\modules.ini"
File "installer\files\base\addons\amxmodx\configs\plugins.ini" File "installer\files\base\addons\amxmodx\configs\plugins.ini"

View File

@ -1998,6 +1998,34 @@ static cell AMX_NATIVE_CALL cs_get_user_weapon(AMX *amx, cell *params)
return 0; 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<void *>(pWeaponBox, m_rgpPlayerItems, i));
if (!FNullEnt(pWeapon))
{
return TypeConversion.edict_to_id(pWeapon);
}
}
return 0;
}
AMX_NATIVE_INFO CstrikeNatives[] = AMX_NATIVE_INFO CstrikeNatives[] =
{ {
{"cs_set_user_money", cs_set_user_money}, {"cs_set_user_money", cs_set_user_money},
@ -2070,5 +2098,6 @@ AMX_NATIVE_INFO CstrikeNatives[] =
{"cs_get_weapon_info", cs_get_weapon_info}, {"cs_get_weapon_info", cs_get_weapon_info},
{"cs_get_user_weapon_entity", cs_get_user_weapon_entity}, {"cs_get_user_weapon_entity", cs_get_user_weapon_entity},
{"cs_get_user_weapon", cs_get_user_weapon}, {"cs_get_user_weapon", cs_get_user_weapon},
{"cs_get_weaponbox_item", cs_get_weaponbox_item},
{nullptr, nullptr} {nullptr, nullptr}
}; };

View File

@ -194,6 +194,12 @@
<None Include="..\..\..\..\plugins\include\cstrike.inc" /> <None Include="..\..\..\..\plugins\include\cstrike.inc" />
<None Include="..\..\..\..\plugins\include\cstrike_const.inc" /> <None Include="..\..\..\..\plugins\include\cstrike_const.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -42,6 +42,9 @@
<Filter Include="ReSDK\cstrike\API"> <Filter Include="ReSDK\cstrike\API">
<UniqueIdentifier>{67de85cb-b8e7-4cd6-b8cf-2ff7ed540c2b}</UniqueIdentifier> <UniqueIdentifier>{67de85cb-b8e7-4cd6-b8cf-2ff7ed540c2b}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{1b196636-b242-45a8-ad14-3fb21eb799f7}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\CstrikeHacks.cpp"> <ClCompile Include="..\CstrikeHacks.cpp">
@ -181,4 +184,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -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, 11 , &calc.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=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)){ (MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){

View File

@ -110,7 +110,7 @@ public:
void saveRank( const char* filename ); void saveRank( const char* filename );
void loadRank( const char* filename ); void loadRank( const char* filename );
RankStats* findEntryInRank(const char* unique, const char* name, bool isip=false); 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; } inline int getRankNum( ) const { return rankNum; }
void clear(); void clear();
void unloadCalc(); void unloadCalc();

View File

@ -421,7 +421,7 @@ void OnAmxxAttach(){
if ( path && *path ) if ( path && *path )
{ {
char error[128]; 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() ) if ( !g_rank.begin() )

View File

@ -163,7 +163,13 @@
<None Include="..\..\..\plugins\include\csstats_const.inc" /> <None Include="..\..\..\plugins\include\csstats_const.inc" />
<None Include="..\..\..\plugins\include\csx.inc" /> <None Include="..\..\..\plugins\include\csx.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -18,6 +18,9 @@
<Filter Include="Pawn Includes"> <Filter Include="Pawn Includes">
<UniqueIdentifier>{3f559917-fcbd-4cd3-8136-8a7a769af465}</UniqueIdentifier> <UniqueIdentifier>{3f559917-fcbd-4cd3-8136-8a7a769af465}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{95e872b8-d195-4d02-8a88-aed2894c54fe}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\CMisc.cpp"> <ClCompile Include="..\CMisc.cpp">
@ -67,4 +70,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -161,7 +161,13 @@
<None Include="..\..\..\..\plugins\include\dodconst.inc" /> <None Include="..\..\..\..\plugins\include\dodconst.inc" />
<None Include="..\..\..\..\plugins\include\dodfun.inc" /> <None Include="..\..\..\..\plugins\include\dodfun.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -18,6 +18,9 @@
<Filter Include="Pawn Includes"> <Filter Include="Pawn Includes">
<UniqueIdentifier>{2deb0e1f-fb04-4734-ae4a-39fa3d4eab86}</UniqueIdentifier> <UniqueIdentifier>{2deb0e1f-fb04-4734-ae4a-39fa3d4eab86}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{1441a5c1-9b0c-4dc7-b898-7236588e5f98}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\CMisc.cpp"> <ClCompile Include="..\CMisc.cpp">
@ -64,4 +67,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -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.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=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)){ (MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){

View File

@ -104,7 +104,7 @@ public:
void saveRank( const char* filename ); void saveRank( const char* filename );
void loadRank( const char* filename ); void loadRank( const char* filename );
RankStats* findEntryInRank(const char* unique, const char* name , bool isip = false); 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; } inline int getRankNum( ) const { return rankNum; }
void clear(); void clear();
void unloadCalc(); void unloadCalc();

View File

@ -471,7 +471,7 @@ void OnAmxxAttach()
if ( path && *path ) if ( path && *path )
{ {
char error[128]; 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() ) if ( !g_rank.begin() )

View File

@ -164,7 +164,13 @@
<None Include="..\..\..\..\plugins\include\dodstats.inc" /> <None Include="..\..\..\..\plugins\include\dodstats.inc" />
<None Include="..\..\..\..\plugins\include\dodx.inc" /> <None Include="..\..\..\..\plugins\include\dodx.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -18,6 +18,9 @@
<Filter Include="Pawn Includes"> <Filter Include="Pawn Includes">
<UniqueIdentifier>{d13b95f6-bd1e-4c68-a7f1-57e4f39ffde3}</UniqueIdentifier> <UniqueIdentifier>{d13b95f6-bd1e-4c68-a7f1-57e4f39ffde3}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{0f02323b-c637-4625-aa3c-03f1424de34c}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\CMisc.cpp"> <ClCompile Include="..\CMisc.cpp">
@ -73,4 +76,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -130,7 +130,13 @@
<None Include="..\..\..\plugins\include\engine_stocks.inc" /> <None Include="..\..\..\plugins\include\engine_stocks.inc" />
<None Include="..\..\..\plugins\include\hlsdk_const.inc" /> <None Include="..\..\..\plugins\include\hlsdk_const.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -27,6 +27,9 @@
<Filter Include="Memtools\CDetour\asm"> <Filter Include="Memtools\CDetour\asm">
<UniqueIdentifier>{6c2c3c74-4dc3-45bf-b3a5-6224971eee69}</UniqueIdentifier> <UniqueIdentifier>{6c2c3c74-4dc3-45bf-b3a5-6224971eee69}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{766da9da-a13a-4f01-a886-570fc28772a6}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\amxxapi.cpp"> <ClCompile Include="..\amxxapi.cpp">
@ -103,4 +106,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -27,7 +27,6 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
} }
cell *ptr = MF_GetAmxAddr(amx, params[2]); cell *ptr = MF_GetAmxAddr(amx, params[2]);
edict_t *e;
switch (type) switch (type)
{ {
@ -85,12 +84,13 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params)
} }
case TR_pHit: case TR_pHit:
{ {
e = TypeConversion.id_to_edict(*ptr); const auto pEdict = TypeConversion.id_to_edict(*ptr);
if (*ptr != -1 && FNullEnt(e)) if (pEdict == nullptr)
return 0; //TODO: return error {
gfm_tr->pHit = e; return 0;
}
gfm_tr->pHit = pEdict;
return 1; return 1;
break;
} }
case TR_iHitgroup: case TR_iHitgroup:
{ {

View File

@ -98,12 +98,13 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params)
} }
case TR_pHit: case TR_pHit:
{ {
edict_t *e = TypeConversion.id_to_edict(*ptr); const auto pEdict = TypeConversion.id_to_edict(*ptr);
if (*ptr != -1 && FNullEnt(e)) if (pEdict == nullptr)
return 0; //TODO: return error {
tr->pHit = e; return 0;
}
tr->pHit = pEdict;
return 1; return 1;
break;
} }
case TR_iHitgroup: case TR_iHitgroup:
{ {

View File

@ -149,42 +149,6 @@ enum
Model_CurrentSequence = -1, 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<studiohdr_t*>(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 ); // GetModelBoundingBox( index, Float:mins[3], Float:maxs[3], sequence = Model_DefaultSize );
static cell AMX_NATIVE_CALL GetModelBoundingBox(AMX *amx, cell *params) 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; 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<studiohdr_t*>(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<studiohdr_t*>(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[] = { AMX_NATIVE_INFO misc_natives[] = {
{ "copy_infokey_buffer", copy_infokey_buffer }, { "copy_infokey_buffer", copy_infokey_buffer },
{ "lookup_sequence", lookup_sequence }, { "lookup_sequence", lookup_sequence },
{ "set_controller", set_controller }, { "set_controller", set_controller },
{ "GetModelCollisionBox", GetModelCollisionBox },
{ "SetModelCollisionBox", SetModelCollisionBox },
{ "GetModelBoundingBox", GetModelBoundingBox }, { "GetModelBoundingBox", GetModelBoundingBox },
{ "SetModelBoundingBox", SetModelBoundingBox },
{NULL, NULL}, {NULL, NULL},
}; };

View File

@ -148,6 +148,12 @@
<None Include="..\..\..\plugins\include\fakemeta_stocks.inc" /> <None Include="..\..\..\plugins\include\fakemeta_stocks.inc" />
<None Include="..\..\..\plugins\include\hlsdk_const.inc" /> <None Include="..\..\..\plugins\include\hlsdk_const.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -48,6 +48,9 @@
<Filter Include="ReSDK\cstrike\API"> <Filter Include="ReSDK\cstrike\API">
<UniqueIdentifier>{2800175e-06bf-42bf-b3c1-f86561471531}</UniqueIdentifier> <UniqueIdentifier>{2800175e-06bf-42bf-b3c1-f86561471531}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{c5065ec5-3262-49dd-825b-2cf3956e79ac}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\fakemeta_amxx.cpp"> <ClCompile Include="..\fakemeta_amxx.cpp">
@ -186,4 +189,9 @@
<Filter>PEV</Filter> <Filter>PEV</Filter>
</CustomBuildStep> </CustomBuildStep>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -11,590 +11,462 @@
// Fun Module // Fun Module
// //
#include <string.h>
#include "fun.h" #include "fun.h"
#include <HLTypeConversion.h> #include <HLTypeConversion.h>
/*
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; HLTypeConversion TypeConversion;
CPlayers Players;
// ######## Utils: // native get_client_listen(receiver, sender)
void FUNUTIL_ResetPlayer(int index) static cell AMX_NATIVE_CALL get_client_listening(AMX *amx, cell *params)
{ {
//MF_PrintSrvConsole("Resetting player index %d! maxclients: %d\n", index, gpGlobals->maxClients); enum args { arg_count, arg_receiver, arg_sender };
for (int i = 1; i <= gpGlobals->maxClients; i++) {
g_bodyhits[index][i] = (char)((1<<HITGROUP_GENERIC) | CHECK_PLAYER(params[arg_receiver]);
(1<<HITGROUP_HEAD) | CHECK_PLAYER(params[arg_sender]);
(1<<HITGROUP_CHEST) |
(1<<HITGROUP_STOMACH) | return GETCLIENTLISTENING(params[arg_receiver], params[arg_sender]);
(1<<HITGROUP_LEFTARM) |
(1<<HITGROUP_RIGHTARM)|
(1<<HITGROUP_LEFTLEG) |
(1<<HITGROUP_RIGHTLEG));
}
// Reset silent slippers
g_silent[index] = false;
} }
// ######## Natives: // native set_client_listen(receiver, sender, listen)
static cell AMX_NATIVE_CALL get_client_listening(AMX *amx, cell *params) // get_client_listening(receiver, sender); = 2 params static cell AMX_NATIVE_CALL set_client_listening(AMX *amx, cell *params)
{ {
// Gets who can listen to who. enum args { arg_count, arg_receiver, arg_sender, arg_listen };
// params[1] = receiver
// params[2] = sender
// Check receiver and sender validity. CHECK_PLAYER(params[arg_receiver]);
CHECK_PLAYER(params[1]); CHECK_PLAYER(params[arg_sender]);
CHECK_PLAYER(params[2]);
// GET- AND SETCLIENTLISTENING returns "qboolean", an int, probably 0 or 1... return SETCLIENTLISTENING(params[arg_receiver], params[arg_sender], params[arg_listen]);
return GETCLIENTLISTENING(params[1], params[2]);
} }
static cell AMX_NATIVE_CALL set_client_listening(AMX *amx, cell *params) // set_client_listening(receiver, sender, listen); = 3 params // native set_user_godmode(index, godmode = 0)
static cell AMX_NATIVE_CALL set_user_godmode(AMX *amx, cell *params)
{ {
// Sets who can listen to who. enum args { arg_count, arg_user, arg_godmode };
// params[1] = receiver
// params[2] = sender
// params[3] = listen
// Check receiver and sender validity. CHECK_PLAYER(params[arg_user]);
CHECK_PLAYER(params[1]);
CHECK_PLAYER(params[2]);
// Make a check on params[3] here later, and call run time error when it's wrong. const auto pPlayer = TypeConversion.id_to_edict(params[arg_user]);
// To do: find out the possible values to set (0, 1?)
// GET- AND SETCLIENTLISTENING returns "qboolean", an int, probably 0 or 1... pPlayer->v.takedamage = params[arg_godmode] != 0 ? DAMAGE_NO : DAMAGE_AIM;
return SETCLIENTLISTENING(params[1], params[2], params[3]);
}
static cell AMX_NATIVE_CALL set_user_godmode(AMX *amx, cell *params) // set_user_godmode(index, godmode = 0); = 2 params
{
/* Sets player godmode. If you want to disable godmode set only first parameter. */
// params[1] = index
// params[2] = godmode = 0
// Check index.
CHECK_PLAYER(params[1]);
// Get player pointer.
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
if (params[2] == 1) {
// Enable godmode
pPlayer->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?
}
return 1; 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. */ enum args { arg_count, arg_user };
// params[1] = index
// Check index. CHECK_PLAYER(params[arg_user]);
CHECK_PLAYER(params[1]);
// Get player pointer. const auto pPlayer = TypeConversion.id_to_edict(params[arg_user]);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
int godmode = 0; return pPlayer->v.takedamage == DAMAGE_NO;
if (pPlayer->v.takedamage == 0.0) {
// God mode is enabled
godmode = 1;
}
return godmode;
} }
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 enum args { arg_count, arg_index, arg_item };
* with weapon_, ammo_ and item_. This event
* is announced with proper message to all players. */
// params[1] = index
// params[2] = item...
// Check index. CHECK_PLAYER(params[arg_index]);
CHECK_PLAYER(params[1]);
// Get player pointer. auto itemLength = 0;
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]); const auto item = MF_GetAmxString(amx, params[arg_item], 1, &itemLength);
// Create item entity pointer if (!itemLength
edict_t *pItemEntity; ||(strncmp(item, "weapon_", 7) != 0
&& strncmp(item, "ammo_", 5) != 0
// Make an "intstring" out of 2nd parameter && strncmp(item, "item_", 5) != 0
int length; && strncmp(item, "tf_weapon_", 10) != 0))
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)
) {
return 0; return 0;
} }
//string_t item = MAKE_STRING(szItem); auto pEntity = CREATE_NAMED_ENTITY(ALLOC_STRING(item));
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);
if (FNullEnt(pItemEntity)) { if (FNullEnt(pEntity))
MF_LogError(amx, AMX_ERR_NATIVE, "Item \"%s\" failed to create", szItem); {
MF_LogError(amx, AMX_ERR_NATIVE, "Item \"%s\" failed to create", item);
return 0; return 0;
} }
//VARS(pItemEntity)->origin = VARS(pPlayer)->origin; // nice to do VARS(ent)->origin instead of ent->v.origin? :-I const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
//I'm not sure, normally I use macros too =P
pItemEntity->v.origin = pPlayer->v.origin;
pItemEntity->v.spawnflags |= SF_NORESPAWN; //SF_NORESPAWN;
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 MDLL_Touch(pEntity, pPlayer);
// 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);
}*/
if (pItemEntity->v.solid == save) { if (pEntity->v.solid == oldSolid)
REMOVE_ENTITY(pItemEntity); {
//the function did not fail - we're just deleting the item REMOVE_ENTITY(pEntity); // The function did not fail - we're just deleting the item
return -1; 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? :-) enum args { arg_count, arg_index };
// params[1] = entity to spawn
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; 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... enum args { arg_count, arg_index, arg_health };
// params[1] = index
// params[2] = health
// Check index CHECK_PLAYER(params[arg_index]);
CHECK_PLAYER(params[1]);
// Fetch player pointer const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]); const auto health = float(params[arg_health]);
// Kill if health too low. if (health > 0.0f)
if (params[2] > 0) {
pPlayer->v.health = float(params[2]); pPlayer->v.health = health;
}
else else
{
MDLL_ClientKill(pPlayer); MDLL_ClientKill(pPlayer);
}
return 1; 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. enum args { arg_count, arg_index, arg_frags };
// params[1] = index
// params[2] = frags
// Check index CHECK_PLAYER(params[arg_index]);
CHECK_PLAYER(params[1]);
// Fetch player pointer const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
pPlayer->v.frags = params[2]; pPlayer->v.frags = float(params[arg_frags]);
return 1; 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. enum args { arg_count, arg_index, arg_armor };
// params[1] = index
// params[2] = armor
// Check index CHECK_PLAYER(params[arg_index]);
CHECK_PLAYER(params[1]);
// Fetch player pointer const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
pPlayer->v.armorvalue = params[2]; pPlayer->v.armorvalue = float(params[arg_armor]);
return 1; 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. enum args { arg_count, arg_index, arg_origin };
// params[1] = index
// params[2] = origin
// Check index CHECK_PLAYER(params[arg_index]);
CHECK_PLAYER(params[1]);
// Fetch player pointer auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]); const auto pVector = MF_GetAmxAddr(amx, params[arg_origin]);
cell *newVectorCell = MF_GetAmxAddr(amx, params[2]);
SET_SIZE(pPlayer, pPlayer->v.mins, pPlayer->v.maxs); SET_SIZE(pPlayer, pPlayer->v.mins, pPlayer->v.maxs);
SET_ORIGIN(pPlayer, Vector((float)newVectorCell[0], (float)newVectorCell[1], (float)newVectorCell[2])); SET_ORIGIN(pPlayer, Vector(float(pVector[0]), float(pVector[1]), float(pVector[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 get_user_rendering(AMX *amx, cell *params) // get_user_rendering(index, &fx = kRenderFxNone, &r = 0, &g = 0, &b = 0, &render = kRenderNormal, &amount = 0); = 7 arguments
{
// Gets 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]);
*MF_GetAmxAddr(amx, params[2]) = pPlayer->v.renderfx;
*MF_GetAmxAddr(amx, params[3]) = pPlayer->v.rendercolor[0];
*MF_GetAmxAddr(amx, params[4]) = pPlayer->v.rendercolor[1];
*MF_GetAmxAddr(amx, params[5]) = pPlayer->v.rendercolor[2];
*MF_GetAmxAddr(amx, params[6]) = pPlayer->v.rendermode;
*MF_GetAmxAddr(amx, params[7]) = pPlayer->v.renderamt;
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;
return 1; 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. enum args { arg_count, arg_index, arg_fx, arg_red, arg_green, arg_blue, arg_render, arg_amount };
// params[1] = index
// Check index CHECK_PLAYER(params[arg_index]);
CHECK_PLAYER(params[1]);
// Fetch player pointer auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
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); 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. enum args { arg_count, arg_index, arg_gravity };
// params[1] = index
// params[2] = gravity (=-1.0)
// Check index
CHECK_PLAYER(params[1]);
// Fetch player pointer CHECK_PLAYER(params[arg_index]);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
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; 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. enum args { arg_count, arg_index };
// params[1] = index
// Check index CHECK_PLAYER(params[arg_index]);
CHECK_PLAYER(params[1]);
// Fetch player pointer const auto pPlayer = TypeConversion.id_to_edict(params[arg_index]);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
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. enum args { arg_count, arg_attacker, arg_target, arg_hitzones };
// params[1] = the one(s) who shoot(s), shooter
int shooter = params[1];
// params[2] = the one getting hit const int attacker = params[arg_attacker];
int gettingHit = params[2]; const int target = params[arg_target];
const int hitzones = params[arg_hitzones];
// params[3] = specified hit zones if (attacker == 0 && target == 0)
int hitzones = params[3]; {
Players.SetEveryoneBodyHits(hitzones);
//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;
}
} }
else if (shooter == 0 && gettingHit != 0) { else if (attacker == 0 && target != 0)
// "All" shooters, target (gettingHit) should be existing player id {
CHECK_PLAYER(gettingHit); CHECK_PLAYER(target);
// Where can all hit gettingHit?
for (int i = 1; i <= gpGlobals->maxClients; i++) Players.SetAttackersBodyHits(target, hitzones);
g_bodyhits[i][gettingHit] = hitzones;
} }
else if (shooter != 0 && gettingHit == 0) { else if (attacker != 0 && target == 0)
// Shooter can hit all in bodyparts. {
CHECK_PLAYER(shooter); CHECK_PLAYER(attacker);
for (int i = 1; i <= gpGlobals->maxClients; i++)
g_bodyhits[shooter][i] = hitzones; 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 else
pPlayer->v.movetype = MOVETYPE_WALK; {
CHECK_PLAYER(attacker);
CHECK_PLAYER(target);
Players.SetBodyHits(attacker, target, hitzones);
}
return 1; 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. enum args { arg_count, arg_attacker, arg_target };
// params[1] = index
// Check index const auto attacker = params[arg_attacker];
CHECK_PLAYER(params[1]);
// Fetch player pointer CHECK_PLAYER(attacker);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
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; return pPlayer->v.movetype == MOVETYPE_NOCLIP;
} }
// JustinHoMi made this one originally // native set_user_footsteps(id, set = 1)
static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params) // set_user_footsteps(id, set = 1); = 2 params static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params)
{ {
// Gives player silent footsteps. enum args { arg_count, arg_index, arg_footsteps };
// if set=0 it will return footsteps to normal
// params[1] = index of player
// params[2] = 0 = normal footstep sound, 1 = silent slippers
// Check index const auto index = params[arg_index];
CHECK_PLAYER(params[1]);
// Fetch player pointer CHECK_PLAYER(index);
edict_t *pPlayer = TypeConversion.id_to_edict(params[1]);
if (params[2]) { const auto pPlayer = TypeConversion.id_to_edict(index);
if (params[arg_footsteps] != 0)
{
pPlayer->v.flTimeStepSound = 999; pPlayer->v.flTimeStepSound = 999;
g_silent[params[1]] = true; Players[index].SetSilentFootsteps(true);
g_pFunctionTable->pfnPlayerPreThink = PlayerPreThink;
} }
else { else
{
pPlayer->v.flTimeStepSound = STANDARDTIMESTEPSOUND; 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; return 1;
} }
// native get_user_footsteps(index)
static cell AMX_NATIVE_CALL get_user_footsteps(AMX *amx, cell *params) 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 // native strip_user_weapons(index)
static cell AMX_NATIVE_CALL strip_user_weapons(AMX *amx, cell *params) // 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"); CHECK_PLAYER(index);
edict_t *pent = CREATE_NAMED_ENTITY(item);
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; return 0;
} }
MDLL_Spawn(pent); MDLL_Spawn(pEntity);
MDLL_Use(pent, pPlayer); MDLL_Use(pEntity, pPlayer);
REMOVE_ENTITY(pent); REMOVE_ENTITY(pEntity);
*reinterpret_cast<int *>(MF_PlayerPropAddr(params[1], Player_CurrentWeapon)) = 0; *reinterpret_cast<int *>(MF_PlayerPropAddr(index, Player_CurrentWeapon)) = 0;
return 1; return 1;
} }
AMX_NATIVE_INFO fun_Exports[] = {
{"get_client_listen", get_client_listening}, AMX_NATIVE_INFO fun_Exports[] =
{"set_client_listen", set_client_listening}, {
{"set_user_godmode", set_user_godmode}, { "get_client_listen" , get_client_listening },
{"get_user_godmode", get_user_godmode}, { "set_client_listen" , set_client_listening },
{"set_user_health", set_user_health}, { "set_user_godmode" , set_user_godmode },
{"give_item", give_item}, { "get_user_godmode" , get_user_godmode },
{"spawn", spawn}, { "set_user_health" , set_user_health },
{"set_user_frags", set_user_frags}, { "give_item" , give_item },
{"set_user_armor", set_user_armor}, { "spawn" , spawn },
{"set_user_origin", set_user_origin}, { "set_user_frags" , set_user_frags },
{"set_user_rendering", set_user_rendering}, { "set_user_armor" , set_user_armor },
{"get_user_rendering", get_user_rendering}, { "set_user_origin" , set_user_origin },
{"set_user_maxspeed", set_user_maxspeed}, { "set_user_rendering", set_user_rendering },
{"get_user_maxspeed", get_user_maxspeed}, { "get_user_rendering", get_user_rendering },
{"set_user_gravity", set_user_gravity}, { "set_user_maxspeed" , set_user_maxspeed },
{"get_user_gravity", get_user_gravity}, { "get_user_maxspeed" , get_user_maxspeed },
{"get_user_footsteps", get_user_footsteps}, { "set_user_gravity" , set_user_gravity },
{"set_user_hitzones", set_user_hitzones}, { "get_user_gravity" , get_user_gravity },
{"get_user_hitzones", get_user_hitzones}, { "get_user_footsteps", get_user_footsteps },
{"set_user_noclip", set_user_noclip}, { "set_user_hitzones" , set_user_hitzones },
{"get_user_noclip", get_user_noclip}, { "get_user_hitzones" , get_user_hitzones },
{"set_user_footsteps", set_user_footsteps}, { "set_user_noclip" , set_user_noclip },
{"strip_user_weapons", strip_user_weapons}, { "get_user_noclip" , get_user_noclip },
/////////////////// <--- 19 chars max in current small version { "set_user_footsteps", set_user_footsteps },
{NULL, NULL} { "strip_user_weapons", strip_user_weapons },
{ nullptr , nullptr }
}; };
/******************************************************************************************/
void PlayerPreThink(edict_t *pEntity) void PlayerPreThink(edict_t *pEntity)
{ {
if (g_silent[ENTINDEX(pEntity)]) { const auto index = TypeConversion.edict_to_id(pEntity);
pEntity->v.flTimeStepSound = 999;
if (Players[index].HasSilentFootsteps())
{
pEntity->v.flTimeStepSound = 999;
RETURN_META(MRES_HANDLED); RETURN_META(MRES_HANDLED);
} }
@ -603,76 +475,53 @@ void PlayerPreThink(edict_t *pEntity)
int ClientConnect(edict_t *pPlayer, const char *pszName, const char *pszAddress, char szRejectReason[128]) int ClientConnect(edict_t *pPlayer, const char *pszName, const char *pszAddress, char szRejectReason[128])
{ {
// Reset stuff: const auto index = TypeConversion.edict_to_id(pPlayer);
FUNUTIL_ResetPlayer(ENTINDEX(pPlayer));
Players[index].Clear();
RETURN_META_VALUE(MRES_IGNORED, 0); 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); 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)) ) { if (ptr->pHit && (ptr->pHit->v.flags & (FL_CLIENT | FL_FAKECLIENT))
int shooterIndex = ENTINDEX(shooter); && shooter && (shooter->v.flags & (FL_CLIENT | FL_FAKECLIENT)) )
if ( !(g_bodyhits[shooterIndex][ENTINDEX(ptr->pHit)] & (1<<ptr->iHitgroup)) ) {
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; ptr->flFraction = 1.0;
RETURN_META(MRES_HANDLED);
}
} }
RETURN_META(MRES_SUPERCEDE); 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() void OnAmxxAttach()
{ {
MF_AddNatives(fun_Exports); MF_AddNatives(fun_Exports);
} }
// The content of OnPluginsLoaded() was moved from OnAmxxAttach with AMXx 1.5 because for some reason gpGlobals->maxClients wasn't void OnPluginsLoaded()
// initialized to its proper value until some time after OnAmxxAttach(). In OnAmxxAttach() it always showed 0. /JGHG {
void OnPluginsLoaded() { Players.Clear();
// Reset stuff - hopefully this should
for (int i = 1; i <= gpGlobals->maxClients; i++) {
// Reset all hitzones
FUNUTIL_ResetPlayer(i);
}
TypeConversion.init(); TypeConversion.init();
g_pFunctionTable->pfnPlayerPreThink = nullptr;
g_pengfuncsTable_Post->pfnTraceLine = nullptr;
} }
/*
void ClientConnectFakeBot(int index) void ServerDeactivate()
{ {
FUNUTIL_ResetPlayer(index); g_pFunctionTable->pfnPlayerPreThink = nullptr;
//MF_Log("A bot connects, forwarded to fun! The bot is %d!", index); g_pengfuncsTable_Post->pfnTraceLine = nullptr;
//CPlayer* player;
RETURN_META(MRES_IGNORED);
} }
*/

View File

@ -11,7 +11,9 @@
// Fun Module // Fun Module
// //
#include "amxxmodule.h" #pragma once
#include <amxxmodule.h>
// Fun-specific defines below // Fun-specific defines below
#define GETCLIENTLISTENING (*g_engfuncs.pfnVoice_GetClientListening) #define GETCLIENTLISTENING (*g_engfuncs.pfnVoice_GetClientListening)
@ -29,19 +31,181 @@
#define HITGROUP_RIGHTARM 5 // 32 #define HITGROUP_RIGHTARM 5 // 32
#define HITGROUP_LEFTLEG 6 // 64 #define HITGROUP_LEFTLEG 6 // 64
#define HITGROUP_RIGHTLEG 7 // 128 #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) \ #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); \ MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
return 0; \ return 0; \
} else { \ } else { \
if (x <= gpGlobals->maxClients) { \ if ((x) <= gpGlobals->maxClients) { \
if (!MF_IsPlayerIngame(x)) { \ if (!MF_IsPlayerIngame(x)) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
return 0; \ return 0; \
} \ } \
} else { \ } 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); \ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
return 0; \ return 0; \
} \ } \
@ -49,7 +213,7 @@
} }
#define CHECK_PLAYER(x) \ #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); \ MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
return 0; \ return 0; \
} else { \ } else { \

View File

@ -119,8 +119,8 @@
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */ // #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_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */ // #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_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
#define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */ // #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */ // #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
// #define FN_StartFrame StartFrame /* pfnStartFrame() */ // #define FN_StartFrame StartFrame /* pfnStartFrame() */
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */ // #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */

View File

@ -19,7 +19,7 @@
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc> <UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120_xp</PlatformToolset> <PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
@ -159,7 +159,13 @@
<ItemGroup> <ItemGroup>
<None Include="..\..\..\plugins\include\fun.inc" /> <None Include="..\..\..\plugins\include\fun.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -21,6 +21,9 @@
<Filter Include="Memtools"> <Filter Include="Memtools">
<UniqueIdentifier>{d2522a66-df9f-49c8-9f74-ee3738ae3d98}</UniqueIdentifier> <UniqueIdentifier>{d2522a66-df9f-49c8-9f74-ee3738ae3d98}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{200a07a6-c1a4-4ad1-bda3-3fb5ea7c106a}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\fun.cpp"> <ClCompile Include="..\fun.cpp">
@ -55,4 +58,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -18,12 +18,15 @@
MMDB_s HandleDB; MMDB_s HandleDB;
ke::Vector<ke::AString> LangList; ke::Vector<ke::AString> LangList;
bool NativesRegistered;
void OnAmxxAttach() void OnAmxxAttach()
{ {
if (loadDatabase()) if (loadDatabase())
{ {
MF_AddNatives(GeoipNatives); MF_AddNatives(GeoipNatives);
NativesRegistered = true;
} }
REG_SVR_COMMAND("geoip", OnGeoipCommand); REG_SVR_COMMAND("geoip", OnGeoipCommand);
@ -38,7 +41,7 @@ void OnAmxxDetach()
void OnGeoipCommand() void OnGeoipCommand()
{ {
const char *cmd = CMD_ARGV(1); const auto cmd = CMD_ARGV(1);
if (!strcmp(cmd, "version")) if (!strcmp(cmd, "version"))
{ {
@ -48,7 +51,7 @@ void OnGeoipCommand()
return; return;
} }
const char *meta_dump = "\n" const auto meta_dump = "\n"
" Database metadata\n" " Database metadata\n"
" Node count: %i\n" " Node count: %i\n"
" Record size: %i bits\n" " Record size: %i bits\n"
@ -59,7 +62,7 @@ void OnGeoipCommand()
" Languages: "; " Languages: ";
char date[40]; 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<const time_t *>(&HandleDB.metadata.build_epoch)));
fprintf(stdout, meta_dump, fprintf(stdout, meta_dump,
HandleDB.metadata.node_count, HandleDB.metadata.node_count,
@ -100,7 +103,7 @@ void OnGeoipCommand()
return; return;
} }
int num_args = CMD_ARGC(); const auto num_args = CMD_ARGC();
if (num_args < 3) if (num_args < 3)
{ {
@ -108,12 +111,12 @@ void OnGeoipCommand()
return; return;
} }
char *ip = stripPort((char *)CMD_ARGV(2)); const auto ip = stripPort(const_cast<char *>(CMD_ARGV(2)));
int gai_error = 0; auto gai_error = 0;
int mmdb_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) if (gai_error != 0 || mmdb_error != MMDB_SUCCESS || !result.found_entry)
{ {
@ -121,17 +124,17 @@ void OnGeoipCommand()
return; return;
} }
MMDB_entry_data_list_s *entry_data_list = NULL; MMDB_entry_data_list_s *entry_data_list = nullptr;
int status = -1; 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)); MF_PrintSrvConsole("\n Could not retrieve data list - %s.\n\n", MMDB_strerror(status));
return; return;
} }
const char *file = NULL; const char *file = nullptr;
FILE *fp = NULL; FILE *fp = nullptr;
if (num_args > 3) if (num_args > 3)
{ {
@ -141,7 +144,7 @@ void OnGeoipCommand()
if (!fp) if (!fp)
{ {
file = NULL; file = nullptr;
fp = stdout; fp = stdout;
} }
@ -156,12 +159,29 @@ void OnGeoipCommand()
MMDB_free_entry_data_list(entry_data_list); 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 else
{ {
MF_PrintSrvConsole("\n"); MF_PrintSrvConsole("\n");
MF_PrintSrvConsole(" Usage: geoip <command> [argument]\n"); MF_PrintSrvConsole(" Usage: geoip <command> [argument]\n");
MF_PrintSrvConsole(" Commands:\n"); MF_PrintSrvConsole(" Commands:\n");
MF_PrintSrvConsole(" version - display geoip database metadata\n"); MF_PrintSrvConsole(" version - display geoip database metadata\n");
MF_PrintSrvConsole(" reload - reload geoip database\n");
MF_PrintSrvConsole(" dump <ip> [output file] - dump all data from an IP address formatted in a JSON-ish fashion.\n"); MF_PrintSrvConsole(" dump <ip> [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(" An output file is mod-based and if not provided, it will print in the console.\n");
MF_PrintSrvConsole("\n"); MF_PrintSrvConsole("\n");
@ -170,7 +190,9 @@ void OnGeoipCommand()
bool loadDatabase() bool loadDatabase()
{ {
if (HandleDB.filename) // Already loaded. const auto isDatabaseLoaded = HandleDB.filename != nullptr;
if (isDatabaseLoaded)
{ {
return true; return true;
} }
@ -181,18 +203,18 @@ bool loadDatabase()
"Country" // Is the default shipped database with AMXX. "Country" // Is the default shipped database with AMXX.
}; };
const char *modName = MF_GetModname(); const auto modName = MF_GetModname();
const char *dataDir = MF_GetLocalInfo("amxx_datadir", "addons/amxmodx/data"); const auto dataDir = MF_GetLocalInfo("amxx_datadir", "addons/amxmodx/data");
char file[255]; char file[260];
int status = -1; auto status = -1;
for (size_t i = 0; i < ARRAYSIZE(databases); ++i) for (auto& database : databases)
{ {
// MF_BuildPathname not used because backslash // MF_BuildPathname not used because backslash
// makes CreateFileMapping failing under windows. // 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); status = MMDB_open(file, MMDB_MODE_MMAP, &HandleDB);
@ -200,7 +222,8 @@ bool loadDatabase()
{ {
break; 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)); MF_Log("Could not open %s - %s", file, MMDB_strerror(status));

View File

@ -123,6 +123,12 @@
<ItemGroup> <ItemGroup>
<None Include="..\..\..\plugins\include\geoip.inc" /> <None Include="..\..\..\plugins\include\geoip.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -21,6 +21,9 @@
<Filter Include="GeoIP2"> <Filter Include="GeoIP2">
<UniqueIdentifier>{0bd4b9fb-f847-4fe5-af3e-9000fc854c5c}</UniqueIdentifier> <UniqueIdentifier>{0bd4b9fb-f847-4fe5-af3e-9000fc854c5c}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{cfe982b9-749c-4d98-ac7b-207290a68c7e}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\geoip_util.cpp"> <ClCompile Include="..\geoip_util.cpp">
@ -76,4 +79,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -63,6 +63,10 @@ void OnAmxxAttach(void)
assert(strcmp(hooklist[Ham_SC_Weapon_ChangeWeaponSkin].name, "sc_weapon_changeweaponskin")==0); 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_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); MF_AddNatives(pdata_natives_safe);
if (ReadConfig() > 0) if (ReadConfig() > 0)

View File

@ -173,7 +173,22 @@ cell Call_Int_Float_Int_Int(AMX *amx, cell *params)
return reinterpret_cast<int (*)(void *, float, int, int)>(__func)(pv, f3, i4, i5); return reinterpret_cast<int (*)(void *, float, int, int)>(__func)(pv, f3, i4, i5);
#endif #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<bool(__fastcall *)(void*, int, float, int, int)>(__func)(pv, 0, f3, i4, i5) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, float, int, int)>(__func)(pv, f3, i4, i5) ? TRUE : FALSE;
#endif
}
cell Call_Void_Entvar_Int(AMX *amx, cell *params) cell Call_Void_Entvar_Int(AMX *amx, cell *params)
{ {
SETUP(2); SETUP(2);
@ -248,6 +263,36 @@ cell Call_Void_Int_Int(AMX *amx, cell *params)
return 1; 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<void(__fastcall *)(void*, int, int, bool)>(__func)(pv, 0, i3, i4);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void *, int, bool)>(__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<void(__fastcall *)(void*, int, bool, bool)>(__func)(pv, 0, i3, i4);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void *, bool, bool)>(__func)(pv, i3, i4);
#endif
return 1;
}
cell Call_Int_Int_Str_Int(AMX *amx, cell *params) cell Call_Int_Int_Str_Int(AMX *amx, cell *params)
{ {
SETUP(3); SETUP(3);
@ -279,6 +324,22 @@ cell Call_Int_Int_Str_Int_Int(AMX *amx, cell *params)
#endif #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<int(__fastcall *)(void*, int, int, const char *, int, bool)>(__func)(pv, 0, i3, sz4, i5, i6);
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<int(*)(void *, int, const char *, int, bool)>(__func)(pv, i3, sz4, i5, i6);
#endif
}
cell Call_Int_Int(AMX *amx, cell *params) cell Call_Int_Int(AMX *amx, cell *params)
{ {
SETUP(1); SETUP(1);
@ -292,6 +353,19 @@ cell Call_Int_Int(AMX *amx, cell *params)
#endif #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<bool (__fastcall *)(void*, int, bool)>(__func)(pv, 0, i3) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *, bool)>(__func)(pv, i3) ? TRUE : FALSE;
#endif
}
cell Call_Int_Entvar(AMX *amx, cell *params) cell Call_Int_Entvar(AMX *amx, cell *params)
{ {
SETUP(1); SETUP(1);
@ -591,6 +665,29 @@ cell Call_Int_pVector(AMX *amx, cell *params)
return ret; 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<bool(__fastcall *)(void *, int, Vector*)>(__func)(pv, 0, &v3);
#elif defined(__linux__) || defined(__APPLE__)
bool ret = reinterpret_cast<bool(*)(void *, Vector*)>(__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) cell Call_Void_Entvar_Float_Float(AMX *amx, cell *params)
{ {
SETUP(3); SETUP(3);
@ -683,6 +780,24 @@ cell Call_Int_ItemInfo(AMX *amx, cell *params)
#endif #endif
} }
cell Call_Bool_ItemInfo(AMX *amx, cell *params)
{
SETUP(1);
void *ptr = reinterpret_cast<void *>(*MF_GetAmxAddr(amx, params[3]));
if (!ptr)
{
MF_LogError(amx, AMX_ERR_NATIVE, "Null ItemInfo handle!");
return 0;
}
#if defined(_WIN32)
return reinterpret_cast<bool(__fastcall *)(void*, int, void *)>(__func)(pv, 0, ptr) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, void *)>(__func)(pv, ptr) ? TRUE : FALSE;
#endif
}
cell Call_Float_Void(AMX *amx, cell *params) cell Call_Float_Void(AMX *amx, cell *params)
{ {
SETUP(1); SETUP(1);
@ -844,6 +959,34 @@ cell Call_Int_Int_Int(AMX *amx, cell *params)
#endif #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<bool (__fastcall *)(void*, int, bool, int)>(__func)(pv, 0, i3, i4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *, bool, int)>(__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<int(__fastcall *)(void*, int, bool, int)>(__func)(pv, 0, i3, i4);
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<int(*)(void *, bool, int)>(__func)(pv, i3, i4);
#endif
}
cell Call_Void_Str_Float_Float_Float(AMX *amx, cell *params) cell Call_Void_Str_Float_Float_Float(AMX *amx, cell *params)
{ {
SETUP(4); SETUP(4);
@ -886,6 +1029,30 @@ cell Call_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, cell *params)
return 1; 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<void (__fastcall *)(void*, int, const char *, float, float, float, bool, void *)>(__func)(pv, 0, sz3, f4, f5, f6, i7, p8);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void (*)(void *, const char *, float, float, float, bool, void *)>(__func)(pv, sz3, f4, f5, f6, i7, p8);
#endif
return 1;
}
cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params) cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params)
{ {
SETUP(4); SETUP(4);
@ -1143,6 +1310,24 @@ cell Call_Void_Str_Int(AMX *amx, cell *params)
return 1; 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<bool(__fastcall *)(void*, int, void *, int)>(__func)(pv, 0, p8, i4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, void *, int)>(__func)(pv, p8, i4) ? TRUE : FALSE;
#endif
}
cell Call_Void_Cbase_Int(AMX *amx, cell *params) cell Call_Void_Cbase_Int(AMX *amx, cell *params)
{ {
SETUP(2); SETUP(2);
@ -1163,6 +1348,27 @@ cell Call_Void_Cbase_Int(AMX *amx, cell *params)
return 1; 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<void(__fastcall *)(void*, int, void *, int, float)>(__func)(pv, 0, p8, i4, f5);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void *, void *, int, float)>(__func)(pv, p8, i4, f5);
#endif
return 1;
}
cell Call_Void_Str(AMX *amx, cell *params) cell Call_Void_Str(AMX *amx, cell *params)
{ {
SETUP(1); SETUP(1);
@ -1401,7 +1607,7 @@ cell Call_Int_Cbase_Bool(AMX *amx, cell *params)
void *pv1 = TypeConversion.id_to_cbase(id3); 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) #if defined(_WIN32)
return reinterpret_cast<int (__fastcall *)(void*, int, void *, bool)>(__func)(pv, 0, pv1, b4); return reinterpret_cast<int (__fastcall *)(void*, int, void *, bool)>(__func)(pv, 0, pv1, b4);
@ -1410,6 +1616,25 @@ cell Call_Int_Cbase_Bool(AMX *amx, cell *params)
#endif #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<bool(__fastcall *)(void*, int, void *, bool)>(__func)(pv, 0, pv1, b4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, void *, bool)>(__func)(pv, pv1, b4) ? TRUE : FALSE;
#endif
}
cell Call_Int_Vector_Vector(AMX *amx, cell *params) cell Call_Int_Vector_Vector(AMX *amx, cell *params)
{ {
SETUP(2); SETUP(2);
@ -1434,6 +1659,54 @@ cell Call_Int_Vector_Vector(AMX *amx, cell *params)
#endif #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<int(__fastcall *)(void *, int, Vector *, Vector *)>(__func)(pv, 0, &v3, &v4);
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<int(*)(void *, Vector *, Vector *)>(__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<bool(__fastcall *)(void *, int, Vector *, Vector *)>(__func)(pv, 0, &v3, &v4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, Vector *, Vector *)>(__func)(pv, &v3, &v4) ? TRUE : FALSE;
#endif
}
cell Call_Int_Entvar_Float(AMX *amx, cell *params) cell Call_Int_Entvar_Float(AMX *amx, cell *params)
{ {
SETUP(2); SETUP(2);
@ -1453,6 +1726,25 @@ cell Call_Int_Entvar_Float(AMX *amx, cell *params)
#endif #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<bool(__fastcall *)(void *, int, entvars_t *, float)>(__func)(pv, 0, ev3, f4) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, entvars_t *, float)>(__func)(pv, ev3, f4) ? TRUE : FALSE;
#endif
}
cell Call_Float_Float(AMX *amx, cell *params) cell Call_Float_Float(AMX *amx, cell *params)
{ {
SETUP(2); SETUP(2);
@ -1497,9 +1789,9 @@ cell Call_Bool_Void(AMX *amx, cell *params)
SETUP(0); SETUP(0);
#if defined(_WIN32) #if defined(_WIN32)
return reinterpret_cast<bool (__fastcall *)(void*, int)>(__func)(pv, 0); return reinterpret_cast<bool (__fastcall *)(void*, int)>(__func)(pv, 0) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__) #elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *)>(__func)(pv); return reinterpret_cast<bool (*)(void *)>(__func)(pv) ? TRUE : FALSE;
#endif #endif
} }
@ -1665,9 +1957,9 @@ cell Call_Bool_Cbase(AMX *amx, cell *params)
void *pv1 = TypeConversion.id_to_cbase(id3); void *pv1 = TypeConversion.id_to_cbase(id3);
#if defined(_WIN32) #if defined(_WIN32)
return reinterpret_cast<bool (__fastcall *)(void*, int, void*)>(__func)(pv, 0, pv1); return reinterpret_cast<bool (__fastcall *)(void*, int, void*)>(__func)(pv, 0, pv1) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__) #elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *, void*)>(__func)(pv, pv1); return reinterpret_cast<bool (*)(void *, void*)>(__func)(pv, pv1) ? TRUE : FALSE;
#endif #endif
} }
@ -1678,9 +1970,24 @@ cell Call_Bool_Int(AMX *amx, cell *params)
int id3=*MF_GetAmxAddr(amx, params[3]); int id3=*MF_GetAmxAddr(amx, params[3]);
#if defined(_WIN32) #if defined(_WIN32)
return reinterpret_cast<bool (__fastcall *)(void*, int, int)>(__func)(pv, 0, id3); return reinterpret_cast<bool (__fastcall *)(void*, int, int)>(__func)(pv, 0, id3) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__) #elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool (*)(void *, int)>(__func)(pv, id3); return reinterpret_cast<bool (*)(void *, int)>(__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<bool(__fastcall *)(void*, int, void*)>(__func)(pv, 0, ev3) ? TRUE : FALSE;
#elif defined(__linux__) || defined(__APPLE__)
return reinterpret_cast<bool(*)(void *, void*)>(__func)(pv, ev3) ? TRUE : FALSE;
#endif #endif
} }
@ -1711,7 +2018,7 @@ cell Call_Void_Cbase_Bool(AMX *amx, cell *params)
CHECK_ENTITY(id3); CHECK_ENTITY(id3);
void *p8 = TypeConversion.id_to_cbase(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) #if defined(_WIN32)
reinterpret_cast<void (__fastcall *)(void*, int, void *, bool)>(__func)(pv, 0, p8, b4); reinterpret_cast<void (__fastcall *)(void*, int, void *, bool)>(__func)(pv, 0, p8, b4);

View File

@ -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_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_Int(AMX *amx, cell *params);
cell Call_Void_Entvar_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_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(AMX *amx, cell *params);
cell Call_Int_Int_Str_Int_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_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(AMX *amx, cell *params);
cell Call_Int_Entvar_Entvar_Float_Int(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_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_Entvar_Float_Float(AMX *amx, cell *params);
cell Call_Void_pFloat_pFloat(AMX *amx, cell *params); cell Call_Void_pFloat_pFloat(AMX *amx, cell *params);
@ -77,6 +89,8 @@ cell Call_Void_Int_Int_Int(AMX *amx, cell *params);
cell Call_Int_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); cell Call_Float_Void(AMX *amx, cell *params);
cell Call_Void_Float_Int(AMX* amx, cell* params); cell Call_Void_Float_Int(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_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(AMX *amx, cell *params);
cell Call_Void_Str_Float_Float_Float_Int_Cbase(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_Vector_Vector_Float_Float(AMX *amx, cell *params);
cell Call_Int_Short(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_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(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_Str(AMX* amx, cell* params);
cell Call_Void_Vector(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_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_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_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_Float_Float(AMX* amx, cell* params);
cell Call_Void_Entvar_Entvar_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_Cbase(AMX *amx, cell *params);
cell Call_Bool_Entvar(AMX *amx, cell *params);
cell Call_Bool_Int(AMX *amx, cell *params); cell Call_Bool_Int(AMX *amx, cell *params);
cell Call_Void_Cbase_Float(AMX* amx, cell* params); cell Call_Void_Cbase_Float(AMX* amx, cell* params);

View File

@ -11,381 +11,46 @@
// Ham Sandwich Module // Ham Sandwich Module
// //
#include "amxxmodule.h" #include <amxxmodule.h>
#include "ham_const.h" #include "ham_const.h"
#include "hooklist.h" #include "hooklist.h"
#include "offsets.h" #include "offsets.h"
#include <amtl/am-string.h>
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<LEX_END; i++)
{
if (tokens[i]!=NULL && *(tokens[i])!='\0')
{
len=strlen(tokens[i]);
if (strncmp(buffer,tokens[i],len)==0)
{
buffer+=len+1;
return i;
}
}
}
return LEX_UNKNOWN;
}
// How we handle "mirrors"
// We just note down the current mod name, and every time
// we come across a mirror with the destination that matches
// the current mod name, we change the current mod name to
// the source for that mirror.
char CurrentModName[64];
static void read_mirror(char *input)
{
char *data=input;
char *data2;
char source[64];
char dest[64];
char old;
while ( *data!=' ' &&
*data!='\t' &&
*data!='\0')
{
data++;
}
old=*data;
*data='\0';
// mark down the source
ke::SafeSprintf(source, sizeof(source), "%s", input);
*data=old;
while ( *data==' ' ||
*data=='\t')
{
data++;
}
data2=data;
while ( *data!=' ' &&
*data!='\t' &&
*data!='\0')
{
data++;
}
old=*data;
*data='\0';
ke::SafeSprintf(dest, sizeof(dest), "%s", data2);
*data=old;
if (strcmp(dest, CurrentModName)==0)
{
ke::SafeSprintf(CurrentModName, sizeof(CurrentModName), "%s", source);
}
}
static void trim_line(char *input)
{
char *oldinput=input;
char *start=input;
while ( *start==' ' ||
*start=='\t' ||
*start=='\r' ||
*start=='\n')
{
start++;
}
// Overwrite the whitespace
if (start != input)
{
while ((*input++=*start++)!='\0')
/* do nothing */ ;
}
start=oldinput;
start+=strlen(start) - 1;
while ( start >= 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) 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); if (!ConfigManager->LoadGameConfigFile("common.games", &CommonConfig, error, sizeof error))
FILE *fp=fopen(FileName,"r");
ke::SafeSprintf(CurrentModName, sizeof(CurrentModName), "%s", MF_GetModname());
if (!fp)
{ {
MF_Log("Unable to open \"%s\" for reading.", FileName); MF_Log("common.games gamedata could not be read: %s", error);
return -1; return -1;
} }
char data[2048]; TypeDescription value;
int insec=0; if (CommonConfig->GetOffset("pev", &value))
while (!feof(fp))
{ {
data[0]='\0'; Offsets.SetPev(value.fieldOffset);
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);
}
};
}
} }
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; return 1;
} }

View File

@ -203,7 +203,7 @@ enum
Ham_CheckMeleeAttack2, Ham_CheckMeleeAttack2,
Ham_ScheduleChange, Ham_ScheduleChange,
Ham_CanPlaySequence, Ham_CanPlaySequence,
Ham_CanPlaySentence, Ham_CanPlaySentence2,
Ham_PlaySentence, Ham_PlaySentence,
Ham_PlayScriptedSentence, Ham_PlayScriptedSentence,
Ham_SentenceStop, Ham_SentenceStop,
@ -484,6 +484,72 @@ enum
Ham_Item_GetItemInfo, 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 HAM_LAST_ENTRY_DONT_USE_ME_LOL
}; };
@ -492,8 +558,9 @@ enum
HAM_OK = 0, HAM_OK = 0,
HAM_INVALID_FUNC, // The function is not valid 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 HAM_ERR_END
}; };

View File

@ -24,16 +24,23 @@ extern HLTypeConversion TypeConversion;
if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \ if (x < 0 || x >= HAM_LAST_ENTRY_DONT_USE_ME_LOL) { \
char msg[1024]; \ 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); \ 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; \ return 0; \
} else if (hooklist[x].isset == 0) { \ } else if (hooklist[x].isset == 0) { \
char msg[1024]; \ 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); \ FailPlugin(amx, x, HAM_FUNC_NOT_CONFIGURED, msg); \
return 0; \ return 0; \
} }
#define CHECK_ENTITY(x) \ #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); \ MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \

View File

@ -313,6 +313,39 @@ int Hook_Int_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2)
return ret; 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<bool (__fastcall*)(void*, int, float, int, int)>(hook->func)(pthis, 0, f1, i1, i2);
#elif defined(__linux__) || defined(__APPLE__)
origret=reinterpret_cast<bool (*)(void*, float, int, int)>(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) void Hook_Void_Entvar_Int(Hook *hook, void *pthis, entvars_t *ev1, int i1)
{ {
PUSH_VOID() PUSH_VOID()
@ -429,6 +462,58 @@ void Hook_Void_Int_Int(Hook *hook, void *pthis, int i1, int i2)
POP() 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<void(__fastcall*)(void*, int, int, bool)>(hook->func)(pthis, 0, i1, i2);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void*, int, bool)>(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<void(__fastcall*)(void*, int, bool, bool)>(hook->func)(pthis, 0, i1, i2);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void*, bool, bool)>(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 Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i2)
{ {
int ret=0; 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; 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<int(__fastcall*)(void*, int, int, const char *, int, bool)>(hook->func)(pthis, 0, i1, a.chars(), i2, i3);
#elif defined(__linux__) || defined(__APPLE__)
origret = reinterpret_cast<int(*)(void*, int, const char *, int, bool)>(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 Hook_Int_Int(Hook *hook, void *pthis, int i1)
{ {
int ret=0; int ret=0;
@ -531,6 +652,38 @@ int Hook_Int_Int(Hook *hook, void *pthis, int i1)
return ret; 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<bool (__fastcall*)(void*, int, bool)>(hook->func)(pthis, 0, i1);
#elif defined(__linux__) || defined(__APPLE__)
origret = reinterpret_cast<bool (*)(void*, bool)>(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 Hook_Int_Entvar(Hook *hook, void *pthis, entvars_t *ev1)
{ {
int ret=0; int ret=0;
@ -973,6 +1126,36 @@ int Hook_Int_pVector(Hook *hook, void *pthis, Vector *v1)
return ret; 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<cell *>(v1), 3, false)
PRE_END()
#if defined(_WIN32)
origret = reinterpret_cast<bool(__fastcall*)(void*, int, Vector *)>(hook->func)(pthis, 0, v1);
#elif defined(__linux__) || defined(__APPLE__)
origret = reinterpret_cast<bool(*)(void*, Vector *)>(hook->func)(pthis, v1);
#endif
POST_START()
, MF_PrepareCellArrayA(reinterpret_cast<cell *>(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) void Hook_Void_Entvar_Float_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1, float f2)
{ {
PUSH_VOID() PUSH_VOID()
@ -1080,6 +1263,7 @@ void Hook_Void_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2, int i3)
KILL_VECTOR() KILL_VECTOR()
POP() POP()
} }
int Hook_Int_ItemInfo(Hook *hook, void *pthis, void *iteminfo) int Hook_Int_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
{ {
int ret = 0; int ret = 0;
@ -1111,6 +1295,38 @@ int Hook_Int_ItemInfo(Hook *hook, void *pthis, void *iteminfo)
return ret; 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<bool (__fastcall*)(void*, int, void *)>(hook->func)(pthis, 0, iteminfo);
#elif defined(__linux__) || defined(__APPLE__)
origret = reinterpret_cast<bool (*)(void*, void *)>(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) float Hook_Float_Void(Hook *hook, void *pthis)
{ {
float ret=0.0; float ret=0.0;
@ -1410,6 +1626,39 @@ int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2)
return ret; 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<bool (__fastcall*)(void*, int, bool, int)>(hook->func)(pthis, 0, i1, i2);
#elif defined(__linux__) || defined(__APPLE__)
origret = reinterpret_cast<bool (*)(void*, bool, int)>(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) void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3)
{ {
ke::AString a; ke::AString a;
@ -1479,6 +1728,42 @@ void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const ch
POP() 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<int (__fastcall*)(void*, int, const char *, float, float, float, bool, void *)>(hook->func)(pthis, 0, a.chars(), f1, f2, f3, i1, cb);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<int (*)(void*, const char *, float, float, float, bool, void *)>(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 Hook_Int_Vector_Vector_Float_Float(Hook *hook, void *pthis, Vector v1, Vector v2, float f1, float f2)
{ {
int ret=0; int ret=0;
@ -1907,6 +2192,42 @@ void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2)
POP() 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<bool (__fastcall*)(void*, int, void *, int)>(hook->func)(pthis, 0, p1, i1);
#elif defined(__linux__) || defined(__APPLE__)
origret = reinterpret_cast<bool (*)(void*, void *, int)>(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) void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1)
{ {
PUSH_VOID() PUSH_VOID()
@ -1935,6 +2256,35 @@ void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1)
POP() 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<void(__fastcall*)(void*, int, void *, int, float)>(hook->func)(pthis, 0, p1, i1, f1);
#elif defined(__linux__) || defined(__APPLE__)
reinterpret_cast<void(*)(void*, void *, int, float)>(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) void Hook_Void_Str(Hook *hook, void *pthis, const char *sz1)
{ {
ke::AString a; ke::AString a;
@ -2274,6 +2624,39 @@ int Hook_Int_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1)
return ret; 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<bool (__fastcall*)(void*, int, void *, bool)>(hook->func)(pthis, 0, cb1, b1);
#elif defined(__linux__) || defined(__APPLE__)
origret=reinterpret_cast<bool (*)(void*, void *, bool)>(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 Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2)
{ {
int ret=0; int ret=0;
@ -2309,6 +2692,76 @@ int Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2)
return ret; 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<cell *>(v1), 3, false)
, MF_PrepareCellArrayA(reinterpret_cast<cell *>(v2), 3, false)
PRE_END()
#if defined(_WIN32)
origret=reinterpret_cast<int (__fastcall*)(void*, int, Vector*, Vector*)>(hook->func)(pthis, 0, v1, v2);
#elif defined(__linux__) || defined(__APPLE__)
origret=reinterpret_cast<int (*)(void*, Vector*, Vector*)>(hook->func)(pthis, v1, v2);
#endif
POST_START()
, MF_PrepareCellArrayA(reinterpret_cast<cell *>(v1), 3, false)
, MF_PrepareCellArrayA(reinterpret_cast<cell *>(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<cell *>(v1), 3, false)
, MF_PrepareCellArrayA(reinterpret_cast<cell *>(v2), 3, false)
PRE_END()
#if defined(_WIN32)
origret=reinterpret_cast<bool (__fastcall*)(void*, int, Vector*, Vector*)>(hook->func)(pthis, 0, v1, v2);
#elif defined(__linux__) || defined(__APPLE__)
origret=reinterpret_cast<bool (*)(void*, Vector*, Vector*)>(hook->func)(pthis, v1, v2);
#endif
POST_START()
, MF_PrepareCellArrayA(reinterpret_cast<cell *>(v1), 3, false)
, MF_PrepareCellArrayA(reinterpret_cast<cell *>(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 Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1)
{ {
int ret=0; int ret=0;
@ -2341,6 +2794,38 @@ int Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1)
return ret; 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<bool(__fastcall*)(void*, int, entvars_t *, float)>(hook->func)(pthis, 0, ev1, f1);
#elif defined(__linux__) || defined(__APPLE__)
origret=reinterpret_cast<bool(*)(void*, entvars_t *, float)>(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 Hook_Float_Float(Hook *hook, void *pthis, float f1)
{ {
float ret=0.0; float ret=0.0;
@ -2643,6 +3128,40 @@ bool Hook_Bool_Cbase(Hook *hook, void *pthis, void *cb)
return ret; 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<bool(__fastcall*)(void*, int, entvars_t*)>(hook->func)(pthis, 0, ev1);
#elif defined(__linux__) || defined(__APPLE__)
origret = reinterpret_cast<bool(*)(void*, entvars_t*)>(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 Hook_Bool_Int(Hook *hook, void *pthis, int i1)
{ {
bool ret=0; bool ret=0;

View File

@ -50,6 +50,11 @@ const bool RB_Int_Float_Int_Int = false;
const int PC_Int_Float_Int_Int = 3; const int PC_Int_Float_Int_Int = 3;
int Hook_Int_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2); 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 RT_Void_Entvar_Int = true;
const bool RB_Void_Entvar_Int = false; const bool RB_Void_Entvar_Int = false;
const int PC_Void_Entvar_Int = 2; 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; const int PC_Void_Int_Int = 2;
void Hook_Void_Int_Int(Hook *hook, void *pthis, int i1, int i2); 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 RT_Int_Int_Str_Int = false;
const bool RB_Int_Int_Str_Int = false; const bool RB_Int_Int_Str_Int = false;
const int PC_Int_Int_Str_Int = 3; 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; 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); 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 RT_Int_Int = false;
const bool RB_Int_Int = false; const bool RB_Int_Int = false;
const int PC_Int_Int = 1; const int PC_Int_Int = 1;
int Hook_Int_Int(Hook *hook, void *pthis, int i1); 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 RT_Int_Entvar = false;
const bool RB_Int_Entvar = false; const bool RB_Int_Entvar = false;
const int PC_Int_Entvar = 1; const int PC_Int_Entvar = 1;
@ -177,6 +202,11 @@ const bool RB_Int_pVector = false;
const int PC_Int_pVector = 1; const int PC_Int_pVector = 1;
int Hook_Int_pVector(Hook *hook, void *pthis, Vector *v1); 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 RT_Void_Entvar_Float_Float = true;
const bool RB_Void_Entvar_Float_Float = false; const bool RB_Void_Entvar_Float_Float = false;
const int PC_Void_Entvar_Float_Float = 3; const int PC_Void_Entvar_Float_Float = 3;
@ -203,6 +233,10 @@ const bool RB_Int_ItemInfo = false;
const int PC_Int_ItemInfo = 1; const int PC_Int_ItemInfo = 1;
int Hook_Int_ItemInfo(Hook *hook, void *pthis, void *iteminfo); 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 RT_Float_Void = false;
const bool RB_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; const int PC_Int_Int_Int = 2;
int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2); 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 RT_Void_Str_Float_Float_Float = true;
const bool RB_Void_Str_Float_Float_Float = false; const bool RB_Void_Str_Float_Float_Float = false;
const int PC_Void_Str_Float_Float_Float = 4; 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; 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); 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 RT_Int_Vector_Vector_Float_Float= false;
const bool RB_Int_Vector_Vector_Float_Float = false; const bool RB_Int_Vector_Vector_Float_Float = false;
const int PC_Int_Vector_Vector_Float_Float = 8; 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; const int PC_Void_Str_Int = 2;
void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2); 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 RT_Void_Cbase_Int = true;
const bool RB_Void_Cbase_Int = false; const bool RB_Void_Cbase_Int = false;
const int PC_Void_Cbase_Int = 2; const int PC_Void_Cbase_Int = 2;
void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1); 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 RT_Void_Str = true;
const bool RB_Void_Str = false; const bool RB_Void_Str = false;
const int PC_Void_Str = 1; const int PC_Void_Str = 1;
@ -401,16 +455,36 @@ const bool RB_Int_Cbase_Bool = false;
const int PC_Int_Cbase_Bool = 2; const int PC_Int_Cbase_Bool = 2;
int Hook_Int_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1); 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 RT_Int_Vector_Vector = false;
const bool RB_Int_Vector_Vector = false; const bool RB_Int_Vector_Vector = false;
const int PC_Int_Vector_Vector = 6; const int PC_Int_Vector_Vector = 6;
int Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2); 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 RT_Int_Entvar_Float = false;
const bool RB_Int_Entvar_Float = false; const bool RB_Int_Entvar_Float = false;
const int PC_Int_Entvar_Float = 2; const int PC_Int_Entvar_Float = 2;
int Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1); 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 RT_Float_Float = false;
const bool RB_Float_Float = false; const bool RB_Float_Float = false;
const int PC_Float_Float = 1; const int PC_Float_Float = 1;
@ -456,6 +530,11 @@ const bool RB_Bool_Cbase = false;
const int PC_Bool_Cbase = 1; const int PC_Bool_Cbase = 1;
bool Hook_Bool_Cbase(Hook *hook, void *pthis, void *cb); 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 RT_Bool_Int = false;
const bool RB_Bool_Int = false; const bool RB_Bool_Int = false;
const int PC_Bool_Int = 1; const int PC_Bool_Int = 1;

View File

@ -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); 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) int Create_Void_Entvar_Int(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE); 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); 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) 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); 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); 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) int Create_Int_Int(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE); 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) int Create_Int_Entvar(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE); 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); 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) 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); return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
@ -168,6 +198,11 @@ int Create_Int_ItemInfo(AMX *amx, const char *func)
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE); 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);
}
int Create_Float_Void(AMX *amx, const char *func) int Create_Float_Void(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE); return MF_RegisterSPForwardByName(amx, func, 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); 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) 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); 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); 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) 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); 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); 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) int Create_Void_Cbase_Int(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE); 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) int Create_Void_Str(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE); return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
} }
int Create_Void_Vector(AMX *amx, const char *func) int Create_Void_Vector(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE); 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); 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) 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); 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); 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) int Create_Int_Vector_Vector(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE); 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) int Create_Int_Entvar_Float(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE); 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) int Create_Float_Float(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE); 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); 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) int Create_Bool_Int(AMX *amx, const char *func)
{ {
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE); return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);

View File

@ -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_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_Int(AMX *amx, const char *func);
int Create_Void_Entvar_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_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(AMX *amx, const char *func);
int Create_Int_Int_Str_Int_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_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(AMX *amx, const char *func);
int Create_Int_Entvar_Entvar_Float_Int(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_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_Entvar_Float_Float(AMX *amx, const char *func);
int Create_Void_pFloat_pFloat(AMX *amx, const char *func); int Create_Void_pFloat_pFloat(AMX *amx, const char *func);
@ -77,6 +89,8 @@ int Create_Void_Int_Int_Int(AMX *amx, const char *func);
int Create_Int_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); int Create_Float_Void(AMX *amx, const char *func);
int Create_Float_Int(AMX *amx, const char *func); int Create_Float_Int(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_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(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_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_Vector_Vector_Float_Float(AMX *amx, const char *func);
int Create_Int_Short(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_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(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_Str(AMX *amx, const char *func);
int Create_Void_Vector(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_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_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_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_Float_Float(AMX *amx, const char *func);
int Create_Void_Entvar_Entvar_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_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_Bool_Int(AMX *amx, const char *func);
int Create_Void_Cbase_Float(AMX *amx, const char *func); int Create_Void_Cbase_Float(AMX *amx, const char *func);

View File

@ -37,7 +37,8 @@ bool gDoForwards=true;
ke::Vector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL]; ke::Vector<Hook *> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
CHamSpecialBotHandler SpecialbotHandler; CHamSpecialBotHandler SpecialbotHandler;
#define V(__KEYNAME, __STUFF__) 0, 0, __KEYNAME, RT_##__STUFF__, RB_##__STUFF__, PC_##__STUFF__, reinterpret_cast<void *>(Hook_##__STUFF__), Create_##__STUFF__, Call_##__STUFF__ #define V(__KEYNAME, __STUFF__) 0, 0, __KEYNAME, false, RT_##__STUFF__, RB_##__STUFF__, PC_##__STUFF__, reinterpret_cast<void *>(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[] = hook_t hooklist[] =
{ {
@ -229,7 +230,7 @@ hook_t hooklist[] =
{ V("checkmeleeattack2", Int_Float_Float) }, { V("checkmeleeattack2", Int_Float_Float) },
{ V("schedulechange", Void_Void) }, { V("schedulechange", Void_Void) },
{ V("canplaysequence", Int_Int_Int) }, { V("canplaysequence", Int_Int_Int) },
{ V("canplaysentence", Int_Int) }, { V("canplaysentence2", Int_Int) },
{ V("playsentence", Void_Str_Float_Float_Float) }, { V("playsentence", Void_Str_Float_Float_Float) },
{ V("playscriptedsentence", Void_Str_Float_Float_Float_Int_Cbase) }, { V("playscriptedsentence", Void_Str_Float_Float_Float_Int_Cbase) },
{ V("sentencestop", Void_Void) }, { V("sentencestop", Void_Void) },
@ -401,23 +402,23 @@ hook_t hooklist[] =
/* Sven co-op */ /* Sven co-op */
{ V("sc_getclassification", Int_Int) }, { V("sc_getclassification", Int_Int) },
{ V("sc_ismonster", Int_Void) }, { V("sc_ismonster", Bool_Void) },
{ V("sc_isphysx", Int_Void) }, { V_REMOVED("sc_isphysx") },
{ V("sc_ispointentity", Int_Void) }, { V("sc_ispointentity", Bool_Void) },
{ V("sc_ismachine", Int_Void) }, { V("sc_ismachine", Bool_Void) },
{ V("sc_criticalremove", Int_Void) }, { V("sc_criticalremove", Bool_Void) },
{ V("sc_updateonremove", Void_Void) }, { V("sc_updateonremove", Void_Void) },
{ V("sc_fvisible", Int_Cbase_Bool) }, { V("sc_fvisible", Bool_Cbase_Bool) },
{ V("sc_fvisiblefrompos", Int_Vector_Vector) }, { V("sc_fvisiblefrompos", Bool_pVector_pVector) },
{ V("sc_isfacing", Int_Entvar_Float) }, { V("sc_isfacing", Bool_Entvar_Float) },
{ V("sc_getpointsfordamage", Float_Float) }, { V("sc_getpointsfordamage", Float_Float) },
{ V("sc_getdamagepoints", Void_Entvar_Entvar_Float) }, { V("sc_getdamagepoints", Void_Entvar_Entvar_Float) },
{ V("sc_oncreate", Void_Void) }, { V("sc_oncreate", Void_Void) },
{ V("sc_ondestroy", Void_Void) }, { V("sc_ondestroy", Void_Void) },
{ V("sc_isvalidentity", Bool_Void) }, { V_REMOVED("sc_isvalidentity") },
{ V("sc_shouldfadeondeath", Int_Void) }, { V("sc_shouldfadeondeath", Int_Void) },
{ V("sc_setupfriendly", Void_Void) }, { V("sc_setupfriendly", Void_Void) },
{ V("sc_revivethink", Void_Void) }, { V_REMOVED("sc_revivethink") },
{ V("sc_revive", Void_Void) }, { V("sc_revive", Void_Void) },
{ V("sc_startmonster", Void_Void) }, { V("sc_startmonster", Void_Void) },
{ V("sc_checkrangeattack1_move",Int_Float_Float) }, { V("sc_checkrangeattack1_move",Int_Float_Float) },
@ -440,10 +441,10 @@ hook_t hooklist[] =
{ V("sc_finbulletcone", Int_Cbase_pVector) }, { V("sc_finbulletcone", Int_Cbase_pVector) },
{ V("sc_callgibmonster", Void_Void) }, { V("sc_callgibmonster", Void_Void) },
{ V("sc_checktimebaseddamage", Void_Void) }, { V("sc_checktimebaseddamage", Void_Void) },
{ V("sc_ismoving", Int_Void) }, { V("sc_ismoving", Bool_Void) },
{ V("sc_isplayerfollowing", Int_Void) }, { V("sc_isplayerfollowing", Int_Void) },
{ V("sc_startplayerfollowing", Void_Cbase) }, { V("sc_startplayerfollowing", Void_Cbase_Bool) },
{ V("sc_stopplayerfollowing", Void_Int) }, { V("sc_stopplayerfollowing", Void_Bool_Bool) },
{ V("sc_usesound", Void_Void) }, { V("sc_usesound", Void_Void) },
{ V("sc_unusesound", Void_Void) }, { V("sc_unusesound", Void_Void) },
{ V("sc_ridemonster", Void_Cbase) }, { V("sc_ridemonster", Void_Cbase) },
@ -454,8 +455,8 @@ hook_t hooklist[] =
{ V("sc_checkrevival", Void_Void) }, { V("sc_checkrevival", Void_Void) },
{ V("sc_mediccallsound", Void_Void) }, { V("sc_mediccallsound", Void_Void) },
{ V("sc_player_menuinputperformed", Void_Bool) }, { V_REMOVED("sc_player_menuinputperformed") },
{ V("sc_player_ismenuinputdone",Bool_Void) }, { V_REMOVED("sc_player_ismenuinputdone") },
{ V("sc_player_specialspawn", Void_Void) }, { V("sc_player_specialspawn", Void_Void) },
{ V("sc_player_isvalidinfoentity", Bool_Void) }, { V("sc_player_isvalidinfoentity", Bool_Void) },
{ V("sc_player_levelend", Void_Void) }, { V("sc_player_levelend", Void_Void) },
@ -470,9 +471,9 @@ hook_t hooklist[] =
{ V("sc_player_resetview", Void_Void) }, { V("sc_player_resetview", Void_Void) },
{ V("sc_player_getlogfrequency",Float_Void) }, { V("sc_player_getlogfrequency",Float_Void) },
{ V("sc_player_logplayerstats", Bool_Void) }, { V("sc_player_logplayerstats", Bool_Void) },
{ V("sc_player_disablecollisionwithplayer", Void_Cbase_Float) }, { V_REMOVED("sc_player_disablecollisionwithplayer") },
{ V("sc_player_enablecollisionwithplayer", Void_Cbase_Bool) }, { V_REMOVED("sc_player_enablecollisionwithplayer") },
{ V("sc_player_cantouchplayer", Bool_Cbase) }, { V_REMOVED("sc_player_cantouchplayer") },
{ V("sc_item_materialize", Void_Void) }, { V("sc_item_materialize", Void_Void) },
@ -483,10 +484,10 @@ hook_t hooklist[] =
{ V("sc_weapon_getw_model", Str_Str) }, { V("sc_weapon_getw_model", Str_Str) },
{ V("sc_weapon_getv_model", Str_Str) }, { V("sc_weapon_getv_model", Str_Str) },
{ V("sc_weapon_precachecustommodels", Void_Void) }, { V("sc_weapon_precachecustommodels", Void_Void) },
{ V("sc_weapon_ismultiplayer", Int_Void) }, { V("sc_weapon_ismultiplayer", Bool_Void) },
{ V("sc_weapon_frunfuncs", Int_Void) }, { V("sc_weapon_frunfuncs", Bool_Void) },
{ V("sc_weapon_setfov", Void_Int) }, { 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_customdecrement",Void_Float) },
{ V("sc_weapon_setv_model", Void_Str) }, { V("sc_weapon_setv_model", Void_Str) },
{ V("sc_weapon_setp_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_sendweaponanim", Void_Int_Int) },
{ V("tfc_weapon_getnextattackdelay", Float_Float) }, { V("tfc_weapon_getnextattackdelay", Float_Float) },
{ V("sc_takehealth",Int_Float_Int_Int) }, { V("sc_takehealth",Bool_Float_Int_Int) },
{ V("sc_takearmor", Int_Float_Int_Int) }, { V("sc_takearmor", Bool_Float_Int_Int) },
{ V("sc_giveammo", Int_Int_Str_Int_Int) }, { V("sc_giveammo", Int_Int_Str_Int_Bool) },
{ V("sc_checkattacker", Int_Cbase) }, { V("sc_checkattacker", Int_Cbase) },
{ V("sc_player_isconnected", Int_Void) }, { V("sc_player_isconnected", Bool_Void) },
{ V("dod_weapon_sendweaponanim", Void_Int_Int) }, { V("dod_weapon_sendweaponanim", Void_Int_Int) },
@ -514,7 +515,69 @@ hook_t hooklist[] =
{ V("ts_weapon_alternateattack", Void_Void) }, { V("ts_weapon_alternateattack", Void_Void) },
{ V("item_getiteminfo", Int_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) },
}; };

View File

@ -19,6 +19,7 @@ typedef struct hook_s
int isset; // whether or not this hook is registered with hamdata int isset; // whether or not this hook is registered with hamdata
int vtid; // vtable index of this function int vtid; // vtable index of this function
const char *name; // name used in the keys 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 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 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 int paramcount; // how many parameters are in the func

View File

@ -139,7 +139,13 @@
<None Include="..\..\..\plugins\include\ham_const.inc" /> <None Include="..\..\..\plugins\include\ham_const.inc" />
<None Include="..\..\..\plugins\include\hamsandwich.inc" /> <None Include="..\..\..\plugins\include\hamsandwich.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -33,6 +33,9 @@
<Filter Include="Memtools"> <Filter Include="Memtools">
<UniqueIdentifier>{c26eb07d-14b7-49e9-9122-6b7f5a711ecf}</UniqueIdentifier> <UniqueIdentifier>{c26eb07d-14b7-49e9-9122-6b7f5a711ecf}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{ce1c1544-036d-4339-918f-a716641a3b4f}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\call_funcs.cpp"> <ClCompile Include="..\call_funcs.cpp">
@ -130,4 +133,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -114,6 +114,12 @@
<ItemGroup> <ItemGroup>
<None Include="..\..\..\plugins\include\json.inc" /> <None Include="..\..\..\plugins\include\json.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -22,6 +22,9 @@
<Filter Include="Pawn Includes"> <Filter Include="Pawn Includes">
<UniqueIdentifier>{aaebd544-6579-4a7e-9c6b-2ccc3c0280be}</UniqueIdentifier> <UniqueIdentifier>{aaebd544-6579-4a7e-9c6b-2ccc3c0280be}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{50d2c03b-6783-40f5-8cb5-78ca29e9cfdc}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\JsonMngr.cpp"> <ClCompile Include="..\JsonMngr.cpp">
@ -59,4 +62,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -36,9 +36,8 @@ if AMXX.mysql_path:
'/SECTION:.data,RW' '/SECTION:.data,RW'
] ]
if binary.compiler.vendor == 'msvc' and binary.compiler.version >= 1900: if binary.compiler.vendor == 'msvc' and binary.compiler.version >= 1900:
binary.compiler.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib'] binary.sources += [
binary.sources += [ '../../public/msvc/msvc15hack.c'
'msvc15hack.c'
] ]
binary.compiler.linkflags += [AMXX.zlib.binary] binary.compiler.linkflags += [AMXX.zlib.binary]

View File

@ -91,7 +91,7 @@
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>ws2_32.lib;..\..\..\..\mysql-5.5\lib\mysqlclient.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>ws2_32.lib;..\..\..\..\mysql-5.5\lib\mysqlclient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
@ -100,6 +100,8 @@
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<SpecifySectionAttributes>.data,RW</SpecifySectionAttributes> <SpecifySectionAttributes>.data,RW</SpecifySectionAttributes>
<AdditionalOptions>/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1 %(AdditionalOptions)</AdditionalOptions>
<ProgramDatabaseFile>$(OutDir)mysql2.pdb</ProgramDatabaseFile>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@ -209,7 +211,13 @@
<ItemGroup> <ItemGroup>
<None Include="..\..\..\plugins\include\sqlx.inc" /> <None Include="..\..\..\plugins\include\sqlx.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -42,6 +42,9 @@
<Filter Include="Third Party\Zlib"> <Filter Include="Third Party\Zlib">
<UniqueIdentifier>{557b0e54-eb0e-488f-b8bc-3cee3f8ddfba}</UniqueIdentifier> <UniqueIdentifier>{557b0e54-eb0e-488f-b8bc-3cee3f8ddfba}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{746bb65b-17aa-4f58-8afc-0cfff3799bb7}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\basic_sql.cpp"> <ClCompile Include="..\basic_sql.cpp">
@ -217,4 +220,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -184,7 +184,13 @@
<ClInclude Include="..\..\..\public\sdk\amxxmodule.h" /> <ClInclude Include="..\..\..\public\sdk\amxxmodule.h" />
<ClInclude Include="..\moduleconfig.h" /> <ClInclude Include="..\moduleconfig.h" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -18,6 +18,9 @@
<Filter Include="Module SDK\SDK Base"> <Filter Include="Module SDK\SDK Base">
<UniqueIdentifier>{28f804b5-b177-4048-b0c6-36ba103593b9}</UniqueIdentifier> <UniqueIdentifier>{28f804b5-b177-4048-b0c6-36ba103593b9}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{4cc1fba9-04e0-4d8b-973a-e14073a505de}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\amxxapi.cpp"> <ClCompile Include="..\amxxapi.cpp">
@ -119,4 +122,9 @@
<Filter>Module SDK</Filter> <Filter>Module SDK</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -118,6 +118,12 @@
<ItemGroup> <ItemGroup>
<None Include="..\..\..\plugins\include\nvault.inc" /> <None Include="..\..\..\plugins\include\nvault.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -18,6 +18,9 @@
<Filter Include="Pawn Includes"> <Filter Include="Pawn Includes">
<UniqueIdentifier>{4722a41b-9bbc-4c55-b0da-315b9f16f618}</UniqueIdentifier> <UniqueIdentifier>{4722a41b-9bbc-4c55-b0da-315b9f16f618}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{9c53c0aa-9c17-4dce-a6c0-6f1e0675766d}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\amxxapi.cpp"> <ClCompile Include="..\amxxapi.cpp">
@ -67,4 +70,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -24,5 +24,9 @@ binary.sources = [
if builder.target_platform == 'windows': if builder.target_platform == 'windows':
binary.sources += ['version.rc'] binary.sources += ['version.rc']
if binary.compiler.vendor == 'msvc' and binary.compiler.version >= 1900:
binary.sources += [
'../../public/msvc/msvc15hack.c'
]
AMXX.modules += [builder.Add(binary)] AMXX.modules += [builder.Add(binary)]

View File

@ -114,6 +114,12 @@
<ItemGroup> <ItemGroup>
<None Include="..\..\..\plugins\include\regex.inc" /> <None Include="..\..\..\plugins\include\regex.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -18,6 +18,9 @@
<Filter Include="Pawn Includes"> <Filter Include="Pawn Includes">
<UniqueIdentifier>{c5722376-8e24-440a-9f13-023f19099b30}</UniqueIdentifier> <UniqueIdentifier>{c5722376-8e24-440a-9f13-023f19099b30}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{2e1aa30c-3176-440f-a39c-3733f9f8d503}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\CRegEx.cpp"> <ClCompile Include="..\CRegEx.cpp">
@ -55,4 +58,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -108,6 +108,12 @@
<ItemGroup> <ItemGroup>
<None Include="..\..\..\plugins\include\sockets.inc" /> <None Include="..\..\..\plugins\include\sockets.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -18,6 +18,9 @@
<Filter Include="Pawn Includes"> <Filter Include="Pawn Includes">
<UniqueIdentifier>{ffbc64d0-627e-4b7b-851d-f0c0cb9030ed}</UniqueIdentifier> <UniqueIdentifier>{ffbc64d0-627e-4b7b-851d-f0c0cb9030ed}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{ea476f56-a723-4227-b805-64745134c852}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\sockets.cpp"> <ClCompile Include="..\sockets.cpp">
@ -40,4 +43,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -15,8 +15,8 @@
#include <amtl/am-string.h> #include <amtl/am-string.h>
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <WinSock2.h>
#include <ws2tcpip.h> #include <WS2tcpip.h>
#undef errno #undef errno
#undef close #undef close
@ -24,6 +24,9 @@
#define errno WSAGetLastError() #define errno WSAGetLastError()
#define close(sockfd) closesocket(sockfd) #define close(sockfd) closesocket(sockfd)
#undef EINPROGRESS
#undef EWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS #define EINPROGRESS WSAEINPROGRESS
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#else #else

View File

@ -149,7 +149,13 @@
<ItemGroup> <ItemGroup>
<None Include="..\..\..\plugins\include\sqlx.inc" /> <None Include="..\..\..\plugins\include\sqlx.inc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../public;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../public;</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -39,6 +39,9 @@
<Filter Include="Pawn Includes"> <Filter Include="Pawn Includes">
<UniqueIdentifier>{e0a36119-bb5b-4f07-9e0e-80f9aa7a7d21}</UniqueIdentifier> <UniqueIdentifier>{e0a36119-bb5b-4f07-9e0e-80f9aa7a7d21}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{9595267e-27de-4ad9-b2cd-ecd10c9513ae}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\basic_sql.cpp"> <ClCompile Include="..\basic_sql.cpp">
@ -145,4 +148,9 @@
<Filter>Pawn Includes</Filter> <Filter>Pawn Includes</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project> </Project>

View File

@ -127,9 +127,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.amxAddr1, &calc.physAddr1)!=AMX_ERR_NONE)||
(MF_AmxAllot(&calc.amx, 8 , &calc.amxAddr2, &calc.physAddr2)!=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)){ (MF_AmxFindPublic(&calc.amx,"get_score",&calc.func)!=AMX_ERR_NONE)){

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