2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-29 06:57:55 +03:00

Refactoring

This commit is contained in:
s1lent 2017-11-13 19:47:54 +07:00
parent ef5283715c
commit f98571f217
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
14 changed files with 97 additions and 98 deletions

View File

@ -199,8 +199,7 @@ C_DLLEXPORT void AMXX_PluginsUnloading()
{ {
} }
// Advanced MF functions NOINLINE void AMXX_Log(const char *fmt, ...)
NOINLINE void MF_Log(const char *fmt, ...)
{ {
char msg[2048]; char msg[2048];
va_list arglst; va_list arglst;
@ -211,7 +210,7 @@ NOINLINE void MF_Log(const char *fmt, ...)
g_amxxapi.Log("[%s] %s", g_ModuleInfo.logtag, msg); g_amxxapi.Log("[%s] %s", g_ModuleInfo.logtag, msg);
} }
NOINLINE void MF_LogError(AMX *amx, int err, const char *fmt, ...) NOINLINE void AMXX_LogError(AMX *amx, int err, const char *fmt, ...)
{ {
char msg[2048]; char msg[2048];
va_list arglst; va_list arglst;
@ -222,7 +221,7 @@ NOINLINE void MF_LogError(AMX *amx, int err, const char *fmt, ...)
g_amxxapi.LogError(amx, err, "[%s] %s", g_ModuleInfo.logtag, msg); g_amxxapi.LogError(amx, err, "[%s] %s", g_ModuleInfo.logtag, msg);
} }
NOINLINE void AMXX_Error(AMX *amx, const char *fmt, ...) NOINLINE void AMXX_Assert(AMX *amx, const char *fmt, ...)
{ {
char msg[2048]; char msg[2048];
va_list arglst; va_list arglst;

View File

@ -491,9 +491,9 @@ struct amxxapi_t
extern amxxapi_t g_amxxapi; extern amxxapi_t g_amxxapi;
void MF_Log(const char *fmt, ...); void AMXX_Log(const char *fmt, ...);
void MF_LogError(AMX *amx, int err, const char *fmt, ...); void AMXX_LogError(AMX *amx, int err, const char *fmt, ...);
void AMXX_Error(AMX *amx, const char *fmt, ...); void AMXX_Assert(AMX *amx, const char *fmt, ...);
char* getAmxString(cell* src, char* dest, size_t max, size_t* len = nullptr); char* getAmxString(cell* src, char* dest, size_t max, size_t* len = nullptr);
void setAmxString(cell* dest, const char* string, size_t max); void setAmxString(cell* dest, const char* string, size_t max);

View File

@ -57,7 +57,7 @@ bool CEntityCallback::SetThink(AMX *amx, CBaseEntity *pEntity, const char *pszCa
} }
if (fwdid == -1) { if (fwdid == -1) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__);
return false; return false;
} }
@ -78,7 +78,7 @@ bool CEntityCallback::SetTouch(AMX *amx, CBaseEntity *pEntity, const char *pszCa
} }
if (fwdid == -1) { if (fwdid == -1) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__);
return false; return false;
} }
@ -99,7 +99,7 @@ bool CEntityCallback::SetUse(AMX *amx, CBaseEntity *pEntity, const char *pszCall
} }
if (fwdid == -1) { if (fwdid == -1) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__);
return false; return false;
} }
@ -120,7 +120,7 @@ bool CEntityCallback::SetBlocked(AMX *amx, CBaseEntity *pEntity, const char *psz
} }
if (fwdid == -1) { if (fwdid == -1) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__);
return false; return false;
} }
@ -141,7 +141,7 @@ bool CEntityCallback::SetMoveDone(AMX *amx, CBaseEntity *pEntity, const char *ps
} }
if (fwdid == -1) { if (fwdid == -1) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: failed to register forward.", __FUNCTION__);
return false; return false;
} }

View File

@ -220,7 +220,7 @@ NOINLINE R DLLEXPORT _callForward(const hook_t* hook, original_t original, volat
} }
if (unlikely(!hookCtx->retVal.set)) { if (unlikely(!hookCtx->retVal.set)) {
AMXX_Error(fwd->GetAmx(), "%s : Can't suppress original function call without new return value set", fwd->GetCallbackName()); AMXX_Assert(fwd->GetAmx(), "%s : Can't suppress original function call without new return value set", fwd->GetCallbackName());
continue; continue;
} }

