Compare commits
152 Commits
amxmodx-0.
...
amxmodx-0.
Author | SHA1 | Date | |
---|---|---|---|
dd211e7a0b | |||
8761791473 | |||
6697b7b1d3 | |||
3c9a47aae3 | |||
d1675c82b5 | |||
b40643950d | |||
ff5b1dd7cc | |||
3587483fa6 | |||
c9c26b869c | |||
8f18856e91 | |||
ddfba00791 | |||
c6eaa97391 | |||
5eb095b514 | |||
4e0bfe161e | |||
0e681d9bd4 | |||
3d1162ecd9 | |||
3414cd7ce7 | |||
66386cca59 | |||
75396c753c | |||
4edd77faee | |||
91db6c7398 | |||
46390b83ac | |||
89eda75b1f | |||
f14808e009 | |||
b569ea3c3f | |||
f595be47dc | |||
ee3404fea0 | |||
61fc7da654 | |||
14c3930b3d | |||
3efa25a5fb | |||
c29a7d34e5 | |||
daa873d8ed | |||
c09de969eb | |||
b0dd18580c | |||
32deaa261f | |||
3a8e103faf | |||
f4b1c9f78a | |||
618759f390 | |||
ced5d6ff57 | |||
db4041114f | |||
b52d77e8bf | |||
940b0be4b9 | |||
75f49e78b0 | |||
f06359e38f | |||
2733adbb49 | |||
fc4d8f183b | |||
ea70c77dd8 | |||
301a69aacb | |||
92eda7c214 | |||
4800ab292c | |||
34cfce33a1 | |||
fec17424fb | |||
264dd7a10d | |||
6cef4eab4f | |||
f4ada32ec2 | |||
bff8c3cdcf | |||
3b670333de | |||
eb36757ef1 | |||
054b1f8868 | |||
23234fad0b | |||
74dca8b6ef | |||
2a187988f6 | |||
d1ee9ee9ba | |||
380f560fa4 | |||
d9b6fa1f93 | |||
8a57648b87 | |||
80b8591295 | |||
f94aa52974 | |||
ef8ad4a894 | |||
41b6f6bd4a | |||
9e8f380121 | |||
39070081d1 | |||
00d8ffe503 | |||
4ef8530bba | |||
77aa0f4f8e | |||
766246648d | |||
7963eb1cde | |||
02d8b2c523 | |||
227fb0411e | |||
027ae6dc7e | |||
334905e16e | |||
e3fad723b8 | |||
5e52c45968 | |||
e3a2a2bc17 | |||
18b75cb07c | |||
4e1c5a3e02 | |||
5db290890f | |||
b9c83aa4a2 | |||
bb12f71137 | |||
0a3911231b | |||
846ef95c58 | |||
601bb30b7e | |||
9728b79c33 | |||
90baf98057 | |||
8ad6437dd8 | |||
02bf904467 | |||
62e4bbcfe9 | |||
fc15ac1f41 | |||
01770f0e5b | |||
87ff81a499 | |||
981f41aee0 | |||
605ca152c2 | |||
0fc8f0b489 | |||
c511d80da7 | |||
8304fc143c | |||
f3cfd31668 | |||
ef90960121 | |||
3700b8b39f | |||
b83f2f5257 | |||
06f61cf92a | |||
5a5ff6d8ea | |||
bbe2626fd1 | |||
d5646ae238 | |||
df43d897df | |||
687a0f23da | |||
aa0dc4dbaf | |||
de399c54c6 | |||
58d522e4c3 | |||
3b90cca5bd | |||
b7c9cfeea4 | |||
4fcad51d25 | |||
c2a2fc7dbe | |||
3f0d3c257a | |||
ecc07d4b45 | |||
8da965552b | |||
cfe36dea52 | |||
c16eab09ec | |||
d07cc0424d | |||
c669efd609 | |||
c3151b312a | |||
3fc3ece5b0 | |||
6887dfef16 | |||
867e7615ae | |||
5157be6e3d | |||
82ca25b231 | |||
a555f9b3f0 | |||
c1a6ce2565 | |||
8874666109 | |||
5233be593f | |||
0f38a24555 | |||
8d06f80eeb | |||
0983698d2e | |||
dde43b6e0d | |||
4382158b88 | |||
ba69d73785 | |||
be3d078d5a | |||
b8ca4586ad | |||
25750d2f05 | |||
423a467a70 | |||
d6e18a3e97 | |||
a6d5d89209 | |||
16b35006bd |
@ -494,6 +494,7 @@ cell executeForwards(int id, ...)
|
|||||||
REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles
|
REAL tmp = (REAL)va_arg(argptr, double); // floats get converted to doubles
|
||||||
params[i] = *(cell*)&tmp;
|
params[i] = *(cell*)&tmp;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
params[i] = (cell)va_arg(argptr, cell);
|
params[i] = (cell)va_arg(argptr, cell);
|
||||||
}
|
}
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
@ -502,10 +503,20 @@ cell executeForwards(int id, ...)
|
|||||||
|
|
||||||
cell CForwardMngr::prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, bool copyBack)
|
cell CForwardMngr::prepareArray(void *ptr, unsigned int size, ForwardArrayElemType type, bool copyBack)
|
||||||
{
|
{
|
||||||
|
if (m_TmpArraysNum >= FORWARD_MAX_PARAMS)
|
||||||
|
{
|
||||||
|
#ifdef MEMORY_TEST
|
||||||
|
m_validateAllAllocUnits();
|
||||||
|
#endif // MEMORY_TEST
|
||||||
|
AMXXLOG_Log("[AMXX] Forwards with more than 32 parameters are not supported (tried to prepare array # %d).", m_TmpArraysNum + 1);
|
||||||
|
m_TmpArraysNum = 0;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
m_TmpArrays[m_TmpArraysNum].ptr = ptr;
|
m_TmpArrays[m_TmpArraysNum].ptr = ptr;
|
||||||
m_TmpArrays[m_TmpArraysNum].size = size;
|
m_TmpArrays[m_TmpArraysNum].size = size;
|
||||||
m_TmpArrays[m_TmpArraysNum].type = type;
|
m_TmpArrays[m_TmpArraysNum].type = type;
|
||||||
m_TmpArrays[m_TmpArraysNum].copyBack = copyBack;
|
m_TmpArrays[m_TmpArraysNum].copyBack = copyBack;
|
||||||
|
|
||||||
return m_TmpArraysNum++;
|
return m_TmpArraysNum++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
#ifndef FORWARD_H
|
#ifndef FORWARD_H
|
||||||
#define FORWARD_H
|
#define FORWARD_H
|
||||||
|
|
||||||
const int FORWARD_MAX_PARAMS = 16;
|
const int FORWARD_MAX_PARAMS = 32;
|
||||||
|
|
||||||
enum ForwardExecType
|
enum ForwardExecType
|
||||||
{
|
{
|
||||||
|
@ -498,7 +498,7 @@ int CLangMngr::GetKeyEntry(String &key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define CHECK_PTR(ptr, start, bufsize) if ((ptr) - (start) >= (bufsize)) { \
|
#define CHECK_PTR(ptr, start, bufsize) if ((ptr) - (start) >= (bufsize)) { \
|
||||||
AMXXLOG_Log("[AMXX] Buffer overflow in formatting (line %d, \"%s\")", amx->curline, g_plugins.findPluginFast(amx)->getName()); \
|
LogError(amx, AMX_ERR_STACKERR, "Buffer overflow in string formatting"); \
|
||||||
outbuf[0] = 0; \
|
outbuf[0] = 0; \
|
||||||
len = 0; \
|
len = 0; \
|
||||||
return outbuf; }
|
return outbuf; }
|
||||||
@ -509,7 +509,7 @@ int CLangMngr::GetKeyEntry(String &key)
|
|||||||
{ \
|
{ \
|
||||||
strcpy(outbuf, ""); \
|
strcpy(outbuf, ""); \
|
||||||
len = 0; \
|
len = 0; \
|
||||||
AMXXLOG_Log("[AMXX] Plugin did not format a string correctly (parameter %d (total %d), line %d, \"%s\")", parm, paramCount, amx->curline, g_plugins.findPluginFast(amx)->getName()); \
|
LogError(amx, AMX_ERR_PARAMS, "String formatted incorrectly - parameter %d (total %d)", parm, paramCount); \
|
||||||
return outbuf; \
|
return outbuf; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,7 +536,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
// Handle player ids (1-32) and server language
|
// Handle player ids (1-32) and server language
|
||||||
if (*pAmxLangName == LANG_PLAYER) // LANG_PLAYER
|
if (*pAmxLangName == LANG_PLAYER) // LANG_PLAYER
|
||||||
{
|
{
|
||||||
if ((int)CVAR_GET_FLOAT("amx_client_languages"))
|
if ((int)CVAR_GET_FLOAT("amx_client_languages") == 0)
|
||||||
{
|
{
|
||||||
cpLangName = g_vault.get("server_language");
|
cpLangName = g_vault.get("server_language");
|
||||||
} else {
|
} else {
|
||||||
@ -545,7 +545,7 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
|
|||||||
} else if (*pAmxLangName == LANG_SERVER) { // LANG_SERVER
|
} else if (*pAmxLangName == LANG_SERVER) { // LANG_SERVER
|
||||||
cpLangName = g_vault.get("server_language");
|
cpLangName = g_vault.get("server_language");
|
||||||
} else if (*pAmxLangName >= 1 && *pAmxLangName <= 32) { // Direct Client Id
|
} else if (*pAmxLangName >= 1 && *pAmxLangName <= 32) { // Direct Client Id
|
||||||
if ((int)CVAR_GET_FLOAT("amx_client_languages"))
|
if ((int)CVAR_GET_FLOAT("amx_client_languages") == 0)
|
||||||
{
|
{
|
||||||
cpLangName = g_vault.get("server_language");
|
cpLangName = g_vault.get("server_language");
|
||||||
} else {
|
} else {
|
||||||
@ -957,7 +957,7 @@ int CLangMngr::MergeDefinitionFile(const char *file)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MD5 md5;
|
MD5 md5;
|
||||||
md5.update(fp);
|
md5.update(fp); // closes for us
|
||||||
md5.finalize();
|
md5.finalize();
|
||||||
char md5buffer[33];
|
char md5buffer[33];
|
||||||
md5.hex_digest(md5buffer);
|
md5.hex_digest(md5buffer);
|
||||||
|
@ -153,9 +153,11 @@ void LogEventsMngr::executeLogEvents()
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
bool valid;
|
bool valid;
|
||||||
for(CLogEvent* a = logevents[ logArgc ]; a ; a = a->next){
|
for(CLogEvent* a = logevents[ logArgc ]; a ; a = a->next)
|
||||||
|
{
|
||||||
valid = true;
|
valid = true;
|
||||||
for( CLogEvent::LogCond* b = a->filters; b ; b = b->next){
|
for( CLogEvent::LogCond* b = a->filters; b ; b = b->next)
|
||||||
|
{
|
||||||
valid = false;
|
valid = false;
|
||||||
for( CLogEvent::LogCondEle* c = b->list; c ; c = c->next) {
|
for( CLogEvent::LogCondEle* c = b->list; c ; c = c->next) {
|
||||||
if ( c->cmp->compareCondition( logArgs[b->argnum] ) == 0 ){
|
if ( c->cmp->compareCondition( logArgs[b->argnum] ) == 0 ){
|
||||||
@ -163,27 +165,15 @@ void LogEventsMngr::executeLogEvents()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!valid) break;
|
if (!valid)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLEEXEPTIONS
|
if (valid)
|
||||||
try
|
|
||||||
{
|
{
|
||||||
#endif
|
|
||||||
|
|
||||||
if (valid){
|
|
||||||
if ((err = amx_Exec(a->plugin->getAMX(), NULL , a->func , 0)) != AMX_ERR_NONE)
|
if ((err = amx_Exec(a->plugin->getAMX(), NULL , a->func , 0)) != AMX_ERR_NONE)
|
||||||
LogError(a->plugin->getAMX(), err, "");
|
LogError(a->plugin->getAMX(), err, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLEEXEPTIONS
|
|
||||||
}
|
|
||||||
catch( ... )
|
|
||||||
{
|
|
||||||
AMXXLOG_Log( "[AMXX] fatal error at log forward function execution");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +428,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params)
|
|||||||
AMX_HEADER *hdr;
|
AMX_HEADER *hdr;
|
||||||
AMX_FUNCSTUB *func;
|
AMX_FUNCSTUB *func;
|
||||||
AMX_NATIVE f;
|
AMX_NATIVE f;
|
||||||
|
int i =0;
|
||||||
|
|
||||||
assert(amx!=NULL);
|
assert(amx!=NULL);
|
||||||
hdr=(AMX_HEADER *)amx->base;
|
hdr=(AMX_HEADER *)amx->base;
|
||||||
@ -437,6 +438,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params)
|
|||||||
assert(index>=0 && index<(cell)NUMENTRIES(hdr,natives,libraries));
|
assert(index>=0 && index<(cell)NUMENTRIES(hdr,natives,libraries));
|
||||||
func=GETENTRY(hdr,natives,index);
|
func=GETENTRY(hdr,natives,index);
|
||||||
f=(AMX_NATIVE)func->address;
|
f=(AMX_NATIVE)func->address;
|
||||||
|
amx->userdata[2] = (char *)GETENTRYNAME(hdr, func);
|
||||||
assert(f!=NULL);
|
assert(f!=NULL);
|
||||||
|
|
||||||
/* now that we have found the function, patch the program so that any
|
/* now that we have found the function, patch the program so that any
|
||||||
@ -606,6 +608,7 @@ static int amx_BrowseRelocate(AMX *amx)
|
|||||||
} else {
|
} else {
|
||||||
amx->userdata[0] = 0;
|
amx->userdata[0] = 0;
|
||||||
amx->userdata[1] = 0;
|
amx->userdata[1] = 0;
|
||||||
|
amx->userdata[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined __GNUC__ || defined ASM32 || defined JIT && !defined __64BIT__
|
#if defined __GNUC__ || defined ASM32 || defined JIT && !defined __64BIT__
|
||||||
|
@ -351,6 +351,15 @@ static cell AMX_NATIVE_CALL is_linux_server(AMX *amx, cell *params)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL is_amd64_server(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
#if SMALL_CELL_SIZE==64
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL is_jit_enabled(AMX *amx, cell *params) // PM: Useless ;P
|
static cell AMX_NATIVE_CALL is_jit_enabled(AMX *amx, cell *params) // PM: Useless ;P
|
||||||
{
|
{
|
||||||
#ifdef JIT
|
#ifdef JIT
|
||||||
@ -1203,6 +1212,7 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
|
|||||||
MESSAGE_BEGIN( params[1], params[2],NULL );
|
MESSAGE_BEGIN( params[1], params[2],NULL );
|
||||||
break;
|
break;
|
||||||
case MSG_PVS: case MSG_PAS:
|
case MSG_PVS: case MSG_PAS:
|
||||||
|
case MSG_PVS_R: case MSG_PAS_R:
|
||||||
if (numparam < 3) {
|
if (numparam < 3) {
|
||||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1213,12 +1223,13 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
|
|||||||
vecOrigin[2] = *(cpOrigin+2);
|
vecOrigin[2] = *(cpOrigin+2);
|
||||||
MESSAGE_BEGIN( params[1], params[2] , vecOrigin );
|
MESSAGE_BEGIN( params[1], params[2] , vecOrigin );
|
||||||
break;
|
break;
|
||||||
|
case MSG_ONE_UNRELIABLE:
|
||||||
case MSG_ONE:
|
case MSG_ONE:
|
||||||
if (numparam < 4) {
|
if (numparam < 4) {
|
||||||
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
amx_RaiseError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MESSAGE_BEGIN( MSG_ONE, params[2], NULL, INDEXENT(params[4]) );
|
MESSAGE_BEGIN( params[1], params[2], NULL, INDEXENT(params[4]) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1667,6 +1678,16 @@ static cell AMX_NATIVE_CALL get_user_msgid(AMX *amx, cell *params) /* 1 param */
|
|||||||
return GET_USER_MSG_ID(PLID, sptemp , NULL );
|
return GET_USER_MSG_ID(PLID, sptemp , NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL get_user_msgname(AMX *amx, cell *params) /* get_user_msgname(msg, str[], len) = 3 params */
|
||||||
|
{
|
||||||
|
const char* STRING = GET_USER_MSG_NAME(PLID, params[1], NULL);
|
||||||
|
if (STRING)
|
||||||
|
return set_amxstring(amx, params[2], STRING, params[3]);
|
||||||
|
|
||||||
|
// Comes here if GET_USER_MSG_NAME failed (ie, invalid msg id)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_task(AMX *amx, cell *params) /* 2 param */
|
static cell AMX_NATIVE_CALL set_task(AMX *amx, cell *params) /* 2 param */
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1740,7 +1761,11 @@ static cell AMX_NATIVE_CALL register_cvar(AMX *amx, cell *params) /* 3 param */
|
|||||||
g_cvars.put( cvar );
|
g_cvars.put( cvar );
|
||||||
|
|
||||||
if ( CVAR_GET_POINTER(temp) == 0 )
|
if ( CVAR_GET_POINTER(temp) == 0 )
|
||||||
CVAR_REGISTER( cvar->getCvar() );
|
{
|
||||||
|
static cvar_t cvar_reg_helper;
|
||||||
|
cvar_reg_helper = *(cvar->getCvar());
|
||||||
|
CVAR_REGISTER( &cvar_reg_helper );
|
||||||
|
}
|
||||||
|
|
||||||
CVAR_SET_STRING( temp ,get_amxstring(amx,params[2],1,i));
|
CVAR_SET_STRING( temp ,get_amxstring(amx,params[2],1,i));
|
||||||
return 1;
|
return 1;
|
||||||
@ -2666,6 +2691,35 @@ cell AMX_NATIVE_CALL require_module(AMX *amx, cell *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL lang_phrase(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
int len = 0;
|
||||||
|
int iLang = params[1];
|
||||||
|
|
||||||
|
const char *cpLangName=NULL;
|
||||||
|
// Handle player ids (1-32) and server language
|
||||||
|
if (iLang == LANG_SERVER) { // LANG_SERVER
|
||||||
|
cpLangName = g_vault.get("server_language");
|
||||||
|
} else if (iLang >= 1 && iLang <= 32) { // Direct Client Id
|
||||||
|
if ((int)CVAR_GET_FLOAT("amx_client_languages") == 0)
|
||||||
|
{
|
||||||
|
cpLangName = g_vault.get("server_language");
|
||||||
|
} else {
|
||||||
|
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(iLang)->pEdict, "lang");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!cpLangName || strlen(cpLangName) < 1)
|
||||||
|
cpLangName = "en";
|
||||||
|
|
||||||
|
const char *str = get_amxstring(amx, params[2], 0, len);
|
||||||
|
|
||||||
|
const char *dat = g_langMngr.GetDef(cpLangName, str);
|
||||||
|
|
||||||
|
set_amxstring(amx, params[3], dat?dat:"ML_LNOTFOUND", params[4]);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
AMX_NATIVE_INFO amxmod_Natives[] = {
|
AMX_NATIVE_INFO amxmod_Natives[] = {
|
||||||
{ "client_cmd", client_cmd },
|
{ "client_cmd", client_cmd },
|
||||||
{ "client_print", client_print },
|
{ "client_print", client_print },
|
||||||
@ -2716,6 +2770,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
|
|||||||
{ "get_user_ip", get_user_ip },
|
{ "get_user_ip", get_user_ip },
|
||||||
{ "get_user_menu", get_user_menu},
|
{ "get_user_menu", get_user_menu},
|
||||||
{ "get_user_msgid", get_user_msgid},
|
{ "get_user_msgid", get_user_msgid},
|
||||||
|
{ "get_user_msgname", get_user_msgname},
|
||||||
{ "get_user_name", get_user_name },
|
{ "get_user_name", get_user_name },
|
||||||
{ "get_user_origin", get_user_origin},
|
{ "get_user_origin", get_user_origin},
|
||||||
{ "get_user_ping", get_user_ping },
|
{ "get_user_ping", get_user_ping },
|
||||||
@ -2731,6 +2786,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
|
|||||||
{ "get_xvar_num", get_xvar_num },
|
{ "get_xvar_num", get_xvar_num },
|
||||||
{ "is_dedicated_server",is_dedicated_server },
|
{ "is_dedicated_server",is_dedicated_server },
|
||||||
{ "is_linux_server", is_linux_server },
|
{ "is_linux_server", is_linux_server },
|
||||||
|
{ "is_amd64_server", is_amd64_server },
|
||||||
{ "is_jit_enabled", is_jit_enabled },
|
{ "is_jit_enabled", is_jit_enabled },
|
||||||
{ "is_user_authorized", is_user_authorized },
|
{ "is_user_authorized", is_user_authorized },
|
||||||
{ "is_map_valid", is_map_valid },
|
{ "is_map_valid", is_map_valid },
|
||||||
@ -2824,5 +2880,6 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
|
|||||||
{ "md5", amx_md5 },
|
{ "md5", amx_md5 },
|
||||||
{ "md5_file", amx_md5_file },
|
{ "md5_file", amx_md5_file },
|
||||||
{ "plugin_flags", plugin_flags},
|
{ "plugin_flags", plugin_flags},
|
||||||
|
{ "lang_phrase", lang_phrase},
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ void CLog::CloseFile()
|
|||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fopen(m_LogFile.c_str(), "a+");
|
fp = fopen(m_LogFile.c_str(), "a+");
|
||||||
|
|
||||||
// get time
|
// get time
|
||||||
time_t td;
|
time_t td;
|
||||||
@ -106,9 +106,12 @@ void CLog::CreateNewFile()
|
|||||||
ALERT(at_logged, "[AMXX] Unexpected fatal logging error. AMXX Logging disabled.\n");
|
ALERT(at_logged, "[AMXX] Unexpected fatal logging error. AMXX Logging disabled.\n");
|
||||||
SET_LOCALINFO("amxx_logging", "0");
|
SET_LOCALINFO("amxx_logging", "0");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fprintf(fp, "AMX Mod X log file started (file \"%s/L%02d%02d%03d.log\") (version \"%s\")\n", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i, AMX_VERSION);
|
fprintf(fp, "AMX Mod X log file started (file \"%s/L%02d%02d%03d.log\") (version \"%s\")\n", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i, AMX_VERSION);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CLog::UseFile(const String &fileName)
|
void CLog::UseFile(const String &fileName)
|
||||||
{
|
{
|
||||||
|
@ -2344,6 +2344,14 @@ CFakeMeta::CFakeMetaPlugin::~CFakeMetaPlugin()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ghost_of_evilspy's "could not find memloc for cvar" fix
|
||||||
|
void FakeMeta_New_CVarRegister(cvar_t *pCVar)
|
||||||
|
{
|
||||||
|
static cvar_t tmpvar;
|
||||||
|
tmpvar = *pCVar;
|
||||||
|
CVAR_REGISTER(&tmpvar);
|
||||||
|
}
|
||||||
|
|
||||||
int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs)
|
int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs)
|
||||||
{
|
{
|
||||||
// Load the library
|
// Load the library
|
||||||
@ -2390,7 +2398,13 @@ int CFakeMeta::CFakeMetaPlugin::Query(mutil_funcs_t *pMetaUtilFuncs)
|
|||||||
m_Status = PL_BADFILE;
|
m_Status = PL_BADFILE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
giveEngFuncsFn(&g_engfuncs, gpGlobals);
|
|
||||||
|
// ghost_of_evilspy's "Could not find memloc for cvar" fix
|
||||||
|
static enginefuncs_t fakemeta_engfuncs;
|
||||||
|
memcpy(&fakemeta_engfuncs, &g_engfuncs, sizeof(enginefuncs_t));
|
||||||
|
// Override cvar register to our own function
|
||||||
|
fakemeta_engfuncs.pfnCVarRegister = FakeMeta_New_CVarRegister;
|
||||||
|
giveEngFuncsFn(&fakemeta_engfuncs, gpGlobals);
|
||||||
|
|
||||||
if (queryFn(META_INTERFACE_VERSION, &m_Info, pMetaUtilFuncs) != 1)
|
if (queryFn(META_INTERFACE_VERSION, &m_Info, pMetaUtilFuncs) != 1)
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,23 @@
|
|||||||
|
|
||||||
CVector<FILE *> FileList;
|
CVector<FILE *> FileList;
|
||||||
|
|
||||||
|
class AutoFilePtr
|
||||||
|
{
|
||||||
|
FILE *m_FP;
|
||||||
|
public:
|
||||||
|
AutoFilePtr(FILE *fp) : m_FP(fp)
|
||||||
|
{ }
|
||||||
|
~AutoFilePtr()
|
||||||
|
{
|
||||||
|
if (m_FP)
|
||||||
|
fclose(m_FP);
|
||||||
|
}
|
||||||
|
operator FILE* ()
|
||||||
|
{
|
||||||
|
return m_FP;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL read_dir(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL read_dir(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
@ -230,17 +247,20 @@ static cell AMX_NATIVE_CALL file_size(AMX *amx, cell *params) /* 1 param */
|
|||||||
{
|
{
|
||||||
int iLen;
|
int iLen;
|
||||||
char* sFile = get_amxstring(amx,params[1],0,iLen);
|
char* sFile = get_amxstring(amx,params[1],0,iLen);
|
||||||
FILE* fp = fopen(build_pathname("%s",sFile),"r");
|
AutoFilePtr fp(fopen(build_pathname("%s",sFile),"r"));
|
||||||
if ( fp != NULL) {
|
if ( fp != NULL)
|
||||||
if ( params[0] < 2 || params[2] == 0 ){
|
{
|
||||||
|
if ( params[0] < 2 || params[2] == 0 )
|
||||||
|
{
|
||||||
fseek(fp,0,SEEK_END);
|
fseek(fp,0,SEEK_END);
|
||||||
int size = ftell(fp);
|
int size = ftell(fp);
|
||||||
fclose(fp);
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
else if ( params[2] == 1 ){
|
else if ( params[2] == 1 )
|
||||||
|
{
|
||||||
int a = 0,lines = 0;
|
int a = 0,lines = 0;
|
||||||
while( a != EOF ){
|
while( a != EOF )
|
||||||
|
{
|
||||||
++lines;
|
++lines;
|
||||||
while ( (a = fgetc(fp)) != '\n' && a != EOF )
|
while ( (a = fgetc(fp)) != '\n' && a != EOF )
|
||||||
;
|
;
|
||||||
@ -454,7 +474,7 @@ static cell AMX_NATIVE_CALL amx_filesize(AMX *amx, cell *params)
|
|||||||
int len;
|
int len;
|
||||||
char *file = build_pathname("%s", format_amxstring(amx, params, 1, len));
|
char *file = build_pathname("%s", format_amxstring(amx, params, 1, len));
|
||||||
long size;
|
long size;
|
||||||
FILE *fp = fopen(file, "rb");
|
AutoFilePtr fp(fopen(file, "rb"));
|
||||||
if (fp) {
|
if (fp) {
|
||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
size = ftell(fp);
|
size = ftell(fp);
|
||||||
|
@ -281,7 +281,7 @@ int C_Spawn( edict_t *pent ) {
|
|||||||
FF_ClientPutInServer = registerForward("client_putinserver", ET_IGNORE, FP_CELL, FP_DONE);
|
FF_ClientPutInServer = registerForward("client_putinserver", ET_IGNORE, FP_CELL, FP_DONE);
|
||||||
FF_PluginCfg = registerForward("plugin_cfg", ET_IGNORE, FP_DONE);
|
FF_PluginCfg = registerForward("plugin_cfg", ET_IGNORE, FP_DONE);
|
||||||
FF_PluginPrecache = registerForward("plugin_precache", ET_IGNORE, FP_DONE);
|
FF_PluginPrecache = registerForward("plugin_precache", ET_IGNORE, FP_DONE);
|
||||||
FF_PluginLog = registerForward("plugin_log", ET_IGNORE, FP_DONE);
|
FF_PluginLog = registerForward("plugin_log", ET_STOP, FP_DONE);
|
||||||
FF_PluginEnd = registerForward("plugin_end", ET_IGNORE, FP_DONE);
|
FF_PluginEnd = registerForward("plugin_end", ET_IGNORE, FP_DONE);
|
||||||
FF_InconsistentFile = registerForward("inconsistent_file", ET_STOP, FP_CELL, FP_STRING, FP_STRINGEX, FP_DONE);
|
FF_InconsistentFile = registerForward("inconsistent_file", ET_STOP, FP_CELL, FP_STRING, FP_STRINGEX, FP_DONE);
|
||||||
FF_ClientAuthorized = registerForward("client_authorized", ET_IGNORE, FP_CELL, FP_DONE);
|
FF_ClientAuthorized = registerForward("client_authorized", ET_IGNORE, FP_CELL, FP_DONE);
|
||||||
@ -985,7 +985,9 @@ void C_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
|
|||||||
g_logevents.parseLogString( );
|
g_logevents.parseLogString( );
|
||||||
if (g_logevents.logEventsExist())
|
if (g_logevents.logEventsExist())
|
||||||
g_logevents.executeLogEvents( );
|
g_logevents.executeLogEvents( );
|
||||||
executeForwards(FF_PluginLog);
|
cell retVal = executeForwards(FF_PluginLog);
|
||||||
|
if (retVal)
|
||||||
|
RETURN_META(MRES_HANDLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
|
@ -616,7 +616,11 @@ int loadModules(const char* filename)
|
|||||||
|
|
||||||
CModule* cc = new CModule( path.c_str() );
|
CModule* cc = new CModule( path.c_str() );
|
||||||
|
|
||||||
if ( cc == 0 ) return loaded;
|
if ( cc == 0 )
|
||||||
|
{
|
||||||
|
fclose(fp);
|
||||||
|
return loaded;
|
||||||
|
}
|
||||||
|
|
||||||
cc->queryModule();
|
cc->queryModule();
|
||||||
|
|
||||||
@ -1161,11 +1165,17 @@ void GenericError(AMX *amx, int err, int line, char buf[], const char *file)
|
|||||||
if (geterr == NULL)
|
if (geterr == NULL)
|
||||||
{
|
{
|
||||||
sprintf(buf, "Run time error %d on line %d (%s \"%s\").", err, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
sprintf(buf, "Run time error %d on line %d (%s \"%s\").", err, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
||||||
|
} else {
|
||||||
|
if (err == AMX_ERR_NATIVE && amx->userdata[2])
|
||||||
|
{
|
||||||
|
geterr = (char *)(amx->userdata[2]);
|
||||||
|
sprintf(buf, "Native error in \"%s\" on line %d (%s \"%s\").", geterr, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
||||||
} else {
|
} else {
|
||||||
sprintf(buf, "Run time error %d (%s) on line %d (%s \"%s\").", err, geterr, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
sprintf(buf, "Run time error %d (%s) on line %d (%s \"%s\").", err, geterr, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//by BAILOPAN
|
//by BAILOPAN
|
||||||
// debugger engine front end
|
// debugger engine front end
|
||||||
@ -1185,8 +1195,21 @@ void LogError(AMX *amx, int err, const char *fmt, ...)
|
|||||||
|
|
||||||
if (!dbg || !(dbg->tail))
|
if (!dbg || !(dbg->tail))
|
||||||
{
|
{
|
||||||
|
if (dbg && amx->curfile < dbg->numFiles && amx->curfile >= 0)
|
||||||
|
{
|
||||||
|
GenericError(amx, err, amx->curline, buf, dbg->files[amx->curfile]);
|
||||||
|
} else {
|
||||||
GenericError(amx, err, amx->curline, buf, NULL);
|
GenericError(amx, err, amx->curline, buf, NULL);
|
||||||
AMXXLOG_Log("[AMXX] %s %s", buf, vbuf);
|
}
|
||||||
|
AMXXLOG_Log("[AMXX] %s", buf);
|
||||||
|
if (*vbuf)
|
||||||
|
{
|
||||||
|
AMXXLOG_Log("%s", vbuf);
|
||||||
|
}
|
||||||
|
if (!dbg)
|
||||||
|
{
|
||||||
|
AMXXLOG_Log("[AMXX] To enable debug mode, add \" debug\" after the plugin name in plugins.ini (without quotes).");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
AMX_TRACE *t = dbg->tail;
|
AMX_TRACE *t = dbg->tail;
|
||||||
AMX_DEBUGCALL tracer = (AMX_DEBUGCALL)(amx->userdata[1]);
|
AMX_DEBUGCALL tracer = (AMX_DEBUGCALL)(amx->userdata[1]);
|
||||||
@ -1194,19 +1217,20 @@ void LogError(AMX *amx, int err, const char *fmt, ...)
|
|||||||
cell line = amx->curline;
|
cell line = amx->curline;
|
||||||
cell file = amx->curfile;
|
cell file = amx->curfile;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
if (file >= dbg->numFiles || file < 0)
|
|
||||||
{
|
|
||||||
GenericError(amx, err, line, buf, NULL);
|
GenericError(amx, err, line, buf, NULL);
|
||||||
} else {
|
|
||||||
GenericError(amx, err, line, buf, dbg->files[file]);
|
|
||||||
}
|
|
||||||
AMXXLOG_Log("[AMXX] %s", buf);
|
AMXXLOG_Log("[AMXX] %s", buf);
|
||||||
if (*vbuf)
|
if (*vbuf)
|
||||||
{
|
{
|
||||||
AMXXLOG_Log("[AMXX] %s", vbuf);
|
AMXXLOG_Log("%s", vbuf);
|
||||||
}
|
}
|
||||||
AMXXLOG_Log("[AMXX] Debug Trace =>");
|
AMXXLOG_Log("[AMXX] Debug Trace =>");
|
||||||
//log the error right away
|
//log the error right away
|
||||||
|
if (file >= dbg->numFiles || file < 0)
|
||||||
|
{
|
||||||
|
AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, g_plugins.findPluginFast(amx)->getName());
|
||||||
|
} else {
|
||||||
|
AMXXLOG_Log("[AMXX] [%d] Line %d, File \"%s\"", i++, line, dbg->files[file]);
|
||||||
|
}
|
||||||
while (t != NULL)
|
while (t != NULL)
|
||||||
{
|
{
|
||||||
line = t->line;
|
line = t->line;
|
||||||
|
@ -316,7 +316,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386"
|
AdditionalOptions="/MACHINE:I386"
|
||||||
AdditionalDependencies="odbc32.lib odbccp32.lib ..\jit\jits.lib ..\zlib\zlib.lib"
|
AdditionalDependencies="..\jit\jits.obj ..\zlib\zlib.lib"
|
||||||
OutputFile="jitdebug/amxmodx_mm.dll"
|
OutputFile="jitdebug/amxmodx_mm.dll"
|
||||||
Version="0.1"
|
Version="0.1"
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
|
@ -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,7 +2454,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_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
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;
|
||||||
@ -2529,7 +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("LogError", g_fn_LogErrorFunc, 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);
|
||||||
|
|
||||||
@ -2636,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
|
@ -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
|
||||||
@ -1990,7 +1990,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_LOG_ERROR g_fn_LogErrorFunc;
|
||||||
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;
|
||||||
@ -2106,7 +2106,7 @@ 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
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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
|
||||||
|
@ -14,4 +14,4 @@
|
|||||||
"Kick player" "amx_kick #%userid%" "b" "u"
|
"Kick player" "amx_kick #%userid%" "b" "u"
|
||||||
"Slay player" "amx_slay #%userid%" "bd" "u"
|
"Slay player" "amx_slay #%userid%" "bd" "u"
|
||||||
"Slap with 1 dmg." "amx_slap #%userid% 1" "bd" "u"
|
"Slap with 1 dmg." "amx_slap #%userid% 1" "bd" "u"
|
||||||
"Ban for 5 minutes" "amx_ban #%userid% id 5" "b" "u"
|
"Ban for 5 minutes" "amx_ban #%userid% 5" "b" "u"
|
||||||
|
@ -50,14 +50,20 @@ fun_amxx.dll
|
|||||||
;sockets_amxx_i386.so
|
;sockets_amxx_i386.so
|
||||||
;sockets_amxx.dll
|
;sockets_amxx.dll
|
||||||
|
|
||||||
|
; --------------------------
|
||||||
|
; Regular Expression support
|
||||||
|
; --------------------------
|
||||||
|
;regex_amxx_i386.so
|
||||||
|
;regex_amxx.dll
|
||||||
|
|
||||||
; ----------------------------------------------------------
|
; ----------------------------------------------------------
|
||||||
; Counter-Strike - adds functions specific to Counter-Strike
|
; Counter-Strike - adds functions specific to Counter-Strike
|
||||||
; ----------------------------------------------------------
|
; ----------------------------------------------------------
|
||||||
;cstrike_amxx_i386.so
|
;cstrike_amxx_i386.so
|
||||||
;cstrike_amxx.dll
|
;cstrike_amxx.dll
|
||||||
|
|
||||||
; ------------------------------------------------
|
; -----------------------------------------------------
|
||||||
; CS Stats - adds functionality for CS statistical
|
; CSX - adds functionality for CS statistics and events
|
||||||
; ------------------------------------------------
|
; -----------------------------------------------------
|
||||||
;csstats_amxx_i386.so
|
;csx_amxx_i386.so
|
||||||
;csstats_amxx.dll
|
;csx_amxx.dll
|
||||||
|
@ -35,9 +35,9 @@ statscfg.amxx ; allows to manage stats plugins via menu and commands
|
|||||||
|
|
||||||
; Counter-Strike
|
; Counter-Strike
|
||||||
;restmenu.amxx ; restrict weapons menu
|
;restmenu.amxx ; restrict weapons menu
|
||||||
;statsx.amxx ; stats on death or round end (CSStats Module required!)
|
;statsx.amxx ; stats on death or round end (CSX Module required!)
|
||||||
;miscstats.amxx ; bunch of events announcement for Counter-Strike
|
;miscstats.amxx ; bunch of events announcement for Counter-Strike
|
||||||
;stats_logging.amxx ; weapons stats logging (CSStats Module required!)
|
;stats_logging.amxx ; weapons stats logging (CSX Module required!)
|
||||||
|
|
||||||
|
|
||||||
; Custom - Add 3rd party plugins here
|
; Custom - Add 3rd party plugins here
|
||||||
|
13
configs/custommenuitems.cfg
Executable file
13
configs/custommenuitems.cfg
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
// Here you can add menu items from any plugin to Menus Front-End plugin, aka "amxmodmenu".
|
||||||
|
//
|
||||||
|
// Usage: "amx_addmenuitem <menu text> <menu command> <access flags> <plugin name>"
|
||||||
|
//
|
||||||
|
// <menu text>: This is the text displayed in the menu itself for this item.
|
||||||
|
// <menu command>: This is the client command used to access the menu.
|
||||||
|
// <access flags>: Specify what access flags admins must have to use this menu item. (Check users.ini for access flags.)
|
||||||
|
// <plugin name>: This must be the _exact_ (though case insensitive) name of the plugin which holds the menu command. (Use "amxx plugins" in server console, plugin names are listed in Name column.)
|
||||||
|
//
|
||||||
|
// Example: (be sure to use quotes around parameters with spaces!)
|
||||||
|
//
|
||||||
|
// amx_addmenuitem "Weapon Arena" "weaponarena_menu" "hu" "Weapon Arena"
|
||||||
|
|
@ -50,6 +50,12 @@ fun_amxx.dll
|
|||||||
;sockets_amxx_i386.so
|
;sockets_amxx_i386.so
|
||||||
;sockets_amxx.dll
|
;sockets_amxx.dll
|
||||||
|
|
||||||
|
; --------------------------
|
||||||
|
; Regular Expression support
|
||||||
|
; --------------------------
|
||||||
|
;regex_amxx_i386.so
|
||||||
|
;regex_amxx.dll
|
||||||
|
|
||||||
; --------------------------------------------------
|
; --------------------------------------------------
|
||||||
; Day of Defeat Fun - adds functions specific to DoD
|
; Day of Defeat Fun - adds functions specific to DoD
|
||||||
; --------------------------------------------------
|
; --------------------------------------------------
|
||||||
|
@ -49,3 +49,9 @@ fun_amxx.dll
|
|||||||
; --------------------------------
|
; --------------------------------
|
||||||
;sockets_amxx_i386.so
|
;sockets_amxx_i386.so
|
||||||
;sockets_amxx.dll
|
;sockets_amxx.dll
|
||||||
|
|
||||||
|
; --------------------------
|
||||||
|
; Regular Expression support
|
||||||
|
; --------------------------
|
||||||
|
;regex_amxx_i386.so
|
||||||
|
;regex_amxx.dll
|
@ -4,23 +4,26 @@
|
|||||||
|
|
||||||
; Add in your mod's maps here
|
; Add in your mod's maps here
|
||||||
|
|
||||||
co_angst
|
|
||||||
ns_caged
|
|
||||||
ns_hera
|
|
||||||
ns_metal
|
ns_metal
|
||||||
|
ns_caged
|
||||||
|
co_sava
|
||||||
|
co_angst
|
||||||
|
ns_hera
|
||||||
ns_lost
|
ns_lost
|
||||||
ns_nothing
|
ns_nothing
|
||||||
co_faceoff
|
co_faceoff
|
||||||
ns_mineshaft
|
ns_mineshaft
|
||||||
co_daimos
|
co_daimos
|
||||||
|
ns_bast
|
||||||
ns_origin
|
ns_origin
|
||||||
co_kestrel
|
co_kestrel
|
||||||
ns_tanith
|
ns_tanith
|
||||||
ns_nancy
|
ns_nancy
|
||||||
ns_veil
|
ns_veil
|
||||||
co_core
|
co_core
|
||||||
|
co_ulysses
|
||||||
ns_eclipse
|
ns_eclipse
|
||||||
co_pulse
|
co_pulse
|
||||||
ns_ayumi
|
ns_ayumi
|
||||||
ns_agora
|
ns_agora
|
||||||
co_ulysses
|
ns_altair
|
||||||
|
@ -50,6 +50,12 @@
|
|||||||
;sockets_amxx_i386.so
|
;sockets_amxx_i386.so
|
||||||
;sockets_amxx.dll
|
;sockets_amxx.dll
|
||||||
|
|
||||||
|
; --------------------------
|
||||||
|
; Regular Expression support
|
||||||
|
; --------------------------
|
||||||
|
;regex_amxx_i386.so
|
||||||
|
;regex_amxx.dll
|
||||||
|
|
||||||
; -----------------
|
; -----------------
|
||||||
; Natural Selection
|
; Natural Selection
|
||||||
; -----------------
|
; -----------------
|
||||||
|
@ -35,6 +35,6 @@ pausecfg.amxx ; allows to pause and unpause some plugins
|
|||||||
; NS Specific plugins
|
; NS Specific plugins
|
||||||
idlekicker.amxx ; kicks idle players
|
idlekicker.amxx ; kicks idle players
|
||||||
nscommands.amxx ; extra commands for Natural-Selection
|
nscommands.amxx ; extra commands for Natural-Selection
|
||||||
unstuck.amxx ; Allows players to free themselves if they get stuck in the map (req engine & ns modules)
|
;unstuck.amxx ; Free stuck players (engine & ns modules required!)
|
||||||
|
|
||||||
; Custom - Add 3rd party plugins here
|
; Custom - Add 3rd party plugins here
|
||||||
|
@ -50,6 +50,12 @@ fun_amxx.dll
|
|||||||
;sockets_amxx_i386.so
|
;sockets_amxx_i386.so
|
||||||
;sockets_amxx.dll
|
;sockets_amxx.dll
|
||||||
|
|
||||||
|
; --------------------------
|
||||||
|
; Regular Expression support
|
||||||
|
; --------------------------
|
||||||
|
;regex_amxx_i386.so
|
||||||
|
;regex_amxx.dll
|
||||||
|
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
; Team Fortress Classic X - adds functions and stats specific to TFC
|
; Team Fortress Classic X - adds functions and stats specific to TFC
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
|
@ -3,7 +3,7 @@ amxx_logdir addons/amxmodx/logs
|
|||||||
amxx_configsdir addons/amxmodx/configs
|
amxx_configsdir addons/amxmodx/configs
|
||||||
amxx_datadir addons/amxmodx/data
|
amxx_datadir addons/amxmodx/data
|
||||||
amxx_modules addons/amxmodx/configs/modules.ini
|
amxx_modules addons/amxmodx/configs/modules.ini
|
||||||
mxx_plugins addons/amxmodx/configs/plugins.ini
|
amxx_plugins addons/amxmodx/configs/plugins.ini
|
||||||
amxx_pluginsdir addons/amxmodx/plugins
|
amxx_pluginsdir addons/amxmodx/plugins
|
||||||
amxx_modulesdir addons/amxmodx/modules
|
amxx_modulesdir addons/amxmodx/modules
|
||||||
amxx_vault addons/amxmodx/data/vault.ini
|
amxx_vault addons/amxmodx/data/vault.ini
|
||||||
|
@ -50,6 +50,12 @@ fun_amxx.dll
|
|||||||
;sockets_amxx_i386.so
|
;sockets_amxx_i386.so
|
||||||
;sockets_amxx.dll
|
;sockets_amxx.dll
|
||||||
|
|
||||||
|
; --------------------------
|
||||||
|
; Regular Expression support
|
||||||
|
; --------------------------
|
||||||
|
;regex_amxx_i386.so
|
||||||
|
;regex_amxx.dll
|
||||||
|
|
||||||
; -----------------------------------------------------------
|
; -----------------------------------------------------------
|
||||||
; The Specialists X - adds functions and stats specific to TS
|
; The Specialists X - adds functions and stats specific to TS
|
||||||
; -----------------------------------------------------------
|
; -----------------------------------------------------------
|
||||||
|
@ -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_LogErrorFunc;
|
||||||
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_LogErrorFunc, 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);
|
||||||
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2649,11 +2683,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 +2701,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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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_LogErrorFunc;
|
||||||
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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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) {
|
||||||
@ -254,6 +190,20 @@ static cell AMX_NATIVE_CALL cs_get_weapon_silenced(AMX *amx, cell *params) // cs
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL cs_get_weapon_id(AMX *amx, cell *params) // cs_get_weapon_id(index); = 1 param
|
||||||
|
{
|
||||||
|
// Get weapon type. Corresponds to CSW_*
|
||||||
|
// params[1] = weapon index
|
||||||
|
|
||||||
|
// Valid entity should be within range
|
||||||
|
CHECK_NONPLAYER(params[1]);
|
||||||
|
|
||||||
|
// Make into edict pointer
|
||||||
|
edict_t *pWeapon = INDEXENT(params[1]);
|
||||||
|
|
||||||
|
return *((int *)pWeapon->pvPrivateData + OFFSET_WEAPONTYPE);
|
||||||
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL cs_set_weapon_silenced(AMX *amx, cell *params) // cs_set_weapon_silenced(index, silence = 1); = 2 params
|
static cell AMX_NATIVE_CALL cs_set_weapon_silenced(AMX *amx, cell *params) // cs_set_weapon_silenced(index, silence = 1); = 2 params
|
||||||
{
|
{
|
||||||
// Silence/unsilence gun. Does only work on M4A1 and USP.
|
// Silence/unsilence gun. Does only work on M4A1 and USP.
|
||||||
@ -261,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);
|
||||||
|
|
||||||
@ -325,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) {
|
||||||
@ -362,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);
|
||||||
@ -432,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;
|
||||||
@ -460,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.
|
||||||
@ -522,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);
|
||||||
}
|
}
|
||||||
@ -548,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];
|
||||||
|
|
||||||
@ -589,7 +469,8 @@ static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_u
|
|||||||
strcpy(teaminfo, "SPECTATOR");
|
strcpy(teaminfo, "SPECTATOR");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(teaminfo, "TEAM_%d", params[2]);
|
int team_nr = (int)params[2];
|
||||||
|
sprintf(teaminfo, "TEAM_%i", team_nr);
|
||||||
}
|
}
|
||||||
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "TeamInfo", NULL));
|
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "TeamInfo", NULL));
|
||||||
WRITE_BYTE(params[1]);
|
WRITE_BYTE(params[1]);
|
||||||
@ -605,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.
|
||||||
}
|
}
|
||||||
@ -629,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;
|
||||||
@ -658,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);
|
||||||
|
|
||||||
@ -714,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;
|
||||||
@ -747,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);
|
||||||
|
|
||||||
@ -822,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;
|
||||||
|
|
||||||
@ -897,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -914,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;
|
||||||
|
|
||||||
@ -989,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1004,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;
|
||||||
@ -1032,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);
|
||||||
|
|
||||||
@ -1073,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]);
|
||||||
}
|
}
|
||||||
@ -1098,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1137,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);
|
||||||
|
|
||||||
@ -1165,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1198,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1212,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1245,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;
|
||||||
@ -1274,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1299,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;
|
||||||
@ -1325,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);
|
||||||
}
|
}
|
||||||
@ -1351,6 +1057,104 @@ static cell AMX_NATIVE_CALL cs_set_no_knives(AMX *amx, cell *params) // cs_set_n
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Damaged Soul
|
||||||
|
static cell AMX_NATIVE_CALL cs_get_user_tked(AMX *amx, cell *params) // cs_get_user_tked(index); = 1 param
|
||||||
|
{
|
||||||
|
// Return 1 if user has committed a team killing)
|
||||||
|
// params[1] = user index
|
||||||
|
|
||||||
|
// Check player
|
||||||
|
CHECK_PLAYER(params[1]);
|
||||||
|
|
||||||
|
// Make into edict pointer
|
||||||
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
|
return *((int *)pPlayer->pvPrivateData + OFFSET_TK);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Damaged Soul
|
||||||
|
static cell AMX_NATIVE_CALL cs_set_user_tked(AMX *amx, cell *params) // cs_set_user_tked(index, tk = 1, subtract = 1); = 2 arguments
|
||||||
|
{
|
||||||
|
// Sets whether or not player has committed a TK.
|
||||||
|
// params[1] = user
|
||||||
|
// params[2] = 1: player has TKed, 0: player hasn't TKed
|
||||||
|
// params[3] = number of frags to subtract
|
||||||
|
|
||||||
|
// Check index
|
||||||
|
CHECK_PLAYER(params[1]);
|
||||||
|
|
||||||
|
// Fetch player pointer
|
||||||
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
|
if (params[2]) {
|
||||||
|
*((int *)pPlayer->pvPrivateData + OFFSET_TK) = 1;
|
||||||
|
} else {
|
||||||
|
*((int *)pPlayer->pvPrivateData + OFFSET_TK) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params[3]) {
|
||||||
|
pPlayer->v.frags = pPlayer->v.frags - params[3];
|
||||||
|
|
||||||
|
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreInfo", NULL));
|
||||||
|
WRITE_BYTE(params[1]); // user index
|
||||||
|
WRITE_SHORT((int)pPlayer->v.frags); // frags
|
||||||
|
WRITE_SHORT(*((int *)pPlayer->pvPrivateData + OFFSET_CSDEATHS)); // deaths
|
||||||
|
WRITE_SHORT(0); // ?
|
||||||
|
WRITE_SHORT(*((int *)pPlayer->pvPrivateData + OFFSET_TEAM)); // team
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL cs_get_user_driving(AMX *amx, cell *params) // cs_get_user_driving(index); = 1 param
|
||||||
|
{
|
||||||
|
// Returns different values depending on if user is driving a value - and if so at what speed.
|
||||||
|
// 0: no driving
|
||||||
|
// 1: driving, but standing still
|
||||||
|
// 2-4: different positive speeds
|
||||||
|
// 5: negative speed (backing)
|
||||||
|
// params[1] = user index
|
||||||
|
|
||||||
|
// Check player
|
||||||
|
CHECK_PLAYER(params[1]);
|
||||||
|
|
||||||
|
// Make into edict pointer
|
||||||
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
|
// If player driving, return 1, if not, return 0
|
||||||
|
return *((int *)pPlayer->pvPrivateData + OFFSET_ISDRIVING);
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL cs_get_user_stationary(AMX *amx, cell *params) // cs_get_user_stationary(index); = 1 param
|
||||||
|
{
|
||||||
|
// Returns 1 if client is using a stationary guns (maybe also other stuff)
|
||||||
|
|
||||||
|
// Check player
|
||||||
|
CHECK_PLAYER(params[1]);
|
||||||
|
|
||||||
|
// Make into edict pointer
|
||||||
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
|
// If player driving, return 1, if not, return 0
|
||||||
|
#if !defined __amd64__
|
||||||
|
return *((int *)pPlayer->pvPrivateData + OFFSET_STATIONARY);
|
||||||
|
#else
|
||||||
|
// The 32 bit server return 0 and 1 by itself from this offset, but the amd64 server has 2 and 3 respectively
|
||||||
|
// Doing a simple checking of these defined constants here, and mapping to 0 and 1, to keep our plugin authors sane.
|
||||||
|
// If an unexpected value is encountered, this will be logged.
|
||||||
|
if (AMD64_STATIONARY_NO == *((int *)pPlayer->pvPrivateData + OFFSET_STATIONARY))
|
||||||
|
return 0;
|
||||||
|
else if (AMD64_STATIONARY_YES == *((int *)pPlayer->pvPrivateData + OFFSET_STATIONARY))
|
||||||
|
return 1;
|
||||||
|
else {
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Unexpected value at offset. Please report this to development team @ www.amxmodx.org!");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
AMX_NATIVE_INFO cstrike_Exports[] = {
|
AMX_NATIVE_INFO cstrike_Exports[] = {
|
||||||
{"cs_set_user_money", cs_set_user_money},
|
{"cs_set_user_money", cs_set_user_money},
|
||||||
{"cs_get_user_money", cs_get_user_money},
|
{"cs_get_user_money", cs_get_user_money},
|
||||||
@ -1384,6 +1188,11 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
|
|||||||
{"cs_get_user_hasprim", cs_get_user_hasprimary},
|
{"cs_get_user_hasprim", cs_get_user_hasprimary},
|
||||||
{"cs_get_no_knives", cs_get_no_knives},
|
{"cs_get_no_knives", cs_get_no_knives},
|
||||||
{"cs_set_no_knives", cs_set_no_knives},
|
{"cs_set_no_knives", cs_set_no_knives},
|
||||||
|
{"cs_get_weapon_id", cs_get_weapon_id},
|
||||||
|
{"cs_get_user_tked", cs_get_user_tked},
|
||||||
|
{"cs_set_user_tked", cs_set_user_tked},
|
||||||
|
{"cs_get_user_driving", cs_get_user_driving},
|
||||||
|
{"cs_get_user_stationary", cs_get_user_stationary},
|
||||||
//------------------- <-- max 19 characters!
|
//------------------- <-- max 19 characters!
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
@ -52,14 +52,18 @@
|
|||||||
|
|
||||||
// "player" entities
|
// "player" entities
|
||||||
#if !defined __amd64__
|
#if !defined __amd64__
|
||||||
|
// 32 bit offsets here
|
||||||
#define OFFSET_TEAM 114 + EXTRAOFFSET
|
#define OFFSET_TEAM 114 + EXTRAOFFSET
|
||||||
#define OFFSET_CSMONEY 115 + EXTRAOFFSET
|
#define OFFSET_CSMONEY 115 + EXTRAOFFSET
|
||||||
#define OFFSET_PRIMARYWEAPON 116 + EXTRAOFFSET
|
#define OFFSET_PRIMARYWEAPON 116 + EXTRAOFFSET
|
||||||
#define OFFSET_INTERNALMODEL 126 + EXTRAOFFSET
|
#define OFFSET_INTERNALMODEL 126 + EXTRAOFFSET
|
||||||
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET
|
#define OFFSET_NVGOGGLES 129 + EXTRAOFFSET
|
||||||
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET
|
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET
|
||||||
#define OFFSET_VIP 215 + EXTRAOFFSET
|
#define OFFSET_VIP 209 + EXTRAOFFSET
|
||||||
#define OFFSET_BUYZONE 241 + EXTRAOFFSET
|
#define OFFSET_TK 216 + EXTRAOFFSET // 040926
|
||||||
|
#define OFFSET_BUYZONE 235 + EXTRAOFFSET
|
||||||
|
#define OFFSET_ISDRIVING 350 + EXTRAOFFSET // 040926
|
||||||
|
#define OFFSET_STATIONARY 362 + EXTRAOFFSET // 040927 (363 works also!)
|
||||||
|
|
||||||
#define OFFSET_AWM_AMMO 382 + EXTRAOFFSET
|
#define OFFSET_AWM_AMMO 382 + EXTRAOFFSET
|
||||||
#define OFFSET_SCOUT_AMMO 383 + EXTRAOFFSET
|
#define OFFSET_SCOUT_AMMO 383 + EXTRAOFFSET
|
||||||
@ -76,7 +80,7 @@
|
|||||||
#define OFFSET_SMOKE_AMMO 394 + EXTRAOFFSET
|
#define OFFSET_SMOKE_AMMO 394 + EXTRAOFFSET
|
||||||
#define OFFSET_C4_AMMO 395 + EXTRAOFFSET
|
#define OFFSET_C4_AMMO 395 + EXTRAOFFSET
|
||||||
|
|
||||||
#define OFFSET_CSDEATHS 449 + EXTRAOFFSET
|
#define OFFSET_CSDEATHS 444 + EXTRAOFFSET // 040926
|
||||||
// "weapon_*" entities
|
// "weapon_*" entities
|
||||||
#define OFFSET_WEAPONTYPE 43 + EXTRAOFFSET
|
#define OFFSET_WEAPONTYPE 43 + EXTRAOFFSET
|
||||||
#define OFFSET_CLIPAMMO 51 + EXTRAOFFSET
|
#define OFFSET_CLIPAMMO 51 + EXTRAOFFSET
|
||||||
@ -85,6 +89,7 @@
|
|||||||
#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET
|
#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET
|
||||||
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET
|
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET
|
||||||
#else
|
#else
|
||||||
|
// Amd64 offsets here
|
||||||
#define OFFSET_TEAM 139 + EXTRAOFFSET // +25
|
#define OFFSET_TEAM 139 + EXTRAOFFSET // +25
|
||||||
#define OFFSET_CSMONEY 140 + EXTRAOFFSET // +25
|
#define OFFSET_CSMONEY 140 + EXTRAOFFSET // +25
|
||||||
#define OFFSET_PRIMARYWEAPON 141 + EXTRAOFFSET // +25
|
#define OFFSET_PRIMARYWEAPON 141 + EXTRAOFFSET // +25
|
||||||
@ -92,7 +97,10 @@
|
|||||||
#define OFFSET_NVGOGGLES 155 + EXTRAOFFSET // +26
|
#define OFFSET_NVGOGGLES 155 + EXTRAOFFSET // +26
|
||||||
#define OFFSET_DEFUSE_PLANT 219 + EXTRAOFFSET // +26
|
#define OFFSET_DEFUSE_PLANT 219 + EXTRAOFFSET // +26
|
||||||
#define OFFSET_VIP 242 + EXTRAOFFSET // +27
|
#define OFFSET_VIP 242 + EXTRAOFFSET // +27
|
||||||
|
#define OFFSET_TK 249 + EXTRAOFFSET // +33 040927
|
||||||
#define OFFSET_BUYZONE 268 + EXTRAOFFSET // +27
|
#define OFFSET_BUYZONE 268 + EXTRAOFFSET // +27
|
||||||
|
#define OFFSET_ISDRIVING 386 + EXTRAOFFSET // 040927
|
||||||
|
#define OFFSET_STATIONARY 400 + EXTRAOFFSET // 040927 (401 works also)
|
||||||
|
|
||||||
#define OFFSET_AWM_AMMO 426 + EXTRAOFFSET // +44
|
#define OFFSET_AWM_AMMO 426 + EXTRAOFFSET // +44
|
||||||
#define OFFSET_SCOUT_AMMO 427 + EXTRAOFFSET // +44
|
#define OFFSET_SCOUT_AMMO 427 + EXTRAOFFSET // +44
|
||||||
@ -109,13 +117,13 @@
|
|||||||
#define OFFSET_SMOKE_AMMO 438 + EXTRAOFFSET // +44
|
#define OFFSET_SMOKE_AMMO 438 + EXTRAOFFSET // +44
|
||||||
#define OFFSET_C4_AMMO 439 + EXTRAOFFSET // +44
|
#define OFFSET_C4_AMMO 439 + EXTRAOFFSET // +44
|
||||||
|
|
||||||
#define OFFSET_CSDEATHS 493 + EXTRAOFFSET // +44
|
#define OFFSET_CSDEATHS 493 + EXTRAOFFSET // +49
|
||||||
// "weapon_*" entities
|
// "weapon_*" entities
|
||||||
#define OFFSET_WEAPONTYPE 57 + EXTRAOFFSET // +14
|
#define OFFSET_WEAPONTYPE 57 + EXTRAOFFSET // +14
|
||||||
#define OFFSET_CLIPAMMO 65 + EXTRAOFFSET // +14
|
#define OFFSET_CLIPAMMO 65 + EXTRAOFFSET // +14
|
||||||
#define OFFSET_SILENCER_FIREMODE 88 + EXTRAOFFSET // +14
|
#define OFFSET_SILENCER_FIREMODE 88 + EXTRAOFFSET // +14
|
||||||
// "hostage_entity" entities
|
// "hostage_entity" entities
|
||||||
#define OFFSET_HOSTAGEFOLLOW 51 + EXTRAOFFSET // +21, long=51, int=107! (must use the long* offset becuase pointers on amd64 are stored the size of longs, 8 bytes, instead of the usual int 4 bytes.)
|
#define OFFSET_HOSTAGEFOLLOW 51 + EXTRAOFFSET // +21, long=51, int=107! (must use the long* offset because pointers on amd64 are stored the size of longs, 8 bytes, instead of the usual int 4 bytes.)
|
||||||
#define OFFSET_HOSTAGEID 516 + EXTRAOFFSET // +29
|
#define OFFSET_HOSTAGEID 516 + EXTRAOFFSET // +29
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -184,6 +192,9 @@
|
|||||||
#define SCOREATTRIB_BOMB 2 // t only
|
#define SCOREATTRIB_BOMB 2 // t only
|
||||||
#define SCOREATTRIB_VIP 4 // ct only
|
#define SCOREATTRIB_VIP 4 // ct only
|
||||||
|
|
||||||
|
#define AMD64_STATIONARY_NO 2
|
||||||
|
#define AMD64_STATIONARY_YES 3
|
||||||
|
|
||||||
enum CS_Internal_Models {
|
enum CS_Internal_Models {
|
||||||
CS_DONTCHANGE = 0,
|
CS_DONTCHANGE = 0,
|
||||||
CS_CT_URBAN = 1,
|
CS_CT_URBAN = 1,
|
||||||
@ -202,3 +213,46 @@ 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); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (x <= gpGlobals->maxClients) { \
|
||||||
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_PLAYER(x) \
|
||||||
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#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); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GETEDICT(n) \
|
||||||
|
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
|
@ -118,6 +118,8 @@
|
|||||||
TargetEnvironment="1"
|
TargetEnvironment="1"
|
||||||
TypeLibraryName=".\Release/cstrike.tlb"
|
TypeLibraryName=".\Release/cstrike.tlb"
|
||||||
HeaderFileName=""/>
|
HeaderFileName=""/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"/>
|
Name="VCPreBuildEventTool"/>
|
||||||
<Tool
|
<Tool
|
||||||
@ -212,6 +214,9 @@
|
|||||||
RelativePath=".\moduleconfig.h">
|
RelativePath=".\moduleconfig.h">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<File
|
||||||
|
RelativePath="..\plugins\include\cstrike.inc">
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
|
|
||||||
#if defined _csstats_included
|
|
||||||
#endinput
|
|
||||||
#endif
|
|
||||||
#define _csstats_included
|
|
||||||
|
|
||||||
/* Gets stats from given weapon index. If wpnindex is 0
|
|
||||||
* then the stats are from all weapons. If weapon has not been used function
|
|
||||||
* returns 0 in other case 1. Fields in stats are:
|
|
||||||
* 0 - kills
|
|
||||||
* 1 - deaths
|
|
||||||
* 2 - headshots
|
|
||||||
* 3 - teamkilling
|
|
||||||
* 4 - shots
|
|
||||||
* 5 - hits
|
|
||||||
* 6 - damage
|
|
||||||
|
|
||||||
* For body hits fields see amxconst.inc. */
|
|
||||||
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
|
|
||||||
|
|
||||||
/* Gets round stats from given weapon index.*/
|
|
||||||
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
|
|
||||||
|
|
||||||
/* Gets overall stats which are stored in file on server
|
|
||||||
* and updated on every respawn or user disconnect.
|
|
||||||
* Function returns the position in stats by diff. kills to deaths. */
|
|
||||||
native get_user_stats(index,stats[8],bodyhits[8]);
|
|
||||||
|
|
||||||
/* Gets round stats of player. */
|
|
||||||
native get_user_rstats(index,stats[8],bodyhits[8]);
|
|
||||||
|
|
||||||
/* Gets stats with which user have killed/hurt his victim. If victim is 0
|
|
||||||
* then stats are from all victims. If victim has not been hurt, function
|
|
||||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
|
||||||
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
|
|
||||||
|
|
||||||
/* Gets stats with which user have been killed/hurt. If killer is 0
|
|
||||||
* then stats are from all attacks. If killer has not hurt user, function
|
|
||||||
* returns 0 in other case 1. User stats are reset on his respawn. */
|
|
||||||
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
|
|
||||||
|
|
||||||
/* Resets life, weapon, victims and attackers user stats. */
|
|
||||||
native reset_user_wstats(index);
|
|
||||||
|
|
||||||
/* Gets overall stats which stored in stats.dat file in amx folder
|
|
||||||
* and updated on every mapchange or user disconnect.
|
|
||||||
* Function returns next index of stats entry or 0 if no more exists. */
|
|
||||||
native get_stats(index,stats[8],bodyhits[8],name[],len);
|
|
||||||
|
|
||||||
/* Returns number of all entries in stats. */
|
|
||||||
native get_statsnum();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* new stats:
|
|
||||||
* 0 - total defusions
|
|
||||||
* 1 - bomb defused
|
|
||||||
* 2 - bomb plants
|
|
||||||
* 3 - bomb explosions
|
|
||||||
*/
|
|
||||||
native get_user_stats2(index,stats[4]);
|
|
||||||
native get_stats2(index,stats[4]);
|
|
@ -1,515 +0,0 @@
|
|||||||
/* AMX Mod X
|
|
||||||
* Misc. Stats Plugin
|
|
||||||
*
|
|
||||||
* by the AMX Mod X Development Team
|
|
||||||
* originally developed by OLO
|
|
||||||
*
|
|
||||||
* This file is part of AMX Mod X.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <amxmodx>
|
|
||||||
|
|
||||||
public MultiKill
|
|
||||||
public MultiKillSound
|
|
||||||
public BombPlanting
|
|
||||||
public BombDefusing
|
|
||||||
public BombPlanted
|
|
||||||
public BombDefused
|
|
||||||
public BombFailed
|
|
||||||
public BombPickUp
|
|
||||||
public BombDrop
|
|
||||||
public BombCountVoice
|
|
||||||
public BombCountDef
|
|
||||||
public BombReached
|
|
||||||
public ItalyBonusKill
|
|
||||||
public EnemyRemaining
|
|
||||||
public LastMan
|
|
||||||
public KnifeKill
|
|
||||||
public KnifeKillSound
|
|
||||||
public GrenadeKill
|
|
||||||
public GrenadeSuicide
|
|
||||||
public HeadShotKill
|
|
||||||
public HeadShotKillSound
|
|
||||||
public RoundCounterSound
|
|
||||||
public RoundCounter
|
|
||||||
public KillingStreak
|
|
||||||
public KillingStreakSound
|
|
||||||
public DoubleKill
|
|
||||||
public DoubleKillSound
|
|
||||||
public PlayerName
|
|
||||||
public FirstBloodSound
|
|
||||||
|
|
||||||
new g_streakKills[33][2]
|
|
||||||
new g_multiKills[33][2]
|
|
||||||
new g_C4Timer
|
|
||||||
new g_Defusing
|
|
||||||
new g_Planter
|
|
||||||
new Float:g_LastOmg
|
|
||||||
new g_LastAnnounce
|
|
||||||
new g_roundCount
|
|
||||||
new Float:g_doubleKill
|
|
||||||
new g_doubleKillId
|
|
||||||
new g_friend[33]
|
|
||||||
new g_firstBlood
|
|
||||||
|
|
||||||
new g_MultiKillMsg[7][] = {
|
|
||||||
"Multi-Kill! %s^n%L %d kills (%d hs)",
|
|
||||||
"Ultra-Kill!!! %s^n%L %d kills (%d hs)",
|
|
||||||
"%s IS ON A KILLING SPREE!!!^n%L %d kills (%d hs)",
|
|
||||||
"RAMPAGE!!! %s^n%L %d kills (%d hs)" ,
|
|
||||||
"%s IS UNSTOPPABLE!!!^n%L %d kills (%d hs)",
|
|
||||||
"%s IS A MONSTER!^n%L %d kills (%d hs)",
|
|
||||||
"%s IS GODLIKE!!!!^n%L %d kills (%d hs)"
|
|
||||||
}
|
|
||||||
new g_Sounds[7][] = {
|
|
||||||
"multikill",
|
|
||||||
"ultrakill",
|
|
||||||
"killingspree",
|
|
||||||
"rampage",
|
|
||||||
"unstoppable",
|
|
||||||
"monsterkill",
|
|
||||||
"godlike"
|
|
||||||
}
|
|
||||||
new g_KillingMsg[7][] = {
|
|
||||||
"%s: Multi-Kill!",
|
|
||||||
"%s: Ultra-Kill!!!",
|
|
||||||
"%s IS ON A KILLING SPREE!!!",
|
|
||||||
"%s: RAMPAGE!!!",
|
|
||||||
"%s IS UNSTOPPABLE!!!",
|
|
||||||
"%s IS A MONSTER!",
|
|
||||||
"%s IS GODLIKE!!!"
|
|
||||||
}
|
|
||||||
new g_KinfeMsg[4][] = {
|
|
||||||
"KNIFE_MSG_1",
|
|
||||||
"KNIFE_MSG_2",
|
|
||||||
"KNIFE_MSG_3",
|
|
||||||
"KNIFE_MSG_4"
|
|
||||||
}
|
|
||||||
new g_LastMessages[4][] = {
|
|
||||||
"LAST_MSG_1",
|
|
||||||
"LAST_MSG_2",
|
|
||||||
"LAST_MSG_3",
|
|
||||||
"LAST_MSG_4"
|
|
||||||
}
|
|
||||||
new g_HeMessages[4][] = {
|
|
||||||
"HE_MSG_1",
|
|
||||||
"HE_MSG_2",
|
|
||||||
"HE_MSG_3",
|
|
||||||
"HE_MSG_4"
|
|
||||||
}
|
|
||||||
new g_SHeMessages[4][] = {
|
|
||||||
"SHE_MSG_1",
|
|
||||||
"SHE_MSG_2",
|
|
||||||
"SHE_MSG_3",
|
|
||||||
"SHE_MSG_4"
|
|
||||||
}
|
|
||||||
new g_HeadShots[7][] = {
|
|
||||||
"HS_MSG_1",
|
|
||||||
"HS_MSG_2",
|
|
||||||
"HS_MSG_3",
|
|
||||||
"HS_MSG_4",
|
|
||||||
"HS_MSG_5",
|
|
||||||
"HS_MSG_6",
|
|
||||||
"HS_MSG_7"
|
|
||||||
}
|
|
||||||
|
|
||||||
new g_teamsNames[4][] = {
|
|
||||||
"TERRORIST",
|
|
||||||
"CT",
|
|
||||||
"TERRORISTS",
|
|
||||||
"CTS"
|
|
||||||
}
|
|
||||||
|
|
||||||
public plugin_init() {
|
|
||||||
register_plugin("CS Misc. Stats",AMXX_VERSION_STR,"AMXX Dev Team")
|
|
||||||
register_dictionary("miscstats.txt")
|
|
||||||
register_event("TextMsg","eRestart","a","2&#Game_C","2&#Game_w")
|
|
||||||
register_event("SendAudio", "eEndRound", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
|
|
||||||
register_event("RoundTime", "eNewRound", "bc")
|
|
||||||
register_event("StatusValue","setTeam","be","1=1")
|
|
||||||
register_event("StatusValue","showStatus","be","1=2","2!0")
|
|
||||||
register_event("StatusValue","hideStatus","be","1=1","2=0")
|
|
||||||
new mapname[32]
|
|
||||||
get_mapname(mapname,31)
|
|
||||||
if (equali(mapname,"de_",3)||equali(mapname,"csde_",5)) {
|
|
||||||
register_event("StatusIcon", "eGotBomb", "be", "1=1", "1=2", "2=c4")
|
|
||||||
register_event("TextMsg", "eBombPickUp", "bc", "2&#Got_bomb")
|
|
||||||
register_event("TextMsg", "eBombDrop", "bc", "2&#Game_bomb_d")
|
|
||||||
}
|
|
||||||
else if ( equali( mapname , "cs_italy" ) ) {
|
|
||||||
register_event( "23" , "chickenKill", "a" , "1=108" , /*"12=106",*/ "15=4" )
|
|
||||||
register_event( "23" , "radioKill", "a" , "1=108" , /*"12=294",*/ "15=2" )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public plugin_cfg() {
|
|
||||||
new g_addStast[] = "amx_statscfg add ^"%s^" %s"
|
|
||||||
server_cmd(g_addStast,"MultiKill","MultiKill")
|
|
||||||
server_cmd(g_addStast,"MultiKillSound","MultiKillSound")
|
|
||||||
server_cmd(g_addStast,"Bomb Planting","BombPlanting")
|
|
||||||
server_cmd(g_addStast,"Bomb Defusing","BombDefusing")
|
|
||||||
server_cmd(g_addStast,"Bomb Planted","BombPlanted")
|
|
||||||
server_cmd(g_addStast,"Bomb Defuse Succ.","BombDefused")
|
|
||||||
server_cmd(g_addStast,"Bomb Def. Failure","BombFailed")
|
|
||||||
server_cmd(g_addStast,"Bomb PickUp","BombPickUp")
|
|
||||||
server_cmd(g_addStast,"Bomb Drop","BombDrop")
|
|
||||||
server_cmd(g_addStast,"Bomb Count Down","BombCountVoice")
|
|
||||||
server_cmd(g_addStast,"Bomb Count Down (def)","BombCountDef")
|
|
||||||
server_cmd(g_addStast,"Bomb Site Reached","BombReached")
|
|
||||||
server_cmd(g_addStast,"Italy Bonus Kill","ItalyBonusKill")
|
|
||||||
server_cmd(g_addStast,"Last Man","LastMan")
|
|
||||||
server_cmd(g_addStast,"Knife Kill","KnifeKill")
|
|
||||||
server_cmd(g_addStast,"Knife Kill Sound","KnifeKillSound")
|
|
||||||
server_cmd(g_addStast,"Grenade Kill","GrenadeKill")
|
|
||||||
server_cmd(g_addStast,"Grenade Suicide","GrenadeSuicide")
|
|
||||||
server_cmd(g_addStast,"HeadShot Kill","HeadShotKill")
|
|
||||||
server_cmd(g_addStast,"HeadShot Kill Sound","HeadShotKillSound")
|
|
||||||
server_cmd(g_addStast,"Round Counter","RoundCounter")
|
|
||||||
server_cmd(g_addStast,"Round Counter Sound","RoundCounterSound")
|
|
||||||
server_cmd(g_addStast,"Killing Streak","KillingStreak")
|
|
||||||
server_cmd(g_addStast,"Killing Streak Sound","KillingStreakSound")
|
|
||||||
server_cmd(g_addStast,"Enemy Remaining","EnemyRemaining")
|
|
||||||
server_cmd(g_addStast,"Double Kill","DoubleKill")
|
|
||||||
server_cmd(g_addStast,"Double Kill Sound","DoubleKillSound")
|
|
||||||
server_cmd(g_addStast,"Player Name","PlayerName")
|
|
||||||
server_cmd(g_addStast,"First Blood Sound","FirstBloodSound")
|
|
||||||
}
|
|
||||||
|
|
||||||
public client_putinserver(id)
|
|
||||||
g_multiKills[id] = g_streakKills[ id ] = { 0 , 0 }
|
|
||||||
|
|
||||||
public client_death(killer,victim,wpnindex,hitplace,TK) {
|
|
||||||
|
|
||||||
new headshot = ( hitplace == HIT_HEAD ) ? 1:0
|
|
||||||
|
|
||||||
if ( g_firstBlood ) {
|
|
||||||
g_firstBlood = 0
|
|
||||||
if ( FirstBloodSound ) client_cmd(0,"spk misc/firstblood")
|
|
||||||
}
|
|
||||||
if ( (KillingStreak || KillingStreakSound) && !TK ) {
|
|
||||||
g_streakKills[ killer ][ 0 ]++
|
|
||||||
g_streakKills[ killer ][ 1 ] = 0
|
|
||||||
g_streakKills[ victim ][ 1 ]++
|
|
||||||
g_streakKills[ victim ][ 0 ] = 0
|
|
||||||
new a = g_streakKills[ killer ][ 0 ] - 3
|
|
||||||
if ( (a > -1) && !( a % 2 ) ) {
|
|
||||||
new name[32]
|
|
||||||
get_user_name( killer , name , 31 )
|
|
||||||
if ( (a >>= 1) > 6 ) a = 6
|
|
||||||
if ( KillingStreak ){
|
|
||||||
set_hudmessage(0, 100, 255, 0.05, 0.55, 2, 0.02, 6.0, 0.01, 0.1, 3)
|
|
||||||
show_hudmessage(0,g_KillingMsg[ a ], name )
|
|
||||||
}
|
|
||||||
if ( KillingStreakSound ) client_cmd( 0, "spk misc/%s", g_Sounds[ a ] )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( MultiKill || MultiKillSound ) {
|
|
||||||
if (killer && !TK ) {
|
|
||||||
g_multiKills[killer][0]++
|
|
||||||
g_multiKills[killer][1] += headshot
|
|
||||||
new param[2]
|
|
||||||
param[0] = killer
|
|
||||||
param[1] = g_multiKills[killer][0]
|
|
||||||
set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( EnemyRemaining ) {
|
|
||||||
new ppl[32], pplnum
|
|
||||||
new team = get_user_team( victim ) - 1
|
|
||||||
get_players(ppl,pplnum,"e", g_teamsNames[1 - team] )
|
|
||||||
if (pplnum) {
|
|
||||||
new eppl[32], epplnum
|
|
||||||
get_players(eppl,epplnum,"ae",g_teamsNames[team])
|
|
||||||
if (epplnum) {
|
|
||||||
new message[128],team_name[32]
|
|
||||||
set_hudmessage(255,255,255,0.02,0.85,2, 0.05, 0.1, 0.02, 3.0, 3)
|
|
||||||
for(new a=0; a<pplnum; ++a){
|
|
||||||
format(team_name,31,"%L",ppl[a],(epplnum==1)?g_teamsNames[team]:g_teamsNames[team+2])
|
|
||||||
format(message,127,"%L",ppl[a],"REMAINING",epplnum,team_name)
|
|
||||||
show_hudmessage(ppl[a],message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( LastMan ) {
|
|
||||||
new cts[32], ts[32], ctsnum, tsnum
|
|
||||||
get_players(cts,ctsnum,"ae", g_teamsNames[1] )
|
|
||||||
get_players(ts,tsnum,"ae", g_teamsNames[0] )
|
|
||||||
if ( ctsnum == 1 && tsnum == 1 ) {
|
|
||||||
new ctname[32], tname[32]
|
|
||||||
get_user_name(cts[0],ctname,31)
|
|
||||||
get_user_name(ts[0],tname,31)
|
|
||||||
set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
|
|
||||||
show_hudmessage(0,"%s vs. %s",ctname,tname)
|
|
||||||
client_cmd(0,"spk misc/maytheforce")
|
|
||||||
}
|
|
||||||
else if ( !g_LastAnnounce ) {
|
|
||||||
new oposite = 0, team = 0
|
|
||||||
if ( ctsnum == 1 && tsnum > 1 ) {
|
|
||||||
g_LastAnnounce = cts[0]
|
|
||||||
oposite = tsnum
|
|
||||||
team = 0
|
|
||||||
}
|
|
||||||
else if ( tsnum == 1 && ctsnum > 1 ) {
|
|
||||||
g_LastAnnounce = ts[0]
|
|
||||||
oposite = ctsnum
|
|
||||||
team = 1
|
|
||||||
}
|
|
||||||
if (g_LastAnnounce) {
|
|
||||||
new name[32]
|
|
||||||
get_user_name(g_LastAnnounce,name,31)
|
|
||||||
set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
|
|
||||||
show_hudmessage(0,"%s (%d HP) vs. %d %s%s: %L",name,
|
|
||||||
get_user_health(g_LastAnnounce),oposite,
|
|
||||||
g_teamsNames[team],(oposite==1)?"":"S",LANG_PLAYER,g_LastMessages[ random_num(0,3) ] )
|
|
||||||
client_cmd(g_LastAnnounce,"spk misc/oneandonly")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( wpnindex == 29 && ( KnifeKill || KnifeKillSound ) ) {
|
|
||||||
if ( KnifeKill ) {
|
|
||||||
new killer_name[32],victim_name[32]
|
|
||||||
get_user_name(killer,killer_name,31)
|
|
||||||
get_user_name(victim,victim_name,31)
|
|
||||||
set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
|
|
||||||
show_hudmessage(0,"%L",LANG_PLAYER,g_KinfeMsg[ random_num(0,3) ],killer_name,victim_name)
|
|
||||||
}
|
|
||||||
if ( KnifeKillSound ) client_cmd(0,"spk misc/humiliation")
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( wpnindex == 4 && (GrenadeKill || GrenadeSuicide) ) {
|
|
||||||
new killer_name[32],victim_name[32]
|
|
||||||
get_user_name(killer,killer_name,32)
|
|
||||||
get_user_name(victim,victim_name,32)
|
|
||||||
set_hudmessage(255, 100, 100, -1.0, 0.25, 1, 6.0, 6.0, 0.5, 0.15, 1)
|
|
||||||
if ( killer != victim ) {
|
|
||||||
if ( GrenadeKill ) show_hudmessage(0,"%L",LANG_PLAYER,g_HeMessages[ random_num(0,3)],killer_name,victim_name)
|
|
||||||
}
|
|
||||||
else if ( GrenadeSuicide ) show_hudmessage(0,"%L",LANG_PLAYER,g_SHeMessages[ random_num(0,3) ],victim_name)
|
|
||||||
}
|
|
||||||
if ( headshot && (HeadShotKill || HeadShotKillSound) ) {
|
|
||||||
if ( HeadShotKill ) {
|
|
||||||
new killer_name[32], victim_name[32], weapon_name[32], message[128], players[32], pnum
|
|
||||||
get_weaponname(wpnindex,weapon_name,31)
|
|
||||||
get_user_name(killer,killer_name,31)
|
|
||||||
get_user_name(victim,victim_name,31)
|
|
||||||
|
|
||||||
get_players(players,pnum,"c")
|
|
||||||
for (new i=0;i<pnum;i++) {
|
|
||||||
format( message, 127, "%L",players[i],g_HeadShots[ random_num(0,6) ] )
|
|
||||||
replace( message, 127 , "$vn", victim_name )
|
|
||||||
replace( message, 127 , "$wn", weapon_name )
|
|
||||||
replace( message, 127 , "$kn", killer_name )
|
|
||||||
set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 1)
|
|
||||||
show_hudmessage(players[i],message )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( HeadShotKillSound ) {
|
|
||||||
client_cmd(killer,"spk misc/headshot")
|
|
||||||
client_cmd(victim,"spk misc/headshot")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( DoubleKill || DoubleKillSound ) {
|
|
||||||
new Float:nowtime = get_gametime()
|
|
||||||
if ( g_doubleKill == nowtime && g_doubleKillId == killer ) {
|
|
||||||
if ( DoubleKill ) {
|
|
||||||
new name[32]
|
|
||||||
get_user_name( killer , name , 31 )
|
|
||||||
set_hudmessage(255, 0, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, 3)
|
|
||||||
show_hudmessage(0,"%L",LANG_PLAYER,"DOUBLE_KILL",name )
|
|
||||||
}
|
|
||||||
if ( DoubleKillSound ) client_cmd(0,"spk misc/doublekill")
|
|
||||||
}
|
|
||||||
g_doubleKill = nowtime
|
|
||||||
g_doubleKillId = killer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public hideStatus(id) {
|
|
||||||
if ( PlayerName ) {
|
|
||||||
set_hudmessage(0,0,0,0.0,0.0,0, 0.0, 0.01, 0.0, 0.0, 4)
|
|
||||||
show_hudmessage(id,"")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public setTeam(id)
|
|
||||||
g_friend[id] = read_data(2)
|
|
||||||
|
|
||||||
public showStatus(id) {
|
|
||||||
if ( PlayerName ) {
|
|
||||||
new name[32],pid = read_data(2)
|
|
||||||
get_user_name(pid,name,31)
|
|
||||||
new color1 = 0,color2 = 0
|
|
||||||
if ( get_user_team(pid)==1 )
|
|
||||||
color1 = 255
|
|
||||||
else
|
|
||||||
color2 = 255
|
|
||||||
if (g_friend[id]==1) { // friend
|
|
||||||
new clip, ammo, wpnid = get_user_weapon(pid,clip,ammo)
|
|
||||||
new wpnname[32]
|
|
||||||
get_weaponname(wpnid,wpnname,31)
|
|
||||||
set_hudmessage(color1,50,color2,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
|
|
||||||
show_hudmessage(id,"%s -- %d HP / %d AP / %s",name,
|
|
||||||
get_user_health(pid),get_user_armor(pid),wpnname[7])
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
set_hudmessage(color1,50,color2,-1.0,0.60,1, 0.01, 3.0, 0.01, 0.01, 4)
|
|
||||||
show_hudmessage(id,name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public eNewRound()
|
|
||||||
if ( read_data(1) == floatround(get_cvar_float("mp_roundtime") * 60.0) ) {
|
|
||||||
g_firstBlood = 1
|
|
||||||
g_C4Timer = 0
|
|
||||||
++g_roundCount
|
|
||||||
if ( RoundCounter ) {
|
|
||||||
set_hudmessage(200, 0, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
|
|
||||||
show_hudmessage(0, "%L", LANG_PLAYER, "PREPARE_FIGHT", g_roundCount )
|
|
||||||
}
|
|
||||||
if ( RoundCounterSound ) client_cmd( 0 , "spk misc/prepare" )
|
|
||||||
if ( KillingStreak ) {
|
|
||||||
new appl[32],ppl, i
|
|
||||||
get_players(appl,ppl, "ac" )
|
|
||||||
for (new a = 0; a < ppl; ++a) {
|
|
||||||
i = appl[ a ]
|
|
||||||
if ( g_streakKills[ i ][ 0 ] >= 2 )
|
|
||||||
client_print( i , print_chat , "* %L", i, "KILLED_ROW", g_streakKills[ i ][ 0 ] )
|
|
||||||
else if ( g_streakKills[ i ][ 1 ] >= 2 )
|
|
||||||
client_print( i , print_chat , "* %L", i, "DIED_ROUNDS", g_streakKills[ i ][ 1 ] )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public eRestart() {
|
|
||||||
eEndRound()
|
|
||||||
g_roundCount = 0
|
|
||||||
g_firstBlood = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
public eEndRound() {
|
|
||||||
g_C4Timer = -2
|
|
||||||
g_LastOmg = 0.0
|
|
||||||
remove_task(8038)
|
|
||||||
g_LastAnnounce = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
public checkKills(param[]) {
|
|
||||||
new id = param[0]
|
|
||||||
new a = param[1]
|
|
||||||
if (a == g_multiKills[id][0]) {
|
|
||||||
a -= 3
|
|
||||||
if ( a > -1 ) {
|
|
||||||
if ( MultiKill ) {
|
|
||||||
new name[32]
|
|
||||||
get_user_name(id,name,31)
|
|
||||||
set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
|
|
||||||
if ( a > 6 ) a = 6
|
|
||||||
show_hudmessage(0,g_MultiKillMsg[a],name,LANG_PLAYER,"WITH",g_multiKills[id][0],g_multiKills[id][1])
|
|
||||||
}
|
|
||||||
if ( MultiKillSound ) client_cmd(0,"spk misc/%s",g_Sounds[a])
|
|
||||||
}
|
|
||||||
g_multiKills[id] = { 0,0 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public chickenKill()
|
|
||||||
if ( ItalyBonusKill ) announceEvent( 0 , "KILLED_CHICKEN" )
|
|
||||||
|
|
||||||
public radioKill() {
|
|
||||||
if ( ItalyBonusKill ) announceEvent( 0 , "BLEW_RADIO" )
|
|
||||||
}
|
|
||||||
|
|
||||||
announceEvent( id, message[] ) {
|
|
||||||
new name[32]
|
|
||||||
get_user_name(id, name , 31)
|
|
||||||
set_hudmessage(255, 100, 50, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
|
|
||||||
show_hudmessage(0,"%L",LANG_PLAYER,message,name)
|
|
||||||
}
|
|
||||||
|
|
||||||
public eBombPickUp(id)
|
|
||||||
if (BombPickUp) announceEvent(id , "PICKED_BOMB")
|
|
||||||
|
|
||||||
public eBombDrop()
|
|
||||||
if (BombDrop) announceEvent(g_Planter , "DROPPED_BOMB")
|
|
||||||
|
|
||||||
public eGotBomb(id) {
|
|
||||||
g_Planter = id
|
|
||||||
if ( BombReached && read_data(1)==2 && g_LastOmg<get_gametime()) {
|
|
||||||
g_LastOmg = get_gametime() + 15.0
|
|
||||||
announceEvent(g_Planter, "REACHED_TARGET" )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bombTimer() {
|
|
||||||
if (--g_C4Timer > 0) {
|
|
||||||
if (BombCountVoice) {
|
|
||||||
if (g_C4Timer == 30 || g_C4Timer == 20) {
|
|
||||||
new temp[48]
|
|
||||||
num_to_word(g_C4Timer,temp,47)
|
|
||||||
client_cmd(0,"spk ^"vox/%s seconds until explosion^"",temp)
|
|
||||||
}
|
|
||||||
else if (g_C4Timer < 11) {
|
|
||||||
new temp[48]
|
|
||||||
num_to_word(g_C4Timer,temp,47)
|
|
||||||
client_cmd(0,"spk ^"vox/%s^"",temp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (BombCountDef && g_Defusing) client_print(g_Defusing,print_center,"%d",g_C4Timer)
|
|
||||||
}
|
|
||||||
else remove_task(8038)
|
|
||||||
}
|
|
||||||
|
|
||||||
public bomb_planted(planter){
|
|
||||||
g_Defusing = 0
|
|
||||||
if (BombPlanted) announceEvent(planter, "SET_UP_BOMB" )
|
|
||||||
g_C4Timer = get_cvar_num("mp_c4timer")
|
|
||||||
set_task(1.0,"bombTimer",8038,"",0,"b")
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public bomb_planting(planter)
|
|
||||||
if (BombPlanting) announceEvent(planter, "PLANT_BOMB" )
|
|
||||||
|
|
||||||
public bomb_defusing(defuser){
|
|
||||||
if (BombDefusing) announceEvent(defuser, "DEFUSING_BOMB" )
|
|
||||||
g_Defusing = defuser
|
|
||||||
}
|
|
||||||
|
|
||||||
public bomb_defused(defuser)
|
|
||||||
if (BombDefused) announceEvent(defuser, "DEFUSED_BOMB" )
|
|
||||||
|
|
||||||
public bomb_explode(planter,defuser)
|
|
||||||
if (BombFailed && defuser) announceEvent(defuser , "FAILED_DEFU" )
|
|
||||||
|
|
||||||
public plugin_modules()
|
|
||||||
{
|
|
||||||
require_module("csx")
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
[en]
|
|
||||||
WITH = with
|
|
||||||
KNIFE_MSG_1 = %s sliced and diced %s
|
|
||||||
KNIFE_MSG_2 = %s pulled out knife and gutted %s
|
|
||||||
KNIFE_MSG_3 = %s sneaks carefully behind and knifed %s
|
|
||||||
KNIFE_MSG_4 = %s knived %s
|
|
||||||
LAST_MSG_1 = Now all depend on you!
|
|
||||||
LAST_MSG_2 = I hope you still have a healthpack.
|
|
||||||
LAST_MSG_3 = All your teammates were killed. Good luck!
|
|
||||||
LAST_MSG_4 = Now you are alone. Have fun!
|
|
||||||
HE_MSG_1 = %s sends a little gift to %s
|
|
||||||
HE_MSG_2 = %s throws a small present to %s
|
|
||||||
HE_MSG_3 = %s made a precision throw to %s
|
|
||||||
HE_MSG_4 = %s got a big explosion for %s
|
|
||||||
SHE_MSG_1 = %s detonated himself with a grenade
|
|
||||||
SHE_MSG_2 = %s trys the effect of an HE Grenade
|
|
||||||
SHE_MSG_3 = %s swallows grenades whole!
|
|
||||||
SHE_MSG_4 = %s explodes!
|
|
||||||
HS_MSG_1 = $kn killed $vn with a well^nplaced shot to the head!
|
|
||||||
HS_MSG_2 = $kn removed $vn's^nhead with the $wn
|
|
||||||
HS_MSG_3 = $kn turned $vn's head^ninto pudding with the $wn
|
|
||||||
HS_MSG_4 = $vn got pwned by $kn
|
|
||||||
HS_MSG_5 = $vn's head has been^nturned into red jello
|
|
||||||
HS_MSG_6 = $kn has superb aim with the $wn,^nas $vn well knows.
|
|
||||||
HS_MSG_7 = $vn's head stayed in $kn's^ncrosshairs a bit too long...
|
|
||||||
DOUBLE_KILL = Wow! %s made a double kill!!!
|
|
||||||
PREPARE_FIGHT = Prepare to FIGHT!^nRound %d
|
|
||||||
KILLED_ROW = You've killed %d in a row so far
|
|
||||||
DIED_ROUNDS = Careful! You've died %d rounds in a row now...
|
|
||||||
KILLED_CHICKEN = Somebody killed a chicken!!!
|
|
||||||
BLEW_RADIO = Somebody blew up the radio!!!
|
|
||||||
REACHED_TARGET = Omg! %s reached the target!
|
|
||||||
PLANT_BOMB = %s is planting the bomb!
|
|
||||||
DEFUSING_BOMB = %s is defusing the bomb...
|
|
||||||
SET_UP_BOMB = %s set us up the bomb!!!
|
|
||||||
DEFUSED_BOMB = %s defused the bomb!
|
|
||||||
FAILED_DEFU = %s failed to defuse the bomb...
|
|
||||||
PICKED_BOMB = %s picked up the bomb...
|
|
||||||
DROPPED_BOMB = %s dropped the bomb!!!
|
|
||||||
CT = CT
|
|
||||||
CTS = CTS
|
|
||||||
TERRORIST = TERRORIST
|
|
||||||
TERRORISTS = TERRORISTS
|
|
||||||
REMAINING = %d %s Remaining...
|
|
File diff suppressed because it is too large
Load Diff
178
dlls/csx/source/Makefile.pl
Executable file
178
dlls/csx/source/Makefile.pl
Executable file
@ -0,0 +1,178 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#(C)2004 AMX Mod X Development Team
|
||||||
|
# by David "BAILOPAN" Anderson
|
||||||
|
|
||||||
|
# output will occur in bin.x.proc
|
||||||
|
# where x is debug or opt and proc is ix86 or amd64
|
||||||
|
# You must use this script from the project src dir
|
||||||
|
|
||||||
|
#options =
|
||||||
|
# debug - enable gdb debugging
|
||||||
|
# amd64 - compile for AMD64
|
||||||
|
# proc=ix86 - assumed not amd64
|
||||||
|
# clean - clean the specifications above
|
||||||
|
|
||||||
|
$PROJECT = "csx_amxx";
|
||||||
|
$sdk = "../../../hlsdk/SourceCode";
|
||||||
|
$mm = "../../../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
|
||||||
|
@CPP_SOURCE_FILES = ("amxxmodule.cpp", "CMisc.cpp", "usermsg.cpp", "meta_api.cpp", "rank.cpp", "CRank.cpp");
|
||||||
|
|
||||||
|
@C_SOURCE_FILES = ();
|
||||||
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\" -fno-exceptions -fno-rtti";
|
||||||
|
|
||||||
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
|
while ($cmd = shift)
|
||||||
|
{
|
||||||
|
if ($cmd =~ /amd64/) {
|
||||||
|
$OPTIONS{"amd64"} = 1;
|
||||||
|
} elsif ($cmd =~ /debug/) {
|
||||||
|
$OPTIONS{"debug"} = 1;
|
||||||
|
} elsif ($cmd =~ /proc=i(\d)86/) {
|
||||||
|
$proc = $1;
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
die "You cannot compile for i".$proc."86 and AMD64.\n";
|
||||||
|
} else {
|
||||||
|
$OPTIONS{"proc"} = "i".$proc."86";
|
||||||
|
}
|
||||||
|
} elsif ($cmd =~ /clean/) {
|
||||||
|
$OPTIONS{"clean"} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$gcc = `$gccf --version`;
|
||||||
|
if ($gcc =~ /2\.9/)
|
||||||
|
{
|
||||||
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
|
} else {
|
||||||
|
$OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"debug"})
|
||||||
|
{
|
||||||
|
$cflags = $OPT{"debug"};
|
||||||
|
} else {
|
||||||
|
if (!$OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$proc = $OPTIONS{"proc"};
|
||||||
|
if (!$proc)
|
||||||
|
{
|
||||||
|
$proc = 3;
|
||||||
|
}
|
||||||
|
$cflags = "-march=i".$proc."86 ".$OPT{"opt"};
|
||||||
|
} else {
|
||||||
|
$cflags = $OPT{"opt"};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$cflags .= " -m64 -DHAVE_I64 -DSMALL_CELL_SIZE=64 $cflags";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"debug"})
|
||||||
|
{
|
||||||
|
$outdir = "bin.debug";
|
||||||
|
} else {
|
||||||
|
$outdir = "bin.opt";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$outdir .= ".amd64";
|
||||||
|
$bin = $PROJECT."_amd64.so";
|
||||||
|
} else {
|
||||||
|
$proc = $OPTIONS{"proc"};
|
||||||
|
if ($proc)
|
||||||
|
{
|
||||||
|
$outdir .= ".i".$proc."86";
|
||||||
|
$bin = $PROJECT."_i".$proc."86.so";
|
||||||
|
} else {
|
||||||
|
$outdir .= ".i386";
|
||||||
|
$bin = $PROJECT."_i386.so";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unlink("$outdir/$bin");
|
||||||
|
if ($OPTIONS{"clean"})
|
||||||
|
{
|
||||||
|
`rm $outdir/*.o`;
|
||||||
|
die("Project cleaned.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#create the dirs
|
||||||
|
#build link list
|
||||||
|
my @LINK;
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $CPP_SOURCE_FILES[$i];
|
||||||
|
$file =~ s/\.cpp/\.o/;
|
||||||
|
push(@LINK, $outdir."/".$file);
|
||||||
|
}
|
||||||
|
for ($i=0; $i<=$#C_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $C_SOURCE_FILES[$i];
|
||||||
|
$file =~ s/\.c/\.o/;
|
||||||
|
push(@LINK, $outdir."/".$file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(-d $outdir))
|
||||||
|
{
|
||||||
|
mkdir($outdir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inc = $OPTIONS{"include"};
|
||||||
|
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $CPP_SOURCE_FILES[$i];
|
||||||
|
$ofile = $file;
|
||||||
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
|
$ofile = "$outdir/$ofile";
|
||||||
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
|
if (-e $ofile)
|
||||||
|
{
|
||||||
|
$file_time = (stat($file))[9];
|
||||||
|
$ofile_time = (stat($ofile))[9];
|
||||||
|
if ($file_time > $ofile_time)
|
||||||
|
{
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $C_SOURCE_FILES[$i];
|
||||||
|
$ofile = $file;
|
||||||
|
$ofile =~ s/\.c/\.o/;
|
||||||
|
$ofile = "$outdir/$ofile";
|
||||||
|
$gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
|
if (-e $ofile)
|
||||||
|
{
|
||||||
|
$file_time = (stat($file))[9];
|
||||||
|
$ofile_time = (stat($ofile))[9];
|
||||||
|
if ($file_time > $ofile_time)
|
||||||
|
{
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$gcc = "$gccf $cflags -shared -ldl -lm @LINK -o $outdir/$bin";
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
@ -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_LogErrorFunc;
|
||||||
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_LogErrorFunc, 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);
|
||||||
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2649,11 +2683,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 +2701,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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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_LogErrorFunc;
|
||||||
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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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);
|
||||||
|
@ -110,6 +110,18 @@ const char* get_localinfo( const char* name , const char* def = 0 )
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientKill(edict_t *pEntity){
|
||||||
|
CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity);
|
||||||
|
if ( !pPlayer->IsAlive())
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
|
||||||
|
MF_ExecuteForward( iFDamage,pPlayer->index , pPlayer->index , 0, 0, 0, 0 );
|
||||||
|
pPlayer->saveKill(pPlayer,0,0,0);
|
||||||
|
MF_ExecuteForward( iFDeath,pPlayer->index, pPlayer->index, 0, 0, 0 );
|
||||||
|
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
|
void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){
|
||||||
|
|
||||||
rankBots = (int)csstats_rankbots->value ? true:false;
|
rankBots = (int)csstats_rankbots->value ? true:false;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
// Module info
|
// Module info
|
||||||
#define MODULE_NAME "CSX"
|
#define MODULE_NAME "CSX"
|
||||||
#define MODULE_VERSION "0.20"
|
#define MODULE_VERSION "0.20"
|
||||||
#define MODULE_AUTHOR "AMXx Dev Team"
|
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||||
#define MODULE_URL "http://www.amxmodx.org/"
|
#define MODULE_URL "http://www.amxmodx.org/"
|
||||||
#define MODULE_LOGTAG "CSX"
|
#define MODULE_LOGTAG "CSX"
|
||||||
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
|
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
|
||||||
@ -70,7 +70,7 @@
|
|||||||
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
|
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
|
||||||
// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
|
// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
|
||||||
#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
|
#define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
|
||||||
// #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
|
#define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
|
||||||
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
|
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
|
||||||
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
|
||||||
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
|
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
|
||||||
@ -332,7 +332,7 @@
|
|||||||
// #define FN_DropToFloor_Post DropToFloor_Post
|
// #define FN_DropToFloor_Post DropToFloor_Post
|
||||||
// #define FN_WalkMove_Post WalkMove_Post
|
// #define FN_WalkMove_Post WalkMove_Post
|
||||||
// #define FN_SetOrigin_Post SetOrigin_Post
|
// #define FN_SetOrigin_Post SetOrigin_Post
|
||||||
// #define FN_EmitSound_Post EmitSound_Post
|
#define FN_EmitSound_Post EmitSound_Post
|
||||||
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
|
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
|
||||||
#define FN_TraceLine_Post TraceLine_Post
|
#define FN_TraceLine_Post TraceLine_Post
|
||||||
// #define FN_TraceToss_Post TraceToss_Post
|
// #define FN_TraceToss_Post TraceToss_Post
|
||||||
|
21
dlls/csx/source/msvc/csx.sln
Executable file
21
dlls/csx/source/msvc/csx.sln
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csx", "csx.vcproj", "{1DC4A99A-F23F-4AAE-881C-79D157C91155}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfiguration) = preSolution
|
||||||
|
Debug = Debug
|
||||||
|
Release = Release
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfiguration) = postSolution
|
||||||
|
{1DC4A99A-F23F-4AAE-881C-79D157C91155}.Debug.ActiveCfg = Debug|Win32
|
||||||
|
{1DC4A99A-F23F-4AAE-881C-79D157C91155}.Debug.Build.0 = Debug|Win32
|
||||||
|
{1DC4A99A-F23F-4AAE-881C-79D157C91155}.Release.ActiveCfg = Release|Win32
|
||||||
|
{1DC4A99A-F23F-4AAE-881C-79D157C91155}.Release.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
311
dlls/csx/source/msvc/csx.vcproj
Executable file
311
dlls/csx/source/msvc/csx.vcproj
Executable file
@ -0,0 +1,311 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="7.10"
|
||||||
|
Name="csx"
|
||||||
|
ProjectGUID="{1DC4A99A-F23F-4AAE-881C-79D157C91155}"
|
||||||
|
SccProjectName=""
|
||||||
|
SccLocalPath="">
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"/>
|
||||||
|
</Platforms>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory=".\release"
|
||||||
|
IntermediateDirectory=".\release"
|
||||||
|
ConfigurationType="2"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;csx_EXPORTS;JIT"
|
||||||
|
StringPooling="TRUE"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
StructMemberAlignment="3"
|
||||||
|
EnableFunctionLevelLinking="TRUE"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderFile=".\release/csx.pch"
|
||||||
|
AssemblerListingLocation=".\release/"
|
||||||
|
ObjectFile=".\release/"
|
||||||
|
ProgramDataBaseFileName=".\release/"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
CompileAs="0"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
OutputFile="release/csx_amxx.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
ProgramDatabaseFile=".\release/csx_amxx.pdb"
|
||||||
|
ImportLibrary=".\release/csx_amxx.lib"
|
||||||
|
TargetMachine="1"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
MkTypLibCompatible="TRUE"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
TargetEnvironment="1"
|
||||||
|
TypeLibraryName=".\release/csx.tlb"
|
||||||
|
HeaderFileName=""/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1033"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory=".\debug"
|
||||||
|
IntermediateDirectory=".\debug"
|
||||||
|
ConfigurationType="2"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||||
|
CharacterSet="2">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\metamod,..\..\sdk\common,..\..\sdk\engine,..\..\sdk\dlls,..\..\hlsdk\sourcecode\pm_shared"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;csx_EXPORTS"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderFile=".\debug/csx.pch"
|
||||||
|
AssemblerListingLocation=".\debug/"
|
||||||
|
ObjectFile=".\debug/"
|
||||||
|
ProgramDataBaseFileName=".\debug/"
|
||||||
|
BrowseInformation="1"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
CompileAs="0"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
OutputFile="debug/csx_amxx.dll"
|
||||||
|
LinkIncremental="1"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
GenerateDebugInformation="TRUE"
|
||||||
|
ProgramDatabaseFile=".\debug/csx_amxx.pdb"
|
||||||
|
ImportLibrary=".\debug/csx_amxx.lib"
|
||||||
|
TargetMachine="1"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
MkTypLibCompatible="TRUE"
|
||||||
|
SuppressStartupBanner="TRUE"
|
||||||
|
TargetEnvironment="1"
|
||||||
|
TypeLibraryName=".\debug/csx.tlb"
|
||||||
|
HeaderFileName=""/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1033"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebDeploymentTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedWrapperGeneratorTool"/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||||
|
<File
|
||||||
|
RelativePath="..\amxxmodule.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\CMisc.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\CRank.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\meta_api.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\rank.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\usermsg.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;JIT;$(NoInherit)"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;csx_EXPORTS;$(NoInherit)"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
BrowseInformation="1"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl">
|
||||||
|
<File
|
||||||
|
RelativePath="..\amxxmodule.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\CMisc.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\CRank.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\moduleconfig.h">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\rank.h">
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
@ -7,15 +7,9 @@
|
|||||||
static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
|
static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int attacker = params[2];
|
int attacker = params[2];
|
||||||
if (attacker<0||attacker>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(attacker);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->attackers[attacker].hits){
|
if (pPlayer->attackers[attacker].hits){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
|
||||||
@ -40,15 +34,9 @@ static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param *
|
|||||||
static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param */
|
static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int victim = params[2];
|
int victim = params[2];
|
||||||
if (victim<0||victim>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(victim);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->victims[victim].hits){
|
if (pPlayer->victims[victim].hits){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
|
||||||
@ -73,13 +61,10 @@ static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param *
|
|||||||
static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
|
static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int weapon = params[2];
|
int weapon = params[2];
|
||||||
if (weapon<0||weapon>=MAX_WEAPONS){
|
if (weapon<0||weapon>=MAX_WEAPONS+MAX_CWEAPONS){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
@ -104,13 +89,10 @@ static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param
|
|||||||
static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */
|
static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int weapon = params[2];
|
int weapon = params[2];
|
||||||
if (weapon<0||weapon>=MAX_WEAPONS){
|
if (weapon<0||weapon>=MAX_WEAPONS+MAX_CWEAPONS){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
@ -135,10 +117,7 @@ static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param *
|
|||||||
static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param */
|
static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
GET_PLAYER_POINTER_I(index)->restartStats();
|
GET_PLAYER_POINTER_I(index)->restartStats();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -146,10 +125,7 @@ static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param
|
|||||||
static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param */
|
static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->rank){
|
if (pPlayer->rank){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
||||||
@ -171,10 +147,7 @@ static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param *
|
|||||||
static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
|
static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if ( pPlayer->rank ){
|
if ( pPlayer->rank ){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
||||||
@ -200,10 +173,7 @@ static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
|
|||||||
static cell AMX_NATIVE_CALL get_user_stats2(AMX *amx, cell *params) /* 3 param */
|
static cell AMX_NATIVE_CALL get_user_stats2(AMX *amx, cell *params) /* 3 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if ( pPlayer->rank ){
|
if ( pPlayer->rank ){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
||||||
@ -297,32 +267,25 @@ static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,melee
|
|||||||
static cell AMX_NATIVE_CALL custom_wpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
|
static cell AMX_NATIVE_CALL custom_wpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
|
||||||
int weapon = params[1];
|
int weapon = params[1];
|
||||||
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){ // only for custom weapons
|
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){ // only for custom weapons
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
|
||||||
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int att = params[2];
|
int att = params[2];
|
||||||
if (att<1||att>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(att);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int vic = params[3];
|
int vic = params[3];
|
||||||
if (vic<1||vic>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(vic);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dmg = params[4];
|
int dmg = params[4];
|
||||||
if ( dmg<1 ){
|
if ( dmg<1 ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid damage %d", dmg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aim = params[5];
|
int aim = params[5];
|
||||||
if ( aim < 0 || aim > 7 ){
|
if ( aim < 0 || aim > 7 ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid aim %d", aim);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,15 +312,11 @@ static cell AMX_NATIVE_CALL custom_wpn_dmg(AMX *amx, cell *params){ // wid,att,v
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,wid
|
static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,wid
|
||||||
int index = params[2];
|
int index = params[2];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int weapon = params[1];
|
int weapon = params[1];
|
||||||
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){
|
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].used ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
|
||||||
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,8 +329,7 @@ static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,w
|
|||||||
static cell AMX_NATIVE_CALL get_wpnname(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_wpnname(AMX *amx, cell *params){
|
||||||
int id = params[1];
|
int id = params[1];
|
||||||
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
|
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||||
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]);
|
return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]);
|
||||||
@ -380,8 +338,7 @@ static cell AMX_NATIVE_CALL get_wpnname(AMX *amx, cell *params){
|
|||||||
static cell AMX_NATIVE_CALL get_wpnlogname(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_wpnlogname(AMX *amx, cell *params){
|
||||||
int id = params[1];
|
int id = params[1];
|
||||||
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
|
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||||
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]);
|
return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]);
|
||||||
@ -390,8 +347,7 @@ static cell AMX_NATIVE_CALL get_wpnlogname(AMX *amx, cell *params){
|
|||||||
static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){
|
||||||
int id = params[1];
|
int id = params[1];
|
||||||
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
|
if (id<1 || id>=MAX_WEAPONS+MAX_CWEAPONS ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||||
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( id == 29 )
|
if ( id == 29 )
|
||||||
@ -433,7 +389,7 @@ AMX_NATIVE_INFO stats_Natives[] = {
|
|||||||
{ "xmod_get_stats_size", get_stats_size },
|
{ "xmod_get_stats_size", get_stats_size },
|
||||||
|
|
||||||
//***************************************
|
//***************************************
|
||||||
{ "get_weaponname", get_wpnname },
|
//{ "get_weaponname", get_wpnname },
|
||||||
|
|
||||||
///*******************
|
///*******************
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RANK_H
|
#ifndef RANK_H
|
||||||
#define RANK_H
|
#define RANK_H
|
||||||
|
|
||||||
@ -99,6 +96,56 @@ void Client_BarTime(void*);
|
|||||||
bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL );
|
bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL );
|
||||||
bool isModuleActive();
|
bool isModuleActive();
|
||||||
|
|
||||||
|
#define CHECK_ENTITY(x) \
|
||||||
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (x <= gpGlobals->maxClients) { \
|
||||||
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_PLAYER(x) \
|
||||||
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_PLAYERRANGE(x) \
|
||||||
|
if (x > gpGlobals->maxClients || x < 0) \
|
||||||
|
{ \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#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); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GETEDICT(n) \
|
||||||
|
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
|
||||||
|
|
||||||
#endif // RANK_H
|
#endif // RANK_H
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,8 +9,9 @@ int weapon;
|
|||||||
int aim;
|
int aim;
|
||||||
CPlayer *pAttacker;
|
CPlayer *pAttacker;
|
||||||
|
|
||||||
|
|
||||||
void Client_ResetHUD(void* mValue){
|
void Client_ResetHUD(void* mValue){
|
||||||
if ( mPlayer && mPlayer->IsAlive() )
|
if ( mPlayer )
|
||||||
mPlayer->clearStats = gpGlobals->time + 0.25f;
|
mPlayer->clearStats = gpGlobals->time + 0.25f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,10 +34,7 @@
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_player_stamina(AMX *amx, cell *params){ // id,(re)set,min,max
|
static cell AMX_NATIVE_CALL set_player_stamina(AMX *amx, cell *params){ // id,(re)set,min,max
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index)
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
if ( params[2] ){ // 0 set , 1 reset
|
if ( params[2] ){ // 0 set , 1 reset
|
||||||
@ -49,12 +46,12 @@ static cell AMX_NATIVE_CALL set_player_stamina(AMX *amx, cell *params){ // id,(r
|
|||||||
|
|
||||||
int min = params[3];
|
int min = params[3];
|
||||||
if ( min<0 || min>100 ){
|
if ( min<0 || min>100 ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid minimum stamina %d", min);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int max = params[4];
|
int max = params[4];
|
||||||
if ( max<min || max>100 ){
|
if ( max<min || max>100 ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid maximum stamina %d", max);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ( pPlayer->ingame ){
|
if ( pPlayer->ingame ){
|
||||||
@ -68,10 +65,7 @@ static cell AMX_NATIVE_CALL set_player_stamina(AMX *amx, cell *params){ // id,(r
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL nade_set_fuse(AMX *amx, cell *params){ // id,(re)set,time,type
|
static cell AMX_NATIVE_CALL nade_set_fuse(AMX *amx, cell *params){ // id,(re)set,time,type
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
if ( params[2] ){ // 0 set , 1 reset
|
if ( params[2] ){ // 0 set , 1 reset
|
||||||
@ -82,7 +76,7 @@ static cell AMX_NATIVE_CALL nade_set_fuse(AMX *amx, cell *params){ // id,(re)set
|
|||||||
|
|
||||||
float fFuse = *(float *)((void *)¶ms[3]);
|
float fFuse = *(float *)((void *)¶ms[3]);
|
||||||
if ( fFuse<0.1 || fFuse>20.0 ){
|
if ( fFuse<0.1 || fFuse>20.0 ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid fuse %f", fFuse);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,30 +91,10 @@ static cell AMX_NATIVE_CALL nade_set_fuse(AMX *amx, cell *params){ // id,(re)set
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL dod_get_wpninfo(AMX *amx, cell *params){ // id
|
|
||||||
int index = params[1];
|
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
|
||||||
|
|
||||||
//weapon_data_t wdata;
|
|
||||||
|
|
||||||
//mm_DispatchThink(pPlayer->pEdict);
|
|
||||||
//mm_GetWeaponData(pPlayer->pEdict,&wdata);
|
|
||||||
|
|
||||||
//MF_PrintSrvConsole("%d \n",wdata.iuser1);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO base_Natives[] = {
|
AMX_NATIVE_INFO base_Natives[] = {
|
||||||
{ "dod_set_stamina", set_player_stamina },
|
{ "dod_set_stamina", set_player_stamina },
|
||||||
{ "dod_set_fuse", nade_set_fuse },
|
{ "dod_set_fuse", nade_set_fuse },
|
||||||
|
|
||||||
{ "dod_get_wpninfo", dod_get_wpninfo },
|
|
||||||
|
|
||||||
///*******************
|
///*******************
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
@ -34,10 +34,7 @@
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_user_class(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL set_user_class(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index)
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int iClass = params[2];
|
int iClass = params[2];
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
@ -59,13 +56,10 @@ static cell AMX_NATIVE_CALL set_user_class(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_user_team(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL set_user_team(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int iTeam = params[2];
|
int iTeam = params[2];
|
||||||
if ( iTeam<1 || iTeam>3 ){
|
if ( iTeam<1 || iTeam>3 ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid team id %d", iTeam);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,10 +95,7 @@ static cell AMX_NATIVE_CALL set_user_team(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_nextclass(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_user_nextclass(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if ( pPlayer->ingame ){
|
if ( pPlayer->ingame ){
|
||||||
@ -116,10 +107,7 @@ static cell AMX_NATIVE_CALL get_user_nextclass(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL is_randomclass(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL is_randomclass(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if ( pPlayer->ingame ){
|
if ( pPlayer->ingame ){
|
||||||
@ -130,23 +118,17 @@ static cell AMX_NATIVE_CALL is_randomclass(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_deaths(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_user_deaths(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame){
|
if (pPlayer->ingame){
|
||||||
return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS );
|
return *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS );
|
||||||
}
|
}
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_user_deaths(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL set_user_deaths(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame){
|
if (pPlayer->ingame){
|
||||||
*( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ) = params[2];
|
*( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ) = params[2];
|
||||||
@ -166,10 +148,7 @@ static cell AMX_NATIVE_CALL set_user_deaths(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_user_score(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL set_user_score(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
if (pPlayer->ingame){
|
if (pPlayer->ingame){
|
||||||
@ -190,12 +169,42 @@ static cell AMX_NATIVE_CALL set_user_score(AMX *amx, cell *params){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL set_user_frags(AMX *amx, cell *params){
|
||||||
|
int index = params[1];
|
||||||
|
CHECK_PLAYER(index);
|
||||||
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
|
if (pPlayer->ingame){
|
||||||
|
pPlayer->pEdict->v.frags = (float)params[2];
|
||||||
|
|
||||||
|
if ( params[3]){
|
||||||
|
//ScoreShort message
|
||||||
|
MESSAGE_BEGIN(MSG_ALL,gmsgScoreShort);
|
||||||
|
WRITE_BYTE(pPlayer->index);
|
||||||
|
WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_SCORE ) );
|
||||||
|
WRITE_SHORT((int)pPlayer->pEdict->v.frags);
|
||||||
|
WRITE_SHORT( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_DEATHS ) );
|
||||||
|
WRITE_BYTE(1);
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL get_user_frags(AMX *amx, cell *params){
|
||||||
|
int index = params[1];
|
||||||
|
CHECK_PLAYER(index);
|
||||||
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
|
if (pPlayer->ingame)
|
||||||
|
return (int)pPlayer->pEdict->v.frags;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_user_teamname(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL set_user_teamname(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
@ -213,10 +222,7 @@ static cell AMX_NATIVE_CALL set_user_teamname(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_teamname(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_user_teamname(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
@ -234,10 +240,7 @@ static cell AMX_NATIVE_CALL get_user_teamname(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL is_weapon_deployed(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL is_weapon_deployed(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame){
|
if (pPlayer->ingame){
|
||||||
if ( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_WDEPLOY) == 1 )
|
if ( *( (int*)pPlayer->pEdict->pvPrivateData + STEAM_PDOFFSET_WDEPLOY) == 1 )
|
||||||
@ -249,10 +252,7 @@ static cell AMX_NATIVE_CALL is_weapon_deployed(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_user_ammo(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL set_user_ammo(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
if ( !pPlayer->ingame )
|
if ( !pPlayer->ingame )
|
||||||
@ -356,10 +356,7 @@ static cell AMX_NATIVE_CALL set_user_ammo(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
if ( !pPlayer->ingame )
|
if ( !pPlayer->ingame )
|
||||||
@ -445,10 +442,7 @@ static cell AMX_NATIVE_CALL get_user_ammo(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL test_pd(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL test_pd(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int type = params[2];
|
int type = params[2];
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame){
|
if (pPlayer->ingame){
|
||||||
@ -487,6 +481,9 @@ AMX_NATIVE_INFO pd_Natives[] = {
|
|||||||
{ "dod_get_user_ammo", get_user_ammo },
|
{ "dod_get_user_ammo", get_user_ammo },
|
||||||
{ "dod_set_user_ammo", set_user_ammo },
|
{ "dod_set_user_ammo", set_user_ammo },
|
||||||
|
|
||||||
|
{ "dod_get_user_kills", get_user_frags },
|
||||||
|
{ "dod_set_user_kills", set_user_frags },
|
||||||
|
|
||||||
{ "dod_test_pd", test_pd },
|
{ "dod_test_pd", test_pd },
|
||||||
///*******************
|
///*******************
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
|
@ -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_LogErrorFunc;
|
||||||
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_LogErrorFunc, 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);
|
||||||
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2649,11 +2683,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 +2701,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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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_LogErrorFunc;
|
||||||
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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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);
|
||||||
|
@ -58,6 +58,49 @@ extern CPlayer* mPlayer;
|
|||||||
|
|
||||||
edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
|
edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
|
||||||
|
|
||||||
|
#define CHECK_ENTITY(x) \
|
||||||
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (x <= gpGlobals->maxClients) { \
|
||||||
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_PLAYER(x) \
|
||||||
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#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); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GETEDICT(n) \
|
||||||
|
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
|
||||||
|
|
||||||
#endif // DODFUN_H
|
#endif // DODFUN_H
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
static cell AMX_NATIVE_CALL get_weapon_name(AMX *amx, cell *params){ // from id to name 3 params id, name, len
|
static cell AMX_NATIVE_CALL get_weapon_name(AMX *amx, cell *params){ // from id to name 3 params id, name, len
|
||||||
int id = params[1];
|
int id = params[1];
|
||||||
if (id<0 || id>=DODMAX_WEAPONS){
|
if (id<0 || id>=DODMAX_WEAPONS){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]);
|
return MF_SetAmxString(amx,params[2],weaponData[id].name,params[3]);
|
||||||
@ -67,7 +67,7 @@ static cell AMX_NATIVE_CALL wpnlog_to_id(AMX *amx, cell *params){ // from log to
|
|||||||
static cell AMX_NATIVE_CALL get_weapon_logname(AMX *amx, cell *params){ // from id to log
|
static cell AMX_NATIVE_CALL get_weapon_logname(AMX *amx, cell *params){ // from id to log
|
||||||
int id = params[1];
|
int id = params[1];
|
||||||
if (id<0 || id>=DODMAX_WEAPONS){
|
if (id<0 || id>=DODMAX_WEAPONS){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]);
|
return MF_SetAmxString(amx,params[2],weaponData[id].logname,params[3]);
|
||||||
@ -76,7 +76,7 @@ static cell AMX_NATIVE_CALL get_weapon_logname(AMX *amx, cell *params){ // from
|
|||||||
static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL is_melee(AMX *amx, cell *params){
|
||||||
int id = params[1];
|
int id = params[1];
|
||||||
if (id<0 || id>=DODMAX_WEAPONS){
|
if (id<0 || id>=DODMAX_WEAPONS){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return weaponData[id].melee;
|
return weaponData[id].melee;
|
||||||
@ -97,10 +97,7 @@ static cell AMX_NATIVE_CALL get_team_score(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_score(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_user_score(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame)
|
if (pPlayer->ingame)
|
||||||
return pPlayer->savedScore;
|
return pPlayer->savedScore;
|
||||||
@ -109,10 +106,7 @@ static cell AMX_NATIVE_CALL get_user_score(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_class(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_user_class(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame)
|
if (pPlayer->ingame)
|
||||||
return pPlayer->pEdict->v.playerclass;
|
return pPlayer->pEdict->v.playerclass;
|
||||||
@ -121,10 +115,7 @@ static cell AMX_NATIVE_CALL get_user_class(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL user_kill(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL user_kill(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
|
|
||||||
if (pPlayer->ingame && pPlayer->IsAlive() ){
|
if (pPlayer->ingame && pPlayer->IsAlive() ){
|
||||||
@ -147,7 +138,7 @@ static cell AMX_NATIVE_CALL get_map_info(AMX *amx, cell *params){
|
|||||||
return g_map.detect_axis_paras;
|
return g_map.detect_axis_paras;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid map info id %d", params[1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@ -155,10 +146,7 @@ static cell AMX_NATIVE_CALL get_map_info(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_pronestate(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_user_pronestate(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame)
|
if (pPlayer->ingame)
|
||||||
return pPlayer->pEdict->v.iuser3;
|
return pPlayer->pEdict->v.iuser3;
|
||||||
@ -168,10 +156,7 @@ static cell AMX_NATIVE_CALL get_user_pronestate(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params){
|
static cell AMX_NATIVE_CALL get_user_weapon(AMX *amx, cell *params){
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame){
|
if (pPlayer->ingame){
|
||||||
int wpn = pPlayer->current;
|
int wpn = pPlayer->current;
|
||||||
@ -190,30 +175,31 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params){ // forward
|
|||||||
#ifdef FORWARD_OLD_SYSTEM
|
#ifdef FORWARD_OLD_SYSTEM
|
||||||
|
|
||||||
int iFunctionIndex;
|
int iFunctionIndex;
|
||||||
|
int err;
|
||||||
switch( params[1] ){
|
switch( params[1] ){
|
||||||
case 0:
|
case 0:
|
||||||
if( MF_AmxFindPublic(amx, "client_damage", &iFunctionIndex) == AMX_ERR_NONE )
|
if( (err=MF_AmxFindPublic(amx, "client_damage", &iFunctionIndex)) == AMX_ERR_NONE )
|
||||||
g_damage_info.put( amx , iFunctionIndex );
|
g_damage_info.put( amx , iFunctionIndex );
|
||||||
else
|
else
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, err, "client_damage not found");
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if( MF_AmxFindPublic(amx, "client_death", &iFunctionIndex) == AMX_ERR_NONE )
|
if( (err=MF_AmxFindPublic(amx, "client_death", &iFunctionIndex)) == AMX_ERR_NONE )
|
||||||
g_death_info.put( amx , iFunctionIndex );
|
g_death_info.put( amx , iFunctionIndex );
|
||||||
else
|
else
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, err, "client_Death not found");
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if( MF_AmxFindPublic(amx, "client_score", &iFunctionIndex) == AMX_ERR_NONE )
|
if( (err=MF_AmxFindPublic(amx, "client_score", &iFunctionIndex)) == AMX_ERR_NONE )
|
||||||
g_score_info.put( amx , iFunctionIndex );
|
g_score_info.put( amx , iFunctionIndex );
|
||||||
else
|
else
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, err, "client_score not found");
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid forward id %d", params[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -248,31 +234,25 @@ static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logna
|
|||||||
static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
|
static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
|
||||||
int weapon = params[1];
|
int weapon = params[1];
|
||||||
if ( weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS ){ // only for custom weapons
|
if ( weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS ){ // only for custom weapons
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid custom weapon id %d", weapon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int att = params[2];
|
int att = params[2];
|
||||||
if (att<1||att>gpGlobals->maxClients){
|
CHECK_PLAYER(params[2]);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int vic = params[3];
|
int vic = params[3];
|
||||||
if (vic<1||vic>gpGlobals->maxClients){
|
CHECK_PLAYER(params[3]);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dmg = params[4];
|
int dmg = params[4];
|
||||||
if ( dmg<1 ){
|
if ( dmg<1 ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid damage %d", dmg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aim = params[5];
|
int aim = params[5];
|
||||||
if ( aim < 0 || aim > 7 ){
|
if ( aim < 0 || aim > 7 ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid aim %d", aim);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,21 +286,17 @@ static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg
|
|||||||
MF_ExecuteForward( iFDeath,pAtt->index, pVic->index, weapon, aim, TA );
|
MF_ExecuteForward( iFDeath,pAtt->index, pVic->index, weapon, aim, TA );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid
|
static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid
|
||||||
int index = params[2];
|
int index = params[2];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
CHECK_PLAYER(index);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int weapon = params[1];
|
int weapon = params[1];
|
||||||
if ( weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS ){
|
if ( weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid custom weapon id %d", weapon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,10 +324,7 @@ static cell AMX_NATIVE_CALL is_custom(AMX *amx, cell *params){
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL dod_get_user_team(AMX *amx, cell *params){ // player,wid
|
static cell AMX_NATIVE_CALL dod_get_user_team(AMX *amx, cell *params){ // player,wid
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
return pPlayer->pEdict->v.team;
|
return pPlayer->pEdict->v.team;
|
||||||
@ -360,10 +333,7 @@ static cell AMX_NATIVE_CALL dod_get_user_team(AMX *amx, cell *params){ // player
|
|||||||
|
|
||||||
static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params){ // player,wid
|
static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params){ // player,wid
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYER(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
int iTeam = pPlayer->pEdict->v.team;
|
int iTeam = pPlayer->pEdict->v.team;
|
||||||
|
@ -35,15 +35,9 @@
|
|||||||
static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
|
static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int attacker = params[2];
|
int attacker = params[2];
|
||||||
if (attacker<0||attacker>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(attacker);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->attackers[attacker].hits){
|
if (pPlayer->attackers[attacker].hits){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
|
||||||
@ -68,15 +62,9 @@ static cell AMX_NATIVE_CALL get_user_astats(AMX *amx, cell *params) /* 6 param *
|
|||||||
static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param */
|
static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int victim = params[2];
|
int victim = params[2];
|
||||||
if (victim<0||victim>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(victim);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->victims[victim].hits){
|
if (pPlayer->victims[victim].hits){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[3]);
|
||||||
@ -101,13 +89,10 @@ static cell AMX_NATIVE_CALL get_user_vstats(AMX *amx, cell *params) /* 6 param *
|
|||||||
static cell AMX_NATIVE_CALL get_user_wlstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
|
static cell AMX_NATIVE_CALL get_user_wlstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int weapon = params[2];
|
int weapon = params[2];
|
||||||
if (weapon<0||weapon>=DODMAX_WEAPONS){
|
if (weapon<0||weapon>=DODMAX_WEAPONS){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
@ -133,13 +118,10 @@ static cell AMX_NATIVE_CALL get_user_wlstats(AMX *amx, cell *params) /* 4 param
|
|||||||
static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
|
static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param */ // DEC-Weapon (round) stats (end)
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index)
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int weapon = params[2];
|
int weapon = params[2];
|
||||||
if (weapon<0||weapon>=DODMAX_WEAPONS){
|
if (weapon<0||weapon>=DODMAX_WEAPONS){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
@ -165,13 +147,10 @@ static cell AMX_NATIVE_CALL get_user_wrstats(AMX *amx, cell *params) /* 4 param
|
|||||||
static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */
|
static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index)
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int weapon = params[2];
|
int weapon = params[2];
|
||||||
if (weapon<0||weapon>=DODMAX_WEAPONS){
|
if (weapon<0||weapon>=DODMAX_WEAPONS){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid weapon id %d", weapon);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
@ -197,10 +176,7 @@ static cell AMX_NATIVE_CALL get_user_wstats(AMX *amx, cell *params) /* 4 param *
|
|||||||
static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param */
|
static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
pPlayer->restartStats();
|
pPlayer->restartStats();
|
||||||
return 1;
|
return 1;
|
||||||
@ -209,10 +185,7 @@ static cell AMX_NATIVE_CALL reset_user_wstats(AMX *amx, cell *params) /* 6 param
|
|||||||
static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
|
static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if ( pPlayer->ingame ){
|
if ( pPlayer->ingame ){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
||||||
@ -237,10 +210,7 @@ static cell AMX_NATIVE_CALL get_user_stats(AMX *amx, cell *params) /* 3 param */
|
|||||||
static cell AMX_NATIVE_CALL get_user_lstats(AMX *amx, cell *params) /* 3 param */
|
static cell AMX_NATIVE_CALL get_user_lstats(AMX *amx, cell *params) /* 3 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index);
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame){
|
if (pPlayer->ingame){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
||||||
@ -263,10 +233,7 @@ static cell AMX_NATIVE_CALL get_user_lstats(AMX *amx, cell *params) /* 3 param *
|
|||||||
static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param */
|
static cell AMX_NATIVE_CALL get_user_rstats(AMX *amx, cell *params) /* 3 param */
|
||||||
{
|
{
|
||||||
int index = params[1];
|
int index = params[1];
|
||||||
if (index<1||index>gpGlobals->maxClients){
|
CHECK_PLAYERRANGE(index)
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||||
if (pPlayer->ingame){
|
if (pPlayer->ingame){
|
||||||
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
cell *cpStats = MF_GetAmxAddr(amx,params[2]);
|
||||||
|
@ -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_LogErrorFunc;
|
||||||
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_LogErrorFunc, 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);
|
||||||
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2649,11 +2683,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 +2701,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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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_LogErrorFunc;
|
||||||
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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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);
|
||||||
|
@ -111,6 +111,54 @@ bool ignoreBots (edict_t *pEnt, edict_t *pOther = NULL );
|
|||||||
bool isModuleActive();
|
bool isModuleActive();
|
||||||
edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
|
edict_t *FindEntityByClassname(edict_t *pentStart, const char *szName);
|
||||||
|
|
||||||
|
#define CHECK_ENTITY(x) \
|
||||||
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (x <= gpGlobals->maxClients) { \
|
||||||
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_PLAYER(x) \
|
||||||
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_PLAYERRANGE(x) \
|
||||||
|
if (x > gpGlobals->maxClients || x < 0) \
|
||||||
|
{ \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#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); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid non-player entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GETEDICT(n) \
|
||||||
|
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
|
||||||
|
|
||||||
#endif // DODX_H
|
#endif // DODX_H
|
||||||
|
|
||||||
|
|
||||||
|
@ -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;
|
||||||
@ -101,7 +90,7 @@ void OnPluginsLoaded()
|
|||||||
g_pFunctionTable->pfnPlayerPostThink=PlayerPostThink_Post;
|
g_pFunctionTable->pfnPlayerPostThink=PlayerPostThink_Post;
|
||||||
|
|
||||||
g_pFunctionTable->pfnSpawn=NULL; // "pfn_spawn"
|
g_pFunctionTable->pfnSpawn=NULL; // "pfn_spawn"
|
||||||
if (CheckForPublic("pfn_spawn"))
|
//if (CheckForPublic("pfn_spawn")) // JGHG: I commented this if out because we always need the Spawn to precache the rocket mdl used with SetView native
|
||||||
g_pFunctionTable->pfnSpawn=Spawn;
|
g_pFunctionTable->pfnSpawn=Spawn;
|
||||||
|
|
||||||
g_pFunctionTable->pfnClientKill=NULL; // "client_kill"
|
g_pFunctionTable->pfnClientKill=NULL; // "client_kill"
|
||||||
@ -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();
|
||||||
|
@ -32,8 +32,6 @@
|
|||||||
* Description: AMX Mod X Module Interface Functions
|
* Description: AMX Mod X Module Interface Functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -53,6 +51,9 @@ DLL_FUNCTIONS *g_pFunctionTable;
|
|||||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||||
enginefuncs_t *g_pengfuncsTable;
|
enginefuncs_t *g_pengfuncsTable;
|
||||||
enginefuncs_t *g_pengfuncsTable_Post;
|
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 =
|
||||||
@ -2207,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2224,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2451,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_LogErrorFunc;
|
||||||
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;
|
||||||
@ -2465,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;
|
||||||
@ -2489,6 +2496,11 @@ PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2532,6 +2544,9 @@ 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_LogErrorFunc, PFN_LOG_ERROR);
|
||||||
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2553,6 +2568,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
||||||
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
||||||
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
||||||
|
REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
|
||||||
|
|
||||||
// Natives / Forwards
|
// Natives / Forwards
|
||||||
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
||||||
@ -2564,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);
|
||||||
@ -2576,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);
|
||||||
@ -2585,6 +2603,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
||||||
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
||||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||||
|
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||||
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||||
@ -2631,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2651,11 +2683,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);
|
||||||
@ -2666,6 +2701,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);
|
||||||
@ -2679,11 +2715,14 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||||
MF_AmxFindPublic(0, 0, 0);
|
MF_AmxFindPublic(0, 0, 0);
|
||||||
MF_AmxAllot(0, 0, 0, 0);
|
MF_AmxAllot(0, 0, 0, 0);
|
||||||
MF_LoadAmxScript(0, 0, 0, 0);
|
MF_LoadAmxScript(0, 0, 0, 0, 0);
|
||||||
MF_UnloadAmxScript(0, 0);
|
MF_UnloadAmxScript(0, 0);
|
||||||
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
||||||
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
||||||
MF_UnregisterSPForward(0);
|
MF_UnregisterSPForward(0);
|
||||||
|
MF_GetPlayerFrags(0);
|
||||||
|
MF_GetPlayerEdict(0);
|
||||||
|
MF_Format("", 4, "str");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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*/);
|
||||||
@ -1944,6 +1948,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
||||||
|
#ifdef USE_METAMOD
|
||||||
|
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#else
|
||||||
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
const unsigned int /*type*/, const size_t /*size*/);
|
const unsigned int /*type*/, const size_t /*size*/);
|
||||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -1955,7 +1965,7 @@ typedef int (*PFN_AMX_EXECV) (AMX* /*amx*/, cell* /*return val*/, int /*in
|
|||||||
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
typedef int (*PFN_AMX_ALLOT) (AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/);
|
||||||
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDPUBLIC) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
typedef int (*PFN_AMX_FINDNATIVE) (AMX* /*amx*/, char* /*func name*/, int* /*index*/);
|
||||||
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/);
|
typedef int (*PFN_LOAD_AMXSCRIPT) (AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */);
|
||||||
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
typedef int (*PFN_UNLOAD_AMXSCRIPT) (AMX* /*amx*/,void** /*code*/);
|
||||||
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
typedef cell (*PFN_REAL_TO_CELL) (REAL /*x*/);
|
||||||
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
typedef REAL (*PFN_CELL_TO_REAL) (cell /*x*/);
|
||||||
@ -1963,6 +1973,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa
|
|||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -1979,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_LogErrorFunc;
|
||||||
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;
|
||||||
@ -2017,6 +2031,9 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
|||||||
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
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_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
|
||||||
@ -2036,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) { }
|
||||||
@ -2050,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) { }
|
||||||
@ -2066,6 +2087,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
|||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
int MF_GetPlayerFlags (int id) { }
|
int MF_GetPlayerFlags (int id) { }
|
||||||
|
edict_t* MF_GetPlayerEdict (int id) { }
|
||||||
|
const char * MF_Format (const char *fmt, ...) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2083,11 +2106,14 @@ 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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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
|
||||||
@ -2097,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
|
||||||
@ -2121,6 +2148,8 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#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_Format g_fn_Format
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -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,23 @@ 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); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (x <= gpGlobals->maxClients) { \
|
||||||
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
extern bool g_inKeyValue;
|
extern bool g_inKeyValue;
|
||||||
extern KeyValueData *g_pkvd;
|
extern KeyValueData *g_pkvd;
|
||||||
|
@ -5,14 +5,18 @@ int is_ent_valid(int iEnt)
|
|||||||
if (iEnt < 1 || iEnt > gpGlobals->maxEntities)
|
if (iEnt < 1 || iEnt > gpGlobals->maxEntities)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (iEnt >= 1 && iEnt <= gpGlobals->maxClients)
|
if (iEnt <= gpGlobals->maxClients)
|
||||||
|
{
|
||||||
if (!MF_IsPlayerIngame(iEnt))
|
if (!MF_IsPlayerIngame(iEnt))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
} else {
|
||||||
|
if (FNullEnt(INDEXENT(iEnt)))
|
||||||
if (FNullEnt(pEnt))
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -26,10 +30,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 +49,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 +64,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 +80,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 +134,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 +164,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 +191,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 +210,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 +341,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 +472,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 +590,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 +604,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 +736,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 +829,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 +923,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 +985,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 +1044,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 +1100,9 @@ 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);
|
if (iSetEnt != 0)
|
||||||
return 0;
|
CHECK_ENTITY(iSetEnt);
|
||||||
}
|
|
||||||
|
|
||||||
edict_t *pEnt = INDEXENT2(iEnt);
|
edict_t *pEnt = INDEXENT2(iEnt);
|
||||||
edict_t *pSetEnt = INDEXENT2(iSetEnt);
|
edict_t *pSetEnt = INDEXENT2(iSetEnt);
|
||||||
@ -1198,10 +1156,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 +1194,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;
|
||||||
@ -1254,22 +1206,22 @@ static cell AMX_NATIVE_CALL entity_set_byte(AMX *amx, cell *params)
|
|||||||
switch (idx)
|
switch (idx)
|
||||||
{
|
{
|
||||||
case controller1:
|
case controller1:
|
||||||
pEnt->v.controller[1] = iNewValue;
|
pEnt->v.controller[0] = iNewValue;
|
||||||
break;
|
break;
|
||||||
case controller2:
|
case controller2:
|
||||||
pEnt->v.controller[2] = iNewValue;
|
pEnt->v.controller[1] = iNewValue;
|
||||||
break;
|
break;
|
||||||
case controller3:
|
case controller3:
|
||||||
pEnt->v.controller[3] = iNewValue;
|
pEnt->v.controller[2] = iNewValue;
|
||||||
break;
|
break;
|
||||||
case controller4:
|
case controller4:
|
||||||
pEnt->v.controller[4] = iNewValue;
|
pEnt->v.controller[3] = iNewValue;
|
||||||
break;
|
break;
|
||||||
case blending1:
|
case blending1:
|
||||||
pEnt->v.blending[1] = iNewValue;
|
pEnt->v.blending[0] = iNewValue;
|
||||||
break;
|
break;
|
||||||
case blending2:
|
case blending2:
|
||||||
pEnt->v.blending[2] = iNewValue;
|
pEnt->v.blending[1] = iNewValue;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
@ -1283,10 +1235,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 +1254,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 +1273,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 +1354,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 +1462,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 +1497,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);
|
||||||
|
@ -20,6 +20,7 @@ CVector<EntClass *> Thinks;
|
|||||||
CVector<Touch *> Touches;
|
CVector<Touch *> Touches;
|
||||||
KeyValueData *g_pkvd;
|
KeyValueData *g_pkvd;
|
||||||
bool g_inKeyValue=false;
|
bool g_inKeyValue=false;
|
||||||
|
bool g_precachedStuff = false;
|
||||||
|
|
||||||
int fstrcmp(const char *s1, const char *s2)
|
int fstrcmp(const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
@ -37,6 +38,11 @@ int fstrcmp(const char *s1, const char *s2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Spawn(edict_t *pEntity) {
|
int Spawn(edict_t *pEntity) {
|
||||||
|
if (!g_precachedStuff) {
|
||||||
|
// Used for SetView, added by JGHG
|
||||||
|
int returnValue = PRECACHE_MODEL("models/rpgrocket.mdl");
|
||||||
|
g_precachedStuff = true;
|
||||||
|
}
|
||||||
if (SpawnForward != -1) {
|
if (SpawnForward != -1) {
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
int id = ENTINDEX(pEntity);
|
int id = ENTINDEX(pEntity);
|
||||||
|
@ -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;
|
||||||
@ -94,6 +93,7 @@ void MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
|
|||||||
{
|
{
|
||||||
if (msgBlocks[msg_type]) {
|
if (msgBlocks[msg_type]) {
|
||||||
inblock = true;
|
inblock = true;
|
||||||
|
msgType = msg_type;
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
} else if (msgHooks[msg_type].size()) {
|
} else if (msgHooks[msg_type].size()) {
|
||||||
inhook = true;
|
inhook = true;
|
||||||
@ -458,12 +458,20 @@ static cell AMX_NATIVE_CALL get_msg_origin(AMX *amx, cell *params)
|
|||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
vec3_t vRet = (Vector)msgOrigin;
|
|
||||||
cell *cAddr = MF_GetAmxAddr(amx, params[1]);
|
cell *cAddr = MF_GetAmxAddr(amx, params[1]);
|
||||||
|
|
||||||
|
if (msgDest >= MSG_PVS && msgDest <= MSG_PAS_R)
|
||||||
|
{
|
||||||
|
vec3_t vRet = (Vector)msgOrigin;
|
||||||
cAddr[0] = amx_ftoc(vRet.x);
|
cAddr[0] = amx_ftoc(vRet.x);
|
||||||
cAddr[1] = amx_ftoc(vRet.y);
|
cAddr[1] = amx_ftoc(vRet.y);
|
||||||
cAddr[2] = amx_ftoc(vRet.z);
|
cAddr[2] = amx_ftoc(vRet.z);
|
||||||
|
} else {
|
||||||
|
cAddr[0] = 0;
|
||||||
|
cAddr[1] = 0;
|
||||||
|
cAddr[2] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -219,8 +219,7 @@ static cell AMX_NATIVE_CALL dllfunc(AMX *amx,cell *params)
|
|||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
MF_Log("Unknown dllfunc entry.");
|
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown dllfunc entry %d", type);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -963,7 +963,7 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
|
|||||||
(*g_engfuncs.pfnSetClientKeyValue)(index,(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)),temp,temp2);
|
(*g_engfuncs.pfnSetClientKeyValue)(index,(*g_engfuncs.pfnGetInfoKeyBuffer)(INDEXENT2(index)),temp,temp2);
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
LOG_CONSOLE(PLID,"[NS2AMX] Unknown engfunc type provided.");
|
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown engfunc type %d", type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,27 @@ inline edict_t* INDEXENT2( int iEdictNum )
|
|||||||
else
|
else
|
||||||
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
||||||
}
|
}
|
||||||
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
|
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
|
||||||
|
#define CHECK_ENTITY(x) \
|
||||||
|
if (x < 0 || x > gpGlobals->maxEntities) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (x <= gpGlobals->maxClients) { \
|
||||||
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
|
||||||
extern AMX_NATIVE_INFO engfunc_natives[];
|
extern AMX_NATIVE_INFO engfunc_natives[];
|
||||||
extern AMX_NATIVE_INFO dllfunc_natives[];
|
extern AMX_NATIVE_INFO dllfunc_natives[];
|
||||||
extern AMX_NATIVE_INFO pev_natives[];
|
extern AMX_NATIVE_INFO pev_natives[];
|
||||||
|
@ -111,6 +111,28 @@ void TraceLine_post(const float *v1, const float *v2, int fNoMonsters, edict_t *
|
|||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AlertMessage(ALERT_TYPE atype, char *szFmt, ...)
|
||||||
|
{
|
||||||
|
static char buf[2048];
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, szFmt);
|
||||||
|
vsprintf(buf, szFmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
FM_ENG_HANDLE(FM_AlertMessage, (Engine[FM_AlertMessage].at(i), atype, buf));
|
||||||
|
RETURN_META(mswi(lastFmRes));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AlertMessage_post(ALERT_TYPE atype, char *szFmt, ...)
|
||||||
|
{
|
||||||
|
static char buf[2048];
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, szFmt);
|
||||||
|
vsprintf(buf, szFmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
FM_ENG_HANDLE(FM_AlertMessage, (Engine[FM_AlertMessage].at(i), atype, buf));
|
||||||
|
RETURN_META(MRES_IGNORED);
|
||||||
|
}
|
||||||
|
|
||||||
// pfnModelIndex
|
// pfnModelIndex
|
||||||
SIMPLE_INT_HOOK_CONSTSTRING(ModelIndex);
|
SIMPLE_INT_HOOK_CONSTSTRING(ModelIndex);
|
||||||
|
|
||||||
@ -448,7 +470,7 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
|
|||||||
int func = params[1];
|
int func = params[1];
|
||||||
// You originally had both post coming from params[2] AND the function name. I've moved post to 3.
|
// You originally had both post coming from params[2] AND the function name. I've moved post to 3.
|
||||||
int post = params[3];
|
int post = params[3];
|
||||||
if (func > FM_AllowLagCompensation || func < 1)
|
if (func >= FM_LAST_DONT_USE_ME || func < 1)
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
@ -872,7 +894,10 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
|
|||||||
ENGHOOK(IsMapValid);
|
ENGHOOK(IsMapValid);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FM_AlertMessage:
|
||||||
|
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_STRING, FP_DONE);
|
||||||
|
ENGHOOK(AlertMessage);
|
||||||
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Begin of DLLFuncs
|
* Begin of DLLFuncs
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef _INCLUDE_FORWARD_H
|
#ifndef _INCLUDE_FORWARD_H
|
||||||
#define _INCLUDE_FORWARD_H
|
#define _INCLUDE_FORWARD_H
|
||||||
|
|
||||||
#define ENGFUNC_NUM 108
|
#define ENGFUNC_NUM 118
|
||||||
|
|
||||||
#define FMV_STRING 1
|
#define FMV_STRING 1
|
||||||
#define FMV_FLOAT 2
|
#define FMV_FLOAT 2
|
||||||
@ -13,6 +13,7 @@
|
|||||||
#define FMRES_OVERRIDE 3
|
#define FMRES_OVERRIDE 3
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
FM_FIRST_DONT_USE_ME = 0,
|
||||||
FM_PrecacheModel = 1, // done
|
FM_PrecacheModel = 1, // done
|
||||||
FM_PrecacheSound, // done
|
FM_PrecacheSound, // done
|
||||||
FM_SetModel, // done
|
FM_SetModel, // done
|
||||||
@ -148,6 +149,8 @@ enum {
|
|||||||
// Create baselines for certain "unplaced" items.
|
// Create baselines for certain "unplaced" items.
|
||||||
FM_CreateInstancedBaselines, // done
|
FM_CreateInstancedBaselines, // done
|
||||||
FM_AllowLagCompensation, // done
|
FM_AllowLagCompensation, // done
|
||||||
|
FM_AlertMessage,
|
||||||
|
FM_LAST_DONT_USE_ME,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CVector<int> Engine[];
|
extern CVector<int> Engine[];
|
||||||
|
@ -4,20 +4,23 @@
|
|||||||
static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
||||||
{
|
{
|
||||||
int index=params[1];
|
int index=params[1];
|
||||||
|
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
|
||||||
if (index >= 1 && index <= gpGlobals->maxClients)
|
if (index >= 1 && index <= gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
if (!MF_IsPlayerIngame(index))
|
if (!MF_IsPlayerIngame(index))
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player %d is not in game", index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (index > gpGlobals->maxEntities || index < 1)
|
if (index > gpGlobals->maxEntities || index < 1)
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
CHECK_ENTITY(index);
|
||||||
edict_t *pPlayer = INDEXENT2(index);
|
edict_t *pPlayer = INDEXENT2(index);
|
||||||
int returntype = *params/sizeof(cell);
|
int returntype = *params/sizeof(cell);
|
||||||
int valuetype=0;
|
int valuetype=0;
|
||||||
@ -36,6 +39,8 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
|||||||
valuetype=VALUETYPE_BYTE;
|
valuetype=VALUETYPE_BYTE;
|
||||||
else if (iSwitch > pev_string_start && iSwitch < pev_string_end)
|
else if (iSwitch > pev_string_start && iSwitch < pev_string_end)
|
||||||
valuetype=VALUETYPE_STRING;
|
valuetype=VALUETYPE_STRING;
|
||||||
|
else if (iSwitch > pev_edict_start && iSwitch < pev_edict_end)
|
||||||
|
valuetype=VALUETYPE_EDICT;
|
||||||
if (iSwitch > pev_int_start && iSwitch < pev_int_end)
|
if (iSwitch > pev_int_start && iSwitch < pev_int_end)
|
||||||
{
|
{
|
||||||
valuetype=VALUETYPE_INT;
|
valuetype=VALUETYPE_INT;
|
||||||
@ -501,8 +506,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
|||||||
{
|
{
|
||||||
return (int)fReturn;
|
return (int)fReturn;
|
||||||
}
|
}
|
||||||
MF_Log("Invalid return valuetype for pev().");
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return valuetype for pev().");
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (returntype == RETURNTYPE_FLOAT)
|
else if (returntype == RETURNTYPE_FLOAT)
|
||||||
@ -552,8 +556,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MF_Log("Invalid return valuetype for pev().");
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return valuetype for pev().");
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
}
|
}
|
||||||
else if (returntype == RETURNTYPE_STRING)
|
else if (returntype == RETURNTYPE_STRING)
|
||||||
{
|
{
|
||||||
@ -610,8 +613,7 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MF_Log("Invalid return valuetype for pev().");
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return valuetype for pev().");
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -623,7 +625,6 @@ static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params)
|
|||||||
CHECK_ENTITY(index);
|
CHECK_ENTITY(index);
|
||||||
edict_t *pPlayer = INDEXENT2(index);
|
edict_t *pPlayer = INDEXENT2(index);
|
||||||
int iSwitch = params[2];
|
int iSwitch = params[2];
|
||||||
|
|
||||||
cell *blah = MF_GetAmxAddr(amx,params[3]);
|
cell *blah = MF_GetAmxAddr(amx,params[3]);
|
||||||
if (iSwitch > pev_int_start && iSwitch < pev_int_end)
|
if (iSwitch > pev_int_start && iSwitch < pev_int_end)
|
||||||
{
|
{
|
||||||
@ -918,37 +919,38 @@ static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params)
|
|||||||
}
|
}
|
||||||
else if (iSwitch > pev_edict_start && iSwitch < pev_edict_end)
|
else if (iSwitch > pev_edict_start && iSwitch < pev_edict_end)
|
||||||
{
|
{
|
||||||
|
int iValue = blah[0];
|
||||||
switch (iSwitch)
|
switch (iSwitch)
|
||||||
{
|
{
|
||||||
case chain:
|
case chain:
|
||||||
pPlayer->v.chain = INDEXENT2(params[3]);
|
pPlayer->v.chain = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case dmg_inflictor:
|
case dmg_inflictor:
|
||||||
pPlayer->v.dmg_inflictor = INDEXENT2(params[3]);
|
pPlayer->v.dmg_inflictor = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case enemy:
|
case enemy:
|
||||||
pPlayer->v.enemy = INDEXENT2(params[3]);
|
pPlayer->v.enemy = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case aiment:
|
case aiment:
|
||||||
pPlayer->v.aiment = INDEXENT2(params[3]);
|
pPlayer->v.aiment = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case owner:
|
case owner:
|
||||||
pPlayer->v.owner = INDEXENT2(params[3]);
|
pPlayer->v.owner = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case groundentity:
|
case groundentity:
|
||||||
pPlayer->v.groundentity = INDEXENT2(params[3]);
|
pPlayer->v.groundentity = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case euser1:
|
case euser1:
|
||||||
pPlayer->v.euser1 = INDEXENT2(params[3]);
|
pPlayer->v.euser1 = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case euser2:
|
case euser2:
|
||||||
pPlayer->v.euser2 = INDEXENT2(params[3]);
|
pPlayer->v.euser2 = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case euser3:
|
case euser3:
|
||||||
pPlayer->v.euser3 = INDEXENT2(params[3]);
|
pPlayer->v.euser3 = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
case euser4:
|
case euser4:
|
||||||
pPlayer->v.euser4 = INDEXENT2(params[3]);
|
pPlayer->v.euser4 = INDEXENT2(iValue);
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -39,20 +39,22 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
|
|
||||||
DLL_FUNCTIONS *g_pFunctionTable;
|
|
||||||
DLL_FUNCTIONS *g_pFunctionTable_Post;
|
|
||||||
enginefuncs_t *g_pengfuncsTable;
|
|
||||||
enginefuncs_t *g_pengfuncsTable_Post;
|
|
||||||
|
|
||||||
|
|
||||||
/************* METAMOD SUPPORT *************/
|
/************* METAMOD SUPPORT *************/
|
||||||
#ifdef USE_METAMOD
|
#ifdef USE_METAMOD
|
||||||
|
|
||||||
enginefuncs_t g_engfuncs;
|
enginefuncs_t g_engfuncs;
|
||||||
DLL_FUNCTIONS *gameDLLFunc;
|
|
||||||
|
|
||||||
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 =
|
||||||
{
|
{
|
||||||
@ -2122,7 +2124,6 @@ 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));
|
||||||
// Mark down the pointer to this mod's function tables...
|
|
||||||
g_pFunctionTable=pFunctionTable;
|
g_pFunctionTable=pFunctionTable;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
@ -2141,7 +2142,6 @@ 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 ) );
|
||||||
// Mark down the pointer to this mod's function tables...
|
|
||||||
g_pFunctionTable_Post=pFunctionTable;
|
g_pFunctionTable_Post=pFunctionTable;
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
@ -2165,7 +2165,6 @@ 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));
|
||||||
// Mark down the pointer to this mod's function tables...
|
|
||||||
g_pengfuncsTable=pengfuncsFromEngine;
|
g_pengfuncsTable=pengfuncsFromEngine;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2184,7 +2183,6 @@ 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));
|
||||||
// Mark down the pointer to this mod's function tables...
|
|
||||||
g_pengfuncsTable_Post=pengfuncsFromEngine;
|
g_pengfuncsTable_Post=pengfuncsFromEngine;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
@ -2210,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2227,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2454,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_LogErrorFunc;
|
||||||
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;
|
||||||
@ -2468,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;
|
||||||
@ -2492,6 +2496,11 @@ PFN_CELL_TO_REAL g_fn_CellToReal;
|
|||||||
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
PFN_REGISTER_SPFORWARD g_fn_RegisterSPForward;
|
||||||
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
PFN_REGISTER_SPFORWARD_BYNAME g_fn_RegisterSPForwardByName;
|
||||||
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
||||||
|
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
|
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
|
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2535,6 +2544,9 @@ 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_LogErrorFunc, PFN_LOG_ERROR);
|
||||||
|
REQFUNC("MergeDefinitionFile", g_fn_MergeDefinition_File, PFN_MERGEDEFINITION_FILE);
|
||||||
|
REQFUNC("Format", g_fn_Format, PFN_FORMAT);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2542,6 +2554,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
REQFUNC("FindAmxScriptByName", g_fn_FindAmxScriptByName, PFN_FIND_AMXSCRIPT_BYNAME);
|
||||||
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
REQFUNC("LoadAmxScript", g_fn_LoadAmxScript, PFN_LOAD_AMXSCRIPT);
|
||||||
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
REQFUNC("UnloadAmxScript", g_fn_UnloadAmxScript, PFN_UNLOAD_AMXSCRIPT);
|
||||||
|
REQFUNC("GetAmxScriptName", g_fn_GetAmxScriptName, PFN_GET_AMXSCRIPTNAME);
|
||||||
|
|
||||||
// String / mem in amx scripts support
|
// String / mem in amx scripts support
|
||||||
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
REQFUNC("SetAmxString", g_fn_SetAmxString, PFN_SET_AMXSTRING);
|
||||||
@ -2555,6 +2568,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
REQFUNC("amx_Execv", g_fn_AmxExecv, PFN_AMX_EXECV);
|
||||||
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
REQFUNC("amx_FindPublic", g_fn_AmxFindPublic, PFN_AMX_FINDPUBLIC);
|
||||||
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
REQFUNC("amx_Allot", g_fn_AmxAllot, PFN_AMX_ALLOT);
|
||||||
|
REQFUNC("amx_FindNative", g_fn_AmxFindNative, PFN_AMX_FINDNATIVE);
|
||||||
|
|
||||||
// Natives / Forwards
|
// Natives / Forwards
|
||||||
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
REQFUNC("AddNatives", g_fn_AddNatives, PFN_ADD_NATIVES);
|
||||||
@ -2566,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);
|
||||||
@ -2578,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);
|
||||||
@ -2587,6 +2603,8 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
REQFUNC("IsPlayerHLTV", g_fn_IsPlayerHLTV, PFN_IS_PLAYER_HLTV);
|
||||||
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
||||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||||
|
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||||
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||||
@ -2633,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2653,11 +2683,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);
|
||||||
@ -2668,6 +2701,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);
|
||||||
@ -2686,6 +2720,9 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
||||||
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
||||||
MF_UnregisterSPForward(0);
|
MF_UnregisterSPForward(0);
|
||||||
|
MF_GetPlayerFrags(0);
|
||||||
|
MF_GetPlayerEdict(0);
|
||||||
|
MF_Format("", 4, "str");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2802,7 +2839,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2815,7 +2852,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2829,7 +2866,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2841,7 +2878,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
@ -2893,6 +2930,7 @@ void operator delete[](void *reportedAddress)
|
|||||||
|
|
||||||
#include <extdll.h>
|
#include <extdll.h>
|
||||||
#include "sdk_util.h"
|
#include "sdk_util.h"
|
||||||
|
#include <cbase.h>
|
||||||
|
|
||||||
#include <string.h> // for strncpy(), etc
|
#include <string.h> // for strncpy(), etc
|
||||||
|
|
||||||
@ -2929,4 +2967,76 @@ void UTIL_LogPrintf( char *fmt, ... )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UTIL_HudMessage(CBaseEntity *pEntity, const hudtextparms_t &textparms,
|
||||||
|
const char *pMessage)
|
||||||
|
{
|
||||||
|
if ( !pEntity )
|
||||||
|
return;
|
||||||
|
|
||||||
|
MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, ENT(pEntity->pev) );
|
||||||
|
WRITE_BYTE( TE_TEXTMESSAGE );
|
||||||
|
WRITE_BYTE( textparms.channel & 0xFF );
|
||||||
|
|
||||||
|
WRITE_SHORT( FixedSigned16( textparms.x, 1<<13 ) );
|
||||||
|
WRITE_SHORT( FixedSigned16( textparms.y, 1<<13 ) );
|
||||||
|
WRITE_BYTE( textparms.effect );
|
||||||
|
|
||||||
|
WRITE_BYTE( textparms.r1 );
|
||||||
|
WRITE_BYTE( textparms.g1 );
|
||||||
|
WRITE_BYTE( textparms.b1 );
|
||||||
|
WRITE_BYTE( textparms.a1 );
|
||||||
|
|
||||||
|
WRITE_BYTE( textparms.r2 );
|
||||||
|
WRITE_BYTE( textparms.g2 );
|
||||||
|
WRITE_BYTE( textparms.b2 );
|
||||||
|
WRITE_BYTE( textparms.a2 );
|
||||||
|
|
||||||
|
WRITE_SHORT( FixedUnsigned16( textparms.fadeinTime, 1<<8 ) );
|
||||||
|
WRITE_SHORT( FixedUnsigned16( textparms.fadeoutTime, 1<<8 ) );
|
||||||
|
WRITE_SHORT( FixedUnsigned16( textparms.holdTime, 1<<8 ) );
|
||||||
|
|
||||||
|
if ( textparms.effect == 2 )
|
||||||
|
WRITE_SHORT( FixedUnsigned16( textparms.fxTime, 1<<8 ) );
|
||||||
|
|
||||||
|
if ( strlen( pMessage ) < 512 )
|
||||||
|
{
|
||||||
|
WRITE_STRING( pMessage );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char tmp[512];
|
||||||
|
strncpy( tmp, pMessage, 511 );
|
||||||
|
tmp[511] = 0;
|
||||||
|
WRITE_STRING( tmp );
|
||||||
|
}
|
||||||
|
MESSAGE_END();
|
||||||
|
}
|
||||||
|
|
||||||
|
short FixedSigned16( float value, float scale )
|
||||||
|
{
|
||||||
|
int output;
|
||||||
|
|
||||||
|
output = (int) (value * scale);
|
||||||
|
|
||||||
|
if ( output > 32767 )
|
||||||
|
output = 32767;
|
||||||
|
|
||||||
|
if ( output < -32768 )
|
||||||
|
output = -32768;
|
||||||
|
|
||||||
|
return (short)output;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short FixedUnsigned16( float value, float scale )
|
||||||
|
{
|
||||||
|
int output;
|
||||||
|
|
||||||
|
output = (int) (value * scale);
|
||||||
|
if ( output < 0 )
|
||||||
|
output = 0;
|
||||||
|
if ( output > 0xFFFF )
|
||||||
|
output = 0xFFFF;
|
||||||
|
|
||||||
|
return (unsigned short)output;
|
||||||
|
}
|
||||||
#endif // USE_METAMOD
|
#endif // USE_METAMOD
|
||||||
|
@ -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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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*/);
|
||||||
@ -1944,6 +1948,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
||||||
|
#ifdef USE_METAMOD
|
||||||
|
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#else
|
||||||
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
const unsigned int /*type*/, const size_t /*size*/);
|
const unsigned int /*type*/, const size_t /*size*/);
|
||||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -1963,6 +1973,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa
|
|||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -1979,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_LogErrorFunc;
|
||||||
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;
|
||||||
@ -2017,6 +2031,9 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
|||||||
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
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_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
|
||||||
@ -2036,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) { }
|
||||||
@ -2050,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) { }
|
||||||
@ -2066,6 +2087,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
|||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
int MF_GetPlayerFlags (int id) { }
|
int MF_GetPlayerFlags (int id) { }
|
||||||
|
edict_t* MF_GetPlayerEdict (int id) { }
|
||||||
|
const char * MF_Format (const char *fmt, ...) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2083,11 +2106,14 @@ 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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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
|
||||||
@ -2097,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
|
||||||
@ -2121,6 +2148,8 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#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_Format g_fn_Format
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
|
@ -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_LogErrorFunc;
|
||||||
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_LogErrorFunc, 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);
|
||||||
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2649,11 +2683,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 +2701,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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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_LogErrorFunc;
|
||||||
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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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);
|
||||||
|
277
dlls/fun/fun.cpp
277
dlls/fun/fun.cpp
@ -47,20 +47,11 @@
|
|||||||
// params[2] = argument2 <--- use the ones in params[n] directly, to save some time.
|
// params[2] = argument2 <--- use the ones in params[n] directly, to save some time.
|
||||||
|
|
||||||
// Check receiver and sender validity. <--- Check ents, maybe need to do this better and more proper later?
|
// Check receiver and sender validity. <--- Check ents, maybe need to do this better and more proper later?
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients
|
CHECK_PLAYER(params[1])
|
||||||
|| params[2] < 1 || params[2] > gpGlobals->maxClients)
|
CHECK_PLAYER(params[2])
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE); <--- Call this, it will end up as RUN TIME ERROR 10 in server console.
|
|
||||||
return 0; <--- Standard return 0 with run time errors? (note in small only 0 returns false, everything else returns true)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get * pointer.
|
// Get * pointer.
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]); <--- Players require a different function than INDEXENT because of an HLSDK bug
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) { <--- Test this pointer this way, return 0...
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1 <--- If native succeeded, return 1, if the native isn't supposed to return a specific value.
|
return 1 <--- If native succeeded, return 1, if the native isn't supposed to return a specific value.
|
||||||
Note: Should be able to do: if (thenative()) and it should return false when it fails, and true when succeeds... is -1 treated as false, or is 0 a must?
|
Note: Should be able to do: if (thenative()) and it should return false when it fails, and true when succeeds... is -1 treated as false, or is 0 a must?
|
||||||
@ -98,12 +89,8 @@ static cell AMX_NATIVE_CALL get_client_listening(AMX *amx, cell *params) // get_
|
|||||||
// params[2] = sender
|
// params[2] = sender
|
||||||
|
|
||||||
// Check receiver and sender validity.
|
// Check receiver and sender validity.
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients
|
CHECK_PLAYER(params[1]);
|
||||||
|| params[2] < 1 || params[2] > gpGlobals->maxClients)
|
CHECK_PLAYER(params[2]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET- AND SETCLIENTLISTENING returns "qboolean", an int, probably 0 or 1...
|
// GET- AND SETCLIENTLISTENING returns "qboolean", an int, probably 0 or 1...
|
||||||
return GETCLIENTLISTENING(params[1], params[2]);
|
return GETCLIENTLISTENING(params[1], params[2]);
|
||||||
@ -117,12 +104,8 @@ static cell AMX_NATIVE_CALL set_client_listening(AMX *amx, cell *params) // set_
|
|||||||
// params[3] = listen
|
// params[3] = listen
|
||||||
|
|
||||||
// Check receiver and sender validity.
|
// Check receiver and sender validity.
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients
|
CHECK_PLAYER(params[1]);
|
||||||
|| params[2] < 1 || params[2] > gpGlobals->maxClients)
|
CHECK_PLAYER(params[2]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make a check on params[3] here later, and call run time error when it's wrong.
|
// Make a check on params[3] here later, and call run time error when it's wrong.
|
||||||
// To do: find out the possible values to set (0, 1?)
|
// To do: find out the possible values to set (0, 1?)
|
||||||
@ -138,19 +121,10 @@ static cell AMX_NATIVE_CALL set_user_godmode(AMX *amx, cell *params) // set_user
|
|||||||
// params[2] = godmode = 0
|
// params[2] = godmode = 0
|
||||||
|
|
||||||
// Check index.
|
// Check index.
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get player pointer.
|
// Get player pointer.
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params[2] == 1) {
|
if (params[2] == 1) {
|
||||||
// Enable godmode
|
// Enable godmode
|
||||||
@ -170,19 +144,10 @@ static cell AMX_NATIVE_CALL get_user_godmode(AMX *amx, cell *params) // get_user
|
|||||||
// params[1] = index
|
// params[1] = index
|
||||||
|
|
||||||
// Check index.
|
// Check index.
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get player pointer.
|
// Get player pointer.
|
||||||
edict_t *pPlayer = INDEXENT(params[1]);
|
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int godmode = 0;
|
int godmode = 0;
|
||||||
|
|
||||||
@ -203,20 +168,10 @@ static cell AMX_NATIVE_CALL give_item(AMX *amx, cell *params) // native give_ite
|
|||||||
// params[2] = item...
|
// params[2] = item...
|
||||||
|
|
||||||
// Check index.
|
// Check index.
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get player pointer.
|
// Get 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create item entity pointer
|
// Create item entity pointer
|
||||||
edict_t *pItemEntity;
|
edict_t *pItemEntity;
|
||||||
@ -240,7 +195,7 @@ static cell AMX_NATIVE_CALL give_item(AMX *amx, cell *params) // native give_ite
|
|||||||
pItemEntity = CREATE_NAMED_ENTITY(item);
|
pItemEntity = CREATE_NAMED_ENTITY(item);
|
||||||
|
|
||||||
if (FNullEnt(pItemEntity)) {
|
if (FNullEnt(pItemEntity)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Item \"%s\" failed to create", szItem);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,18 +233,9 @@ static cell AMX_NATIVE_CALL spawn(AMX *amx, cell *params) // spawn(id) = 1 param
|
|||||||
// Spawns an entity, this can be a user/player -> spawns at spawnpoints, or created entities seems to need this as a final "kick" into the game? :-)
|
// Spawns an entity, this can be a user/player -> spawns at spawnpoints, or created entities seems to need this as a final "kick" into the game? :-)
|
||||||
// params[1] = entity to spawn
|
// params[1] = entity to spawn
|
||||||
|
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxEntities)
|
CHECK_ENTITY(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
edict_t *pEnt = INDEXENT(params[1]);
|
|
||||||
|
|
||||||
// Check entity validity
|
edict_t *pEnt = GETEDICT(params[1]);
|
||||||
if (FNullEnt(pEnt)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
MDLL_Spawn(pEnt);
|
MDLL_Spawn(pEnt);
|
||||||
|
|
||||||
@ -303,19 +249,10 @@ static cell AMX_NATIVE_CALL set_user_health(AMX *amx, cell *params) // set_user_
|
|||||||
// params[2] = health
|
// params[2] = health
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kill if health too low.
|
// Kill if health too low.
|
||||||
if (params[2] > 0)
|
if (params[2] > 0)
|
||||||
@ -333,19 +270,10 @@ static cell AMX_NATIVE_CALL set_user_frags(AMX *amx, cell *params) // set_user_f
|
|||||||
// params[2] = frags
|
// params[2] = frags
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->v.frags = params[2];
|
pPlayer->v.frags = params[2];
|
||||||
|
|
||||||
@ -359,19 +287,10 @@ static cell AMX_NATIVE_CALL set_user_armor(AMX *amx, cell *params) // set_user_a
|
|||||||
// params[2] = armor
|
// params[2] = armor
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->v.armorvalue = params[2];
|
pPlayer->v.armorvalue = params[2];
|
||||||
|
|
||||||
@ -385,19 +304,10 @@ static cell AMX_NATIVE_CALL set_user_origin(AMX *amx, cell *params) // set_user_
|
|||||||
// params[2] = origin
|
// params[2] = origin
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cell *newVectorCell = MF_GetAmxAddr(amx, params[2]);
|
cell *newVectorCell = MF_GetAmxAddr(amx, params[2]);
|
||||||
|
|
||||||
@ -419,19 +329,10 @@ static cell AMX_NATIVE_CALL set_user_rendering(AMX *amx, cell *params) // set_us
|
|||||||
// params[7] = amount
|
// params[7] = amount
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->v.renderfx = params[2];
|
pPlayer->v.renderfx = params[2];
|
||||||
Vector newVector = Vector(float(params[3]), float(params[4]), float(params[5]));
|
Vector newVector = Vector(float(params[3]), float(params[4]), float(params[5]));
|
||||||
@ -452,19 +353,10 @@ static cell AMX_NATIVE_CALL set_user_maxspeed(AMX *amx, cell *params) // set_use
|
|||||||
REAL fNewSpeed = amx_ctof(params[2]);
|
REAL fNewSpeed = amx_ctof(params[2]);
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SETCLIENTMAXSPEED(pPlayer, fNewSpeed);
|
SETCLIENTMAXSPEED(pPlayer, fNewSpeed);
|
||||||
pPlayer->v.maxspeed = fNewSpeed;
|
pPlayer->v.maxspeed = fNewSpeed;
|
||||||
@ -478,19 +370,10 @@ static cell AMX_NATIVE_CALL get_user_maxspeed(AMX *amx, cell *params) // Float:g
|
|||||||
// params[1] = index
|
// params[1] = index
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return amx_ftoc(pPlayer->v.maxspeed);
|
return amx_ftoc(pPlayer->v.maxspeed);
|
||||||
}
|
}
|
||||||
@ -501,19 +384,10 @@ static cell AMX_NATIVE_CALL set_user_gravity(AMX *amx, cell *params) // set_user
|
|||||||
// params[1] = index
|
// params[1] = index
|
||||||
// params[2] = gravity (=-1.0)
|
// params[2] = gravity (=-1.0)
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
pPlayer->v.gravity = amx_ctof(params[2]);
|
pPlayer->v.gravity = amx_ctof(params[2]);
|
||||||
|
|
||||||
@ -526,19 +400,10 @@ static cell AMX_NATIVE_CALL get_user_gravity(AMX *amx, cell *params) // Float:ge
|
|||||||
// params[1] = index
|
// params[1] = index
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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]);
|
||||||
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return amx_ftoc(pPlayer->v.gravity);
|
return amx_ftoc(pPlayer->v.gravity);
|
||||||
}
|
}
|
||||||
@ -571,10 +436,7 @@ static cell AMX_NATIVE_CALL set_user_hitzones(AMX *amx, cell *params) // set_use
|
|||||||
else {
|
else {
|
||||||
if (shooter == 0) {
|
if (shooter == 0) {
|
||||||
// "All" shooters, target (gettingHit) should be existing player id
|
// "All" shooters, target (gettingHit) should be existing player id
|
||||||
if (gettingHit < 1 || gettingHit > gpGlobals->maxClients) {
|
CHECK_PLAYER(gettingHit);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// Where can gettingHit get hit by all?
|
// Where can gettingHit get hit by all?
|
||||||
g_zones_getHit[gettingHit] = hitzones;
|
g_zones_getHit[gettingHit] = hitzones;
|
||||||
}
|
}
|
||||||
@ -596,29 +458,14 @@ static cell AMX_NATIVE_CALL get_user_hitzones(AMX *amx, cell *params) // get_use
|
|||||||
int gettingHit = params[2];
|
int gettingHit = params[2];
|
||||||
|
|
||||||
if (shooter) {
|
if (shooter) {
|
||||||
if (FNullEnt(shooter)) {
|
CHECK_PLAYER(shooter);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_zones_toHit[shooter];
|
return g_zones_toHit[shooter];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!gettingHit) {
|
CHECK_PLAYER(gettingHit);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (FNullEnt(gettingHit)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return g_zones_getHit[gettingHit];
|
return g_zones_getHit[gettingHit];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL set_user_noclip(AMX *amx, cell *params) // set_user_noclip(index, noclip = 0); = 2 arguments
|
static cell AMX_NATIVE_CALL set_user_noclip(AMX *amx, cell *params) // set_user_noclip(index, noclip = 0); = 2 arguments
|
||||||
{
|
{
|
||||||
@ -627,20 +474,10 @@ static cell AMX_NATIVE_CALL set_user_noclip(AMX *amx, cell *params) // set_user_
|
|||||||
// params[2] = no clip or not...
|
// params[2] = no clip or not...
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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 validity.
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params[2] == 1)
|
if (params[2] == 1)
|
||||||
pPlayer->v.movetype = MOVETYPE_NOCLIP;
|
pPlayer->v.movetype = MOVETYPE_NOCLIP;
|
||||||
@ -656,20 +493,10 @@ static cell AMX_NATIVE_CALL get_user_noclip(AMX *amx, cell *params) // get_user_
|
|||||||
// params[1] = index
|
// params[1] = index
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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 validity.
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pPlayer->v.movetype == MOVETYPE_NOCLIP;
|
return pPlayer->v.movetype == MOVETYPE_NOCLIP;
|
||||||
}
|
}
|
||||||
@ -683,20 +510,10 @@ static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params) // set_us
|
|||||||
// params[2] = 0 = normal footstep sound, 1 = silent slippers
|
// params[2] = 0 = normal footstep sound, 1 = silent slippers
|
||||||
|
|
||||||
// Check index
|
// Check index
|
||||||
if (params[1] < 1 || params[1] > gpGlobals->maxClients)
|
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 validity.
|
|
||||||
if (FNullEnt(pPlayer)) {
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params[2]) {
|
if (params[2]) {
|
||||||
pPlayer->v.flTimeStepSound = 999;
|
pPlayer->v.flTimeStepSound = 999;
|
||||||
@ -712,13 +529,9 @@ static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params) // set_us
|
|||||||
|
|
||||||
// SidLuke
|
// SidLuke
|
||||||
static cell AMX_NATIVE_CALL strip_user_weapons(AMX *amx, cell *params) { // index
|
static cell AMX_NATIVE_CALL strip_user_weapons(AMX *amx, cell *params) { // index
|
||||||
if (!MF_IsPlayerIngame(params[1]))
|
CHECK_PLAYER(params[1]);
|
||||||
{
|
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
edict_t* pPlayer = INDEXENT(params[1]);
|
edict_t* pPlayer = MF_GetPlayerEdict(params[1]);
|
||||||
|
|
||||||
string_t item = MAKE_STRING("trigger_once");
|
string_t item = MAKE_STRING("trigger_once");
|
||||||
edict_t *pent = CREATE_NAMED_ENTITY( item );
|
edict_t *pent = CREATE_NAMED_ENTITY( item );
|
||||||
|
@ -60,3 +60,35 @@ bool g_ResetHUDbool;
|
|||||||
edict_t* g_edict;
|
edict_t* g_edict;
|
||||||
//bool g_bot[33]; // is user bot? <--- removed, only needed with akimbot
|
//bool g_bot[33]; // is user bot? <--- removed, only needed with akimbot
|
||||||
// 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); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (x <= gpGlobals->maxClients) { \
|
||||||
|
if (!MF_IsPlayerIngame(x)) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} else { \
|
||||||
|
if (x != 0 && FNullEnt(INDEXENT(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_PLAYER(x) \
|
||||||
|
if (x < 1 || x > gpGlobals->maxClients) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \
|
||||||
|
return 0; \
|
||||||
|
} else { \
|
||||||
|
if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define GETEDICT(n) \
|
||||||
|
((n >= 1 && n <= gpGlobals->maxClients) ? MF_GetPlayerEdict(n) : INDEXENT(n))
|
||||||
|
Binary file not shown.
@ -29,7 +29,7 @@
|
|||||||
// Do native functions init here (MF_AddNatives)
|
// Do native functions init here (MF_AddNatives)
|
||||||
#define FN_AMXX_ATTACH OnAmxxAttach
|
#define FN_AMXX_ATTACH OnAmxxAttach
|
||||||
// AMXX dettach
|
// AMXX dettach
|
||||||
#define FN_AMXX_DETTACH OnAmxxDettach
|
#define FN_AMXX_DETACH OnAmxxDetach
|
||||||
// All plugins loaded
|
// All plugins loaded
|
||||||
// Do forward functions init here (MF_RegisterForward)
|
// Do forward functions init here (MF_RegisterForward)
|
||||||
// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
|
// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
|
||||||
|
@ -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_LogErrorFunc;
|
||||||
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;
|
||||||
@ -2480,6 +2499,8 @@ PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
|||||||
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
||||||
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
PFN_GETPLAYERFLAGS g_fn_GetPlayerFlags;
|
||||||
|
PFN_GET_PLAYER_EDICT g_fn_GetPlayerEdict;
|
||||||
|
PFN_FORMAT g_fn_Format;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2523,7 +2544,9 @@ 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_LogErrorFunc, 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);
|
||||||
|
|
||||||
// Amx scripts
|
// Amx scripts
|
||||||
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
REQFUNC("GetAmxScript", g_fn_GetAmxScript, PFN_GET_AMXSCRIPT);
|
||||||
@ -2557,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);
|
||||||
@ -2569,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);
|
||||||
@ -2579,6 +2604,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
REQFUNC("GetPlayerArmor", g_fn_GetPlayerArmor, PFN_GET_PLAYER_ARMOR);
|
||||||
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
REQFUNC("GetPlayerHealth", g_fn_GetPlayerHealth, PFN_GET_PLAYER_HEALTH);
|
||||||
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS);
|
||||||
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
|
|
||||||
// Memory
|
// Memory
|
||||||
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
REQFUNC_OPT("Allocator", g_fn_Allocator, PFN_ALLOCATOR);
|
||||||
@ -2625,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2645,11 +2683,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);
|
||||||
@ -2660,6 +2701,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);
|
||||||
@ -2673,16 +2715,17 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_AmxExecv(0, 0, 0, 0, 0);
|
MF_AmxExecv(0, 0, 0, 0, 0);
|
||||||
MF_AmxFindPublic(0, 0, 0);
|
MF_AmxFindPublic(0, 0, 0);
|
||||||
MF_AmxAllot(0, 0, 0, 0);
|
MF_AmxAllot(0, 0, 0, 0);
|
||||||
MF_LoadAmxScript(0, 0, 0, 0);
|
MF_LoadAmxScript(0, 0, 0, 0, 0);
|
||||||
MF_UnloadAmxScript(0, 0);
|
MF_UnloadAmxScript(0, 0);
|
||||||
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForward(0, 0, 0, 0, 0, 0);
|
||||||
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
MF_RegisterSPForwardByName(0, 0, 0, 0, 0, 0);
|
||||||
MF_UnregisterSPForward(0);
|
MF_UnregisterSPForward(0);
|
||||||
|
MF_GetPlayerFrags(0);
|
||||||
|
MF_GetPlayerEdict(0);
|
||||||
|
MF_Format("", 4, "str");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MEMORY_TEST
|
|
||||||
|
|
||||||
/************* MEMORY *************/
|
/************* MEMORY *************/
|
||||||
// undef all defined macros
|
// undef all defined macros
|
||||||
#undef new
|
#undef new
|
||||||
@ -2796,7 +2839,7 @@ void *operator new(size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *operator new[](size_t reportedSize)
|
void *operator new[](size_t reportedSize)
|
||||||
@ -2809,7 +2852,7 @@ void *operator new[](size_t reportedSize)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Microsoft memory tracking operators
|
// Microsoft memory tracking operators
|
||||||
@ -2823,7 +2866,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
|
||||||
{
|
{
|
||||||
@ -2835,7 +2878,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
|
|||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
// allocation failed
|
// allocation failed
|
||||||
throw std::bad_alloc();
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator delete(void *reportedAddress)
|
void operator delete(void *reportedAddress)
|
||||||
@ -2854,8 +2897,6 @@ void operator delete[](void *reportedAddress)
|
|||||||
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //MEMORY_TEST
|
|
||||||
|
|
||||||
/************* stuff from dlls/util.cpp *************/
|
/************* stuff from dlls/util.cpp *************/
|
||||||
// must come here because cbase.h declares it's own operator new
|
// must come here because cbase.h declares it's own operator new
|
||||||
|
|
||||||
|
@ -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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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*/);
|
||||||
@ -1944,6 +1948,12 @@ typedef int (*PFN_IS_PLAYER_CONNECTING) (int /*id*/);
|
|||||||
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
typedef int (*PFN_IS_PLAYER_HLTV) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_ARMOR) (int /*id*/);
|
||||||
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
typedef int (*PFN_GET_PLAYER_HEALTH) (int /*id*/);
|
||||||
|
#ifdef USE_METAMOD
|
||||||
|
typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#else
|
||||||
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
const unsigned int /*type*/, const size_t /*size*/);
|
const unsigned int /*type*/, const size_t /*size*/);
|
||||||
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_REALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -1963,6 +1973,7 @@ typedef int (*PFN_REGISTER_SPFORWARD) (AMX * /*amx*/, int /*func*/, ... /*pa
|
|||||||
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
typedef int (*PFN_REGISTER_SPFORWARD_BYNAME) (AMX * /*amx*/, const char * /*funcName*/, ... /*params*/);
|
||||||
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
typedef void (*PFN_UNREGISTER_SPFORWARD) (int /*id*/);
|
||||||
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/);
|
||||||
|
typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/);
|
||||||
|
|
||||||
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
extern PFN_ADD_NATIVES g_fn_AddNatives;
|
||||||
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
extern PFN_BUILD_PATHNAME g_fn_BuildPathname;
|
||||||
@ -1979,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_LogErrorFunc;
|
||||||
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;
|
||||||
@ -2017,6 +2031,9 @@ extern PFN_UNREGISTER_SPFORWARD g_fn_UnregisterSPForward;
|
|||||||
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
extern PFN_MERGEDEFINITION_FILE g_fn_MergeDefinition_File;
|
||||||
extern PFN_AMX_FINDNATIVE g_fn_AmxFindNative;
|
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_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
|
||||||
@ -2036,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) { }
|
||||||
@ -2050,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) { }
|
||||||
@ -2066,6 +2087,8 @@ int MF_RegisterSPForwardByName (AMX * amx, const char *str, ...) { }
|
|||||||
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
int MF_RegisterSPForward (AMX * amx, int func, ...) { }
|
||||||
void MF_UnregisterSPForward (int id) { }
|
void MF_UnregisterSPForward (int id) { }
|
||||||
int MF_GetPlayerFlags (int id) { }
|
int MF_GetPlayerFlags (int id) { }
|
||||||
|
edict_t* MF_GetPlayerEdict (int id) { }
|
||||||
|
const char * MF_Format (const char *fmt, ...) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2083,11 +2106,14 @@ 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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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
|
||||||
@ -2097,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
|
||||||
@ -2121,8 +2148,8 @@ void MF_Log(const char *fmt, ...);
|
|||||||
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
#define MF_RegisterSPForward g_fn_RegisterSPForward
|
||||||
#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
|
||||||
#ifdef MEMORY_TEST
|
#define MF_Format g_fn_Format
|
||||||
|
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
void *operator new(size_t reportedSize);
|
void *operator new(size_t reportedSize);
|
||||||
@ -2167,6 +2194,4 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
|
|||||||
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
|
||||||
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
|
||||||
|
|
||||||
#endif //MEMORY_TEST
|
|
||||||
|
|
||||||
#endif // #ifndef __AMXXMODULE_H__
|
#endif // #ifndef __AMXXMODULE_H__
|
||||||
|
@ -72,7 +72,7 @@ static cell AMX_NATIVE_CALL sql_connect(AMX *amx, cell *params) // 6 param
|
|||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
if (!strlen(host) || !strlen(user) || !strlen(dbname)) {
|
if (!strlen(host) || !strlen(user) || !strlen(dbname)) {
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid parameter supplied");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ static cell AMX_NATIVE_CALL sql_error(AMX *amx, cell *params) // 3 params
|
|||||||
unsigned int id = params[1]-1;
|
unsigned int id = params[1]-1;
|
||||||
if (id >= DBList.size() || DBList[id]->isFree)
|
if (id >= DBList.size() || DBList[id]->isFree)
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid connection %d", id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,8 +146,7 @@ static cell AMX_NATIVE_CALL sql_query(AMX *amx, cell *params) // 2 params
|
|||||||
unsigned int id = params[1]-1;
|
unsigned int id = params[1]-1;
|
||||||
|
|
||||||
if (id >= DBList.size() || DBList[id]->isFree) {
|
if (id >= DBList.size() || DBList[id]->isFree) {
|
||||||
MF_Log("Invalid Database Handle %d", id);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Database Handle %d", id);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,8 +169,7 @@ static cell AMX_NATIVE_CALL sql_nextrow(AMX *amx, cell *params) // 1 param
|
|||||||
|
|
||||||
if (id >= Results.size() || Results[id]->isFree)
|
if (id >= Results.size() || Results[id]->isFree)
|
||||||
{
|
{
|
||||||
MF_Log("Invalid result handle %d", id);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,8 +186,7 @@ static cell AMX_NATIVE_CALL sql_close(AMX *amx, cell *params) // 1 param
|
|||||||
{
|
{
|
||||||
unsigned int id = params[1]-1;
|
unsigned int id = params[1]-1;
|
||||||
if (id >= DBList.size() || DBList[id]->isFree) {
|
if (id >= DBList.size() || DBList[id]->isFree) {
|
||||||
MF_Log("Invalid Database Handle %d", id);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid Database Handle %d", id);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,8 +207,7 @@ static cell AMX_NATIVE_CALL sql_getfield(AMX *amx, cell *params) // 2-4 params
|
|||||||
|
|
||||||
if (id >= Results.size() || Results[id]->isFree)
|
if (id >= Results.size() || Results[id]->isFree)
|
||||||
{
|
{
|
||||||
MF_Log("Invalid result handle %d", id);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +217,7 @@ static cell AMX_NATIVE_CALL sql_getfield(AMX *amx, cell *params) // 2-4 params
|
|||||||
const char *field = Result->GetField(id);
|
const char *field = Result->GetField(id);
|
||||||
if (field == NULL)
|
if (field == NULL)
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column %d", id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,8 +251,7 @@ static cell AMX_NATIVE_CALL sql_getresult(AMX *amx, cell *params) // 4 params
|
|||||||
|
|
||||||
if (id >= Results.size() || Results[id]->isFree)
|
if (id >= Results.size() || Results[id]->isFree)
|
||||||
{
|
{
|
||||||
MF_Log("Invalid result handle %d", id);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +263,7 @@ static cell AMX_NATIVE_CALL sql_getresult(AMX *amx, cell *params) // 4 params
|
|||||||
const char *field = Result->GetField(id);
|
const char *field = Result->GetField(id);
|
||||||
if (field == NULL)
|
if (field == NULL)
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column \"%s\"", column);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,8 +293,7 @@ static cell AMX_NATIVE_CALL sql_free_result(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if (id >= Results.size() || Results[id]->isFree)
|
if (id >= Results.size() || Results[id]->isFree)
|
||||||
{
|
{
|
||||||
MF_Log("Invalid result handle %d", id);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,8 +310,7 @@ static cell AMX_NATIVE_CALL sql_num_rows(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if (id >= Results.size() || Results[id]->isFree)
|
if (id >= Results.size() || Results[id]->isFree)
|
||||||
{
|
{
|
||||||
MF_Log("Invalid result handle %d", id);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ static cell AMX_NATIVE_CALL ns_giveitem(AMX *amx, cell *params)
|
|||||||
gpGamedllFuncs->dllapi_table->pfnSpawn(object); // emulate spawn
|
gpGamedllFuncs->dllapi_table->pfnSpawn(object); // emulate spawn
|
||||||
object->v.flags |= FL_ONGROUND; // make it think it's touched the ground
|
object->v.flags |= FL_ONGROUND; // make it think it's touched the ground
|
||||||
gpGamedllFuncs->dllapi_table->pfnThink(object); //
|
gpGamedllFuncs->dllapi_table->pfnThink(object); //
|
||||||
gpGamedllFuncs->dllapi_table->pfnTouch(player,object); // give it to the player
|
gpGamedllFuncs->dllapi_table->pfnTouch(object,player); // give it to the player
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -370,10 +370,93 @@ static cell AMX_NATIVE_CALL ns_user_kill(AMX *amx, cell *params)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#define ANGLEVECTORS (*g_engfuncs.pfnAngleVectors)
|
||||||
|
static cell AMX_NATIVE_CALL ns_user_slap(AMX *amx, cell *params) /* 2 param */
|
||||||
|
{
|
||||||
|
int index = params[1];
|
||||||
|
if (index<1||index>gpGlobals->maxClients)
|
||||||
|
return 0;
|
||||||
|
int power = abs((int)params[2]);
|
||||||
|
edict_t *e=INDEXENT2(index);
|
||||||
|
if (e->v.iuser3 == 2 /* Commander class*/)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (MF_IsPlayerIngame(index) && MF_IsPlayerAlive(index)) {
|
||||||
|
if (e->v.health <= power) {
|
||||||
|
float bef = e->v.frags;
|
||||||
|
/*MDLL_ClientKill(pPlayer->pEdict);*/
|
||||||
|
edict_t *pEntity = CREATE_NAMED_ENTITY(MAKE_STRING("trigger_hurt"));
|
||||||
|
if (pEntity)
|
||||||
|
{
|
||||||
|
KeyValueData kvd;
|
||||||
|
kvd.szClassName="trigger_hurt";
|
||||||
|
kvd.szKeyName="classname";
|
||||||
|
kvd.szValue="trigger_hurt";
|
||||||
|
kvd.fHandled=0;
|
||||||
|
MDLL_KeyValue(pEntity,&kvd);
|
||||||
|
kvd.szClassName="trigger_hurt";
|
||||||
|
kvd.szKeyName="dmg";
|
||||||
|
kvd.szValue="20000.0";
|
||||||
|
kvd.fHandled=0;
|
||||||
|
MDLL_KeyValue(pEntity,&kvd);
|
||||||
|
kvd.szClassName="trigger_hurt";
|
||||||
|
kvd.szKeyName="damagetype";
|
||||||
|
kvd.szValue="1";
|
||||||
|
kvd.fHandled=0;
|
||||||
|
MDLL_KeyValue(pEntity,&kvd);
|
||||||
|
kvd.szClassName="trigger_hurt";
|
||||||
|
kvd.szKeyName="origin";
|
||||||
|
kvd.szValue="8192 8192 8192";
|
||||||
|
kvd.fHandled=0;
|
||||||
|
MDLL_KeyValue(pEntity,&kvd);
|
||||||
|
MDLL_Spawn(pEntity);
|
||||||
|
pEntity->v.classname=MAKE_STRING("slap");
|
||||||
|
MDLL_Touch(pEntity,e);
|
||||||
|
REMOVE_ENTITY(pEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
e->v.frags = bef;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
edict_t *pEdict = e;
|
||||||
|
int numparam = *params/sizeof(cell);
|
||||||
|
if (numparam<3 || params[3]) {
|
||||||
|
pEdict->v.velocity.x += RANDOM_LONG(-600,600);
|
||||||
|
pEdict->v.velocity.y += RANDOM_LONG(-180,180);
|
||||||
|
pEdict->v.velocity.z += RANDOM_LONG(100,200);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vec3_t v_forward, v_right;
|
||||||
|
vec3_t vang = pEdict->v.angles;
|
||||||
|
float fang[3];
|
||||||
|
fang[0] = vang.x;
|
||||||
|
fang[1] = vang.y;
|
||||||
|
fang[2] = vang.z;
|
||||||
|
ANGLEVECTORS( fang, v_forward, v_right, NULL );
|
||||||
|
pEdict->v.velocity = pEdict->v.velocity + v_forward * 220 + Vector(0,0,200);
|
||||||
|
}
|
||||||
|
pEdict->v.punchangle.x = RANDOM_LONG(-10,10);
|
||||||
|
pEdict->v.punchangle.y = RANDOM_LONG(-10,10);
|
||||||
|
pEdict->v.health -= power;
|
||||||
|
int armor = (int)pEdict->v.armorvalue;
|
||||||
|
armor -= power;
|
||||||
|
if (armor < 0) armor = 0;
|
||||||
|
pEdict->v.armorvalue = armor;
|
||||||
|
pEdict->v.dmg_inflictor = pEdict;
|
||||||
|
static const char *bit_sound[3] = {
|
||||||
|
"weapons/cbar_hitbod1.wav",
|
||||||
|
"weapons/cbar_hitbod2.wav",
|
||||||
|
"weapons/cbar_hitbod3.wav" };
|
||||||
|
EMIT_SOUND_DYN2(pEdict, CHAN_VOICE, bit_sound[RANDOM_LONG(0,2)], 1.0, ATTN_NORM, 0, PITCH_NORM);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
AMX_NATIVE_INFO ns_misc_natives[] = {
|
AMX_NATIVE_INFO ns_misc_natives[] = {
|
||||||
///////////////////
|
///////////////////
|
||||||
{ "user_kill", ns_user_kill },
|
{ "user_kill", ns_user_kill },
|
||||||
|
{ "user_slap", ns_user_slap },
|
||||||
|
|
||||||
{ "ns_get_build", ns_get_build },
|
{ "ns_get_build", ns_get_build },
|
||||||
|
|
||||||
|
@ -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_LogErrorFunc;
|
||||||
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_LogErrorFunc, 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);
|
||||||
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2649,11 +2683,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 +2701,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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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_LogErrorFunc;
|
||||||
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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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);
|
||||||
|
@ -9,6 +9,8 @@ CSpawn ns_spawnpoints;
|
|||||||
CPlayer g_player[33];
|
CPlayer g_player[33];
|
||||||
edict_t *player_edicts[33];
|
edict_t *player_edicts[33];
|
||||||
|
|
||||||
|
BOOL CheckForPublic(const char *publicname);
|
||||||
|
|
||||||
int gmsgHudText2=0;
|
int gmsgHudText2=0;
|
||||||
int ChangeclassForward = -1;
|
int ChangeclassForward = -1;
|
||||||
int BuiltForward = -1;
|
int BuiltForward = -1;
|
||||||
@ -35,13 +37,25 @@ void OnPluginsLoaded()
|
|||||||
iscombat=FALSE;
|
iscombat=FALSE;
|
||||||
char mapname[255];
|
char mapname[255];
|
||||||
strcpy(mapname,STRING(gpGlobals->mapname));
|
strcpy(mapname,STRING(gpGlobals->mapname));
|
||||||
if ((mapname[0]=='c' || mapname[0]=='C') && (mapname[1]=='o' || mapname[0]=='O') && mapname[2]=='_')
|
if ((mapname[0]=='c' || mapname[0]=='C') && (mapname[1]=='o' || mapname[1]=='O') && mapname[2]=='_')
|
||||||
iscombat=TRUE;
|
iscombat=TRUE;
|
||||||
|
|
||||||
ChangeclassForward = MF_RegisterForward("client_changeclass", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
ChangeclassForward = MF_RegisterForward("client_changeclass", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
// No sense in this if it's combat..
|
// No sense in this if it's combat..
|
||||||
if (!iscombat)
|
if (!iscombat) {
|
||||||
|
if (CheckForPublic("client_built")) {
|
||||||
BuiltForward = MF_RegisterForward("client_built", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
BuiltForward = MF_RegisterForward("client_built", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
|
g_pengfuncsTable_Post->pfnAlertMessage=AlertMessage_Post;
|
||||||
|
g_pengfuncsTable->pfnCreateNamedEntity=CreateNamedEntity;
|
||||||
|
} else {
|
||||||
|
g_pengfuncsTable_Post->pfnAlertMessage=NULL;
|
||||||
|
g_pengfuncsTable->pfnCreateNamedEntity=NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// no need for these hooks in co
|
||||||
|
g_pengfuncsTable_Post->pfnAlertMessage=NULL;
|
||||||
|
g_pengfuncsTable->pfnCreateNamedEntity=NULL;
|
||||||
|
}
|
||||||
SpawnForward = MF_RegisterForward("client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
|
SpawnForward = MF_RegisterForward("client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
|
||||||
TeamForward = MF_RegisterForward("client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*new team*/,FP_CELL/*old team*/,FP_DONE);
|
TeamForward = MF_RegisterForward("client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*new team*/,FP_CELL/*old team*/,FP_DONE);
|
||||||
}
|
}
|
||||||
@ -120,7 +134,7 @@ void PlayerPostThink_Post(edict_t *pEntity)
|
|||||||
// name<CID><AUTHID><TEAM> changed role to "class" -- client_changeclass
|
// name<CID><AUTHID><TEAM> changed role to "class" -- client_changeclass
|
||||||
void AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
|
void AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
|
||||||
{
|
{
|
||||||
if (atype != at_logged || iscombat)
|
if (atype != at_logged)
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
va_list LogArg;
|
va_list LogArg;
|
||||||
char *sz, *message;
|
char *sz, *message;
|
||||||
@ -275,8 +289,9 @@ void AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
|
|||||||
iForward = 1;
|
iForward = 1;
|
||||||
}
|
}
|
||||||
// ns2amx_built.execute(index,iCreateEntityIndex,iForward,iType);
|
// ns2amx_built.execute(index,iCreateEntityIndex,iForward,iType);
|
||||||
if (BuiltForward != -1)
|
if (BuiltForward != -1) {
|
||||||
MF_ExecuteForward(BuiltForward, index, iCreateEntityIndex, iForward, iType);
|
MF_ExecuteForward(BuiltForward, index, FStrEq((const char *)szParm[3],"type \"weapon_mine\"") ? 0 : iCreateEntityIndex, iForward, iType);
|
||||||
|
}
|
||||||
iCreateEntityIndex=0;
|
iCreateEntityIndex=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -450,3 +465,24 @@ edict_t *UTIL_FindEntityByString(edict_t *pentStart, const char *szKeyword, cons
|
|||||||
return pentEntity;
|
return pentEntity;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CheckForPublic(const char *publicname)
|
||||||
|
{
|
||||||
|
AMX* amx;
|
||||||
|
char blah[64];
|
||||||
|
strncpy(blah,publicname,63);
|
||||||
|
int iFunctionIndex;
|
||||||
|
int i=0;
|
||||||
|
// Loop through all running scripts
|
||||||
|
while((amx=MF_GetScriptAmx(i++))!=NULL)
|
||||||
|
{
|
||||||
|
// Scan for public
|
||||||
|
if (MF_AmxFindPublic(amx, blah, &iFunctionIndex) == AMX_ERR_NONE)
|
||||||
|
{
|
||||||
|
// Public was found.
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE; // no public found in any loaded script
|
||||||
|
}
|
@ -179,7 +179,7 @@
|
|||||||
// #define FN_AngleVectors AngleVectors
|
// #define FN_AngleVectors AngleVectors
|
||||||
// #define FN_CreateEntity CreateEntity
|
// #define FN_CreateEntity CreateEntity
|
||||||
// #define FN_RemoveEntity RemoveEntity
|
// #define FN_RemoveEntity RemoveEntity
|
||||||
// #define FN_CreateNamedEntity CreateNamedEntity
|
#define FN_CreateNamedEntity CreateNamedEntity
|
||||||
// #define FN_MakeStatic MakeStatic
|
// #define FN_MakeStatic MakeStatic
|
||||||
// #define FN_EntIsOnFloor EntIsOnFloor
|
// #define FN_EntIsOnFloor EntIsOnFloor
|
||||||
// #define FN_DropToFloor DropToFloor
|
// #define FN_DropToFloor DropToFloor
|
||||||
|
@ -10,6 +10,14 @@
|
|||||||
#include "CSpawn.h"
|
#include "CSpawn.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
|
|
||||||
|
extern DLL_FUNCTIONS *g_pFunctionTable;
|
||||||
|
extern DLL_FUNCTIONS *g_pFunctionTable_Post;
|
||||||
|
extern enginefuncs_t *g_pengfuncsTable;
|
||||||
|
extern enginefuncs_t *g_pengfuncsTable_Post;
|
||||||
|
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable;
|
||||||
|
extern NEW_DLL_FUNCTIONS *g_pNewFunctionsTable_Post;
|
||||||
|
|
||||||
|
|
||||||
extern CSpawn ns_spawnpoints;
|
extern CSpawn ns_spawnpoints;
|
||||||
|
|
||||||
|
|
||||||
|
Binary file not shown.
@ -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_LogErrorFunc;
|
||||||
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_LogErrorFunc, 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);
|
||||||
@ -2629,6 +2651,18 @@ void MF_Log(const char *fmt, ...)
|
|||||||
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
g_fn_Log("[%s] %s", MODULE_NAME, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
// :TODO: Overflow possible here
|
||||||
|
char msg[3072];
|
||||||
|
va_list arglst;
|
||||||
|
va_start(arglst, fmt);
|
||||||
|
vsprintf(msg, fmt, arglst);
|
||||||
|
va_end(arglst);
|
||||||
|
|
||||||
|
g_fn_LogErrorFunc(amx, err, "[%s] %s", MODULE_NAME, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// validate macros
|
// validate macros
|
||||||
@ -2649,11 +2683,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 +2701,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*/);
|
||||||
@ -1934,6 +1937,7 @@ 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_LogErrorFunc;
|
||||||
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, ...);
|
||||||
|
void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
||||||
#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);
|
||||||
|
@ -215,7 +215,7 @@ static cell AMX_NATIVE_CALL sql_getfield(AMX *amx, cell *params) // 2-4 params
|
|||||||
const char *field = Result->GetField(params[2]-1);
|
const char *field = Result->GetField(params[2]-1);
|
||||||
if (field == NULL)
|
if (field == NULL)
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column %d", params[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ static cell AMX_NATIVE_CALL sql_getresult(AMX *amx, cell *params) // 4 params
|
|||||||
const char *field = Result->GetField(column);
|
const char *field = Result->GetField(column);
|
||||||
if (field == NULL)
|
if (field == NULL)
|
||||||
{
|
{
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid column \"%s\"", field);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,8 +317,7 @@ static cell AMX_NATIVE_CALL sql_num_rows(AMX *amx, cell *params)
|
|||||||
|
|
||||||
if (id >= Results.size() || Results[id]->isFree)
|
if (id >= Results.size() || Results[id]->isFree)
|
||||||
{
|
{
|
||||||
MF_Log("Invalid result handle %d", id);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid result handle %d", id);
|
||||||
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
114
dlls/regex/CRegEx.cpp
Executable file
114
dlls/regex/CRegEx.cpp
Executable file
@ -0,0 +1,114 @@
|
|||||||
|
#include "pcre.h"
|
||||||
|
#include "CRegEx.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include "amxxmodule.h"
|
||||||
|
|
||||||
|
RegEx::RegEx()
|
||||||
|
{
|
||||||
|
mErrorOffset = 0;
|
||||||
|
mError = NULL;
|
||||||
|
re = NULL;
|
||||||
|
mFree = true;
|
||||||
|
subject = NULL;
|
||||||
|
mSubStrings = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegEx::Clear()
|
||||||
|
{
|
||||||
|
mErrorOffset = 0;
|
||||||
|
mError = NULL;
|
||||||
|
if (re)
|
||||||
|
pcre_free(re);
|
||||||
|
re = NULL;
|
||||||
|
mFree = true;
|
||||||
|
if (subject)
|
||||||
|
delete [] subject;
|
||||||
|
subject = NULL;
|
||||||
|
mSubStrings = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegEx::~RegEx()
|
||||||
|
{
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RegEx::isFree(bool set, bool val)
|
||||||
|
{
|
||||||
|
if (set)
|
||||||
|
{
|
||||||
|
mFree = val;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return mFree;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int RegEx::Compile(const char *pattern)
|
||||||
|
{
|
||||||
|
int errno;
|
||||||
|
|
||||||
|
if (!mFree)
|
||||||
|
Clear();
|
||||||
|
|
||||||
|
re = pcre_compile(pattern, 0, &mError, &mErrorOffset, NULL);
|
||||||
|
|
||||||
|
if (re == NULL)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mFree = false;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RegEx::Match(const char *str)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
if (mFree || re == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
//save str
|
||||||
|
subject = new char[strlen(str)+1];
|
||||||
|
strcpy(subject, str);
|
||||||
|
|
||||||
|
rc = pcre_exec(re, NULL, subject, (int)strlen(subject), 0, 0, ovector, 30);
|
||||||
|
|
||||||
|
if (rc < 0)
|
||||||
|
{
|
||||||
|
if (rc == PCRE_ERROR_NOMATCH)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
mErrorOffset = rc;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mSubStrings = rc;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *RegEx::GetSubstring(int s, char buffer[], int max)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
if (s >= mSubStrings || s < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
char *substr_a = subject + ovector[2*s];
|
||||||
|
int substr_l = ovector[2*s+1] - ovector[2*s];
|
||||||
|
|
||||||
|
for (i = 0; i<substr_l; i++)
|
||||||
|
{
|
||||||
|
if (i >= max)
|
||||||
|
break;
|
||||||
|
buffer[i] = substr_a[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[i] = '\0';
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
27
dlls/regex/CRegEx.h
Executable file
27
dlls/regex/CRegEx.h
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef _INCLUDE_CREGEX_H
|
||||||
|
#define _INCLUDE_CREGEX_H
|
||||||
|
|
||||||
|
class RegEx
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RegEx();
|
||||||
|
~RegEx();
|
||||||
|
bool isFree(bool set=false, bool val=false);
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
int Compile(const char *pattern);
|
||||||
|
int Match(const char *str);
|
||||||
|
const char *GetSubstring(int s, char buffer[], int max);
|
||||||
|
public:
|
||||||
|
int mErrorOffset;
|
||||||
|
const char *mError;
|
||||||
|
int mSubStrings;
|
||||||
|
private:
|
||||||
|
pcre *re;
|
||||||
|
bool mFree;
|
||||||
|
int ovector[30];
|
||||||
|
char *subject;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //_INCLUDE_CREGEX_H
|
||||||
|
|
444
dlls/regex/CVector.h
Executable file
444
dlls/regex/CVector.h
Executable file
@ -0,0 +1,444 @@
|
|||||||
|
/* AMX Mod X
|
||||||
|
*
|
||||||
|
* by the AMX Mod X Development Team
|
||||||
|
* originally developed by OLO
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* In addition, as a special exception, the author gives permission to
|
||||||
|
* link the code of this program with the Half-Life Game Engine ("HL
|
||||||
|
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
||||||
|
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
||||||
|
* respects for all of the code used other than the HL Engine and MODs
|
||||||
|
* from Valve. If you modify this file, you may extend this exception
|
||||||
|
* to your version of the file, but you are not obligated to do so. If
|
||||||
|
* you do not wish to do so, delete this exception statement from your
|
||||||
|
* version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CVECTOR_H__
|
||||||
|
#define __CVECTOR_H__
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
// Vector
|
||||||
|
template <class T> class CVector
|
||||||
|
{
|
||||||
|
bool Grow()
|
||||||
|
{
|
||||||
|
// automatic grow
|
||||||
|
size_t newSize = m_Size * 2;
|
||||||
|
if (newSize == 0)
|
||||||
|
newSize = 8; // a good init value
|
||||||
|
T *newData = new T[newSize];
|
||||||
|
if (!newData)
|
||||||
|
return false;
|
||||||
|
if (m_Data)
|
||||||
|
{
|
||||||
|
memcpy(newData, m_Data, m_Size * sizeof(T));
|
||||||
|
delete [] m_Data;
|
||||||
|
}
|
||||||
|
m_Data = newData;
|
||||||
|
m_Size = newSize;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GrowIfNeeded()
|
||||||
|
{
|
||||||
|
if (m_CurrentUsedSize >= m_Size)
|
||||||
|
return Grow();
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChangeSize(size_t size)
|
||||||
|
{
|
||||||
|
// change size
|
||||||
|
if (size == m_Size)
|
||||||
|
return true;
|
||||||
|
T *newData = new T[size];
|
||||||
|
if (!newData)
|
||||||
|
return false;
|
||||||
|
if (m_Data)
|
||||||
|
{
|
||||||
|
memcpy(newData, m_Data, (m_Size < size) ? (m_Size * sizeof(T)) : (size * sizeof(T)));
|
||||||
|
delete [] m_Data;
|
||||||
|
}
|
||||||
|
if (m_Size < size)
|
||||||
|
m_CurrentSize = size;
|
||||||
|
m_Data = newData;
|
||||||
|
m_Size = size;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeMemIfPossible()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
T *m_Data;
|
||||||
|
size_t m_Size;
|
||||||
|
size_t m_CurrentUsedSize;
|
||||||
|
size_t m_CurrentSize;
|
||||||
|
public:
|
||||||
|
class iterator
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
T *m_Ptr;
|
||||||
|
public:
|
||||||
|
// constructors / destructors
|
||||||
|
iterator()
|
||||||
|
{
|
||||||
|
m_Ptr = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator(T * ptr)
|
||||||
|
{
|
||||||
|
m_Ptr = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// member functions
|
||||||
|
T * base()
|
||||||
|
{
|
||||||
|
return m_Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const T * base() const
|
||||||
|
{
|
||||||
|
return m_Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// operators
|
||||||
|
T & operator*()
|
||||||
|
{
|
||||||
|
return *m_Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
T * operator->()
|
||||||
|
{
|
||||||
|
return m_Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator & operator++() // preincrement
|
||||||
|
{
|
||||||
|
++m_Ptr;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator operator++(int) // postincrement
|
||||||
|
{
|
||||||
|
iterator tmp = *this;
|
||||||
|
++m_Ptr;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator & operator--() // predecrement
|
||||||
|
{
|
||||||
|
--m_Ptr;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator operator--(int) // postdecrememnt
|
||||||
|
{
|
||||||
|
iterator tmp = *this;
|
||||||
|
--m_Ptr;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(T * right) const
|
||||||
|
{
|
||||||
|
return (m_Ptr == right);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const iterator & right) const
|
||||||
|
{
|
||||||
|
return (m_Ptr == right.m_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(T * right) const
|
||||||
|
{
|
||||||
|
return (m_Ptr != right);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const iterator & right) const
|
||||||
|
{
|
||||||
|
return (m_Ptr != right.m_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator & operator+=(size_t offset)
|
||||||
|
{
|
||||||
|
m_Ptr += offset;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator & operator-=(size_t offset)
|
||||||
|
{
|
||||||
|
m_Ptr += offset;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator operator+(size_t offset) const
|
||||||
|
{
|
||||||
|
iterator tmp(*this);
|
||||||
|
tmp.m_Ptr += offset;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator operator-(size_t offset) const
|
||||||
|
{
|
||||||
|
iterator tmp(*this);
|
||||||
|
tmp.m_Ptr += offset;
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
T & operator[](size_t offset)
|
||||||
|
{
|
||||||
|
return (*(*this + offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
const T & operator[](size_t offset) const
|
||||||
|
{
|
||||||
|
return (*(*this + offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<(const iterator & right) const
|
||||||
|
{
|
||||||
|
return m_Ptr < right.m_Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator>(const iterator & right) const
|
||||||
|
{
|
||||||
|
return m_Ptr > right.m_Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<=(const iterator & right) const
|
||||||
|
{
|
||||||
|
return m_Ptr <= right.m_Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator>=(const iterator & right) const
|
||||||
|
{
|
||||||
|
return m_Ptr >= right.m_Ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t operator-(const iterator & right) const
|
||||||
|
{
|
||||||
|
return m_Ptr - right.m_Ptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// constructors / destructors
|
||||||
|
CVector<T>()
|
||||||
|
{
|
||||||
|
m_Size = 0;
|
||||||
|
m_CurrentUsedSize = 0;
|
||||||
|
m_Data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CVector<T>(const CVector<T> & other)
|
||||||
|
{
|
||||||
|
// copy data
|
||||||
|
m_Data = new T [other.m_Size];
|
||||||
|
m_Size = other.m_Size;
|
||||||
|
m_CurrentUsedSize = other.m_CurrentUsedSize;
|
||||||
|
memcpy(m_Data, other.m_Data, m_CurrentUsedSize * sizeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
~CVector<T>()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// interface
|
||||||
|
size_t size() const
|
||||||
|
{
|
||||||
|
return m_CurrentUsedSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t capacity() const
|
||||||
|
{
|
||||||
|
return m_Size;
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator begin()
|
||||||
|
{
|
||||||
|
return iterator(m_Data);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator end()
|
||||||
|
{
|
||||||
|
return iterator(m_Data + m_CurrentUsedSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator iterAt(size_t pos)
|
||||||
|
{
|
||||||
|
if (pos > m_CurrentUsedSize)
|
||||||
|
assert(0);
|
||||||
|
return iterator(m_Data + pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool reserve(size_t newSize)
|
||||||
|
{
|
||||||
|
return ChangeSize(newSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool push_back(const T & elem)
|
||||||
|
{
|
||||||
|
++m_CurrentUsedSize;
|
||||||
|
if (!GrowIfNeeded())
|
||||||
|
{
|
||||||
|
--m_CurrentUsedSize;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Data[m_CurrentUsedSize - 1] = elem;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pop_back()
|
||||||
|
{
|
||||||
|
--m_CurrentUsedSize;
|
||||||
|
if (m_CurrentUsedSize < 0)
|
||||||
|
m_CurrentUsedSize = 0;
|
||||||
|
// :TODO: free memory sometimes
|
||||||
|
}
|
||||||
|
|
||||||
|
bool resize(size_t newSize)
|
||||||
|
{
|
||||||
|
if (!ChangeSize(newSize))
|
||||||
|
return false;
|
||||||
|
FreeMemIfPossible();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool empty() const
|
||||||
|
{
|
||||||
|
return (m_CurrentUsedSize == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
T & at(size_t pos)
|
||||||
|
{
|
||||||
|
if (pos > m_CurrentUsedSize)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
return m_Data[pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
const T & at(size_t pos) const
|
||||||
|
{
|
||||||
|
if (pos > m_CurrentUsedSize)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
return m_Data[pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
T & operator[](size_t pos)
|
||||||
|
{
|
||||||
|
return at(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
const T & operator[](size_t pos) const
|
||||||
|
{
|
||||||
|
return at(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
T & front()
|
||||||
|
{
|
||||||
|
if (m_CurrentUsedSize < 1)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
return m_Data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
const T & front() const
|
||||||
|
{
|
||||||
|
if (m_CurrentUsedSize < 1)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
return m_Data[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
T & back()
|
||||||
|
{
|
||||||
|
if (m_CurrentUsedSize < 1)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
return m_Data[m_CurrentUsedSize - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
const T & back() const
|
||||||
|
{
|
||||||
|
if (m_CurrentUsedSize < 1)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
return m_Data[m_CurrentUsedSize - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool insert(iterator where, const T & value)
|
||||||
|
{
|
||||||
|
// we have to insert before
|
||||||
|
// if it is begin, don't decrement
|
||||||
|
if (where != m_Data)
|
||||||
|
--where;
|
||||||
|
// validate iter
|
||||||
|
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
++m_CurrentUsedSize;
|
||||||
|
if (!GrowIfNeeded())
|
||||||
|
{
|
||||||
|
--m_CurrentUsedSize;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
memmove(where.base() + 1, where.base(), m_CurrentUsedSize - (where - m_Data));
|
||||||
|
memcpy(where.base(), &value, sizeof(T));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void erase(iterator where)
|
||||||
|
{
|
||||||
|
// validate iter
|
||||||
|
if (where < m_Data || where >= (m_Data + m_CurrentUsedSize))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (m_CurrentUsedSize > 1)
|
||||||
|
{
|
||||||
|
// move
|
||||||
|
memmove(where.base(), where.base() + 1, m_CurrentUsedSize - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
--m_CurrentUsedSize;
|
||||||
|
// :TODO: free memory sometimes
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
m_Size = 0;
|
||||||
|
m_CurrentUsedSize = 0;
|
||||||
|
delete [] m_Data;
|
||||||
|
m_Data = NULL;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __CVECTOR_H__
|
||||||
|
|
185
dlls/regex/Makefile.pl
Executable file
185
dlls/regex/Makefile.pl
Executable file
@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#(C)2004 AMX Mod X Development Team
|
||||||
|
# by David "BAILOPAN" Anderson
|
||||||
|
|
||||||
|
# output will occur in bin.x.proc
|
||||||
|
# where x is debug or opt and proc is ix86 or amd64
|
||||||
|
# You must use this script from the project src dir
|
||||||
|
|
||||||
|
#options =
|
||||||
|
# debug - enable gdb debugging
|
||||||
|
# amd64 - compile for AMD64
|
||||||
|
# proc=ix86 - assumed not amd64
|
||||||
|
# clean - clean the specifications above
|
||||||
|
|
||||||
|
$PROJECT = "regex_amxx";
|
||||||
|
$sdk = "../../hlsdk/SourceCode";
|
||||||
|
$mm = "../../metamod/metamod";
|
||||||
|
$gccf = "gcc";
|
||||||
|
$pcreposix = "/usr/local/lib/libpcreposix.a";
|
||||||
|
$pcre = "/usr/local/lib/libpcre.a";
|
||||||
|
|
||||||
|
@CPP_SOURCE_FILES = ("CRegEx.cpp", "module.cpp", "amxxmodule.cpp");
|
||||||
|
|
||||||
|
@C_SOURCE_FILES = ();
|
||||||
|
my %OPTIONS, %OPT;
|
||||||
|
|
||||||
|
$OPT{"debug"} = "-g -ggdb";
|
||||||
|
$OPT{"opt"} = "-O2 -ffast-math -funroll-loops -fomit-frame-pointer -s -DNDEBUG -Wall -Wno-unknown-pragmas -DOPT_TYPE=\"optimized\"";
|
||||||
|
|
||||||
|
$OPTIONS{"include"} = "-I$sdk -I. -I$mm -I$sdk/engine -I$sdk/common -I$sdk/pm_shared -I$sdk/dlls";
|
||||||
|
|
||||||
|
while ($cmd = shift)
|
||||||
|
{
|
||||||
|
if ($cmd =~ /amd64/) {
|
||||||
|
$OPTIONS{"amd64"} = 1;
|
||||||
|
} elsif ($cmd =~ /debug/) {
|
||||||
|
$OPTIONS{"debug"} = 1;
|
||||||
|
} elsif ($cmd =~ /proc=i(\d)86/) {
|
||||||
|
$proc = $1;
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
die "You cannot compile for i".$proc."86 and AMD64.\n";
|
||||||
|
} else {
|
||||||
|
$OPTIONS{"proc"} = "i".$proc."86";
|
||||||
|
}
|
||||||
|
} elsif ($cmd =~ /clean/) {
|
||||||
|
$OPTIONS{"clean"} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$gcc = `$gccf --version`;
|
||||||
|
if ($gcc =~ /2\.9/)
|
||||||
|
{
|
||||||
|
$OPT{"opt"} .= " -malign-loops=2 -malign-jumps=2 -malign-functions=2";
|
||||||
|
} else {
|
||||||
|
$OPT{"opt"} .= " -falign-loops=2 -falign-jumps=2 -falign-functions=2";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"debug"})
|
||||||
|
{
|
||||||
|
$cflags = $OPT{"debug"};
|
||||||
|
} else {
|
||||||
|
if (!$OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$proc = $OPTIONS{"proc"};
|
||||||
|
if (!$proc)
|
||||||
|
{
|
||||||
|
$proc = 3;
|
||||||
|
}
|
||||||
|
$cflags = "-march=i".$proc."86 ".$OPT{"opt"};
|
||||||
|
} else {
|
||||||
|
$cflags = $OPT{"opt"};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$cflags .= " -m64 -DHAVE_I64 -DSMALL_CELL_SIZE=64 $cflags";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"debug"})
|
||||||
|
{
|
||||||
|
$outdir = "bin.debug";
|
||||||
|
} else {
|
||||||
|
$outdir = "bin.opt";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($OPTIONS{"amd64"})
|
||||||
|
{
|
||||||
|
$outdir .= ".amd64";
|
||||||
|
$bin = $PROJECT."_amd64.so";
|
||||||
|
} else {
|
||||||
|
$proc = $OPTIONS{"proc"};
|
||||||
|
if ($proc)
|
||||||
|
{
|
||||||
|
$outdir .= ".i".$proc."86";
|
||||||
|
$bin = $PROJECT."_i".$proc."86.so";
|
||||||
|
} else {
|
||||||
|
$outdir .= ".i386";
|
||||||
|
$bin = $PROJECT."_i386.so";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unlink("$outdir/$bin");
|
||||||
|
if ($OPTIONS{"clean"})
|
||||||
|
{
|
||||||
|
`rm $outdir/*.o`;
|
||||||
|
die("Project cleaned.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#create the dirs
|
||||||
|
#build link list
|
||||||
|
my @LINK;
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $CPP_SOURCE_FILES[$i];
|
||||||
|
$file =~ s/\.cpp/\.o/;
|
||||||
|
push(@LINK, $outdir."/".$file);
|
||||||
|
}
|
||||||
|
for ($i=0; $i<=$#C_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $C_SOURCE_FILES[$i];
|
||||||
|
$file =~ s/\.c/\.o/;
|
||||||
|
push(@LINK, $outdir."/".$file);
|
||||||
|
}
|
||||||
|
|
||||||
|
push(@LINK, $pcre);
|
||||||
|
push(@LINK, $pcreposix);
|
||||||
|
|
||||||
|
if (!(-d $outdir))
|
||||||
|
{
|
||||||
|
mkdir($outdir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inc = $OPTIONS{"include"};
|
||||||
|
|
||||||
|
$cflags .= " -fno-exceptions";
|
||||||
|
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $CPP_SOURCE_FILES[$i];
|
||||||
|
$ofile = $file;
|
||||||
|
$ofile =~ s/\.cpp/\.o/;
|
||||||
|
$ofile = "$outdir/$ofile";
|
||||||
|
$gcc = "$gccf $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
|
if (-e $ofile)
|
||||||
|
{
|
||||||
|
$file_time = (stat($file))[9];
|
||||||
|
$ofile_time = (stat($ofile))[9];
|
||||||
|
if ($file_time > $ofile_time)
|
||||||
|
{
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i=0; $i<=$#CPP_SOURCE_FILES; $i++)
|
||||||
|
{
|
||||||
|
$file = $C_SOURCE_FILES[$i];
|
||||||
|
$ofile = $file;
|
||||||
|
$ofile =~ s/\.c/\.o/;
|
||||||
|
$ofile = "$outdir/$ofile";
|
||||||
|
$gcc = "cc $cflags -Dstrcmpi=strcasecmp -fPIC $inc -c $file -o $ofile";
|
||||||
|
if (-e $ofile)
|
||||||
|
{
|
||||||
|
$file_time = (stat($file))[9];
|
||||||
|
$ofile_time = (stat($file))[9];
|
||||||
|
if ($file_time > $ofile_time)
|
||||||
|
{
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$gcc = "$gccf $cflags -fPIC -shared -ldl -lm @LINK -o $outdir/$bin";
|
||||||
|
print "$gcc\n";
|
||||||
|
`$gcc`;
|
3042
dlls/regex/amxxmodule.cpp
Executable file
3042
dlls/regex/amxxmodule.cpp
Executable file
File diff suppressed because it is too large
Load Diff
2197
dlls/regex/amxxmodule.h
Executable file
2197
dlls/regex/amxxmodule.h
Executable file
File diff suppressed because it is too large
Load Diff
BIN
dlls/regex/lib_win/pcre.lib
Executable file
BIN
dlls/regex/lib_win/pcre.lib
Executable file
Binary file not shown.
BIN
dlls/regex/lib_win/pcreposix.lib
Executable file
BIN
dlls/regex/lib_win/pcreposix.lib
Executable file
Binary file not shown.
128
dlls/regex/module.cpp
Executable file
128
dlls/regex/module.cpp
Executable file
@ -0,0 +1,128 @@
|
|||||||
|
#include <string.h>
|
||||||
|
#include "pcre.h"
|
||||||
|
#include "amxxmodule.h"
|
||||||
|
#include "CVector.h"
|
||||||
|
#include "CRegEx.h"
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
CVector<RegEx *> PEL;
|
||||||
|
|
||||||
|
int GetPEL()
|
||||||
|
{
|
||||||
|
for (int i=0; i<(int)PEL.size(); i++)
|
||||||
|
{
|
||||||
|
if (PEL[i]->isFree())
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegEx *x = new RegEx();
|
||||||
|
PEL.push_back(x);
|
||||||
|
|
||||||
|
return (int)PEL.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL regex_match(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
const char *str = MF_GetAmxString(amx, params[1], 0, &len);
|
||||||
|
const char *regex = MF_GetAmxString(amx, params[2], 1, &len);
|
||||||
|
|
||||||
|
int id = GetPEL();
|
||||||
|
RegEx *x = PEL[id];
|
||||||
|
|
||||||
|
if (x->Compile(regex) == 0)
|
||||||
|
{
|
||||||
|
cell *eOff = MF_GetAmxAddr(amx, params[3]);
|
||||||
|
const char *err = x->mError;
|
||||||
|
*eOff = x->mErrorOffset;
|
||||||
|
MF_SetAmxString(amx, params[4], err?err:"unknown", params[5]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int e = x->Match(str);
|
||||||
|
if (e == -1)
|
||||||
|
{
|
||||||
|
/* there was a match error. destroy this and move on. */
|
||||||
|
cell *res = MF_GetAmxAddr(amx, params[3]);
|
||||||
|
*res = x->mErrorOffset;
|
||||||
|
x->Clear();
|
||||||
|
return -2;
|
||||||
|
} else if (e == 0) {
|
||||||
|
cell *res = MF_GetAmxAddr(amx, params[3]);
|
||||||
|
*res = 0;
|
||||||
|
x->Clear();
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
cell *res = MF_GetAmxAddr(amx, params[3]);
|
||||||
|
*res = x->mSubStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
return id+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL regex_substr(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
int id = params[1]-1;
|
||||||
|
if (id >= (int)PEL.size() || id < 0 || PEL[id]->isFree())
|
||||||
|
{
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid regex handle %d", id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegEx *x = PEL[id];
|
||||||
|
//good idea? probably not.
|
||||||
|
static char buffer[4096];
|
||||||
|
|
||||||
|
const char *ret = x->GetSubstring(params[2], buffer, 4095);
|
||||||
|
|
||||||
|
if (ret == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
MF_SetAmxString(amx, params[3], ret, params[4]);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell AMX_NATIVE_CALL regex_free(AMX *amx, cell *params)
|
||||||
|
{
|
||||||
|
cell *c = MF_GetAmxAddr(amx, params[1]);
|
||||||
|
int id = *c;
|
||||||
|
*c = 0;
|
||||||
|
id -= 1;
|
||||||
|
if (id >= (int)PEL.size() || id < 0 || PEL[id]->isFree())
|
||||||
|
{
|
||||||
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid regex handle %d", id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegEx *x = PEL[id];
|
||||||
|
x->Clear();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
AMX_NATIVE_INFO regex_Natives[] = {
|
||||||
|
{"regex_match", regex_match},
|
||||||
|
{"regex_substr", regex_substr},
|
||||||
|
{"regex_free", regex_free},
|
||||||
|
{NULL, NULL},
|
||||||
|
};
|
||||||
|
|
||||||
|
void OnAmxxAttach()
|
||||||
|
{
|
||||||
|
MF_AddNatives(regex_Natives);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnAmxxDetach()
|
||||||
|
{
|
||||||
|
for (int i = 0; i<(int)PEL.size(); i++)
|
||||||
|
{
|
||||||
|
if (PEL[i])
|
||||||
|
{
|
||||||
|
delete PEL[i];
|
||||||
|
PEL[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PEL.clear();
|
||||||
|
}
|
10
dlls/regex/module.h
Executable file
10
dlls/regex/module.h
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
/* (C)2004 David "BAILOPAN" anderosn
|
||||||
|
* Licensed under the GNU General Public License, version 2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _INCLUDE_REGEX_H
|
||||||
|
#define _INCLUDE_REGEX_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif //_INCLUDE_REGEX_H
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user