mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
Added debugging support
This commit is contained in:
parent
62e4bbcfe9
commit
02bf904467
@ -45,6 +45,16 @@
|
|||||||
enginefuncs_t g_engfuncs;
|
enginefuncs_t g_engfuncs;
|
||||||
globalvars_t *gpGlobals;
|
globalvars_t *gpGlobals;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DLL_FUNCTIONS *g_pFunctionTable;
|
||||||
|
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||||
|
enginefuncs_t *g_pengfuncsTable;
|
||||||
|
enginefuncs_t *g_pengfuncsTable_Post;
|
||||||
|
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||||
|
NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||||
|
|
||||||
|
|
||||||
// GetEntityAPI2 functions
|
// GetEntityAPI2 functions
|
||||||
static DLL_FUNCTIONS g_EntityAPI_Table =
|
static DLL_FUNCTIONS g_EntityAPI_Table =
|
||||||
{
|
{
|
||||||
@ -2114,6 +2124,7 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS));
|
memcpy(pFunctionTable, &g_EntityAPI_Table, sizeof(DLL_FUNCTIONS));
|
||||||
|
g_pFunctionTable=pFunctionTable;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2131,7 +2142,7 @@ C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interface
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
|
memcpy( pFunctionTable, &g_EntityAPI_Post_Table, sizeof( DLL_FUNCTIONS ) );
|
||||||
|
g_pFunctionTable_Post=pFunctionTable;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2154,6 +2165,7 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t));
|
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Table, sizeof(enginefuncs_t));
|
||||||
|
g_pengfuncsTable=pengfuncsFromEngine;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2171,6 +2183,7 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t));
|
memcpy(pengfuncsFromEngine, &g_EngineFuncs_Post_Table, sizeof(enginefuncs_t));
|
||||||
|
g_pengfuncsTable_Post=pengfuncsFromEngine;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2195,6 +2208,7 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable,
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS));
|
memcpy(pNewFunctionTable, &g_NewFuncs_Table, sizeof(NEW_DLL_FUNCTIONS));
|
||||||
|
g_pNewFunctionsTable=pNewFunctionTable;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2212,6 +2226,7 @@ C_DLLEXPORT int GetNewDLLFunctions_Post( NEW_DLL_FUNCTIONS *pNewFunctionTable, i
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS));
|
memcpy(pNewFunctionTable, &g_NewFuncs_Post_Table, sizeof(NEW_DLL_FUNCTIONS));
|
||||||
|
g_pNewFunctionsTable_Post=pNewFunctionTable;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2439,11 +2454,14 @@ 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;
|
||||||
PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
|
PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
|
||||||
PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
|
PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
|
||||||
|
PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
|
||||||
|
PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
|
||||||
PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
|
PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
|
||||||
PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
|
PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
|
||||||
PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
|
PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
|
||||||
@ -2453,6 +2471,7 @@ PFN_IS_PLAYER_AUTHORIZED g_fn_IsPlayerAuthorized;
|
|||||||
PFN_GET_PLAYER_TIME g_fn_GetPlayerTime;
|
PFN_GET_PLAYER_TIME g_fn_GetPlayerTime;
|
||||||
PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime;
|
PFN_GET_PLAYER_PLAYTIME g_fn_GetPlayerPlayTime;
|
||||||
PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon;
|
PFN_GET_PLAYER_CURWEAPON g_fn_GetPlayerCurweapon;
|
||||||
|
PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||||
PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID;
|
PFN_GET_PLAYER_TEAMID g_fn_GetPlayerTeamID;
|
||||||
PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths;
|
PFN_GET_PLAYER_DEATHS g_fn_GetPlayerDeaths;
|
||||||
PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu;
|
PFN_GET_PLAYER_MENU g_fn_GetPlayerMenu;
|
||||||
@ -2525,6 +2544,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);
|
||||||
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
@ -2560,7 +2580,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD);
|
REQFUNC("ExecuteForward", g_fn_ExecuteForward, PFN_EXECUTE_FORWARD);
|
||||||
REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY);
|
REQFUNC("PrepareCellArray", g_fn_PrepareCellArray, PFN_PREPARE_CELLARRAY);
|
||||||
REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY);
|
REQFUNC("PrepareCharArray", g_fn_PrepareCharArray, PFN_PREPARE_CHARARRAY);
|
||||||
|
REQFUNC("PrepareCellArrayA", g_fn_PrepareCellArrayA, PFN_PREPARE_CELLARRAY_A);
|
||||||
|
REQFUNC("PrepareCharArrayA", g_fn_PrepareCharArrayA, PFN_PREPARE_CHARARRAY_A);
|
||||||
// Player
|
// Player
|
||||||
REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID);
|
REQFUNC("IsPlayerValid", g_fn_IsPlayerValid, PFN_IS_PLAYER_VALID);
|
||||||
REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME);
|
REQFUNC("GetPlayerName", g_fn_GetPlayerName, PFN_GET_PLAYER_NAME);
|
||||||
@ -2572,6 +2593,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME);
|
REQFUNC("GetPlayerPlayTime", g_fn_GetPlayerPlayTime, PFN_GET_PLAYER_PLAYTIME);
|
||||||
REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON);
|
REQFUNC("GetPlayerCurweapon", g_fn_GetPlayerCurweapon, PFN_GET_PLAYER_CURWEAPON);
|
||||||
REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID);
|
REQFUNC("GetPlayerTeamID", g_fn_GetPlayerTeamID, PFN_GET_PLAYER_TEAMID);
|
||||||
|
REQFUNC("GetPlayerTeam",g_fn_GetPlayerTeam, PFN_GET_PLAYER_TEAM);
|
||||||
REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS);
|
REQFUNC("GetPlayerDeaths", g_fn_GetPlayerDeaths, PFN_GET_PLAYER_DEATHS);
|
||||||
REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU);
|
REQFUNC("GetPlayerMenu", g_fn_GetPlayerMenu, PFN_GET_PLAYER_MENU);
|
||||||
REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS);
|
REQFUNC("GetPlayerKeys", g_fn_GetPlayerKeys, PFN_GET_PLAYER_KEYS);
|
||||||
@ -2649,11 +2671,14 @@ 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);
|
||||||
MF_PrepareCellArray(NULL, 0);
|
MF_PrepareCellArray(NULL, 0);
|
||||||
MF_PrepareCharArray(NULL, 0);
|
MF_PrepareCharArray(NULL, 0);
|
||||||
|
MF_PrepareCellArrayA(NULL, 0, true);
|
||||||
|
MF_PrepareCharArrayA(NULL, 0, true);
|
||||||
MF_IsPlayerValid(0);
|
MF_IsPlayerValid(0);
|
||||||
MF_GetPlayerName(0);
|
MF_GetPlayerName(0);
|
||||||
MF_GetPlayerIP(0);
|
MF_GetPlayerIP(0);
|
||||||
@ -2664,6 +2689,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_GetPlayerPlayTime(0);
|
MF_GetPlayerPlayTime(0);
|
||||||
MF_GetPlayerCurweapon(0);
|
MF_GetPlayerCurweapon(0);
|
||||||
MF_GetPlayerTeamID(0);
|
MF_GetPlayerTeamID(0);
|
||||||
|
MF_GetPlayerTeam(0);
|
||||||
MF_GetPlayerDeaths(0);
|
MF_GetPlayerDeaths(0);
|
||||||
MF_GetPlayerMenu(0);
|
MF_GetPlayerMenu(0);
|
||||||
MF_GetPlayerKeys(0);
|
MF_GetPlayerKeys(0);
|
||||||
|
@ -55,7 +55,7 @@ struct amxx_module_info_s
|
|||||||
// The next section is copied from the amx.h file
|
// The next section is copied from the amx.h file
|
||||||
// Copyright (c) ITB CompuPhase, 1997-2004
|
// Copyright (c) ITB CompuPhase, 1997-2004
|
||||||
|
|
||||||
#if defined __LCC__ || defined __DMC__ || defined __linux__
|
#if defined __LCC__ || defined __DMC__ || defined __linux__ || defined __GNUC__
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
|
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
|
||||||
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
|
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
|
||||||
@ -929,7 +929,7 @@ void FN_EngineFprintf(FILE *pfile, char *szFmt, ...);
|
|||||||
#endif // FN_EngineFprintf
|
#endif // FN_EngineFprintf
|
||||||
|
|
||||||
#ifdef FN_PvAllocEntPrivateData
|
#ifdef FN_PvAllocEntPrivateData
|
||||||
void *FN_PvAllocEntPrivateData(edict_t *pEdict, long cb);
|
void *FN_PvAllocEntPrivateData(edict_t *pEdict, int32 cb);
|
||||||
#endif // FN_PvAllocEntPrivateData
|
#endif // FN_PvAllocEntPrivateData
|
||||||
|
|
||||||
#ifdef FN_PvEntPrivateData
|
#ifdef FN_PvEntPrivateData
|
||||||
@ -1919,11 +1919,14 @@ 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*/);
|
||||||
typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/);
|
typedef cell (*PFN_PREPARE_CELLARRAY) (cell * /*ptr*/, unsigned int /*size*/);
|
||||||
typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/);
|
typedef cell (*PFN_PREPARE_CHARARRAY) (char * /*ptr*/, unsigned int /*size*/);
|
||||||
|
typedef cell (*PFN_PREPARE_CELLARRAY_A) (cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
|
||||||
|
typedef cell (*PFN_PREPARE_CHARARRAY_A) (char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/);
|
||||||
typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_VALID) (int /*id*/);
|
||||||
typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/);
|
typedef const char * (*PFN_GET_PLAYER_NAME) (int /*id*/);
|
||||||
typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/);
|
typedef const char * (*PFN_GET_PLAYER_IP) (int /*id*/);
|
||||||
@ -1932,8 +1935,9 @@ typedef int (*PFN_IS_PLAYER_BOT) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_AUTHORIZED) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_TIME) (int /*id*/);
|
||||||
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
typedef float (*PFN_GET_PLAYER_PLAYTIME) (int /*id*/);
|
||||||
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
|
typedef int (*PFN_GETPLAYERFLAGS) (int /* id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_CURWEAPON) (int /*id*/);
|
||||||
|
typedef const char * (*PFN_GET_PLAYER_TEAM) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_TEAMID) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_DEATHS) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_MENU) (int /*id*/);
|
||||||
@ -1986,11 +1990,14 @@ 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;
|
||||||
extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
|
extern PFN_PREPARE_CELLARRAY g_fn_PrepareCellArray;
|
||||||
extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
|
extern PFN_PREPARE_CHARARRAY g_fn_PrepareCharArray;
|
||||||
|
extern PFN_PREPARE_CELLARRAY_A g_fn_PrepareCellArrayA;
|
||||||
|
extern PFN_PREPARE_CHARARRAY_A g_fn_PrepareCharArrayA;
|
||||||
extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
|
extern PFN_IS_PLAYER_VALID g_fn_IsPlayerValid;
|
||||||
extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
|
extern PFN_GET_PLAYER_NAME g_fn_GetPlayerName;
|
||||||
extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
|
extern PFN_GET_PLAYER_IP g_fn_GetPlayerIP;
|
||||||
@ -2026,6 +2033,7 @@ extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
|||||||
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
extern PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
extern PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
extern PFN_FORMAT g_fn_Format;
|
extern PFN_FORMAT g_fn_Format;
|
||||||
|
extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam;
|
||||||
|
|
||||||
#ifdef MAY_NEVER_BE_DEFINED
|
#ifdef MAY_NEVER_BE_DEFINED
|
||||||
// Function prototypes for intellisense and similar systems
|
// Function prototypes for intellisense and similar systems
|
||||||
@ -2045,11 +2053,14 @@ 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, ...) { }
|
||||||
cell MF_PrepareCellArray (cell * ptr, unsigned int size) { }
|
cell MF_PrepareCellArray (cell * ptr, unsigned int size) { }
|
||||||
cell MF_PrepareCharArray (char * ptr, unsigned int size) { }
|
cell MF_PrepareCharArray (char * ptr, unsigned int size) { }
|
||||||
|
cell MF_PrepareCellArrayA (cell * ptr, unsigned int size, bool copyBack) { }
|
||||||
|
cell MF_PrepareCharArrayA (char * ptr, unsigned int size, bool copyBack) { }
|
||||||
int MF_IsPlayerValid (int id) { }
|
int MF_IsPlayerValid (int id) { }
|
||||||
const char * MF_GetPlayerName (int id) { }
|
const char * MF_GetPlayerName (int id) { }
|
||||||
const char * MF_GetPlayerIP (int id) { }
|
const char * MF_GetPlayerIP (int id) { }
|
||||||
@ -2059,6 +2070,7 @@ int MF_IsPlayerAuthorized (int id) { }
|
|||||||
float MF_GetPlayerTime (int id) { }
|
float MF_GetPlayerTime (int id) { }
|
||||||
float MF_GetPlayerPlayTime (int id) { }
|
float MF_GetPlayerPlayTime (int id) { }
|
||||||
int MF_GetPlayerCurweapon (int id) { }
|
int MF_GetPlayerCurweapon (int id) { }
|
||||||
|
const char * MF_GetPlayerTeam (int id) { }
|
||||||
int MF_GetPlayerTeamID (int id) { }
|
int MF_GetPlayerTeamID (int id) { }
|
||||||
int MF_GetPlayerDeaths (int id) { }
|
int MF_GetPlayerDeaths (int id) { }
|
||||||
int MF_GetPlayerMenu (int id) { }
|
int MF_GetPlayerMenu (int id) { }
|
||||||
@ -2094,11 +2106,14 @@ const char * MF_Format (const char *fmt, ...) { }
|
|||||||
#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
|
||||||
#define MF_PrepareCellArray g_fn_PrepareCellArray
|
#define MF_PrepareCellArray g_fn_PrepareCellArray
|
||||||
#define MF_PrepareCharArray g_fn_PrepareCharArray
|
#define MF_PrepareCharArray g_fn_PrepareCharArray
|
||||||
|
#define MF_PrepareCellArrayA g_fn_PrepareCellArrayA
|
||||||
|
#define MF_PrepareCharArrayA g_fn_PrepareCharArrayA
|
||||||
#define MF_IsPlayerValid g_fn_IsPlayerValid
|
#define MF_IsPlayerValid g_fn_IsPlayerValid
|
||||||
#define MF_GetPlayerName g_fn_GetPlayerName
|
#define MF_GetPlayerName g_fn_GetPlayerName
|
||||||
#define MF_GetPlayerIP g_fn_GetPlayerIP
|
#define MF_GetPlayerIP g_fn_GetPlayerIP
|
||||||
@ -2108,6 +2123,7 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_GetPlayerTime g_fn_GetPlayerTime
|
#define MF_GetPlayerTime g_fn_GetPlayerTime
|
||||||
#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime
|
#define MF_GetPlayerPlayTime g_fn_GetPlayerPlayTime
|
||||||
#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon
|
#define MF_GetPlayerCurweapon g_fn_GetPlayerCurweapon
|
||||||
|
#define MF_GetPlayerTeam g_fn_GetPlayerTeam
|
||||||
#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID
|
#define MF_GetPlayerTeamID g_fn_GetPlayerTeamID
|
||||||
#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths
|
#define MF_GetPlayerDeaths g_fn_GetPlayerDeaths
|
||||||
#define MF_GetPlayerMenu g_fn_GetPlayerMenu
|
#define MF_GetPlayerMenu g_fn_GetPlayerMenu
|
||||||
@ -2133,7 +2149,7 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
|
||||||
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
|
||||||
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
|
#define MF_GetPlayerEdict g_fn_GetPlayerEdict
|
||||||
#define MF_Format g_fn_Format;
|
#define MF_Format g_fn_Format
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -37,11 +37,7 @@
|
|||||||
|
|
||||||
bool UTIL_IsPlayer(AMX* amx, edict_t* pPlayer) {
|
bool UTIL_IsPlayer(AMX* amx, edict_t* pPlayer) {
|
||||||
bool player = false;
|
bool player = false;
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (strcmp(STRING(pPlayer->v.classname), "player") == 0)
|
if (strcmp(STRING(pPlayer->v.classname), "player") == 0)
|
||||||
player = true;
|
player = true;
|
||||||
|
|
||||||
@ -74,20 +70,10 @@ static cell AMX_NATIVE_CALL cs_set_user_money(AMX *amx, cell *params) // cs_set_
|
|||||||
// params[3] = flash money?
|
// params[3] = flash money?
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch player pointer
|
// Fetch player pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Give money
|
// Give money
|
||||||
*((int *)pPlayer->pvPrivateData + OFFSET_CSMONEY) = params[2];
|
*((int *)pPlayer->pvPrivateData + OFFSET_CSMONEY) = params[2];
|
||||||
@ -107,20 +93,10 @@ static cell AMX_NATIVE_CALL cs_get_user_money(AMX *amx, cell *params) // cs_get_
|
|||||||
// params[1] = user
|
// params[1] = user
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch player pointer
|
// Fetch player pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return money
|
// Return money
|
||||||
return *((int *)pPlayer->pvPrivateData + OFFSET_CSMONEY);
|
return *((int *)pPlayer->pvPrivateData + OFFSET_CSMONEY);
|
||||||
@ -132,20 +108,10 @@ static cell AMX_NATIVE_CALL cs_get_user_deaths(AMX *amx, cell *params) // cs_get
|
|||||||
// params[1] = user
|
// params[1] = user
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch player pointer
|
// Fetch player pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *((int *)pPlayer->pvPrivateData + OFFSET_CSDEATHS);
|
return *((int *)pPlayer->pvPrivateData + OFFSET_CSDEATHS);
|
||||||
}
|
}
|
||||||
@ -157,20 +123,10 @@ static cell AMX_NATIVE_CALL cs_set_user_deaths(AMX *amx, cell *params) // cs_set
|
|||||||
// params[2] = new deaths
|
// params[2] = new deaths
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch player pointer
|
// Fetch player pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set deaths
|
// Set deaths
|
||||||
*((int *)pPlayer->pvPrivateData + OFFSET_CSDEATHS) = params[2];
|
*((int *)pPlayer->pvPrivateData + OFFSET_CSDEATHS) = params[2];
|
||||||
@ -193,24 +149,14 @@ static cell AMX_NATIVE_CALL cs_get_hostage_id(AMX *amx, cell *params) // cs_get_
|
|||||||
// params[1] = hostage entity index
|
// params[1] = hostage entity index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_ENTITY(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into class pointer
|
// Make into class pointer
|
||||||
edict_t *pEdict = INDEXENT(params[1]);
|
edict_t *pEdict = GETEDICT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pEdict)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure this is a hostage.
|
// Make sure this is a hostage.
|
||||||
if (strcmp(STRING(pEdict->v.classname), "hostage_entity") != 0) {
|
if (strcmp(STRING(pEdict->v.classname), "hostage_entity") != 0) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity %d (\"%s\") is not a hostage", params[1], STRING(pEdict->v.classname));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,21 +170,11 @@ static cell AMX_NATIVE_CALL cs_get_weapon_silenced(AMX *amx, cell *params) // cs
|
|||||||
// params[1] = weapon index
|
// params[1] = weapon index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pWeapon = INDEXENT(params[1]);
|
edict_t *pWeapon = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pWeapon)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
||||||
int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
||||||
switch (weapontype) {
|
switch (weapontype) {
|
||||||
@ -260,21 +196,11 @@ static cell AMX_NATIVE_CALL cs_get_weapon_type(AMX *amx, cell *params) // cs_get
|
|||||||
// params[1] = weapon index
|
// params[1] = weapon index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pWeapon = INDEXENT(params[1]);
|
edict_t *pWeapon = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pWeapon)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
return *((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,21 +211,11 @@ static cell AMX_NATIVE_CALL cs_set_weapon_silenced(AMX *amx, cell *params) // cs
|
|||||||
// params[2] = 1, and we silence the gun, 0 and we unsilence gun.
|
// params[2] = 1, and we silence the gun, 0 and we unsilence gun.
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pWeapon = INDEXENT(params[1]);
|
edict_t *pWeapon = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pWeapon)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
||||||
int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
int *silencemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
||||||
|
|
||||||
@ -349,21 +265,11 @@ static cell AMX_NATIVE_CALL cs_get_weapon_burstmode(AMX *amx, cell *params) // c
|
|||||||
// params[1] = weapon index
|
// params[1] = weapon index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pWeapon = INDEXENT(params[1]);
|
edict_t *pWeapon = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pWeapon)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
||||||
int* firemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
int* firemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
||||||
switch (weapontype) {
|
switch (weapontype) {
|
||||||
@ -386,21 +292,11 @@ static cell AMX_NATIVE_CALL cs_set_weapon_burstmode(AMX *amx, cell *params) // c
|
|||||||
// params[2] = 1, and we set burstmode, 0 and we unset it.
|
// params[2] = 1, and we set burstmode, 0 and we unset it.
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pWeapon = INDEXENT(params[1]);
|
edict_t *pWeapon = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pWeapon)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
int weapontype = (int)*((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
||||||
|
|
||||||
int* firemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
int* firemode = ((int *)pWeapon->pvPrivateData + OFFSET_SILENCER_FIREMODE);
|
||||||
@ -456,20 +352,10 @@ static cell AMX_NATIVE_CALL cs_get_user_vip(AMX *amx, cell *params) // cs_get_us
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( *((int *)pPlayer->pvPrivateData + OFFSET_VIP) & PLAYER_IS_VIP )
|
if ( *((int *)pPlayer->pvPrivateData + OFFSET_VIP) & PLAYER_IS_VIP )
|
||||||
return 1;
|
return 1;
|
||||||
@ -484,20 +370,10 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_us
|
|||||||
// params[2] = if 1, activate vip, else deactivate vip.
|
// params[2] = if 1, activate vip, else deactivate vip.
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params[2] == 1) {
|
if (params[2] == 1) {
|
||||||
// Set to "be" vip.
|
// Set to "be" vip.
|
||||||
@ -546,20 +422,10 @@ static cell AMX_NATIVE_CALL cs_get_user_team(AMX *amx, cell *params) // cs_get_u
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *((int *)pPlayer->pvPrivateData + OFFSET_TEAM);
|
return *((int *)pPlayer->pvPrivateData + OFFSET_TEAM);
|
||||||
}
|
}
|
||||||
@ -572,20 +438,10 @@ static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_u
|
|||||||
// params[3] = model = 0
|
// params[3] = model = 0
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int model = params[3];
|
int model = params[3];
|
||||||
|
|
||||||
@ -630,20 +486,10 @@ static cell AMX_NATIVE_CALL cs_get_user_inside_buyzone(AMX *amx, cell *params) /
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (int)*((int *)pPlayer->pvPrivateData + OFFSET_BUYZONE); // This offset is 0 when outside, 1 when inside.
|
return (int)*((int *)pPlayer->pvPrivateData + OFFSET_BUYZONE); // This offset is 0 when outside, 1 when inside.
|
||||||
}
|
}
|
||||||
@ -654,20 +500,10 @@ static cell AMX_NATIVE_CALL cs_get_user_plant(AMX *amx, cell *params) // cs_get_
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_DEFUSE_PLANT) & CAN_PLANT_BOMB)
|
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_DEFUSE_PLANT) & CAN_PLANT_BOMB)
|
||||||
return 1;
|
return 1;
|
||||||
@ -683,20 +519,10 @@ static cell AMX_NATIVE_CALL cs_set_user_plant(AMX *amx, cell *params) // cs_set_
|
|||||||
// params[3] = show bomb icon?
|
// params[3] = show bomb icon?
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int* plantskill = ((int *)pPlayer->pvPrivateData + OFFSET_DEFUSE_PLANT);
|
int* plantskill = ((int *)pPlayer->pvPrivateData + OFFSET_DEFUSE_PLANT);
|
||||||
|
|
||||||
@ -739,20 +565,10 @@ static cell AMX_NATIVE_CALL cs_get_user_defusekit(AMX *amx, cell *params) // cs_
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_DEFUSE_PLANT) & HAS_DEFUSE_KIT)
|
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_DEFUSE_PLANT) & HAS_DEFUSE_KIT)
|
||||||
return 1;
|
return 1;
|
||||||
@ -772,20 +588,10 @@ static cell AMX_NATIVE_CALL cs_set_user_defusekit(AMX *amx, cell *params) // cs_
|
|||||||
// params[7] = flash = 0
|
// params[7] = flash = 0
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int* defusekit = ((int *)pPlayer->pvPrivateData + OFFSET_DEFUSE_PLANT);
|
int* defusekit = ((int *)pPlayer->pvPrivateData + OFFSET_DEFUSE_PLANT);
|
||||||
|
|
||||||
@ -847,20 +653,10 @@ static cell AMX_NATIVE_CALL cs_get_user_backpackammo(AMX *amx, cell *params) //
|
|||||||
// params[2] = weapon, as in CSW_*
|
// params[2] = weapon, as in CSW_*
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
@ -922,7 +718,7 @@ static cell AMX_NATIVE_CALL cs_get_user_backpackammo(AMX *amx, cell *params) //
|
|||||||
offset = OFFSET_C4_AMMO;
|
offset = OFFSET_C4_AMMO;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", params[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,20 +735,10 @@ static cell AMX_NATIVE_CALL cs_set_user_backpackammo(AMX *amx, cell *params) //
|
|||||||
// params[3] = new amount
|
// params[3] = new amount
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
@ -1014,7 +800,7 @@ static cell AMX_NATIVE_CALL cs_set_user_backpackammo(AMX *amx, cell *params) //
|
|||||||
offset = OFFSET_C4_AMMO;
|
offset = OFFSET_C4_AMMO;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", params[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1029,20 +815,10 @@ static cell AMX_NATIVE_CALL cs_get_user_nvg(AMX *amx, cell *params) // cs_get_us
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_NVGOGGLES) & HAS_NVGOGGLES)
|
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_NVGOGGLES) & HAS_NVGOGGLES)
|
||||||
return 1;
|
return 1;
|
||||||
@ -1057,20 +833,10 @@ static cell AMX_NATIVE_CALL cs_set_user_nvg(AMX *amx, cell *params) // cs_set_us
|
|||||||
// params[2] = 1 = give, 0 = remove
|
// params[2] = 1 = give, 0 = remove
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int* defusekit = ((int *)pPlayer->pvPrivateData + OFFSET_NVGOGGLES);
|
int* defusekit = ((int *)pPlayer->pvPrivateData + OFFSET_NVGOGGLES);
|
||||||
|
|
||||||
@ -1098,20 +864,9 @@ static cell AMX_NATIVE_CALL cs_get_user_model(AMX *amx, cell *params) // cs_get_
|
|||||||
// params[3] = max length to set
|
// params[3] = max length to set
|
||||||
|
|
||||||
// Valid player index should be within range
|
// Valid player index should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return MF_SetAmxString(amx, params[2], GETCLIENTKEYVALUE(GETINFOKEYBUFFER(pPlayer), "model"), params[3]);
|
return MF_SetAmxString(amx, params[2], GETCLIENTKEYVALUE(GETINFOKEYBUFFER(pPlayer), "model"), params[3]);
|
||||||
}
|
}
|
||||||
@ -1123,23 +878,13 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params) // cs_set_
|
|||||||
// params[2] = model
|
// params[2] = model
|
||||||
|
|
||||||
// Valid player index should be within range
|
// Valid player index should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t* pPlayer = INDEXENT(params[1]);
|
edict_t* pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params[2] == -1) {
|
if (params[2] == -1) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid model %d", params[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1162,20 +907,10 @@ static cell AMX_NATIVE_CALL cs_reset_user_model(AMX *amx, cell *params) // cs_re
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Valid player index should be within range
|
// Valid player index should be within range
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t* pPlayer = INDEXENT(params[1]);
|
edict_t* pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_players[params[1]].SetModelled(false);
|
g_players[params[1]].SetModelled(false);
|
||||||
|
|
||||||
@ -1190,24 +925,14 @@ static cell AMX_NATIVE_CALL cs_get_hostage_follow(AMX *amx, cell *params) // cs_
|
|||||||
// params[1] = hostage index
|
// params[1] = hostage index
|
||||||
|
|
||||||
// Valid index should be within range
|
// Valid index should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t* pHostage = INDEXENT(params[1]);
|
edict_t* pHostage = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pHostage)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure this is a hostage.
|
// Make sure this is a hostage.
|
||||||
if (strcmp(STRING(pHostage->v.classname), "hostage_entity") != 0) {
|
if (strcmp(STRING(pHostage->v.classname), "hostage_entity") != 0) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity %d (\"%s\") is not a hostage", params[1], STRING(pHostage->v.classname));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,7 +948,7 @@ static cell AMX_NATIVE_CALL cs_get_hostage_follow(AMX *amx, cell *params) // cs_
|
|||||||
edict_t* pEntity = (edict_t*)following;
|
edict_t* pEntity = (edict_t*)following;
|
||||||
|
|
||||||
if (FNullEnt(pEntity)) {
|
if (FNullEnt(pEntity)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown error finding hostage parameter");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1237,24 +962,14 @@ static cell AMX_NATIVE_CALL cs_set_hostage_follow(AMX *amx, cell *params) // cs_
|
|||||||
// params[2] = index to follow, if -1 then set hostage to not follow anything
|
// params[2] = index to follow, if -1 then set hostage to not follow anything
|
||||||
|
|
||||||
// Valid index should be within range
|
// Valid index should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t* pHostage = INDEXENT(params[1]);
|
edict_t* pHostage = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pHostage)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure this is a hostage.
|
// Make sure this is a hostage.
|
||||||
if (strcmp(STRING(pHostage->v.classname), "hostage_entity") != 0) {
|
if (strcmp(STRING(pHostage->v.classname), "hostage_entity") != 0) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity %d (\"%s\") is not a hostage", params[1], STRING(pHostage->v.classname));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1270,20 +985,10 @@ static cell AMX_NATIVE_CALL cs_set_hostage_follow(AMX *amx, cell *params) // cs_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Valid index should be within range
|
// Valid index should be within range
|
||||||
if (params[2] < 1 || params[2] > gpGlobals->maxEntities)
|
CHECK_ENTITY(params[2]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t* pEntity = INDEXENT(params[2]);
|
edict_t* pEntity = GETEDICT(params[2]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pEntity)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !defined __amd64__
|
#if !defined __amd64__
|
||||||
*((int *)pHostage->pvPrivateData + OFFSET_HOSTAGEFOLLOW) = (int)pEntity;
|
*((int *)pHostage->pvPrivateData + OFFSET_HOSTAGEFOLLOW) = (int)pEntity;
|
||||||
@ -1299,21 +1004,11 @@ static cell AMX_NATIVE_CALL cs_get_weapon_ammo(AMX *amx, cell *params) // cs_get
|
|||||||
// params[1] = weapon index
|
// params[1] = weapon index
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pWeapon = INDEXENT(params[1]);
|
edict_t *pWeapon = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pWeapon)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *((int *)pWeapon->pvPrivateData + OFFSET_CLIPAMMO);
|
return *((int *)pWeapon->pvPrivateData + OFFSET_CLIPAMMO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,21 +1019,11 @@ static cell AMX_NATIVE_CALL cs_set_weapon_ammo(AMX *amx, cell *params) // cs_set
|
|||||||
// params[2] = newammo
|
// params[2] = newammo
|
||||||
|
|
||||||
// Valid entity should be within range
|
// Valid entity should be within range
|
||||||
if (params[1] <= gpGlobals->maxClients || params[1] > gpGlobals->maxEntities)
|
CHECK_NONPLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pWeapon = INDEXENT(params[1]);
|
edict_t *pWeapon = INDEXENT(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pWeapon)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*((int *)pWeapon->pvPrivateData + OFFSET_CLIPAMMO) = params[2];
|
*((int *)pWeapon->pvPrivateData + OFFSET_CLIPAMMO) = params[2];
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -1350,14 +1035,10 @@ static cell AMX_NATIVE_CALL cs_get_user_hasprimary(AMX *amx, cell *params) // cs
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Check player
|
// Check player
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
return *((int *)pPlayer->pvPrivateData + OFFSET_PRIMARYWEAPON);
|
return *((int *)pPlayer->pvPrivateData + OFFSET_PRIMARYWEAPON);
|
||||||
}
|
}
|
||||||
@ -1383,20 +1064,10 @@ static cell AMX_NATIVE_CALL cs_get_user_tked(AMX *amx, cell *params) // cs_get_u
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Check player
|
// Check player
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *((int *)pPlayer->pvPrivateData + OFFSET_TK);
|
return *((int *)pPlayer->pvPrivateData + OFFSET_TK);
|
||||||
}
|
}
|
||||||
@ -1410,20 +1081,10 @@ static cell AMX_NATIVE_CALL cs_set_user_tked(AMX *amx, cell *params) // cs_set_u
|
|||||||
// params[3] = number of frags to subtract
|
// params[3] = number of frags to subtract
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch player pointer
|
// Fetch player pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params[2]) {
|
if (params[2]) {
|
||||||
*((int *)pPlayer->pvPrivateData + OFFSET_TK) = 1;
|
*((int *)pPlayer->pvPrivateData + OFFSET_TK) = 1;
|
||||||
@ -1456,20 +1117,10 @@ static cell AMX_NATIVE_CALL cs_get_user_driving(AMX *amx, cell *params) // cs_ge
|
|||||||
// params[1] = user index
|
// params[1] = user index
|
||||||
|
|
||||||
// Check player
|
// Check player
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If player driving, return 1, if not, return 0
|
// If player driving, return 1, if not, return 0
|
||||||
return *((int *)pPlayer->pvPrivateData + OFFSET_ISDRIVING);
|
return *((int *)pPlayer->pvPrivateData + OFFSET_ISDRIVING);
|
||||||
@ -1480,20 +1131,10 @@ static cell AMX_NATIVE_CALL cs_get_user_stationary(AMX *amx, cell *params) // cs
|
|||||||
// Returns 1 if client is using a stationary guns (maybe also other stuff)
|
// Returns 1 if client is using a stationary guns (maybe also other stuff)
|
||||||
|
|
||||||
// Check player
|
// Check player
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make into edict pointer
|
// Make into edict pointer
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
// Check entity validity
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If player driving, return 1, if not, return 0
|
// If player driving, return 1, if not, return 0
|
||||||
#if !defined __amd64__
|
#if !defined __amd64__
|
||||||
@ -1507,8 +1148,7 @@ static cell AMX_NATIVE_CALL cs_get_user_stationary(AMX *amx, cell *params) // cs
|
|||||||
else if (AMD64_STATIONARY_YES == *((int *)pPlayer->pvPrivateData + OFFSET_STATIONARY))
|
else if (AMD64_STATIONARY_YES == *((int *)pPlayer->pvPrivateData + OFFSET_STATIONARY))
|
||||||
return 1;
|
return 1;
|
||||||
else {
|
else {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Unexpected value at offset. Please report this to development team @ www.amxmodx.org!");
|
||||||
MF_Log("Unexpected value at offset. Please report this to development team @ www.amxmodx.org!");
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -213,3 +213,39 @@ CCstrikePlayer g_players[33];
|
|||||||
bool g_precachedknife = false;
|
bool g_precachedknife = false;
|
||||||
bool g_noknives = false;
|
bool g_noknives = false;
|
||||||
// Globals above
|
// Globals above
|
||||||
|
|
||||||
|
#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(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_PLAYER(x) \
|
||||||
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
} else { \
|
||||||
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_NONPLAYER(x) \
|
||||||
|
if (x < 1 || x <= gpGlobals->maxClients || x > gpGlobals->maxEntities) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Non-player entity %d out of range", x); \
|
||||||
|
} else { \
|
||||||
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GETEDICT(n) \
|
||||||
|
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
|
Loading…
Reference in New Issue
Block a user