View File

@ -106,7 +106,7 @@ cell AMX_NATIVE_CALL amx_get_viewent(AMX *amx, cell *params)
client_t *pClient = clientOfIndex(params[arg_index]); client_t *pClient = clientOfIndex(params[arg_index]);
if (unlikely(pClient == nullptr || !(pClient->active | pClient->spawned | pClient->connected))) if (unlikely(pClient == nullptr || !(pClient->active | pClient->spawned | pClient->connected)))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[arg_index]);
return FALSE; return FALSE;
} }
@ -134,7 +134,7 @@ cell AMX_NATIVE_CALL amx_get_key_value(AMX *amx, cell *params)
char *buffer = reinterpret_cast<char *>(params[arg_buffer]); char *buffer = reinterpret_cast<char *>(params[arg_buffer]);
if (!buffer) if (!buffer)
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid buffer", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid buffer", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -162,7 +162,7 @@ cell AMX_NATIVE_CALL amx_set_key_value(AMX *amx, cell *params)
char *buffer = reinterpret_cast<char *>(params[arg_buffer]); char *buffer = reinterpret_cast<char *>(params[arg_buffer]);
if (!buffer) if (!buffer)
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid buffer", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid buffer", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -205,12 +205,12 @@ cell AMX_NATIVE_CALL amx_GetBonePosition(AMX *amx, cell *params)
CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]); CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]);
if (unlikely(pEntity == nullptr)) { if (unlikely(pEntity == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
if (FNullEnt(params[arg_index])) { if (FNullEnt(params[arg_index])) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: worldspawn not allowed", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: worldspawn not allowed", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -242,12 +242,12 @@ cell AMX_NATIVE_CALL amx_GetAttachment(AMX *amx, cell *params)
CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]); CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]);
if (unlikely(pEntity == nullptr)) { if (unlikely(pEntity == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
if (FNullEnt(params[arg_index])) { if (FNullEnt(params[arg_index])) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: worldspawn not allowed", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: worldspawn not allowed", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -280,7 +280,7 @@ cell AMX_NATIVE_CALL amx_SetThink(AMX *amx, cell *params)
CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]); CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]);
if (unlikely(pEntity == nullptr)) { if (unlikely(pEntity == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -293,7 +293,7 @@ cell AMX_NATIVE_CALL amx_SetThink(AMX *amx, cell *params)
int funcid; int funcid;
if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) { if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname);
return FALSE; return FALSE;
} }
@ -324,7 +324,7 @@ cell AMX_NATIVE_CALL amx_SetTouch(AMX *amx, cell *params)
CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]); CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]);
if (unlikely(pEntity == nullptr)) { if (unlikely(pEntity == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -337,7 +337,7 @@ cell AMX_NATIVE_CALL amx_SetTouch(AMX *amx, cell *params)
int funcid; int funcid;
if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) { if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname);
return FALSE; return FALSE;
} }
@ -368,7 +368,7 @@ cell AMX_NATIVE_CALL amx_SetUse(AMX *amx, cell *params)
CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]); CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]);
if (unlikely(pEntity == nullptr)) { if (unlikely(pEntity == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -381,7 +381,7 @@ cell AMX_NATIVE_CALL amx_SetUse(AMX *amx, cell *params)
int funcid; int funcid;
if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) { if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname);
return FALSE; return FALSE;
} }
@ -412,7 +412,7 @@ cell AMX_NATIVE_CALL amx_SetBlocked(AMX *amx, cell *params)
CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]); CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]);
if (unlikely(pEntity == nullptr)) { if (unlikely(pEntity == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -425,7 +425,7 @@ cell AMX_NATIVE_CALL amx_SetBlocked(AMX *amx, cell *params)
int funcid; int funcid;
if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) { if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname);
return FALSE; return FALSE;
} }
@ -457,7 +457,7 @@ cell AMX_NATIVE_CALL amx_SetMoveDone(AMX *amx, cell *params)
CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]); CBaseEntity *pEntity = getPrivate<CBaseEntity>(params[arg_index]);
if (unlikely(pEntity == nullptr)) { if (unlikely(pEntity == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -470,7 +470,7 @@ cell AMX_NATIVE_CALL amx_SetMoveDone(AMX *amx, cell *params)
int funcid; int funcid;
if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) { if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname);
return FALSE; return FALSE;
} }

