mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Added debugging engine
This commit is contained in:
parent
01770f0e5b
commit
fc15ac1f41
@ -11,17 +11,6 @@ int AmxStringToEngine(AMX *amx, cell param, int &len)
|
|||||||
return ALLOC_STRING(szString);
|
return ALLOC_STRING(szString);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineError(AMX *amx, char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list p;
|
|
||||||
va_start(p, fmt);
|
|
||||||
char errbuf[512];
|
|
||||||
vsprintf(errbuf, fmt, p);
|
|
||||||
va_end(p);
|
|
||||||
MF_Log("%s (\"%s\", line %d)", errbuf, MF_GetScriptName(MF_FindScriptByAmx(amx)), amx->curline);
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearHooks()
|
void ClearHooks()
|
||||||
{
|
{
|
||||||
register unsigned int i = 0;
|
register unsigned int i = 0;
|
||||||
@ -240,7 +229,7 @@ void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
|||||||
Msg.clear();
|
Msg.clear();
|
||||||
register int i = 0, j = 0;
|
register int i = 0, j = 0;
|
||||||
for (i=0; i<256; i++) {
|
for (i=0; i<256; i++) {
|
||||||
for (j=0; j<msgHooks[i].size(); j++)
|
for (j=0; j<(int)msgHooks[i].size(); j++)
|
||||||
if (msgHooks[i].at(j) != -1)
|
if (msgHooks[i].at(j) != -1)
|
||||||
MF_UnregisterSPForward(msgHooks[i].at(j));
|
MF_UnregisterSPForward(msgHooks[i].at(j));
|
||||||
msgHooks[i].clear();
|
msgHooks[i].clear();
|
||||||
|
@ -2451,6 +2451,7 @@ PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
|||||||
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
PFN_LOG g_fn_Log;
|
PFN_LOG g_fn_Log;
|
||||||
|
PFN_LOG_ERROR g_fn_LogError;
|
||||||
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
@ -2532,6 +2533,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
REQFUNC("PrintSrvConsole", g_fn_PrintSrvConsole, PFN_PRINT_SRVCONSOLE);
|
||||||
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
REQFUNC("GetModname", g_fn_GetModname, PFN_GET_MODNAME);
|
||||||
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
REQFUNC("Log", g_fn_Log, PFN_LOG);
|
||||||
|
REQFUNC("LogError", g_fn_LogError, PFN_LOG_ERROR);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2651,6 +2653,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_GetAmxStringLen(NULL);
|
MF_GetAmxStringLen(NULL);
|
||||||
MF_CopyAmxMemory(NULL, NULL, 0);
|
MF_CopyAmxMemory(NULL, NULL, 0);
|
||||||
MF_Log("str", "str", 0);
|
MF_Log("str", "str", 0);
|
||||||
|
MF_LogError(NULL, 0, NULL);
|
||||||
MF_RaiseAmxError(NULL, 0);
|
MF_RaiseAmxError(NULL, 0);
|
||||||
MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0);
|
MF_RegisterForward("str", (ForwardExecType)0, 0, 0, 0);
|
||||||
MF_ExecuteForward(0, 0, 0);
|
MF_ExecuteForward(0, 0, 0);
|
||||||
|
@ -1919,6 +1919,7 @@ typedef int (*PFN_GET_AMXSTRINGLEN) (const cell *ptr);
|
|||||||
typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/);
|
typedef char * (*PFN_FORMAT_AMXSTRING) (AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/);
|
||||||
typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/);
|
typedef void (*PFN_COPY_AMXMEMORY) (cell * /*dest*/, const cell * /*src*/, int /*len*/);
|
||||||
typedef void (*PFN_LOG) (const char * /*fmt*/, ...);
|
typedef void (*PFN_LOG) (const char * /*fmt*/, ...);
|
||||||
|
typedef void (*PFN_LOG_ERROR) (AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ...);
|
||||||
typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/);
|
typedef int (*PFN_RAISE_AMXERROR) (AMX * /*amx*/, int /*error*/);
|
||||||
typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/);
|
typedef int (*PFN_REGISTER_FORWARD) (const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/);
|
||||||
typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/);
|
typedef int (*PFN_EXECUTE_FORWARD) (int /*id*/, ... /*params*/);
|
||||||
@ -1979,6 +1980,7 @@ extern PFN_GET_AMXSTRINGLEN g_fn_GetAmxStringLen;
|
|||||||
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
extern PFN_FORMAT_AMXSTRING g_fn_FormatAmxString;
|
||||||
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
extern PFN_COPY_AMXMEMORY g_fn_CopyAmxMemory;
|
||||||
extern PFN_LOG g_fn_Log;
|
extern PFN_LOG g_fn_Log;
|
||||||
|
extern PFN_LOG_ERROR g_fn_LogError;
|
||||||
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
extern PFN_RAISE_AMXERROR g_fn_RaiseAmxError;
|
||||||
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
extern PFN_REGISTER_FORWARD g_fn_RegisterForward;
|
||||||
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
extern PFN_EXECUTE_FORWARD g_fn_ExecuteForward;
|
||||||
@ -2036,6 +2038,7 @@ int MF_GetAmxStringLen (const cell *ptr) { }
|
|||||||
char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { }
|
char * MF_FormatAmxString (AMX * amx, cell * params, int startParam, int * pLen) { }
|
||||||
void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { }
|
void MF_CopyAmxMemory (cell * dest, const cell * src, int len) { }
|
||||||
void MF_Log (const char * fmt, ...) { }
|
void MF_Log (const char * fmt, ...) { }
|
||||||
|
void MF_LogError (AMX * amx, int err, const char *fmt, ...) { }
|
||||||
int MF_RaiseAmxError (AMX * amx, int error) { }
|
int MF_RaiseAmxError (AMX * amx, int error) { }
|
||||||
int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { }
|
int MF_RegisterForward (const char * funcname, ForwardExecType exectype, ...) { }
|
||||||
int MF_ExecuteForward (int id, ...) { }
|
int MF_ExecuteForward (int id, ...) { }
|
||||||
@ -2083,6 +2086,7 @@ int MF_GetPlayerFlags (int id) { }
|
|||||||
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
#define MF_GetAmxStringLen g_fn_GetAmxStringLen
|
||||||
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
#define MF_CopyAmxMemory g_fn_CopyAmxMemory
|
||||||
void MF_Log(const char *fmt, ...);
|
void MF_Log(const char *fmt, ...);
|
||||||
|
#define MF_LogError g_fn_LogError
|
||||||
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
#define MF_RaiseAmxError g_fn_RaiseAmxError
|
||||||
#define MF_RegisterForward g_fn_RegisterForward
|
#define MF_RegisterForward g_fn_RegisterForward
|
||||||
#define MF_ExecuteForward g_fn_ExecuteForward
|
#define MF_ExecuteForward g_fn_ExecuteForward
|
||||||
|
@ -105,10 +105,7 @@ static cell AMX_NATIVE_CALL VelocityByAim(AMX *amx, cell *params)
|
|||||||
cell *vRet = MF_GetAmxAddr(amx, params[3]);
|
cell *vRet = MF_GetAmxAddr(amx, params[3]);
|
||||||
Vector vVector = Vector(0, 0, 0);
|
Vector vVector = Vector(0, 0, 0);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -329,8 +326,8 @@ static cell AMX_NATIVE_CALL set_speak(AMX *amx, cell *params) {
|
|||||||
int iIndex = params[1];
|
int iIndex = params[1];
|
||||||
int iNewSpeakFlags = params[2];
|
int iNewSpeakFlags = params[2];
|
||||||
|
|
||||||
if (iIndex> gpGlobals->maxClients || !is_ent_valid(iIndex)) {
|
if (iIndex > gpGlobals->maxClients || !MF_IsPlayerIngame(iIndex)) {
|
||||||
EngineError(amx, "Invalid player %d", iIndex);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,8 +339,8 @@ static cell AMX_NATIVE_CALL set_speak(AMX *amx, cell *params) {
|
|||||||
static cell AMX_NATIVE_CALL get_speak(AMX *amx, cell *params) {
|
static cell AMX_NATIVE_CALL get_speak(AMX *amx, cell *params) {
|
||||||
int iIndex = params[1];
|
int iIndex = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iIndex) || iIndex > gpGlobals->maxClients) {
|
if (iIndex > gpGlobals->maxClients || !MF_IsPlayerIngame(iIndex)) {
|
||||||
EngineError(amx, "Invalid player %d", iIndex);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,10 +366,7 @@ static cell AMX_NATIVE_CALL get_info_keybuffer(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (FNullEnt(iEnt) || iEnt < 1 || iEnt > gpGlobals->maxClients) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *e = INDEXENT2(iEnt);
|
edict_t *e = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -387,10 +381,7 @@ static cell AMX_NATIVE_CALL drop_to_floor(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *e = INDEXENT2(iEnt);
|
edict_t *e = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -413,15 +404,12 @@ static cell AMX_NATIVE_CALL attach_view(AMX *amx, cell *params)
|
|||||||
int iIndex = params[1];
|
int iIndex = params[1];
|
||||||
int iTargetIndex = params[2];
|
int iTargetIndex = params[2];
|
||||||
|
|
||||||
if (iIndex > gpGlobals->maxClients || !is_ent_valid(iIndex)) {
|
if (iIndex > gpGlobals->maxClients || !MF_IsPlayerIngame(iIndex)) {
|
||||||
EngineError(amx, "Invalid player %d", iIndex);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_ent_valid(iTargetIndex)) {
|
CHECK_ENTITY(iIndex);
|
||||||
EngineError(amx, "Invalid Entity %d", iIndex);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SET_VIEW(INDEXENT2(iIndex), INDEXENT2(iTargetIndex));
|
SET_VIEW(INDEXENT2(iIndex), INDEXENT2(iTargetIndex));
|
||||||
|
|
||||||
@ -435,8 +423,8 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
|
|||||||
int iIndex = params[1];
|
int iIndex = params[1];
|
||||||
int iCameraType = params[2];
|
int iCameraType = params[2];
|
||||||
|
|
||||||
if (iIndex > gpGlobals->maxClients || !is_ent_valid(iIndex)) {
|
if (iIndex > gpGlobals->maxClients || !MF_IsPlayerIngame(iIndex)) {
|
||||||
EngineError(amx, "Invalid player %d", iIndex);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", iIndex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
#include "entity.h"
|
#include "entity.h"
|
||||||
#include "gpglobals.h"
|
#include "gpglobals.h"
|
||||||
|
|
||||||
//#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
|
|
||||||
|
|
||||||
extern DLL_FUNCTIONS *g_pFunctionTable;
|
extern DLL_FUNCTIONS *g_pFunctionTable;
|
||||||
extern DLL_FUNCTIONS *g_pFunctionTable_Post;
|
extern DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||||
extern enginefuncs_t *g_pengfuncsTable;
|
extern enginefuncs_t *g_pengfuncsTable;
|
||||||
@ -170,8 +168,6 @@ inline edict_t* INDEXENT2( int iEdictNum )
|
|||||||
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineError(AMX *amx, char *fmt, ...);
|
|
||||||
|
|
||||||
int Spawn(edict_t *pEntity);
|
int Spawn(edict_t *pEntity);
|
||||||
void ChangeLevel(char* s1, char* s2);
|
void ChangeLevel(char* s1, char* s2);
|
||||||
void PlaybackEvent(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
|
void PlaybackEvent(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
|
||||||
@ -184,7 +180,20 @@ void PlayerPostThink_Post(edict_t *pEntity);
|
|||||||
void pfnTouch(edict_t *pToucher, edict_t *pTouched);
|
void pfnTouch(edict_t *pToucher, edict_t *pTouched);
|
||||||
void Think(edict_t *pent);
|
void Think(edict_t *pent);
|
||||||
|
|
||||||
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { EngineError(amx, "Invalid entity %d", x); return 0; }
|
#define CHECK_ENTITY(x) \
|
||||||
|
if (x <= 0 || x > gpGlobals->maxEntities) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
} else { \
|
||||||
|
if (x <= gpGlobals->maxClients) { \
|
||||||
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
if (FNullEnt(INDEXENT2(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
extern bool g_inKeyValue;
|
extern bool g_inKeyValue;
|
||||||
extern KeyValueData *g_pkvd;
|
extern KeyValueData *g_pkvd;
|
||||||
|
@ -26,10 +26,8 @@ static cell AMX_NATIVE_CALL entity_range(AMX *amx, cell *params)
|
|||||||
int idxa = params[1];
|
int idxa = params[1];
|
||||||
int idxb = params[2];
|
int idxb = params[2];
|
||||||
|
|
||||||
if (!is_ent_valid(idxa) || !is_ent_valid(idxb)) {
|
CHECK_ENTITY(idxa);
|
||||||
EngineError(amx, "Invalid Entity");
|
CHECK_ENTITY(idxb);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEntA = INDEXENT2(idxa);
|
edict_t *pEntA = INDEXENT2(idxa);
|
||||||
edict_t *pEntB = INDEXENT2(idxb);
|
edict_t *pEntB = INDEXENT2(idxb);
|
||||||
@ -47,10 +45,7 @@ static cell AMX_NATIVE_CALL call_think(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -65,10 +60,8 @@ static cell AMX_NATIVE_CALL fake_touch(AMX *amx, cell *params)
|
|||||||
int iPtr = params[1];
|
int iPtr = params[1];
|
||||||
int iPtd = params[2];
|
int iPtd = params[2];
|
||||||
|
|
||||||
if (!is_ent_valid(iPtr) || !is_ent_valid(iPtd)) {
|
CHECK_ENTITY(iPtr);
|
||||||
EngineError(amx, "Invalid Entity");
|
CHECK_ENTITY(iPtd);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pToucher = INDEXENT2(iPtr);
|
edict_t *pToucher = INDEXENT2(iPtr);
|
||||||
edict_t *pTouched = INDEXENT2(iPtd);
|
edict_t *pTouched = INDEXENT2(iPtd);
|
||||||
@ -83,10 +76,8 @@ static cell AMX_NATIVE_CALL force_use(AMX *amx, cell *params)
|
|||||||
int iPtr = params[1];
|
int iPtr = params[1];
|
||||||
int iPtd = params[2];
|
int iPtd = params[2];
|
||||||
|
|
||||||
if (!is_ent_valid(iPtr) || !is_ent_valid(iPtd)) {
|
CHECK_ENTITY(iPtr);
|
||||||
EngineError(amx, "Invalid Entity");
|
CHECK_ENTITY(iPtd);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pUser = INDEXENT2(iPtr);
|
edict_t *pUser = INDEXENT2(iPtr);
|
||||||
edict_t *pUsed = INDEXENT2(iPtd);
|
edict_t *pUsed = INDEXENT2(iPtd);
|
||||||
@ -139,10 +130,7 @@ static cell AMX_NATIVE_CALL DispatchKeyValue(AMX *amx, cell *params)
|
|||||||
if (count == 3) {
|
if (count == 3) {
|
||||||
cell *cVal = MF_GetAmxAddr(amx, params[1]);
|
cell *cVal = MF_GetAmxAddr(amx, params[1]);
|
||||||
int iValue = *cVal;
|
int iValue = *cVal;
|
||||||
if (!is_ent_valid(iValue)) {
|
CHECK_ENTITY(iValue);
|
||||||
EngineError(amx, "Invalid Entity %d", iValue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
edict_t *pEntity = INDEXENT2(iValue);
|
edict_t *pEntity = INDEXENT2(iValue);
|
||||||
KeyValueData kvd;
|
KeyValueData kvd;
|
||||||
int iLength=0;
|
int iLength=0;
|
||||||
@ -172,10 +160,7 @@ static cell AMX_NATIVE_CALL DispatchKeyValue(AMX *amx, cell *params)
|
|||||||
static cell AMX_NATIVE_CALL get_keyvalue(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL get_keyvalue(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
int idx = params[1];
|
int idx = params[1];
|
||||||
if (!is_ent_valid(idx)) {
|
CHECK_ENTITY(idx);
|
||||||
EngineError(amx, "Invalid Entity %d", idx);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
edict_t *pEntity = INDEXENT2(idx);
|
edict_t *pEntity = INDEXENT2(idx);
|
||||||
char *test = INFO_KEY_BUFFER(pEntity);
|
char *test = INFO_KEY_BUFFER(pEntity);
|
||||||
int iLength=0;
|
int iLength=0;
|
||||||
@ -202,10 +187,7 @@ static cell AMX_NATIVE_CALL DispatchSpawn(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -224,10 +206,7 @@ static cell AMX_NATIVE_CALL entity_get_float(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
REAL fVal = 0;
|
REAL fVal = 0;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -358,10 +337,7 @@ static cell AMX_NATIVE_CALL entity_set_float(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
REAL fVal = amx_ctof(params[3]);
|
REAL fVal = amx_ctof(params[3]);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -492,10 +468,7 @@ static cell AMX_NATIVE_CALL entity_get_int(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
int iRetValue = 0;
|
int iRetValue = 0;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -613,7 +586,7 @@ static cell AMX_NATIVE_CALL entity_get_int(AMX *amx, cell *params)
|
|||||||
iRetValue = pEnt->v.deadflag;
|
iRetValue = pEnt->v.deadflag;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
EngineError(amx, "Invalid property %d", iEnt);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid property %d", idx);
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -627,10 +600,7 @@ static cell AMX_NATIVE_CALL entity_set_int(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
int iNewValue = params[3];
|
int iNewValue = params[3];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -762,10 +732,7 @@ static cell AMX_NATIVE_CALL entity_get_vector(AMX *amx, cell *params)
|
|||||||
cell *vRet = MF_GetAmxAddr(amx, params[3]);
|
cell *vRet = MF_GetAmxAddr(amx, params[3]);
|
||||||
Vector vRetValue = Vector(0, 0, 0);
|
Vector vRetValue = Vector(0, 0, 0);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -858,10 +825,7 @@ static cell AMX_NATIVE_CALL entity_set_vector(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
REAL fX = amx_ctof(vAmx[0]);
|
REAL fX = amx_ctof(vAmx[0]);
|
||||||
REAL fY = amx_ctof(vAmx[1]);
|
REAL fY = amx_ctof(vAmx[1]);
|
||||||
@ -955,10 +919,7 @@ static cell AMX_NATIVE_CALL entity_get_string(AMX *amx, cell *params)
|
|||||||
int iszString = 0;
|
int iszString = 0;
|
||||||
const char *szRet = NULL;
|
const char *szRet = NULL;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -1020,10 +981,7 @@ static cell AMX_NATIVE_CALL entity_set_string(AMX *amx, cell *params)
|
|||||||
int iLen;
|
int iLen;
|
||||||
int iszString = AmxStringToEngine(amx, params[3], iLen);
|
int iszString = AmxStringToEngine(amx, params[3], iLen);
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -1082,10 +1040,7 @@ static cell AMX_NATIVE_CALL entity_get_edict(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
edict_t *pRet;
|
edict_t *pRet;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -1141,10 +1096,8 @@ static cell AMX_NATIVE_CALL entity_set_edict(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
int iSetEnt = params[3];
|
int iSetEnt = params[3];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt) || !is_ent_valid(iSetEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
CHECK_ENTITY(iSetEnt);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
edict_t *pSetEnt = INDEXENT2(iSetEnt);
|
edict_t *pSetEnt = INDEXENT2(iSetEnt);
|
||||||
@ -1198,10 +1151,7 @@ static cell AMX_NATIVE_CALL entity_get_byte(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
int iRetValue = 0;
|
int iRetValue = 0;
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -1239,10 +1189,7 @@ static cell AMX_NATIVE_CALL entity_set_byte(AMX *amx, cell *params)
|
|||||||
int idx = params[2];
|
int idx = params[2];
|
||||||
int iNewValue = params[3];
|
int iNewValue = params[3];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(iNewValue > 255)
|
if(iNewValue > 255)
|
||||||
iNewValue = 255;
|
iNewValue = 255;
|
||||||
@ -1283,10 +1230,7 @@ static cell AMX_NATIVE_CALL entity_set_origin(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
cell *vVector = MF_GetAmxAddr(amx, params[2]);
|
cell *vVector = MF_GetAmxAddr(amx, params[2]);
|
||||||
@ -1305,10 +1249,7 @@ static cell AMX_NATIVE_CALL entity_set_model(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
int iLen;
|
int iLen;
|
||||||
@ -1327,10 +1268,7 @@ static cell AMX_NATIVE_CALL entity_set_size(AMX *amx, cell *params)
|
|||||||
{
|
{
|
||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
|
|
||||||
if (!is_ent_valid(iEnt)) {
|
CHECK_ENTITY(iEnt);
|
||||||
EngineError(amx, "Invalid Entity %d", iEnt);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
|
|
||||||
@ -1411,10 +1349,7 @@ static cell AMX_NATIVE_CALL find_sphere_class(AMX *amx, cell *params) // find_sp
|
|||||||
|
|
||||||
vec3_t vecOrigin;
|
vec3_t vecOrigin;
|
||||||
if (params[1] > 0) {
|
if (params[1] > 0) {
|
||||||
if (!is_ent_valid(params[1])) {
|
CHECK_ENTITY(params[1]);
|
||||||
EngineError(amx, "Invalid Entity %d", params[1]);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t* pEntity = INDEXENT2(params[1]);
|
edict_t* pEntity = INDEXENT2(params[1]);
|
||||||
vecOrigin = pEntity->v.origin;
|
vecOrigin = pEntity->v.origin;
|
||||||
@ -1522,10 +1457,7 @@ static cell AMX_NATIVE_CALL find_ent_by_owner(AMX *amx, cell *params) // native
|
|||||||
int iEnt = params[1];
|
int iEnt = params[1];
|
||||||
int oEnt = params[3];
|
int oEnt = params[3];
|
||||||
// Check index to start searching at, 0 must be possible for iEnt.
|
// Check index to start searching at, 0 must be possible for iEnt.
|
||||||
if (!is_ent_valid(oEnt)) {
|
CHECK_ENTITY(oEnt);
|
||||||
EngineError(amx, "Invalid Entity");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
edict_t *entOwner = INDEXENT2(oEnt);
|
edict_t *entOwner = INDEXENT2(oEnt);
|
||||||
@ -1560,10 +1492,7 @@ static cell AMX_NATIVE_CALL get_grenade_id(AMX *amx, cell *params) /* 4 param *
|
|||||||
int index = params[1];
|
int index = params[1];
|
||||||
char* szModel;
|
char* szModel;
|
||||||
|
|
||||||
if (!is_ent_valid(index)) {
|
CHECK_ENTITY(index);
|
||||||
EngineError(amx, "Invalid Entity %d", index);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t* pentFind = INDEXENT2(params[4]);
|
edict_t* pentFind = INDEXENT2(params[4]);
|
||||||
edict_t* pentOwner = INDEXENT2(index);
|
edict_t* pentOwner = INDEXENT2(index);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
CVector<argMsg*> Msg;
|
CVector<argMsg*> Msg;
|
||||||
CVector<int> msgHooks[256];
|
CVector<int> msgHooks[256];
|
||||||
//int msgHooks[256] = {0};
|
|
||||||
int msgBlocks[256] = {0};
|
int msgBlocks[256] = {0};
|
||||||
int msgDest;
|
int msgDest;
|
||||||
int msgType;
|
int msgType;
|
||||||
|
Loading…
Reference in New Issue
Block a user