View File

@ -2,10 +2,10 @@
#define PARAMS_COUNT (params[0] / sizeof(cell)) #define PARAMS_COUNT (params[0] / sizeof(cell))
#define CHECK_ISPLAYER(x) if (unlikely(params[x] <= 0 || params[x] > gpGlobals->maxClients)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid player index %i [%s]", __FUNCTION__, params[x], #x); return FALSE; } #define CHECK_ISPLAYER(x) if (unlikely(params[x] <= 0 || params[x] > gpGlobals->maxClients)) { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid player index %i [%s]", __FUNCTION__, params[x], #x); return FALSE; }
#define CHECK_ISENTITY(x) if (unlikely(params[x] < 0 || params[x] > gpGlobals->maxEntities)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid entity index %i [%s]", __FUNCTION__, params[x], #x); return FALSE; } #define CHECK_ISENTITY(x) if (unlikely(params[x] < 0 || params[x] > gpGlobals->maxEntities)) { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid entity index %i [%s]", __FUNCTION__, params[x], #x); return FALSE; }
#define CHECK_GAMERULES() if (unlikely(!g_pGameRules)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: gamerules not initialized", __FUNCTION__); return FALSE; } #define CHECK_GAMERULES() if (unlikely(!g_pGameRules)) { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: gamerules not initialized", __FUNCTION__); return FALSE; }
#define CHECK_CONNECTED(x, y) if (unlikely(x == nullptr || x->has_disconnected)) { MF_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[y]); return FALSE; } #define CHECK_CONNECTED(x, y) if (unlikely(x == nullptr || x->has_disconnected)) { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: player %i is not connected", __FUNCTION__, params[y]); return FALSE; }
class CAmxArg class CAmxArg
{ {

View File

@ -22,13 +22,13 @@ cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params)
if (unlikely(hook == nullptr)) if (unlikely(hook == nullptr))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: function with id (%d) doesn't exist in current API version.", __FUNCTION__, func); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: function with id (%d) doesn't exist in current API version.", __FUNCTION__, func);
return INVALID_HOOKCHAIN; return INVALID_HOOKCHAIN;
} }
if (unlikely(!hook->checkRequirements())) if (unlikely(!hook->checkRequirements()))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: function (%s) is not available, %s required.", __FUNCTION__, hook->func_name, hook->depend_name); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: function (%s) is not available, %s required.", __FUNCTION__, hook->func_name, hook->depend_name);
return INVALID_HOOKCHAIN; return INVALID_HOOKCHAIN;
} }
@ -38,14 +38,14 @@ cell AMX_NATIVE_CALL RegisterHookChain(AMX *amx, cell *params)
int funcid; int funcid;
if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE)) if (unlikely(g_amxxapi.amx_FindPublic(amx, funcname, &funcid) != AMX_ERR_NONE))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, funcname);
return INVALID_HOOKCHAIN; return INVALID_HOOKCHAIN;
} }
int fwid = hook->registerForward(amx, funcname); int fwid = hook->registerForward(amx, funcname);
if (unlikely(fwid == -1)) if (unlikely(fwid == -1))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: register forward failed.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: register forward failed.", __FUNCTION__);
return INVALID_HOOKCHAIN; return INVALID_HOOKCHAIN;
} }
@ -70,7 +70,7 @@ cell AMX_NATIVE_CALL EnableHookChain(AMX *amx, cell *params)
if (unlikely(hook == nullptr)) if (unlikely(hook == nullptr))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid HookChain handle.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid HookChain handle.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -94,7 +94,7 @@ cell AMX_NATIVE_CALL DisableHookChain(AMX *amx, cell *params)
if (unlikely(hook == nullptr)) if (unlikely(hook == nullptr))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid HookChain handle.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid HookChain handle.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -114,7 +114,7 @@ cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params)
{ {
if (unlikely(!g_hookCtx)) if (unlikely(!g_hookCtx))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: trying to set return value without active hook.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: trying to set return value without active hook.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -123,7 +123,7 @@ cell AMX_NATIVE_CALL SetHookChainReturn(AMX *amx, cell *params)
if (unlikely(params[arg_type] != retVal.type)) if (unlikely(params[arg_type] != retVal.type))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: trying to set return value with incompatible type.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: trying to set return value with incompatible type.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -179,7 +179,7 @@ cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params)
{ {
if (unlikely(!g_hookCtx)) if (unlikely(!g_hookCtx))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: trying to get return value without active hook.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: trying to get return value without active hook.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -188,13 +188,13 @@ cell AMX_NATIVE_CALL GetHookChainReturn(AMX *amx, cell *params)
if (unlikely(params[arg_type] != retVal.type)) if (unlikely(params[arg_type] != retVal.type))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: trying to set return value with incompatible type.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: trying to set return value with incompatible type.", __FUNCTION__);
return FALSE; return FALSE;
} }
if (unlikely(!retVal.set)) if (unlikely(!retVal.set))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: return value isn't set.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: return value isn't set.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -242,7 +242,7 @@ cell AMX_NATIVE_CALL SetHookChainArg(AMX *amx, cell *params)
{ {
if (unlikely(!g_hookCtx)) if (unlikely(!g_hookCtx))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: trying to get return value without active hook.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: trying to get return value without active hook.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -251,7 +251,7 @@ cell AMX_NATIVE_CALL SetHookChainArg(AMX *amx, cell *params)
if (unlikely(number >= g_hookCtx->args_count)) if (unlikely(number >= g_hookCtx->args_count))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: can't set argument %i of hookchain with %i args.", __FUNCTION__, params[arg_number], g_hookCtx->args_count); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: can't set argument %i of hookchain with %i args.", __FUNCTION__, params[arg_number], g_hookCtx->args_count);
return FALSE; return FALSE;
} }
@ -259,7 +259,7 @@ cell AMX_NATIVE_CALL SetHookChainArg(AMX *amx, cell *params)
if (unlikely(params[arg_type] != type)) if (unlikely(params[arg_type] != type))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid argument type provided.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid argument type provided.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -307,7 +307,7 @@ AMX_NATIVE_INFO HookChain_Natives[] =
void RegisterNatives_HookChains() void RegisterNatives_HookChains()
{ {
if (!api_cfg.hasReHLDS() && !api_cfg.hasReGameDLL()) if (!api_cfg.hasReHLDS() && !api_cfg.hasReGameDLL())
fillNatives(HookChain_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "You need ReHlds or ReGameDll for use hookchains"); return FALSE; }); fillNatives(HookChain_Natives, [](AMX *amx, cell *params) -> cell { AMXX_LogError(amx, AMX_ERR_NATIVE, "You need ReHlds or ReGameDll for use hookchains"); return FALSE; });
g_amxxapi.AddNatives(HookChain_Natives); g_amxxapi.AddNatives(HookChain_Natives);
} }

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#define PARAMS_REQUIRE(x) if (params[0] != x * sizeof(cell)) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameters count in %s", __FUNCTION__); return nullptr; } #define PARAMS_REQUIRE(x) if (params[0] != x * sizeof(cell)) { AMXX_LogError(amx, AMX_ERR_NATIVE, "Invalid parameters count in %s", __FUNCTION__); return nullptr; }
#define NATIVE_MEMBER_REQUIRE(a,x) if (!api_cfg.has##x()) { MF_LogError(amx, AMX_ERR_NATIVE, "Member (%s) is not available, required %s", memberlist[a]->member_name, #x); return 0; } #define NATIVE_MEMBER_REQUIRE(a,x) if (!api_cfg.has##x()) { AMXX_LogError(amx, AMX_ERR_NATIVE, "Member (%s) is not available, required %s", memberlist[a]->member_name, #x); return 0; }
void RegisterNatives_HookChains(); void RegisterNatives_HookChains();

View File

@ -15,13 +15,13 @@ cell AMX_NATIVE_CALL set_member(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_member]]; member_t *member = memberlist[params[arg_member]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]);
return FALSE; return FALSE;
} }
edict_t *pEdict = edictByIndexAmx(params[arg_index]); edict_t *pEdict = edictByIndexAmx(params[arg_index]);
if (unlikely(pEdict == nullptr || pEdict->pvPrivateData == nullptr)) { if (unlikely(pEdict == nullptr || pEdict->pvPrivateData == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -56,13 +56,13 @@ cell AMX_NATIVE_CALL get_member(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_member]]; member_t *member = memberlist[params[arg_member]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]);
return FALSE; return FALSE;
} }
edict_t *pEdict = edictByIndexAmx(params[arg_index]); edict_t *pEdict = edictByIndexAmx(params[arg_index]);
if (unlikely(pEdict == nullptr || pEdict->pvPrivateData == nullptr)) { if (unlikely(pEdict == nullptr || pEdict->pvPrivateData == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -132,7 +132,7 @@ cell AMX_NATIVE_CALL set_member_game(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_member]]; member_t *member = memberlist[params[arg_member]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]);
return FALSE; return FALSE;
} }
@ -159,7 +159,7 @@ cell AMX_NATIVE_CALL get_member_game(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_member]]; member_t *member = memberlist[params[arg_member]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]);
return FALSE; return FALSE;
} }
@ -200,14 +200,14 @@ cell AMX_NATIVE_CALL set_entvar(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
CHECK_ISENTITY(arg_index); CHECK_ISENTITY(arg_index);
edict_t *pEdict = edictByIndexAmx(params[arg_index]); edict_t *pEdict = edictByIndexAmx(params[arg_index]);
if (unlikely(pEdict == nullptr || pEdict->pvPrivateData == nullptr)) { if (unlikely(pEdict == nullptr || pEdict->pvPrivateData == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -229,7 +229,7 @@ cell AMX_NATIVE_CALL get_entvar(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -237,7 +237,7 @@ cell AMX_NATIVE_CALL get_entvar(AMX *amx, cell *params)
edict_t *pEdict = edictByIndexAmx(params[arg_index]); edict_t *pEdict = edictByIndexAmx(params[arg_index]);
if (unlikely(pEdict == nullptr || &pEdict->v == nullptr)) { if (unlikely(pEdict == nullptr || &pEdict->v == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid or uninitialized entity", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -294,7 +294,7 @@ cell AMX_NATIVE_CALL set_pmove(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -319,7 +319,7 @@ cell AMX_NATIVE_CALL get_pmove(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -362,7 +362,7 @@ cell AMX_NATIVE_CALL set_movevar(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -385,7 +385,7 @@ cell AMX_NATIVE_CALL get_movevar(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -419,7 +419,7 @@ cell AMX_NATIVE_CALL set_ucmd(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -440,7 +440,7 @@ cell AMX_NATIVE_CALL get_ucmd(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -475,7 +475,7 @@ cell AMX_NATIVE_CALL set_pmtrace(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -499,7 +499,7 @@ cell AMX_NATIVE_CALL get_pmtrace(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_var]]; member_t *member = memberlist[params[arg_var]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_var]);
return FALSE; return FALSE;
} }
@ -534,13 +534,13 @@ cell AMX_NATIVE_CALL set_rebuy(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_member]]; member_t *member = memberlist[params[arg_member]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]);
return FALSE; return FALSE;
} }
cell *handle = (cell *)params[arg_handle]; cell *handle = (cell *)params[arg_handle];
if (unlikely(handle == nullptr)) { if (unlikely(handle == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid rebuy handle", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid rebuy handle", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -562,13 +562,13 @@ cell AMX_NATIVE_CALL get_rebuy(AMX *amx, cell *params)
member_t *member = memberlist[params[arg_member]]; member_t *member = memberlist[params[arg_member]];
if (unlikely(member == nullptr)) { if (unlikely(member == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown member id %i", __FUNCTION__, params[arg_member]);
return FALSE; return FALSE;
} }
cell *handle = (cell *)params[arg_handle]; cell *handle = (cell *)params[arg_handle];
if (unlikely(handle == nullptr)) { if (unlikely(handle == nullptr)) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid rebuy handle", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid rebuy handle", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -612,7 +612,7 @@ AMX_NATIVE_INFO ReGameVars_Natives[] =
void RegisterNatives_Members() void RegisterNatives_Members()
{ {
if (!api_cfg.hasReGameDLL()) if (!api_cfg.hasReGameDLL())
fillNatives(ReGameVars_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReGameDll"); return FALSE; }); fillNatives(ReGameVars_Natives, [](AMX *amx, cell *params) -> cell { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReGameDll"); return FALSE; });
g_amxxapi.AddNatives(ReGameVars_Natives); g_amxxapi.AddNatives(ReGameVars_Natives);
g_amxxapi.AddNatives(EngineVars_Natives); g_amxxapi.AddNatives(EngineVars_Natives);

View File

@ -271,7 +271,7 @@ cell AMX_NATIVE_CALL rg_multidmg_add(AMX *amx, cell *params)
CHECK_ISENTITY(arg_victim); CHECK_ISENTITY(arg_victim);
if (params[arg_victim] < 0) { // null if (params[arg_victim] < 0) { // null
MF_LogError(amx, AMX_ERR_NATIVE, "%s: victim == null", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: victim == null", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -418,7 +418,7 @@ cell AMX_NATIVE_CALL rg_round_end(AMX *amx, cell *params)
auto winstatus = params[arg_win]; auto winstatus = params[arg_win];
if (winstatus <= 0) { if (winstatus <= 0) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown win status %i", __FUNCTION__, winstatus); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown win status %i", __FUNCTION__, winstatus);
return FALSE; return FALSE;
} }
@ -697,7 +697,7 @@ cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params)
if (!GetWeaponInfoRange(weaponId, false) && info_type != WI_ID) if (!GetWeaponInfoRange(weaponId, false) && info_type != WI_ID)
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid weapon id %i", __FUNCTION__, weaponId); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid weapon id %i", __FUNCTION__, weaponId);
return 0; return 0;
} }
@ -731,7 +731,7 @@ cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params)
case WI_AMMO_NAME: case WI_AMMO_NAME:
{ {
if (PARAMS_COUNT != arg_4) { if (PARAMS_COUNT != arg_4) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: bad parameter count, got %i, expected %i", __FUNCTION__, PARAMS_COUNT, arg_4); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: bad parameter count, got %i, expected %i", __FUNCTION__, PARAMS_COUNT, arg_4);
return -1; return -1;
} }
@ -750,7 +750,7 @@ cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params)
case WI_NAME: case WI_NAME:
{ {
if (PARAMS_COUNT != arg_4) { if (PARAMS_COUNT != arg_4) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: bad parameter count, got %i, expected %i", __FUNCTION__, PARAMS_COUNT, arg_4); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: bad parameter count, got %i, expected %i", __FUNCTION__, PARAMS_COUNT, arg_4);
return -1; return -1;
} }
@ -767,7 +767,7 @@ cell AMX_NATIVE_CALL rg_get_weapon_info(AMX *amx, cell *params)
return 1; return 1;
} }
default: default:
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown type statement %i, params count %i", __FUNCTION__, info_type, PARAMS_COUNT); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown type statement %i, params count %i", __FUNCTION__, info_type, PARAMS_COUNT);
return -1; return -1;
} }
} }
@ -789,7 +789,7 @@ cell AMX_NATIVE_CALL rg_set_weapon_info(AMX *amx, cell *params)
WeaponIdType weaponId = static_cast<WeaponIdType>(params[arg_weapon_id]); WeaponIdType weaponId = static_cast<WeaponIdType>(params[arg_weapon_id]);
if (!GetWeaponInfoRange(weaponId, true)) if (!GetWeaponInfoRange(weaponId, true))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid weapon id %i", __FUNCTION__, weaponId); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid weapon id %i", __FUNCTION__, weaponId);
return 0; return 0;
} }
@ -819,10 +819,10 @@ cell AMX_NATIVE_CALL rg_set_weapon_info(AMX *amx, cell *params)
break; break;
case WI_AMMO_NAME: case WI_AMMO_NAME:
case WI_NAME: case WI_NAME:
MF_LogError(amx, AMX_ERR_NATIVE, "%s: this change will have no effect, type statement %i", __FUNCTION__, info_type); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: this change will have no effect, type statement %i", __FUNCTION__, info_type);
return 0; return 0;
default: default:
MF_LogError(amx, AMX_ERR_NATIVE, "%s: unknown type statement %i, params count %i", __FUNCTION__, info_type, PARAMS_COUNT); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: unknown type statement %i, params count %i", __FUNCTION__, info_type, PARAMS_COUNT);
return 0; return 0;
} }
@ -1380,7 +1380,7 @@ cell AMX_NATIVE_CALL rg_set_user_model(AMX *amx, cell *params)
char modelbuf[256]; char modelbuf[256];
const char* newModel = getAmxString(amx, params[arg_model], modelbuf); const char* newModel = getAmxString(amx, params[arg_model], modelbuf);
if (*newModel == '\0') { if (*newModel == '\0') {
MF_LogError(amx, AMX_ERR_NATIVE, "Model can not be empty"); AMXX_LogError(amx, AMX_ERR_NATIVE, "Model can not be empty");
return FALSE; return FALSE;
} }
@ -1552,7 +1552,7 @@ cell AMX_NATIVE_CALL rg_instant_reload_weapons(AMX *amx, cell *params)
{ {
pWeapon = getPrivate<CBasePlayerWeapon>(params[arg_weapon]); pWeapon = getPrivate<CBasePlayerWeapon>(params[arg_weapon]);
if (!pWeapon || !pWeapon->IsWeapon()) { if (!pWeapon || !pWeapon->IsWeapon()) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity weapon", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity weapon", __FUNCTION__);
return FALSE; return FALSE;
} }
} }
@ -1709,7 +1709,7 @@ cell AMX_NATIVE_CALL rg_switch_weapon(AMX *amx, cell *params)
auto pWeapon = getPrivate<CBasePlayerWeapon>(params[arg_weapon]); auto pWeapon = getPrivate<CBasePlayerWeapon>(params[arg_weapon]);
if (pWeapon == nullptr || !pWeapon->IsWeapon()) { if (pWeapon == nullptr || !pWeapon->IsWeapon()) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity weapon", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity weapon", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -1752,7 +1752,7 @@ cell AMX_NATIVE_CALL rg_is_player_can_takedamage(AMX *amx, cell *params)
CBaseEntity *pAttacker = getPrivate<CBaseEntity>(params[arg_attacker]); CBaseEntity *pAttacker = getPrivate<CBaseEntity>(params[arg_attacker]);
if (!pAttacker) { if (!pAttacker) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity attacker", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity attacker", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -1776,7 +1776,7 @@ cell AMX_NATIVE_CALL rg_get_weaponbox_id(AMX *amx, cell *params)
CWeaponBox *pEntityBox = getPrivate<CWeaponBox>(params[arg_entity]); CWeaponBox *pEntityBox = getPrivate<CWeaponBox>(params[arg_entity]);
if (pEntityBox == nullptr) { if (pEntityBox == nullptr) {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity weaponbox", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: Invalid entity weaponbox", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -2147,10 +2147,10 @@ AMX_NATIVE_INFO Misc_Natives_RH[] =
void RegisterNatives_Misc() void RegisterNatives_Misc()
{ {
if (!api_cfg.hasReGameDLL()) if (!api_cfg.hasReGameDLL())
fillNatives(Misc_Natives_RG, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReGameDll"); return FALSE; }); fillNatives(Misc_Natives_RG, [](AMX *amx, cell *params) -> cell { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReGameDll"); return FALSE; });
if (!api_cfg.hasReHLDS()) if (!api_cfg.hasReHLDS())
fillNatives(Misc_Natives_RH, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReHlds"); return FALSE; }); fillNatives(Misc_Natives_RH, [](AMX *amx, cell *params) -> cell { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "ReHlds"); return FALSE; });
g_amxxapi.AddNatives(Misc_Natives_RG); g_amxxapi.AddNatives(Misc_Natives_RG);
g_amxxapi.AddNatives(Misc_Natives_RH); g_amxxapi.AddNatives(Misc_Natives_RH);

View File

@ -21,7 +21,7 @@ cell AMX_NATIVE_CALL RegisterQueryFile(AMX *amx, cell *params)
{ {
case RES_TYPE_NONE: case RES_TYPE_NONE:
case RES_TYPE_IGNORE: case RES_TYPE_IGNORE:
MF_LogError(amx, AMX_ERR_NATIVE, "%s: invalid flag type \"%i\".", __FUNCTION__, flag); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: invalid flag type \"%i\".", __FUNCTION__, flag);
break; break;
case RES_TYPE_EXISTS: case RES_TYPE_EXISTS:
if (params[arg_hash] == -1) { if (params[arg_hash] == -1) {
@ -35,7 +35,7 @@ cell AMX_NATIVE_CALL RegisterQueryFile(AMX *amx, cell *params)
char filename[MAX_PATH]; char filename[MAX_PATH];
const char *file = getAmxString(amx, params[arg_file], filename); const char *file = getAmxString(amx, params[arg_file], filename);
if (!file || file[0] == '\0') { if (!file || file[0] == '\0') {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: file can not be empty.", __FUNCTION__); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: file can not be empty.", __FUNCTION__);
return FALSE; return FALSE;
} }
@ -45,7 +45,7 @@ cell AMX_NATIVE_CALL RegisterQueryFile(AMX *amx, cell *params)
int funcid; int funcid;
if (unlikely(g_amxxapi.amx_FindPublic(amx, func, &funcid) != AMX_ERR_NONE)) if (unlikely(g_amxxapi.amx_FindPublic(amx, func, &funcid) != AMX_ERR_NONE))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, func); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: public function \"%s\" not found.", __FUNCTION__, func);
return FALSE; return FALSE;
} }
@ -79,7 +79,7 @@ AMX_NATIVE_INFO Rechecker_Natives[] =
void RegisterNatives_Rechecker() void RegisterNatives_Rechecker()
{ {
if (!api_cfg.hasRechecker()) if (!api_cfg.hasRechecker())
fillNatives(Rechecker_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "Rechecker"); return FALSE; }); fillNatives(Rechecker_Natives, [](AMX *amx, cell *params) -> cell { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "Rechecker"); return FALSE; });
g_amxxapi.AddNatives(Rechecker_Natives); g_amxxapi.AddNatives(Rechecker_Natives);
} }

View File

@ -78,7 +78,7 @@ AMX_NATIVE_INFO Reunion_Natives[] =
void RegisterNatives_Reunion() void RegisterNatives_Reunion()
{ {
if (!api_cfg.hasReunion()) if (!api_cfg.hasReunion())
fillNatives(Reunion_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "Reunion"); return FALSE; }); fillNatives(Reunion_Natives, [](AMX *amx, cell *params) -> cell { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "Reunion"); return FALSE; });
g_amxxapi.AddNatives(Reunion_Natives); g_amxxapi.AddNatives(Reunion_Natives);
} }

View File

@ -112,7 +112,7 @@ AMX_NATIVE_INFO VTC_Natives[] =
void RegisterNatives_VTC() void RegisterNatives_VTC()
{ {
if (!api_cfg.hasVTC()) if (!api_cfg.hasVTC())
fillNatives(VTC_Natives, [](AMX *amx, cell *params) -> cell { MF_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "VTC"); return FALSE; }); fillNatives(VTC_Natives, [](AMX *amx, cell *params) -> cell { AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: isn't available", "VTC"); return FALSE; });
g_amxxapi.AddNatives(VTC_Natives); g_amxxapi.AddNatives(VTC_Natives);
} }

View File

@ -52,7 +52,7 @@ CTempStrings::CTempStrings()
char* CTempStrings::push(AMX* amx) char* CTempStrings::push(AMX* amx)
{ {
if (m_current == STRINGS_MAX) { if (m_current == STRINGS_MAX) {
MF_LogError(amx, AMX_ERR_NATIVE, "temp strings limit exceeded, contact reapi authors"); AMXX_LogError(amx, AMX_ERR_NATIVE, "temp strings limit exceeded, contact reapi authors");
return nullptr; return nullptr;
} }
@ -69,7 +69,7 @@ CBaseEntity *GiveNamedItemInternal(AMX *amx, CBasePlayer *pPlayer, const char *p
edict_t *pEdict = CREATE_NAMED_ENTITY(ALLOC_STRING(pszItemName)); edict_t *pEdict = CREATE_NAMED_ENTITY(ALLOC_STRING(pszItemName));
if (FNullEnt(pEdict)) if (FNullEnt(pEdict))
{ {
MF_LogError(amx, AMX_ERR_NATIVE, "%s: Item \"%s\" failed to create!\n", __FUNCTION__, pszItemName); AMXX_LogError(amx, AMX_ERR_NATIVE, "%s: Item \"%s\" failed to create!\n", __FUNCTION__, pszItemName);
return nullptr; return nullptr;
} }