1 Commits

Author SHA1 Message Date
3d6bd966ec Tagged 0.10 2006-07-20 06:03:41 +00:00
67 changed files with 645 additions and 2759 deletions

View File

@ -44,9 +44,6 @@ EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
m_Func = func;
// flags
m_FlagAlive = true;
m_FlagDead = true;
m_FlagWorld = (flags & 1) ? true : false; // flag a
m_FlagPlayer = (flags & 2) ? true : false; // flag b
m_FlagOnce = (flags & 4) ? true : false; // flag c
@ -58,54 +55,11 @@ EventsMngr::ClEvent::ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags)
m_Stamp = 0.0f;
m_Done = false;
m_Conditions = NULL;
}
EventsMngr::ClEvent::~ClEvent()
{
cond_t *tmp1 = m_Conditions;
cond_t *tmp2 = NULL;
while (tmp1)
{
tmp2 = tmp1->next;
delete tmp1;
tmp1 = tmp2;
}
m_Conditions = NULL;
}
void EventsMngr::NextParam()
{
const int INITIAL_PARSEVAULT_SIZE = 32;
if (m_ParsePos < m_ParseVaultSize)
return;
MsgDataEntry *tmp = NULL;
int tmpSize = 0;
if (m_ParseVault)
{
// copy to tmp
tmp = new MsgDataEntry[m_ParseVaultSize];
memcpy(tmp, m_ParseVault, m_ParseVaultSize * sizeof(MsgDataEntry));
tmpSize = m_ParseVaultSize;
delete [] m_ParseVault;
m_ParseVault = NULL;
}
if (m_ParseVaultSize > 0)
m_ParseVaultSize *= 2;
else
m_ParseVaultSize = INITIAL_PARSEVAULT_SIZE;
m_ParseVault = new MsgDataEntry[m_ParseVaultSize];
if (tmp)
{
memcpy(m_ParseVault, tmp, tmpSize * sizeof(MsgDataEntry));
delete [] tmp;
tmp = NULL;
}
}
int EventsMngr::ClEvent::getFunction()
@ -115,20 +69,12 @@ int EventsMngr::ClEvent::getFunction()
EventsMngr::EventsMngr()
{
m_ParseVault = NULL;
m_ParseVaultSize = 0;
clearEvents();
}
EventsMngr::~EventsMngr()
{
clearEvents();
// delete parsevault
if (m_ParseVault)
{
delete [] m_ParseVault;
m_ParseVault = NULL;
}
}
@ -160,34 +106,23 @@ void EventsMngr::ClEvent::registerFilter(char *filter)
if (!*value)
return;
cond_t *tmpCond = new cond_t;
if (!tmpCond)
return;
CondMapPair pair;
// type character
tmpCond->type = *value;
pair.second.type = *value;
// set a null here so param id can be recognized, and save it
// set a null here so param id can be recognized later
*value++ = 0;
tmpCond->paramId = atoi(filter);
// rest of line
tmpCond->sValue.set(value);
tmpCond->fValue = atof(value);
tmpCond->iValue = atoi(value);
tmpCond->next = NULL;
pair.second.sValue = value;
pair.second.fValue = atof(value);
pair.second.iValue = atoi(value);
if (m_Conditions)
{
cond_t *tmp = m_Conditions;
while (tmp->next)
tmp = tmp->next;
tmp->next = tmpCond;
// param id
pair.first = atoi(filter);
}
else
m_Conditions = tmpCond;
m_Conditions.insert(pair);
}
EventsMngr::ClEvent* EventsMngr::registerEvent(CPluginMngr::CPlugin* plugin, int func, int flags, int msgid)
@ -200,7 +135,7 @@ EventsMngr::ClEvent* EventsMngr::registerEvent(CPluginMngr::CPlugin* plugin, int
if (!event)
return NULL;
m_Events[msgid].put(event);
m_Events[msgid].push_back(event);
return event;
}
@ -214,38 +149,37 @@ void EventsMngr::parserInit(int msg_type, float* timer, CPlayer* pPlayer, int in
m_Timer = timer;
// don't parse if nothing to do
if (!m_Events[msg_type].size())
if (m_Events[msg_type].empty())
return;
for(ClEventVecIter iter = m_Events[msg_type].begin(); iter; ++iter)
for(ClEventVecIter iter = m_Events[msg_type].begin(); iter != m_Events[msg_type].end(); ++iter)
{
if ((*iter).m_Done)
if ((*iter)->m_Done)
continue;
if (!(*iter).m_Plugin->isExecutable((*iter).m_Func))
if (!(*iter)->m_Plugin->isExecutable((*iter)->m_Func))
{
(*iter).m_Done = true;
(*iter)->m_Done = true;
continue;
}
if (pPlayer)
{
if (!(*iter).m_FlagPlayer || (pPlayer->IsAlive() ? !(*iter).m_FlagAlive : !(*iter).m_FlagDead ) )
if (!(*iter)->m_FlagPlayer || (pPlayer->IsAlive() ? !(*iter)->m_FlagAlive : !(*iter)->m_FlagDead ) )
{
(*iter).m_Done = true;
(*iter)->m_Done = true;
continue;
}
}
else if (!(*iter).m_FlagWorld)
else if (!(*iter)->m_FlagWorld)
{
(*iter).m_Done = true;
(*iter)->m_Done = true;
continue;
}
if ((*iter).m_FlagOnce && (*iter).m_Stamp == (float)(*timer))
if ((*iter)->m_FlagOnce && (*iter)->m_Stamp == (float)(*timer))
{
(*iter).m_Done = true;
(*iter)->m_Done = true;
continue;
}
m_ParseNotDone = true;
@ -253,8 +187,13 @@ void EventsMngr::parserInit(int msg_type, float* timer, CPlayer* pPlayer, int in
if (m_ParseNotDone)
{
// we don't clear it (performance)
if (m_ParseVault.size() < 1)
{
m_ParseVault.reserve(32); // 32 as default
m_ParseVault.push_back(MsgDataVault());
}
m_ParsePos = 0;
NextParam();
m_ParseVault[m_ParsePos].type = MSG_INTEGER;
m_ParseVault[m_ParsePos].iValue = index;
}
@ -267,42 +206,45 @@ void EventsMngr::parseValue(int iValue)
if (!m_ParseNotDone || !m_ParseFun)
return;
// grow if needed
++m_ParsePos;
NextParam();
if (m_ParseVault.size() <= static_cast<size_t>(++m_ParsePos))
{
MsgDataVault tmp;
m_ParseVault.push_back(tmp);
}
m_ParseVault[m_ParsePos].type = MSG_INTEGER;
m_ParseVault[m_ParsePos].iValue = iValue;
// loop through the registered funcs, and decide whether they have to be called or not
// if they shouldnt, their m_Done is set to true
for (ClEventVecIter iter = m_ParseFun->begin(); iter; ++iter)
// loop through the registered funcs, and decide whether they have to be called
bool skip;
for (ClEventVecIter iter = m_ParseFun->begin(); iter != m_ParseFun->end(); ++iter)
{
if ((*iter).m_Done)
continue; // already skipped; don't bother with parsing
if ((*iter)->m_Done)
continue;
// loop through conditions
bool execute;
for (ClEvent::cond_t *condIter = (*iter).m_Conditions; condIter; condIter = condIter->next)
skip = false;
ClEvent::CondMapIter condIter = (*iter)->m_Conditions.find(m_ParsePos);
if (condIter == (*iter)->m_Conditions.end())
continue;
do
{
if (condIter->paramId == m_ParsePos)
switch(condIter->second.type)
{
execute = false;
switch(condIter->type)
{
case '=': if (condIter->iValue == iValue) execute=true; break;
case '!': if (condIter->iValue != iValue) execute=true; break;
case '&': if (iValue & condIter->iValue) execute=true; break;
case '<': if (iValue < condIter->iValue) execute=true; break;
case '>': if (iValue > condIter->iValue) execute=true; break;
}
if (execute)
continue;
(*iter).m_Done = true; // don't execute
break;
case '=': if (condIter->second.iValue == iValue) skip=true; break;
case '!': if (condIter->second.iValue != iValue) skip=true; break;
case '&': if (iValue & condIter->second.iValue) skip=true; break;
case '<': if (iValue < condIter->second.iValue) skip=true; break;
case '>': if (iValue > condIter->second.iValue) skip=true; break;
}
}
if (skip)
break;
} while ( ++condIter != (*iter)->m_Conditions.end() );
if (skip)
continue;
(*iter)->m_Done = true;
}
}
@ -312,40 +254,44 @@ void EventsMngr::parseValue(float fValue)
if (!m_ParseNotDone || !m_ParseFun)
return;
// grow if needed
++m_ParsePos;
NextParam();
if (m_ParseVault.size() <= static_cast<size_t>(++m_ParsePos))
{
MsgDataVault tmp;
m_ParseVault.push_back(tmp);
}
m_ParseVault[m_ParsePos].type = MSG_FLOAT;
m_ParseVault[m_ParsePos].fValue = fValue;
// loop through the registered funcs, and decide whether they have to be called or not
// if they shouldnt, their m_Done is set to true
for (ClEventVecIter iter = m_ParseFun->begin(); iter; ++iter)
// loop through the registered funcs, and decide whether they have to be called
bool skip;
for (ClEventVecIter iter = m_ParseFun->begin(); iter != m_ParseFun->end(); ++iter)
{
if ((*iter).m_Done)
continue; // already skipped; don't bother with parsing
if ((*iter)->m_Done)
continue;
// loop through conditions
for (ClEvent::cond_t *condIter = (*iter).m_Conditions; condIter; condIter = condIter->next)
skip = false;
ClEvent::CondMapIter condIter = (*iter)->m_Conditions.find(m_ParsePos);
if (condIter == (*iter)->m_Conditions.end())
continue;
do
{
if (condIter->paramId == m_ParsePos)
switch(condIter->second.type)
{
bool execute = false;
switch(condIter->type)
{
case '=': if (condIter->fValue == fValue) execute=true; break;
case '!': if (condIter->fValue != fValue) execute=true; break;
case '<': if (fValue < condIter->fValue) execute=true; break;
case '>': if (fValue > condIter->fValue) execute=true; break;
}
if (execute)
continue;
(*iter).m_Done = true; // don't execute
break;
case '=': if (condIter->second.fValue == fValue) skip=true; break;
case '!': if (condIter->second.fValue != fValue) skip=true; break;
case '<': if (fValue < condIter->second.fValue) skip=true; break;
case '>': if (fValue > condIter->second.fValue) skip=true; break;
}
}
if (skip)
break;
} while ( ++condIter != (*iter)->m_Conditions.end() );
if (skip)
continue;
(*iter)->m_Done = true;
}
}
@ -356,37 +302,42 @@ void EventsMngr::parseValue(const char *sz)
return;
// grow if needed
++m_ParsePos;
NextParam();
if (m_ParseVault.size() <= static_cast<size_t>(++m_ParsePos))
{
MsgDataVault tmp;
m_ParseVault.push_back(tmp);
}
m_ParseVault[m_ParsePos].type = MSG_STRING;
m_ParseVault[m_ParsePos].sValue = sz;
// loop through the registered funcs, and decide whether they have to be called or not
// if they shouldnt, their m_Done is set to true
for (ClEventVecIter iter = m_ParseFun->begin(); iter; ++iter)
// loop through the registered funcs, and decide whether they have to be called
bool skip;
for (ClEventVecIter iter = m_ParseFun->begin(); iter != m_ParseFun->end(); ++iter)
{
if ((*iter).m_Done)
continue; // already skipped; don't bother with parsing
if ((*iter)->m_Done)
continue;
// loop through conditions
for (ClEvent::cond_t *condIter = (*iter).m_Conditions; condIter; condIter = condIter->next)
skip = false;
ClEvent::CondMapIter condIter = (*iter)->m_Conditions.find(m_ParsePos);
if (condIter == (*iter)->m_Conditions.end())
continue;
do
{
if (condIter->paramId == m_ParsePos)
switch(condIter->second.type)
{
bool execute = false;
switch(condIter->type)
{
case '=': if (!strcmp(sz, condIter->sValue.str())) execute=true; break;
case '!': if (strcmp(sz, condIter->sValue.str())) execute=true; break;
case '&': if (strstr(sz, condIter->sValue.str())) execute=true; break;
}
if (execute)
continue;
(*iter).m_Done = true; // don't execute
break;
case '=': if (!strcmp(sz, condIter->second.sValue.c_str())) skip=true; break;
case '!': if (!strstr(sz, condIter->second.sValue.c_str())) skip=true; break;
case '&': if (strstr(sz, condIter->second.sValue.c_str())) skip=true; break;
}
}
if (skip)
break;
} while ( ++condIter != (*iter)->m_Conditions.end() );
if (skip)
continue;
(*iter)->m_Done = true;
}
}
@ -403,20 +354,20 @@ void EventsMngr::executeEvents()
try
{
#endif // #ifdef ENABLEEXEPTIONS
for (ClEventVecIter iter = m_ParseFun->begin(); iter; ++iter)
for (ClEventVecIter iter = m_ParseFun->begin(); iter != m_ParseFun->end(); ++iter)
{
if ( (*iter).m_Done )
if ( (*iter)->m_Done )
{
(*iter).m_Done = false;
(*iter)->m_Done = false;
continue;
}
(*iter).m_Stamp = (float)*m_Timer;
(*iter)->m_Stamp = *m_Timer;
if ((err = amx_Exec((*iter).m_Plugin->getAMX(), NULL, (*iter).m_Func, 1, m_ParseVaultSize ? m_ParseVault[0].iValue : 0)) != AMX_ERR_NONE)
if ((err = amx_Exec((*iter)->m_Plugin->getAMX(), NULL, (*iter)->m_Func, 1, m_ParseVault.size() ? m_ParseVault[0].iValue : 0)) != AMX_ERR_NONE)
{
UTIL_Log("[AMXX] Run time error %d on line %ld (plugin \"%s\")", err,
(*iter).m_Plugin->getAMX()->curline, (*iter).m_Plugin->getName());
(*iter)->m_Plugin->getAMX()->curline, (*iter)->m_Plugin->getName());
}
}
@ -427,8 +378,6 @@ void EventsMngr::executeEvents()
UTIL_Log( "[AMXX] fatal error at event execution");
}
#endif // #ifdef ENABLEEXEPTIONS
m_ParseFun = NULL;
}
int EventsMngr::getArgNum()
@ -492,6 +441,11 @@ void EventsMngr::clearEvents(void)
{
for (int i = 0; i < MAX_AMX_REG_MSG; ++i)
{
for (ClEventVecIter iter = m_Events[i].begin(); iter != m_Events[i].end(); ++iter)
{
if (*iter)
delete *iter;
}
m_Events[i].clear();
}
}

View File

@ -32,6 +32,10 @@
#ifndef __CEVENTS_H__
#define __CEVENTS_H__
#include <vector>
#include <map>
#include <string>
#define MAX_AMX_REG_MSG MAX_REG_MSGS+16
enum {
@ -86,48 +90,46 @@ public:
// conditions
struct cond_t
{
int paramId; // the message parameter id
String sValue; // value (string)
float fValue; // value (float)
int iValue; // value (int)
int type; // type (can be int, float, string)
cond_t *next;
std::string sValue; // value
float fValue;
int iValue;
int type;
};
cond_t *m_Conditions;
typedef std::pair<int, cond_t> CondMapPair;
typedef std::map<int, cond_t> CondMap;
typedef CondMap::iterator CondMapIter;
CondMap m_Conditions;
public:
// constructors & destructors
ClEvent(CPluginMngr::CPlugin* plugin, int func, int flags);
~ClEvent();
public:
inline CPluginMngr::CPlugin* getPlugin();
inline int getFunction();
void registerFilter(char* filter); // add a condition
};
private:
struct MsgDataEntry
struct MsgDataVault
{
float fValue;
int iValue;
const char* sValue;
MsgParamType type;
};
MsgDataEntry *m_ParseVault;
int m_ParseVaultSize;
void NextParam(); // make sure a new parameter can be added
typedef std::vector<MsgDataVault> MsgDataVaultVec;
typedef MsgDataVaultVec::iterator MsgDataVaultVecIter;
MsgDataVaultVec m_ParseVault;
typedef CList<ClEvent> ClEventVec;
typedef std::vector<ClEvent*> ClEventVec;
typedef ClEventVec::iterator ClEventVecIter;
ClEventVec m_Events[MAX_AMX_REG_MSG];
ClEventVec *m_ParseFun; // current Event vector
bool m_ParseNotDone;
int m_ParsePos; // is args. num. - 1
int m_ParsePos; // is -1 less then args. num.
float* m_Timer;
ClEvent* getValidEvent(ClEvent* a );

View File

@ -29,7 +29,7 @@ else
OS=LINUX
endif
CC_LINUX=gcc-2.95
CC_LINUX=gcc
ifeq "$(OS)" "WIN32"
CC_WIN32=gcc
LD_WINDLL=dllwrap
@ -61,7 +61,7 @@ OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
OBJC_WIN32 := $(CSRCFILES:%.c=$(OBJDIR_WIN32)/%.o)
CCOPT = -O2 -march=i686 -ffast-math -funroll-loops \
CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
-malign-jumps=2 -malign-functions=2 -s -DNDEBUG
@ -72,7 +72,7 @@ CFLAGS:=$(CCOPT) $(CFLAGS) $(ODEF) $(EXTRA_FLAGS)
DO_CC_LINUX=$(CC_LINUX) $(CFLAGS) -fPIC $(INCLUDEDIRS) -o $@ -c $<
DO_CC_WIN32=$(CC_WIN32) $(CFLAGS) $(INCLUDEDIRS) -o $@ -c $<
LINK_LINUX=$(CC_LINUX) $(CFLAGS) -shared -ldl -lm $(OBJ_LINUX) $(OBJC_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@
LINK_LINUX=$(CC_LINUX) $(CFLAGS) -lstdc++ -shared -ldl -lm $(OBJ_LINUX) $(OBJC_LINUX) $(EXTRA_LIBDIRS_LINUX) $(EXTRA_LIBS_LINUX) -o $@
LINK_WIN32=$(LD_WINDLL) -mwindows --def $(MODNAME).def --add-stdcall-alias $(OBJ_WIN32) $(OBJC_WIN32) $(EXTRA_LIBDIRS_WIN32) $(EXTRA_LIBS_WIN32) -o $@
$(OBJDIR_LINUX)/%.o: $(SRCDIR)/%.c

View File

@ -10,8 +10,10 @@
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* PM: Whole file changed
*/
#if defined __linux__
#define LINUX
#if defined LINUX
#include <sclinux.h>
#endif
#ifndef __AMX_H
@ -20,7 +22,7 @@
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
* here, these types are probably undefined.
*/
#if defined __LCC__ || defined __linux__
#if defined __LCC__ || defined LINUX
#include <stdint.h>
#else
typedef short int int16_t;
@ -107,7 +109,7 @@ typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx);
#define PACKED
#endif
#if !defined AMX_NO_ALIGN
#if defined __linux__
#if defined LINUX
#pragma pack(1) /* structures must be packed (byte-aligned) */
#else
#pragma pack(push)
@ -296,7 +298,7 @@ int AMXAPI amx_SetUserData(AMX *amx, long tag, void *ptr);
char * AMXAPI amx_StrError(int errnum);
int AMXAPI amx_StrLen(cell *cstring, int *length);
#if !defined AMX_NO_ALIGN
#if defined __linux__
#if defined LINUX
#pragma pack() /* reset default packing */
#else
#pragma pack(pop) /* reset previous packing */

View File

@ -33,7 +33,7 @@
#include <meta_api.h>
#include <time.h>
#include "amxmod.h"
#include <string>
static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
{
@ -401,6 +401,11 @@ static cell AMX_NATIVE_CALL get_user_userid(AMX *amx, cell *params) /* 1 param *
return pPlayer->initialized ? GETPLAYERUSERID(pPlayer->pEdict) : -1;
}
static cell AMX_NATIVE_CALL get_user_wonid(AMX *amx, cell *params) //1 param
{
return 0;
}
static cell AMX_NATIVE_CALL get_user_authid(AMX *amx, cell *params) /* 3 param */
{
@ -1014,95 +1019,6 @@ static cell AMX_NATIVE_CALL set_cvar_string(AMX *amx, cell *params) /* 2 param *
return 1;
}
static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
{
int numparam = *params/sizeof(cell);
Vector vecOrigin;
cell *cpOrigin;
switch (params[1]){
case MSG_BROADCAST:
case MSG_ALL:
case MSG_SPEC:
MESSAGE_BEGIN( params[1], params[2],NULL );
break;
case MSG_PVS: case MSG_PAS:
if (numparam < 3) {
amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0;
}
cpOrigin = get_amxaddr(amx,params[3]);
vecOrigin.x = *cpOrigin;
vecOrigin.y = *(cpOrigin+1);
vecOrigin.z = *(cpOrigin+2);
MESSAGE_BEGIN( params[1], params[2] , vecOrigin );
break;
case MSG_ONE:
if (numparam < 4) {
amx_RaiseError(amx,AMX_ERR_NATIVE);
return 0;
}
MESSAGE_BEGIN( MSG_ONE, params[2], NULL, INDEXENT(params[4]) );
break;
}
return 1;
}
static cell AMX_NATIVE_CALL message_end(AMX *amx, cell *params)
{
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL write_byte(AMX *amx, cell *params) /* 1 param */
{
WRITE_BYTE( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_char(AMX *amx, cell *params) /* 1 param */
{
WRITE_CHAR( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_short(AMX *amx, cell *params) /* 1 param */
{
WRITE_SHORT( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_long(AMX *amx, cell *params) /* 1 param */
{
WRITE_LONG( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_entity(AMX *amx, cell *params) /* 1 param */
{
WRITE_ENTITY( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */
{
WRITE_ANGLE( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */
{
WRITE_COORD( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_string(AMX *amx, cell *params) /* 1 param */
{
int a;
WRITE_STRING( get_amxstring(amx,params[1],3,a) );
return 1;
}
static cell AMX_NATIVE_CALL log_message(AMX *amx, cell *params) /* 1 param */
{
int len;
@ -2093,46 +2009,23 @@ static cell AMX_NATIVE_CALL get_modulesnum(AMX *amx, cell *params)
return static_cast<cell>(g_modules.size());
}
// native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen, &status);
// native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen);
static cell AMX_NATIVE_CALL get_module(AMX *amx, cell *params)
{
CList<CModule>::iterator moduleIter;
// find the module
int i = params[1];
for (moduleIter = g_modules.begin(); moduleIter && i; ++moduleIter)
--i;
if (i != 0 || !moduleIter)
return -1; // not found
return -1;
// set name, author, version
module_info_s *info = (*moduleIter).getInfo();
set_amxstring(amx, params[2], info->name, params[3]);
set_amxstring(amx, params[4], info->author, params[5]);
set_amxstring(amx, params[6], info->version, params[7]);
// compatibility problem possible
int numParams = params[0] / sizeof(cell);
if (numParams < 8)
{
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
UTIL_Log("[AMXX] get_module: call to a previous version (plugin \"%s\", line %d)", curPlugin->getName(), amx->curline);
amx_RaiseError(amx, AMX_ERR_NATIVE);
}
// set status
cell *addr;
if (amx_GetAddr(amx, params[8], &addr) != AMX_ERR_NONE)
{
CPluginMngr::CPlugin *curPlugin = g_plugins.findPluginFast(amx);
UTIL_Log("[AMXX] get_module: invalid reference (plugin \"%s\", line %d)", curPlugin->getName(), amx->curline);
amx_RaiseError(amx, AMX_ERR_NATIVE);
}
*addr = (cell)(*moduleIter).getStatusValue();
return params[1];
return params[1];
}
// native log_amx(const msg[], ...);
@ -2140,7 +2033,6 @@ static cell AMX_NATIVE_CALL log_amx(AMX *amx, cell *params)
{
CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx);
int len;
UTIL_Log("[%s] %s", plugin->getName(), format_amxstring(amx, params, 1, len));
return 0;
}
@ -2469,6 +2361,7 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "get_user_userid", get_user_userid },
{ "get_user_weapon", get_user_weapon},
{ "get_user_weapons", get_user_weapons},
{ "get_user_wonid", get_user_wonid},
{ "get_weaponname", get_weaponname},
{ "get_xvar_float", get_xvar_num },
{ "get_xvar_id", get_xvar_id },
@ -2548,15 +2441,5 @@ AMX_NATIVE_INFO amxmod_Natives[] = {
{ "callfunc_push_float", callfunc_push_byval },
{ "callfunc_push_intrf", callfunc_push_byref },
{ "callfunc_push_floatrf", callfunc_push_byref },
{ "message_begin", message_begin },
{ "message_end", message_end },
{ "write_angle", write_angle },
{ "write_byte", write_byte },
{ "write_char", write_char },
{ "write_coord", write_coord },
{ "write_entity", write_entity },
{ "write_long", write_long },
{ "write_short", write_short },
{ "write_string", write_string },
{ NULL, NULL }
};

View File

@ -46,7 +46,7 @@
#include "CMenu.h"
#include "CEvent.h"
#define AMX_VERSION "0.15"
#define AMX_VERSION "0.1"
#ifdef __cplusplus
extern "C" {

View File

@ -212,20 +212,15 @@ int Spawn( edict_t *pent ) {
hostname = CVAR_GET_POINTER("hostname");
mp_timelimit = CVAR_GET_POINTER("mp_timelimit");
// we need to initialize logging in Meta_Attach, but we have to create a new logfile each map,
// so we clear g_log_dir in ServerDeactivate_Post to know we should create one...
if (g_log_dir.empty())
{
g_log_dir.set("addons/amxx/logs"); // :TODO: maybe not do this through String as an optimalization ( a #define or const char * ?)
UTIL_MakeNewLogFile();
}
// ###### Initialize logging
g_log_dir.set( get_localinfo("amx_logdir" , "addons/amxx/logs" ) );
UTIL_MakeNewLogFile();
// ###### Initialize task manager
g_tasksMngr.registerTimers( &gpGlobals->time, &mp_timelimit->value, &g_game_timeleft );
// ###### Initialize commands prefixes
g_commands.registerPrefix( "amx" );
g_commands.registerPrefix( "amxx" );
g_commands.registerPrefix( "say" );
g_commands.registerPrefix( "admin_" );
g_commands.registerPrefix( "sm_" );
@ -233,7 +228,8 @@ int Spawn( edict_t *pent ) {
Vault amx_config;
// ###### Load custom path configuration
amx_config.setSource(build_pathname("%s", "addons/amxx/configs/core.ini"));
amx_config.setSource( build_pathname("%s",
get_localinfo("amxx_cfg" , "addons/amxx/configs/core.ini")) );
if ( amx_config.loadVault() ){
Vault::iterator a = amx_config.begin();
@ -244,8 +240,11 @@ int Spawn( edict_t *pent ) {
amx_config.clear();
}
// ###### Make sure basedir is set
get_localinfo("amxx_basedir" , "addons/amxx" );
// ###### Load modules
int loaded = loadModules( "addons/amxx/modules.ini" );
int loaded = loadModules( get_localinfo("amxx_modules" , "addons/amxx/modules.ini" ) );
attachModules();
// Set some info about amx version and modules
if ( loaded ){
@ -261,7 +260,8 @@ int Spawn( edict_t *pent ) {
}
// ###### Load Vault
g_vault.setSource( build_pathname("%s", "addons/amxx/configs/vault.ini" ) );
g_vault.setSource( build_pathname("%s",
get_localinfo("amxx_vault" , "addons/amxx/configs/vault.ini" ) ) );
g_vault.loadVault( );
@ -275,7 +275,8 @@ int Spawn( edict_t *pent ) {
memset(g_players[0].flags,-1,sizeof(g_players[0].flags));
// ###### Load AMX scripts
g_plugins.loadPluginsFromFile( "addons/amxx/plugins.ini" ); // :TODO: Where the hell should this be!?!?!
g_plugins.loadPluginsFromFile(
get_localinfo("amxx_plugins" , "addons/amxx/plugins.ini" ) );
// ###### Call precache forward function
g_dontprecache = false;
@ -439,7 +440,6 @@ void ServerDeactivate_Post() {
g_xvars.clear();
g_plugins.clear();
g_log_dir.clear();
UTIL_Log("Log file closed.");
RETURN_META(MRES_IGNORED);
@ -973,12 +973,9 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
a = &gameDir[i];
g_mod_name.set(a);
// ###### Initialize logging here
g_log_dir.set("addons/amxx/logs"); // :TODO: maybe not do this through String as an optimalization ( a #define or const char * ?)
UTIL_MakeNewLogFile();
// ###### Now attach metamod modules
attachMetaModModules( "addons/amxx/modules.ini" );
attachMetaModModules( get_localinfo("amxx_modules" ,
"addons/amxx/modules.ini" ) );
return(TRUE);
}
@ -1007,7 +1004,8 @@ C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason) {
dettachModules();
// ###### Now dettach metamod modules
dettachMetaModModules( "addons/amxx/modules.ini" );
dettachMetaModModules( get_localinfo("amxx_modules" ,
"addons/amxx/modules.ini" ) );
return(TRUE);
}

View File

@ -1,752 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="amxmod_mm"
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\metamod,..\..\hlsdk\sourcecode\common,..\..\hlsdk\sourcecode\engine,..\..\hlsdk\sourcecode\dlls,..\..\hlsdk\sourcecode\pm_shared,..\extra\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;amxmod_mm_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\release/amxmod_mm.pch"
AssemblerListingLocation=".\release/"
ObjectFile=".\release/"
ProgramDataBaseFileName=".\release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"
CommandLine="copy &quot;$(TargetPath)&quot; D:\SIERRA\Half-Life\cstrike\addons\amx\dlls
"
Outputs="$(TargetName)"/>
<Tool
Name="VCLinkerTool"
OutputFile="release/amx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=".\amxmod_mm.def"
ProgramDatabaseFile=".\release/amx_mm.pdb"
ImportLibrary=".\release/amx_mm.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\release/amxmod_mm.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\metamod,..\...\hlsdk\sourcecode\common,..\...\hlsdk\sourcecode\engine,..\...\hlsdk\sourcecode\dlls,..\...\hlsdk\sourcecode\pm_shared,..\extra\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;amxmod_mm_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
StructMemberAlignment="3"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\debug/amxmod_mm.pch"
AssemblerListingLocation=".\debug/"
ObjectFile=".\debug/"
ProgramDataBaseFileName=".\debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"
CommandLine="copy &quot;$(TargetPath)&quot; D:\SIERRA\Half-Life\cstrike\addons\amx\dlls
"
Outputs="$(TargetName)"/>
<Tool
Name="VCLinkerTool"
OutputFile="debug/amx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
ModuleDefinitionFile=".\amxmod_mm.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\debug/amx_mm.pdb"
ImportLibrary=".\debug/amx_mm.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\debug/amxmod_mm.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="..\amx.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\amxcore.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\amxmod.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\amxtime.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CCmd.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CEvent.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CFile.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CForward.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CLogEvent.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CMenu.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CMisc.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CModule.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CPlugin.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CString.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CTask.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\CVault.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\emsg.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\file.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\float.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\meta_api.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\modules.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\power.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\srvcmd.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\string.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\strptime.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\util.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\vault.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;amxmod_mm_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\amxmod.h">
</File>
<File
RelativePath="..\CCmd.h">
</File>
<File
RelativePath="..\CEvent.h">
</File>
<File
RelativePath="..\CFile.h">
</File>
<File
RelativePath="..\CForward.h">
</File>
<File
RelativePath="..\CList.h">
</File>
<File
RelativePath="..\CLogEvent.h">
</File>
<File
RelativePath="..\CMenu.h">
</File>
<File
RelativePath="..\CMisc.h">
</File>
<File
RelativePath="..\CModule.h">
</File>
<File
RelativePath="..\CPlugin.h">
</File>
<File
RelativePath="..\CString.h">
</File>
<File
RelativePath="..\CTask.h">
</File>
<File
RelativePath="..\CVault.h">
</File>
<File
RelativePath="..\modules.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Binary file not shown.

View File

@ -272,7 +272,7 @@ void UTIL_FakeClientCommand(edict_t *pEdict, const char *cmd, const char *arg1,
g_fakecmd.fake = false;
}
String g_UTIL_LogFile;
std::string g_UTIL_LogFile;
void UTIL_MakeNewLogFile()
{
@ -292,8 +292,8 @@ void UTIL_MakeNewLogFile()
int i = 0;
while (true)
{
g_UTIL_LogFile.set(build_pathname("%s/L%02d%02d%03d.log", g_log_dir.str(), curTime->tm_mon + 1, curTime->tm_mday, i));
FILE *pTmpFile = fopen(g_UTIL_LogFile.str(), "r"); // open for reading to check whether the file exists
g_UTIL_LogFile = build_pathname("%s/L%02d%02d%03d.log", g_log_dir.str(), curTime->tm_mon + 1, curTime->tm_mday, i);
FILE *pTmpFile = fopen(g_UTIL_LogFile.c_str(), "r"); // open for reading to check whether the file exists
if (!pTmpFile)
break;
fclose(pTmpFile);
@ -322,7 +322,7 @@ void UTIL_Log(const char *fmt, ...)
strftime(date, 31, "%m/%d/%Y - %H:%M:%S", curTime);
// log msg now
FILE *pF = fopen(g_UTIL_LogFile.str(), "a+");
FILE *pF = fopen(g_UTIL_LogFile.c_str(), "a+");
if (!pF)
return; // don't try to create a new logfile to prevent recursion crashes if there is an unforseen error

View File

@ -1,9 +1,8 @@
; AMX Mod X Modules; You can specify both linux & win32 modules here
; Fun - This has extra functions
fun_amx.dll
fun_amx_i386.so
; Engine - This has engine functions core to half-life
engine_amx.dll
engine_amx_i386.so

View File

@ -30,7 +30,7 @@
; Account flags:
; a - disconnect player on invalid password
; b - clan tag
; c - this is steamid/wonid
; c - this is steamid
; d - this is ip
; e - password is not checked (only name/ip/steamid needed)

View File

@ -11,10 +11,22 @@
CCstrikePlayer::CCstrikePlayer()
{
//SetOnline(false);
SetModelled(false);
//SetTime(0.0);
SetInspectModel(false);
}
/*bool CCstrikePlayer::GetOnline()
{
return online;
}
bool CCstrikePlayer::SetOnline(bool onlineIn)
{
return online = onlineIn;
}*/
bool CCstrikePlayer::GetModelled()
{
return modelled;
@ -33,11 +45,22 @@ const char* CCstrikePlayer::GetModel()
return model;
}
void CCstrikePlayer::SetModel(const char* modelIn)
const char* CCstrikePlayer::SetModel(const char* modelIn)
{
strcpy(model, modelIn);
//SetTime(0.0);
return strcpy(model, modelIn);
}
/*float CCstrikePlayer::GetTime()
{
return time;
}
void CCstrikePlayer::SetTime(float timeIn)
{
time = timeIn;
}
*/
bool CCstrikePlayer::GetInspectModel()
{
return inspectModel;

View File

@ -10,17 +10,22 @@ class CCstrikePlayer
public:
CCstrikePlayer();
/*bool GetOnline();
bool SetOnline(bool onlineIn);*/
bool GetModelled();
bool SetModelled(bool modelledIn);
//float GetTime();
//void SetTime(float timeIn);
const char* GetModel();
void SetModel(const char* modelIn);
const char* SetModel(const char* modelIn);
bool GetInspectModel();
void SetInspectModel(bool inspectModelIn);
private:
bool inspectModel;
bool online, inspectModel;
bool modelled;
char model[32];
//float time;
};
#endif // !defined(INCLUDED_CCSTRIKEPLAYER)

View File

@ -1,4 +1,4 @@
MODNAME = cstrike_amx
MODNAME = cstrike_mm
SRCFILES = cstrike.cpp CstrikePlayer.cpp
EXTRA_LIBS_LINUX =
@ -6,12 +6,12 @@ EXTRA_LIBS_WIN32 =
EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux
EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32
EXTRA_INCLUDEDIRS = -Iextra/include -I../amxmodx
EXTRA_INCLUDEDIRS = -Iextra/include
EXTRA_FLAGS = -Dstrcmpi=strcasecmp
SDKTOP=../hlsdk
METADIR=../metamodx
METADIR=../metamod/metamod
SDKSRC=$(SDKTOP)/SourceCode
@ -25,7 +25,7 @@ else
OS=LINUX
endif
CC_LINUX=gcc-2.95
CC_LINUX=gcc
ifeq "$(OS)" "WIN32"
CC_WIN32=gcc
LD_WINDLL=dllwrap
@ -57,9 +57,9 @@ OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
OBJC_WIN32 := $(CSRCFILES:%.c=$(OBJDIR_WIN32)/%.o)
CCOPT = -march=i386 -O2 -ffast-math -funroll-loops \
CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
-malign-jumps=2 -malign-functions=2 -s -DNDEBUG
-malign-jumps=2 -malign-functions=2 -s -DNDEBUG -lstdc++
INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS)
CFLAGS=-Wall -Wno-unknown-pragmas

View File

@ -175,15 +175,6 @@ static cell AMX_NATIVE_CALL cs_set_user_deaths(AMX *amx, cell *params) // cs_set
// Set deaths
*((int *)pPlayer->pvPrivateData + OFFSET_CSDEATHS) = params[2];
// Update scoreboard here..?
MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "ScoreInfo", NULL));
WRITE_BYTE(params[1]);
WRITE_SHORT(pPlayer->v.frags);
WRITE_SHORT(params[2]);
WRITE_SHORT(0); // dunno what this parameter is (doesn't seem to be vip)
WRITE_SHORT(*((int *)pPlayer->pvPrivateData + OFFSET_TEAM));
MESSAGE_END();
return 1;
}
@ -428,7 +419,7 @@ static cell AMX_NATIVE_CALL cs_get_user_vip(AMX *amx, cell *params) // cs_get_us
return 0;
}
if ( *((int *)pPlayer->pvPrivateData + OFFSET_VIP) & PLAYER_IS_VIP )
if ((int)((int *)pPlayer->pvPrivateData + OFFSET_VIP) == PLAYER_IS_VIP)
return 1;
return 0;
@ -457,9 +448,9 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) // cs_set_us
}
if (params[2])
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) |= PLAYER_IS_VIP;
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) = PLAYER_IS_VIP;
else
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) &= ~PLAYER_IS_VIP;
*((int *)pPlayer->pvPrivateData + OFFSET_VIP) = PLAYER_IS_NOT_VIP;
return 1;
}

View File

@ -53,10 +53,10 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/cstrike_amxx.dll"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Cmds=echo Copying dll... copy Release\cstrike.dll K:\S\cstrike\addons\amxx\modules\cstrike_amx.dll echo Copying inc... copy ..\plugins\include\cstrike.inc K:\S\cstrike\addons\amxx\scripting\include\
PostBuild_Cmds=echo Copying dll... copy Release\cstrike_amxx.dll K:\S\cstrike\addons\amx\dlls echo Copying inc... copy cstrike_amxx.inc K:\S\cstrike\addons\amx\examples\include
# End Special Build Tool
!ELSEIF "$(CFG)" == "cstrike - Win32 Debug"
@ -125,7 +125,7 @@ SOURCE=.\CstrikePlayer.h
# End Group
# Begin Source File
SOURCE=..\plugins\include\cstrike.inc
SOURCE=.\cstrike_amxx.inc
# End Source File
# End Target
# End Project

View File

@ -1,5 +1,4 @@
//#define __cswonbuild__ // comment when compiling for STEAM
//#define CS_WON_BUILD
/* AMX Mod X
* Counter-Strike Module
@ -67,11 +66,11 @@ pfnmodule_engine_g* g_engModuleFunc;
#define NAME "Counter-Strike"
#define AUTHOR "AMX Mod X Dev Team"
#if defined __cswonbuild__
#define VERSION "0.15 WON" // change both these versions
#if defined CS_WON_BUILD
#define VERSION "0.1 WON" // change both these versions
#else
#define VERSION "0.15 STEAM" // change both these versions
#endif // defined __cswonbuild__
#define VERSION "0.1" // change both these versions
#endif // defined CS_WON_BUILD
#define URL "http://www.amxmodx.org"
#define LOGTAG "AMXCS"
#define DATE __DATE__
@ -115,8 +114,7 @@ pfnmodule_engine_g* g_engModuleFunc;
#define OFFSET_WEAPONTYPE 43 + EXTRAOFFSET // same as STEAM
#define OFFSET_SILENCER_FIREMODE 70 + EXTRAOFFSET // differs -4 from STEAM
// "hostage_entity" entities
#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET // NOT YET CHECKED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! find out before build
#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET // same as STEAM
//#define OFFSET_HOSTAGEFOLLOW 86 + EXTRAOFFSET // NOT YET CHECKED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! find out before build
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET // same as STEAM
#else // from here STEAM build looks for offsets
// "player" entities
@ -211,7 +209,8 @@ pfnmodule_engine_g* g_engModuleFunc;
#define FAMAS_AUTOMATIC 0
#define FAMAS_BURSTMODE 16
#define PLAYER_IS_VIP (1<<8)
#define PLAYER_IS_NOT_VIP 0
#define PLAYER_IS_VIP 256
#define TEAM_T 1
#define TEAM_CT 2

View File

@ -1,217 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="cstrike"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/cstrike.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="Debug/cstrike_amxx_debug.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\cstrike.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/cstrike_amxx_debug.pdb"
ImportLibrary=".\Debug/cstrike_amxx_debug.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/cstrike.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1053"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/cstrike.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="Release/cstrike_amxx.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\cstrike.def"
ProgramDatabaseFile=".\Release/cstrike_amxx.pdb"
ImportLibrary=".\Release/cstrike_amxx.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/cstrike.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="echo Copying dll...
copy Release\cstrike_amxx.dll K:\S\cstrike\addons\amx\dlls
echo Copying inc...
copy cstrike_amxx.inc K:\S\cstrike\addons\amx\examples\include
"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"/>
<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="cstrike.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;CSTRIKE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;CSTRIKE_EXPORTS;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="cstrike.def">
</File>
<File
RelativePath="CstrikePlayer.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;CSTRIKE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;CSTRIKE_EXPORTS;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="cstrike.h">
</File>
<File
RelativePath="CstrikePlayer.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<File
RelativePath="cstrike_amxx.inc">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,4 +1,4 @@
MODNAME = engine_amx
MODNAME = engine_mm
SRCFILES = meta_api.cpp
EXTRA_LIBS_LINUX =
@ -6,12 +6,12 @@ EXTRA_LIBS_WIN32 =
EXTRA_LIBDIRS_LINUX = -Lextra/lib_linux
EXTRA_LIBDIRS_WIN32 = -Lextra/lib_win32
EXTRA_INCLUDEDIRS = -Iextra/include -I../amxmodx
EXTRA_INCLUDEDIRS = -Iextra/include
EXTRA_FLAGS = -Dstrcmpi=strcasecmp
SDKTOP=../hlsdk
METADIR=../metamodx
METADIR=../metamod/metamod
SDKSRC=$(SDKTOP)/SourceCode
@ -57,9 +57,9 @@ OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
OBJC_WIN32 := $(CSRCFILES:%.c=$(OBJDIR_WIN32)/%.o)
CCOPT = -march=i386 -O2 -ffast-math -funroll-loops \
CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
-malign-jumps=2 -malign-functions=2 -s -DNDEBUG
-malign-jumps=2 -malign-functions=2 -s -DNDEBUG -lstdc++
INCLUDEDIRS=-I../curl/include -I$(SRCDIR) -I$(METADIR) -I$(SDKSRC)/engine -I$(SDKSRC)/common -I$(SDKSRC)/pm_shared -I$(SDKSRC)/dlls -I$(SDKSRC) $(EXTRA_INCLUDEDIRS)
CFLAGS=-Wall -Wno-unknown-pragmas

View File

@ -32,12 +32,16 @@
* version.
*/
#define VERSION "0.15"
#define VERSION "0.1"
#include <string>
using namespace std;
plugin_info_t Plugin_info = {
META_INTERFACE_VERSION, // ifvers
"ENGINE", // name
"Engine", // name
VERSION, // version
__DATE__, // date
"AMX Mod X Dev Team", // author
@ -49,7 +53,7 @@ plugin_info_t Plugin_info = {
};
module_info_s module_info = {
"ENGINE", // name
"Engine", // name
"AMX Mod X Dev Team", // author
VERSION, // version
AMX_INTERFACE_VERSION,
@ -111,8 +115,6 @@ int thread_fork(void *arg);
#define AMS_OFFSET 0.01
#define GETINFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer)
#define SPEAK_NORMAL 0
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
@ -129,52 +131,6 @@ int thread_fork(void *arg);
#define BLOCK_ONCE 1
#define BLOCK_SET 2
//jghg
enum globals {
// Edict
GL_trace_ent = 0,
// Float
GL_coop,
GL_deathmatch,
GL_force_retouch,
GL_found_secrets,
GL_frametime,
GL_serverflags,
GL_teamplay,
GL_time,
GL_trace_allsolid,
GL_trace_fraction,
GL_trace_inopen,
GL_trace_inwater,
GL_trace_plane_dist,
GL_trace_startsolid,
// Int
GL_cdAudioTrack,
GL_maxClients,
GL_maxEntities,
GL_msg_entity,
GL_trace_flags,
GL_trace_hitgroup,
// String
GL_pStringBase,
GL_mapname,
GL_startspot,
// Vector
GL_trace_endpos,
GL_trace_plane_normal,
GL_v_forward,
GL_v_right,
GL_v_up,
GL_vecLandmarkOffset,
// Void (not supported)
GL_pSaveData
};
enum {
gamestate,
oldbuttons,
@ -356,7 +312,6 @@ enum {
arg_entity,
};
//by BAILOPAN
class argStack {
public:
argStack(argStack *p=NULL) //initialize with link to previous
@ -374,7 +329,6 @@ public:
writeangle = 0.0;
writecoord = 0.0;
writeentity = 0;
writestring = NULL;
}
argStack* arg()
@ -390,13 +344,6 @@ public:
return next;
}
~argStack()
{
if (writestring != NULL) {
delete [] writestring;
}
}
void put(int arg_type, int i)
{
argtype = arg_type;
@ -440,9 +387,7 @@ public:
switch (argtype)
{
case arg_string:
delete [] writestring;
writestring = new char[strlen(sz)+1];
strcpy(writestring, sz);
writestring.append((char *)sz);
break;
}
}
@ -470,7 +415,7 @@ public:
WRITE_COORD(writecoord);
break;
case arg_string:
WRITE_STRING(writestring);
WRITE_STRING(writestring.c_str());
break;
case arg_entity:
WRITE_ENTITY(writeentity);
@ -521,7 +466,7 @@ public:
switch (argtype)
{
case arg_string:
return strlen(writestring);
return (writestring.length());
break;
}
return 0;
@ -532,7 +477,7 @@ public:
switch (argtype)
{
case arg_string:
return (const char*)writestring;
return writestring.c_str();
break;
}
@ -726,20 +671,6 @@ public:
}
}
void destroy()
{
argStack *p;
while (next != NULL) {
p = next->link();
delete next;
next = p;
}
if (p != NULL) {
delete p;
p = NULL;
}
}
private:
int argtype;
int writebyte;
@ -748,7 +679,7 @@ private:
int writelong;
float writeangle;
float writecoord;
char *writestring;
std::string writestring;
int writeentity;
argStack *next;
};
@ -828,9 +759,16 @@ public:
void Destroy()
{
CHeadArg->destroy();
delete CHeadArg;
CHeadArg = NULL;
argStack *p;
p = CHeadArg->link();
while (p) {
argStack *n = p->link();
delete p;
p = n;
}
argcount = 0;
}
bool Set(int n, int arg_type, int data)

View File

@ -1,187 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="engine"
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"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/engine.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="release/engine_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\engine.def"
ProgramDatabaseFile=".\Release/engine_mm.pdb"
ImportLibrary=".\Release/engine_mm.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/engine.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"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ENGINE_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/engine.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/engine.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\engine.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/engine.pdb"
ImportLibrary=".\Debug/engine.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/engine.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="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="engine.h">
</File>
<File
RelativePath="meta_api.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;ENGINE_EXPORTS;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;ENGINE_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="engine.def">
</File>
<File
RelativePath="engine.inc">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -42,47 +42,16 @@
#include <limits.h>
#include "engine.h"
extern "C" void destroy(MessageInfo* p) {
delete p;
}
GlobalInfo GlInfo;
MessageInfo *msgd = NULL;
MessageInfo *msgd;
bool isMsgHooked[MAX_MESSAGES];
int inHookProcess;
edict_t *valid_ent(int ent);
edict_t *valid_player(int ent);
void UTIL_SetSize(edict_t *pev, const Vector &vecMin, const Vector &vecMax)
{
SET_SIZE(ENT(pev), vecMin, vecMax);
}
edict_t *valid_player(int ent)
{
if (ent < 1 || ent > gpGlobals->maxClients) {
return NULL;
}
edict_t *e = INDEXENT(ent);
if (FNullEnt(e)) {
return NULL;
}
return e;
}
edict_t *valid_ent(int ent)
{
if (ent < 1 || ent > gpGlobals->maxEntities) {
return NULL;
}
edict_t *e = INDEXENT(ent);
if (FNullEnt(e)) {
return NULL;
}
return e;
}
cvar_t amxxe_version = {"amxxe_version", VERSION, FCVAR_SERVER, 0};
//from OLO
char* get_amxstring(AMX *amx,cell amx_addr,int id, int& len)
@ -219,7 +188,7 @@ static cell AMX_NATIVE_CALL get_msg_arg_int(AMX *amx, cell *params)
int argn = params[1];
if (inHookProcess && msgd!=NULL) {
if (argn <= msgd->args() && argn > 0) {
if (argn < msgd->args() && argn > 0) {
return msgd->RetArg_Int(argn);
} else {
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
@ -242,7 +211,7 @@ static cell AMX_NATIVE_CALL get_msg_arg_float(AMX *amx, cell *params)
float retVal;
if (inHookProcess && msgd!=NULL) {
if (argn <= msgd->args() && argn > 0) {
if (argn < msgd->args() && argn > 0) {
retVal = msgd->RetArg_Float(argn);
return *(cell*)((void *)&retVal);
} else {
@ -264,20 +233,16 @@ static cell AMX_NATIVE_CALL get_msg_arg_string(AMX *amx, cell *params)
int argn = params[1];
int iLen = 0;
char *szValue = '\0';
char *szRetr;
if (inHookProcess && msgd!=NULL) {
if (argn <= msgd->args() && argn > 0) {
if (argn < msgd->args() && argn > 0) {
iLen = msgd->RetArg_Strlen(argn);
szValue = new char[iLen+1];
szRetr = (char *)msgd->RetArg_String(argn);
if (szRetr != NULL) {
strcpy(szValue, szRetr);
if (strlen(szValue)) {
return SET_AMXSTRING(amx, params[2], szValue, params[3]);
} else {
return SET_AMXSTRING(amx, params[2], "", params[3]);
}
strcpy(szValue, msgd->RetArg_String(argn));
if (strlen(szValue)) {
return SET_AMXSTRING(amx, params[2], szValue, params[3]);
} else {
return SET_AMXSTRING(amx, params[2], "", params[3]);
}
} else {
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
@ -299,7 +264,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_string(AMX *amx, cell *params)
char *szData = AMX_GET_STRING(amx, params[2], iLen);
if (inHookProcess && msgd!=NULL) {
if (argn <= msgd->args() && argn > 0) {
if (argn < msgd->args() && argn > 0) {
if (msgd->Set(argn, arg_string, szData)) {
return 1;
} else {
@ -324,7 +289,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_float(AMX *amx, cell *params)
int argtype = params[2];
if (inHookProcess && msgd!=NULL) {
if (argn <= msgd->args() && argn > 0) {
if (argn < msgd->args() && argn > 0) {
if (msgd->Set(argn, argtype, params[3])) {
return 1;
} else {
@ -350,7 +315,7 @@ static cell AMX_NATIVE_CALL set_msg_arg_int(AMX *amx, cell *params)
int iData = params[3];
if (inHookProcess && msgd!=NULL) {
if (argn <= msgd->args() && argn > 0) {
if (argn < msgd->args() && argn > 0) {
if (msgd->Set(argn, argtype, iData)) {
return 1;
} else {
@ -459,6 +424,100 @@ static cell AMX_NATIVE_CALL get_offset_short(AMX *amx, cell *params)
}
////////////////////////////////////////////
//THESE ARE FROM amxmod.cpp!!!
////////////////////////////////////////////
static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
{
int numparam = *params/sizeof(cell);
Vector vecOrigin;
cell *cpOrigin;
switch (params[1]){
case MSG_BROADCAST:
case MSG_ALL:
case MSG_SPEC:
MESSAGE_BEGIN( params[1], params[2],NULL );
break;
case MSG_PVS: case MSG_PAS:
if (numparam < 3) {
AMX_RAISEERROR(amx,AMX_ERR_NATIVE);
return 0;
}
cpOrigin = get_amxaddr(amx,params[3]);
vecOrigin.x = *cpOrigin;
vecOrigin.y = *(cpOrigin+1);
vecOrigin.z = *(cpOrigin+2);
MESSAGE_BEGIN( params[1], params[2] , vecOrigin );
break;
case MSG_ONE:
if (numparam < 4) {
AMX_RAISEERROR(amx,AMX_ERR_NATIVE);
return 0;
}
MESSAGE_BEGIN( MSG_ONE, params[2], NULL, INDEXENT(params[4]) );
break;
}
return 1;
}
static cell AMX_NATIVE_CALL message_end(AMX *amx, cell *params)
{
MESSAGE_END();
return 1;
}
static cell AMX_NATIVE_CALL write_byte(AMX *amx, cell *params) /* 1 param */
{
WRITE_BYTE( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_char(AMX *amx, cell *params) /* 1 param */
{
WRITE_CHAR( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_short(AMX *amx, cell *params) /* 1 param */
{
WRITE_SHORT( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_long(AMX *amx, cell *params) /* 1 param */
{
WRITE_LONG( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_entity(AMX *amx, cell *params) /* 1 param */
{
WRITE_ENTITY( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */
{
WRITE_ANGLE( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */
{
WRITE_COORD( params[1] );
return 1;
}
static cell AMX_NATIVE_CALL write_string(AMX *amx, cell *params) /* 1 param */
{
int a;
WRITE_STRING( get_amxstring(amx,params[1],3,a) );
return 1;
}
////////////////////////////////////////////
////////////////////////////////////////////
//(BAILOPAN)
//Gets a pvPrivateData offset for a player (player, offset, float=0)
static cell AMX_NATIVE_CALL get_offset(AMX *amx, cell *params)
@ -1571,22 +1630,22 @@ static cell AMX_NATIVE_CALL entity_get_byte(AMX *amx, cell *params) {
switch(iValueSet) {
case controller1:
iRetValue = pEntity->v.controller[0];
break;
case controller2:
iRetValue = pEntity->v.controller[1];
break;
case controller3:
case controller2:
iRetValue = pEntity->v.controller[2];
break;
case controller4:
case controller3:
iRetValue = pEntity->v.controller[3];
break;
case controller4:
iRetValue = pEntity->v.controller[4];
break;
case blending1:
iRetValue = pEntity->v.blending[0];
iRetValue = pEntity->v.blending[1];
break;
case blending2:
iRetValue = pEntity->v.blending[1];
iRetValue = pEntity->v.blending[2];
break;
default:
return 0;
@ -1771,20 +1830,23 @@ static cell AMX_NATIVE_CALL create_entity(AMX *amx, cell *params) {
}
//ej ref'd by jghg
static cell AMX_NATIVE_CALL find_ent_by_class(AMX *amx, cell *params) /* 3 param */
static cell AMX_NATIVE_CALL find_entity(AMX *amx, cell *params) /* 3 param */
{
edict_t *pEnt = INDEXENT(params[1]);
edict_t *pSearch_after_ent = INDEXENT(params[1]);
char* sCatagory = NULL;
int len;
char* sValue = GET_AMXSTRING(amx, params[2], 1, len);
char* sValue = GET_AMXSTRING(amx, params[3], 1, len);
edict_t *pEnt = FIND_ENTITY_BY_STRING(pSearch_after_ent, "classname", sValue);
pEnt = FIND_ENTITY_BY_STRING(pEnt, "classname", sValue);
if(pEnt) // This even needed?
return ENTINDEX(pEnt);
else
return 0;
}
}
// DispatchKeyValue, sets a key-value pair for a newly created entity.
@ -2335,8 +2397,8 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
SET_MODEL(pNewCamera, "models/rpgrocket.mdl");
SET_SIZE(pNewCamera, Vector(0, 0, 0), Vector(0, 0, 0));
pNewCamera->v.movetype = MOVETYPE_NOCLIP;
pNewCamera->v.solid = SOLID_NOT;
pNewCamera->v.movetype = MOVETYPE_FLY;
pNewCamera->v.solid = SOLID_BBOX;
pNewCamera->v.takedamage = DAMAGE_NO;
pNewCamera->v.gravity = 0;
pNewCamera->v.owner = pPlayer;
@ -2364,8 +2426,8 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
SET_MODEL(pNewCamera, "models/rpgrocket.mdl");
SET_SIZE(pNewCamera, Vector(0, 0, 0), Vector(0, 0, 0));
pNewCamera->v.movetype = MOVETYPE_NOCLIP;
pNewCamera->v.solid = SOLID_NOT;
pNewCamera->v.movetype = MOVETYPE_FLY;
pNewCamera->v.solid = SOLID_BBOX;
pNewCamera->v.takedamage = DAMAGE_NO;
pNewCamera->v.gravity = 0;
pNewCamera->v.owner = pPlayer;
@ -2393,8 +2455,8 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) {
SET_MODEL(pNewCamera, "models/rpgrocket.mdl");
SET_SIZE(pNewCamera, Vector(0, 0, 0), Vector(0, 0, 0));
pNewCamera->v.movetype = MOVETYPE_NOCLIP;
pNewCamera->v.solid = SOLID_NOT;
pNewCamera->v.movetype = MOVETYPE_FLY;
pNewCamera->v.solid = SOLID_BBOX;
pNewCamera->v.takedamage = DAMAGE_NO;
pNewCamera->v.gravity = 0;
pNewCamera->v.owner = pPlayer;
@ -2443,254 +2505,6 @@ static cell AMX_NATIVE_CALL precache_generic(AMX *amx, cell *params)
return 1;
}
//ported from jghg2
static cell AMX_NATIVE_CALL drop_to_floor(AMX *amx, cell *params)
{
int iEnt = params[1];
edict_t* e = valid_ent(iEnt);
if (e!=NULL) {
return DROP_TO_FLOOR(e);
}
return -1;
}
static cell AMX_NATIVE_CALL get_info_keybuffer(AMX *amx, cell *params)
{
int iEnt = params[1];
edict_t *e = valid_ent(iEnt);
if (e!=NULL) {
char *info = GETINFOKEYBUFFER(e);
return SET_AMXSTRING(amx, params[2], info, params[3]);
} else {
return 0;
}
}
static cell AMX_NATIVE_CALL force_use(AMX *amx, cell *params)
{
int pev = params[1];
int ent = params[2];
edict_t *pPlayer = valid_player(pev);
edict_t *pEntity = valid_ent(ent);
MDLL_Use(pEntity, pPlayer);
return 1;
}
static cell AMX_NATIVE_CALL get_global_float(AMX *amx, cell *params)
{
int global = params[1];
float returnValue;
switch (params[1]) {
case GL_coop:
returnValue = gpGlobals->coop;
break;
case GL_deathmatch:
returnValue = gpGlobals->deathmatch;
break;
case GL_force_retouch:
returnValue = gpGlobals->force_retouch;
break;
case GL_found_secrets:
returnValue = gpGlobals->found_secrets;
break;
case GL_frametime:
returnValue = gpGlobals->frametime;
break;
case GL_serverflags:
returnValue = gpGlobals->serverflags;
break;
case GL_teamplay:
returnValue = gpGlobals->teamplay;
break;
case GL_time:
returnValue = gpGlobals->time;
break;
case GL_trace_allsolid:
returnValue = gpGlobals->trace_allsolid;
break;
case GL_trace_fraction:
returnValue = gpGlobals->trace_fraction;
break;
case GL_trace_inopen:
returnValue = gpGlobals->trace_inopen;
break;
case GL_trace_inwater:
returnValue = gpGlobals->trace_inwater;
break;
case GL_trace_plane_dist:
returnValue = gpGlobals->trace_plane_dist;
break;
case GL_trace_startsolid:
returnValue = gpGlobals->trace_startsolid;
break;
default:
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
return *(cell*)((void *)&returnValue);
}
static cell AMX_NATIVE_CALL get_global_int(AMX *amx, cell *params)
{
int returnValue = 0;
switch (params[1]) {
case GL_cdAudioTrack:
returnValue = gpGlobals->cdAudioTrack;
break;
case GL_maxClients:
returnValue = gpGlobals->maxClients;
break;
case GL_maxEntities:
returnValue = gpGlobals->maxEntities;
break;
case GL_msg_entity:
returnValue = gpGlobals->msg_entity;
break;
case GL_trace_flags:
returnValue = gpGlobals->trace_flags;
break;
case GL_trace_hitgroup:
returnValue = gpGlobals->trace_hitgroup;
break;
default:
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
return returnValue;
}
static cell AMX_NATIVE_CALL get_global_string(AMX *amx, cell *params)
{
string_t* returnValue;
switch(params[1]) {
case GL_pStringBase: // const char *, so no string_t
return SET_AMXSTRING(amx, params[2], gpGlobals->pStringBase, params[3]);
// The rest are string_t:s...
case GL_mapname:
returnValue = &(gpGlobals->mapname);
break;
case GL_startspot:
returnValue = &(gpGlobals->startspot);
break;
default:
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
return SET_AMXSTRING(amx, params[2], STRING(*returnValue), params[3]);
}
static cell AMX_NATIVE_CALL get_global_vector(AMX *amx, cell *params) // globals_get_vector(variable, Float:vector[3]); = 2 params
{
cell *returnVector = GET_AMXADDR(amx, params[2]);
vec3_t fetchedVector;
switch (params[1]) {
case GL_trace_endpos:
fetchedVector = gpGlobals->trace_endpos;
break;
case GL_trace_plane_normal:
fetchedVector = gpGlobals->trace_plane_normal;
break;
case GL_v_forward:
fetchedVector = gpGlobals->v_forward;
break;
case GL_v_right:
fetchedVector = gpGlobals->v_right;
break;
case GL_v_up:
fetchedVector = gpGlobals->v_up;
break;
case GL_vecLandmarkOffset:
fetchedVector = gpGlobals->vecLandmarkOffset;
break;
default:
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
returnVector[0] = *(cell*)((void *)&fetchedVector.x);
returnVector[1] = *(cell*)((void *)&fetchedVector.y);
returnVector[2] = *(cell*)((void *)&fetchedVector.z);
return 1;
}
static cell AMX_NATIVE_CALL get_global_edict(AMX *amx, cell *params) // globals_get_edict(variable); = 1 param
{
edict_t* pReturnEntity;
switch (params[1]) {
case GL_trace_ent:
pReturnEntity = gpGlobals->trace_ent;
break;
default:
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
// Will crash if ENTINDEX() is called on bad pointer?
if(!FNullEnt(pReturnEntity))
return ENTINDEX(pReturnEntity);
return 0;
}
static cell AMX_NATIVE_CALL precache_event(AMX *amx, cell *params)
{
int len;
char *szEvent = FORMAT_AMXSTRING(amx, params, 2, len);
PRECACHE_EVENT(params[1], (char *)STRING(ALLOC_STRING(szEvent)));
return 1;
}
static cell AMX_NATIVE_CALL get_decal_index(AMX *amx, cell *params)
{
int len;
char *szDecal = GET_AMXSTRING(amx, params[1], 0, len);
return DECAL_INDEX(szDecal);
}
static cell AMX_NATIVE_CALL set_size(AMX *amx, cell *params)
{
int ent = params[1];
edict_t *e = valid_ent(ent);
if (e == NULL) {
return 0;
}
cell *cMin = GET_AMXADDR(amx, params[2]);
float x1 = *(float *)((void *)&cMin[0]);
float y1 = *(float *)((void *)&cMin[1]);
float z1 = *(float *)((void *)&cMin[2]);
Vector vMin = Vector(x1, y1, z1);
cell *cMax = GET_AMXADDR(amx, params[3]);
float x2 = *(float *)((void *)&cMax[0]);
float y2 = *(float *)((void *)&cMax[1]);
float z2 = *(float *)((void *)&cMax[2]);
Vector vMax = Vector(x2, y2, z2);
UTIL_SetSize(e, vMin, vMax);
return 1;
}
/********************************************
METAMOD HOOKED FUNCTIONS
*****************************************/
@ -2875,7 +2689,7 @@ BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress
//(vexd)
void GameInit(void) {
CVAR_REGISTER(&amxxe_version);
}
// make sure that if we currently have an edited light value, to use it.
@ -2945,7 +2759,7 @@ void MessageEnd(void) {
msgd->SendMsg();
RETURN_META(MRES_SUPERCEDE);
}
delete msgd;
destroy(msgd);
msgd = NULL;
}
@ -3049,7 +2863,6 @@ void WriteEntity(int iValue) {
}
void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ){
PRECACHE_MODEL("models/rpgrocket.mdl");
AMX* amx;
void* code;
const char* filename;
@ -3108,7 +2921,7 @@ void ServerDeactivate() {
}
if (msgd != NULL) {
delete msgd;
destroy(msgd);
msgd = NULL;
}
@ -3350,8 +3163,7 @@ AMX_NATIVE_INFO Engine_Natives[] = {
{"create_entity", create_entity},
{"remove_entity", remove_entity},
{"find_ent_by_class", find_ent_by_class},
{"find_ent_by_classname", find_ent_by_class}, // just in case anyone likes typing the whole thing
{"find_entity", find_entity},
{"find_ent_by_owner", find_ent_by_owner},
{"find_ent_by_target", find_ent_by_target},
{"find_ent_by_tname", find_ent_by_tname},
@ -3376,19 +3188,17 @@ AMX_NATIVE_INFO Engine_Natives[] = {
{"get_msg_arg_string", get_msg_arg_string},
{"get_msg_args", get_msg_args},
{"get_msg_argtype", get_msg_argtype},
{"message_begin", message_begin},
{"message_end", message_end},
{"write_angle", write_angle},
{"write_byte", write_byte},
{"write_char", write_char},
{"write_coord", write_coord},
{"write_entity", write_entity},
{"write_long", write_long},
{"write_short", write_short},
{"write_string", write_string},
{"is_valid_ent", is_valid_ent},
{"drop_to_floor", drop_to_floor},
{"get_info_keybuffer", get_info_keybuffer},
{"force_use", force_use},
{"get_global_float", get_global_float},
{"get_global_int", get_global_int},
{"get_global_string", get_global_string},
{"get_global_edict", get_global_edict},
{"get_global_vector", get_global_vector},
{"set_size", set_size},
{"get_decal_index", get_decal_index},
{"precache_event", precache_event},
{"call_think", call_think},
{ NULL, NULL }

View File

@ -1,4 +1,4 @@
MODNAME = fun_amx
MODNAME = fun_mm
SRCFILES = fun.cpp
EXTRA_LIBS_LINUX =
@ -12,7 +12,7 @@ EXTRA_FLAGS = -Dstrcmpi=strcasecmp
AMXDIR=../amxmodx
SDKTOP=../hlsdk
METADIR=../metamodx
METADIR=../metamod/metamod
SDKSRC=$(SDKTOP)/SourceCode
@ -26,7 +26,7 @@ else
OS=LINUX
endif
CC_LINUX=gcc-2.95
CC_LINUX=gcc
ifeq "$(OS)" "WIN32"
CC_WIN32=gcc
LD_WINDLL=dllwrap
@ -55,7 +55,7 @@ endif
OBJ_LINUX := $(SRCFILES:%.cpp=$(OBJDIR_LINUX)/%.o)
OBJ_WIN32 := $(SRCFILES:%.cpp=$(OBJDIR_WIN32)/%.o)
CCOPT = -march=i386 -O2 -ffast-math -funroll-loops \
CCOPT = -march=i586 -O6 -ffast-math -funroll-loops \
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
-malign-jumps=2 -malign-functions=2 -s -DNDEBUG -lstdc++

View File

@ -67,18 +67,6 @@
}
*/
// ######## Utils:
void FUNUTIL_ResetPlayer(int index)
{
// Reset silent slippers
g_silent[index] = false;
// Reset hitzones
g_zones_toHit[index] = (1<<HITGROUP_GENERIC) | (1<<HITGROUP_HEAD) | (1<<HITGROUP_CHEST) | (1<<HITGROUP_STOMACH) | (1<<HITGROUP_LEFTARM) | (1<<HITGROUP_RIGHTARM)| (1<<HITGROUP_LEFTLEG) | (1<<HITGROUP_RIGHTLEG);
g_zones_getHit[index] = (1<<HITGROUP_GENERIC) | (1<<HITGROUP_HEAD) | (1<<HITGROUP_CHEST) | (1<<HITGROUP_STOMACH) | (1<<HITGROUP_LEFTARM) | (1<<HITGROUP_RIGHTARM)| (1<<HITGROUP_LEFTLEG) | (1<<HITGROUP_RIGHTLEG);
}
// ######## Natives:
static cell AMX_NATIVE_CALL get_client_listening(AMX *amx, cell *params) // get_client_listening(receiver, sender); = 2 params
{
// Gets who can listen to who.
@ -496,101 +484,21 @@ static cell AMX_NATIVE_CALL get_user_gravity(AMX *amx, cell *params) // Float:ge
return *(cell*)((void *)&(pPlayer->v.gravity)); // The way to return floats... (sigh)
}
/*static cell AMX_NATIVE_CALL set_hitzones(AMX *amx, cell *params) // set_hitzones(body = 255) = 1 argument
static cell AMX_NATIVE_CALL set_hitzones(AMX *amx, cell *params) // set_hitzones(body = 255) = 1 argument
{
// Sets "hitable" zones.
// Gets user gravity.
// params[1] = body hitzones
//native set_user_hitzones(index=0,target=0,body=255);
//set_user_hitzones(id, 0, 0) // Makes ID not able to shoot EVERYONE - id can shoot on 0 (all) at 0
//set_user_hitzones(0, id, 0) // Makes EVERYONE not able to shoot ID - 0 (all) can shoot id at 0
// Fetch player pointer
g_body = params[1];
return 1;
}*/
/*static cell AMX_NATIVE_CALL get_hitzones(AMX *amx, cell *params) // get_hitzones() = 0 arguments
{
// Gets hitzones.
return g_body;
}*/
static cell AMX_NATIVE_CALL set_user_hitzones(AMX *amx, cell *params) // set_user_hitzones(index = 0, target = 0, body = 255); = 3 arguments
{
// Sets user hitzones.
// params[1] = the one(s) who shoot(s), shooter
int shooter = params[1];
if (shooter == -1)
shooter = 0;
// params[2] = the one getting hit
int gettingHit = params[2];
if (gettingHit == -1)
gettingHit = 0;
// params[3] = specified hit zones
int hitzones = params[3];
if (hitzones == -1)
hitzones = 255;
//set_user_hitzones(id, 0, 0) // Makes ID not able to shoot EVERYONE - id can shoot on 0 (all) at 0
//set_user_hitzones(0, id, 0) // Makes EVERYONE not able to shoot ID - 0 (all) can shoot id at 0
if (shooter == 0 && gettingHit == 0) {
// set hitzones for ALL, both where people can hit and where they can _get_ hit.
for (int i = 1; i <= 32; i++) {
g_zones_toHit[i] = hitzones;
g_zones_getHit[i] = hitzones;
}
}
else {
if (shooter == 0) {
// "All" shooters, target (gettingHit) should be existing player id
if (gettingHit < 1 || gettingHit > gpGlobals->maxClients) {
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
// Where can gettingHit get hit by all?
g_zones_getHit[gettingHit] = hitzones;
}
else {
// "shooter" will now only be able to hit other people in "hitzones". (target should be 0 here)
g_zones_toHit[shooter] = hitzones;
}
}
return 1;
}
static cell AMX_NATIVE_CALL get_user_hitzones(AMX *amx, cell *params) // get_user_hitzones(index, target); = 2 arguments
static cell AMX_NATIVE_CALL get_hitzones(AMX *amx, cell *params) // get_hitzones() = 0 arguments
{
// Gets user hitzones.
// params[1] = if this is not 0, return what zones this player can hit
int shooter = params[1];
// params[2] = if shooter was 0, and if this is a player, return what zones this player can get hit in, else... make runtime error?
int gettingHit = params[2];
if (shooter) {
if (FNullEnt(shooter)) {
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
return g_zones_toHit[shooter];
}
else {
if (!gettingHit) {
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
else {
if (FNullEnt(gettingHit)) {
AMX_RAISEERROR(amx, AMX_ERR_NATIVE);
return 0;
}
else {
return g_zones_getHit[gettingHit];
}
}
}
// Gets hitzones.
return g_body;
}
static cell AMX_NATIVE_CALL set_user_noclip(AMX *amx, cell *params) // set_user_noclip(index, noclip = 0); = 2 arguments
@ -673,11 +581,11 @@ static cell AMX_NATIVE_CALL set_user_footsteps(AMX *amx, cell *params) // set_us
if (params[2]) {
pPlayer->v.flTimeStepSound = 999;
g_silent[params[1]] = true;
silent[params[1]] = true;
}
else {
pPlayer->v.flTimeStepSound = STANDARDTIMESTEPSOUND;
g_silent[params[1]] = false;
silent[params[1]] = false;
}
return 1;
@ -699,8 +607,8 @@ AMX_NATIVE_INFO fun_Exports[] = {
{"get_user_maxspeed", get_user_maxspeed},
{"set_user_gravity", set_user_gravity},
{"get_user_gravity", get_user_gravity},
{"set_user_hitzones", set_user_hitzones},
{"get_user_hitzones", get_user_hitzones},
{"set_hitzones", set_hitzones},
{"get_hitzones", get_hitzones},
{"set_user_noclip", set_user_noclip},
{"get_user_noclip", get_user_noclip},
{"set_user_footsteps", set_user_footsteps},
@ -711,7 +619,7 @@ AMX_NATIVE_INFO fun_Exports[] = {
/******************************************************************************************/
void PlayerPreThink(edict_t *pEntity)
{
if (g_silent[ENTINDEX(pEntity)]) {
if (silent[ENTINDEX(pEntity)]) {
pEntity->v.flTimeStepSound = 999;
RETURN_META(MRES_HANDLED);
}
@ -719,46 +627,14 @@ void PlayerPreThink(edict_t *pEntity)
RETURN_META(MRES_IGNORED);
}
/* <--- removed, only needed with akimbot
int ClientConnect(edict_t *pPlayer, const char *pszName, const char *pszAddress, char szRejectReason[128])
{
int index = ENTINDEX(pPlayer);
if (index < 1 || index > gpGlobals->maxClients) // This is probably not really necessary... but just in case to not cause out of bounds errors below.
return 1;
// Find out if user is bot (this doesn't seem to be ever called when bot connects though, but leave it here)
const char* auth = GETPLAYERAUTHID(pPlayer);
if (strcmp(auth, "BOT") == 0)
g_bot[index] = true;
else
g_bot[index] = false;
// Reset stuff:
FUNUTIL_ResetPlayer(index);
return 1;
}
void ClientDisconnect(edict_t *pEntity)
void ClientDisconnect( edict_t *pEntity)
{
int index = ENTINDEX(pEntity);
if (index < 1 || index > gpGlobals->maxClients) // This is probably not really necessary... but just in case to not cause out of bounds errors below.
RETURN_META(MRES_IGNORED);
// Reset stuff:
FUNUTIL_ResetPlayer(index);
// Set to be bot until proven not in ClientConnect
g_bot[index] = true;
silent[index] = false;
RETURN_META(MRES_IGNORED);
}
*/
DLL_FUNCTIONS gFunctionTable; /* = {
DLL_FUNCTIONS gFunctionTable = {
NULL, // pfnGameInit
NULL, // pfnSpawn
NULL, // pfnThink
@ -777,7 +653,7 @@ DLL_FUNCTIONS gFunctionTable; /* = {
NULL, // pfnRestoreGlobalState
NULL, // pfnResetGlobalState
ClientConnect, // pfnClientConnect
NULL, // pfnClientConnect
ClientDisconnect, // pfnClientDisconnect
NULL, // pfnClientKill
NULL, // pfnClientPutInServer
@ -819,7 +695,8 @@ DLL_FUNCTIONS gFunctionTable; /* = {
NULL, // pfnCreateInstancedBaselines
NULL, // pfnInconsistentFile
NULL, // pfnAllowLagCompensation
};*/
};
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
if(!pFunctionTable) {
@ -832,20 +709,13 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
*interfaceVersion = INTERFACE_VERSION;
return(FALSE);
}
//gFunctionTable.pfnClientConnect = ClientConnect; <--- removed, only needed with akimbot
//gFunctionTable.pfnClientDisconnect = ClientDisconnect; <--- removed, only needed with akimbot
//gFunctionTable.pfnClientPutInServer = ClientPutInServer;
gFunctionTable.pfnPlayerPreThink = PlayerPreThink;
memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS));
return(TRUE);
}
/********/
/*void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr)
void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr)
{
if (g_body == 255) {
RETURN_META(MRES_IGNORED);
@ -860,58 +730,6 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
RETURN_META(MRES_SUPERCEDE);
}
}*/
void TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr)
{
/* from eiface.h:
// Returned by TraceLine
typedef struct
{
int fAllSolid; // if true, plane is not valid
int fStartSolid; // if true, the initial point was in a solid area
int fInOpen;
int fInWater;
float flFraction; // time completed, 1.0 = didn't hit anything
vec3_t vecEndPos; // final position
float flPlaneDist;
vec3_t vecPlaneNormal; // surface normal at impact
edict_t *pHit; // entity the surface is on
int iHitgroup; // 0 == generic, non zero is specific body part
} TraceResult;
*/
/*if (g_bot[ENTINDEX(pentToSkip)]) <--- removed, only needed with akimbot
RETURN_META(MRES_IGNORED);*/
TRACE_LINE(v1, v2, fNoMonsters, pentToSkip, ptr); // pentToSkip gotta be the one that is shooting, so filter it
int hitIndex = ENTINDEX(ptr->pHit);
if (hitIndex >= 1 && hitIndex <= gpGlobals->maxClients) {
if ( !(
g_zones_getHit[hitIndex] & (1 << ptr->iHitgroup) // can ptr->pHit get hit in ptr->iHitgroup at all?
&& g_zones_toHit[hitIndex] & (1 << ptr->iHitgroup) ) // can pentToSkip hit other people in that hit zone?
) {
ptr->flFraction = 1.0; // set to not hit anything (1.0 = shot doesn't hit anything)
}
}
/* if ( !(
g_zones_getHit[ENTINDEX(ptr->pHit)] & (1 << ptr->iHitgroup) // can ptr->pHit get hit in ptr->iHitgroup at all?
&& g_zones_toHit[ENTINDEX(pentToSkip)] & (1 << ptr->iHitgroup) ) // can pentToSkip hit other people in that hit zone?
) {
ptr->flFraction = 1.0; // set to not hit anything (1.0 = shot doesn't hit anything)
}*/
RETURN_META(MRES_SUPERCEDE);
/*
MRES_IGNORED, // plugin didn't take any action
MRES_HANDLED, // plugin did something, but real function should still be called
MRES_OVERRIDE, // call real function, but use my return value
MRES_SUPERCEDE, // skip real function; use my return value
*/
//RETURN_META(MRES_IGNORED);
}
enginefuncs_t meta_engfuncs;
@ -948,29 +766,22 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
// JGHG added stuff below (initing stuff here)
//g_body = (1<<HITGROUP_GENERIC) | (1<<HITGROUP_HEAD) | (1<<HITGROUP_CHEST) | (1<<HITGROUP_STOMACH) | (1<<HITGROUP_LEFTARM) | (1<<HITGROUP_RIGHTARM)| (1<<HITGROUP_LEFTLEG) | (1<<HITGROUP_RIGHTLEG); // init hs_body
g_body = (1<<HITGROUP_GENERIC) | (1<<HITGROUP_HEAD) | (1<<HITGROUP_CHEST) | (1<<HITGROUP_STOMACH) | (1<<HITGROUP_LEFTARM) | (1<<HITGROUP_RIGHTARM)| (1<<HITGROUP_LEFTLEG) | (1<<HITGROUP_RIGHTLEG); // init hs_body
CVAR_REGISTER(&fun_version);
// generic is needed or bots go crazy... don't know what its for otherwise. You can still kill people.
// these hitzones never affect CS knife? ie you can always hit with knife no matter what you set here
//hs_body = (1<<HITGROUP_GENERIC) | (1<<HITGROUP_LEFTLEG) | (1<<HITGROUP_LEFTARM); // init hs_body
// Set default zones for people to hit and get hit.
for (int i = 1; i <= 32; i++) {
g_zones_toHit[i] = (1<<HITGROUP_GENERIC) | (1<<HITGROUP_HEAD) | (1<<HITGROUP_CHEST) | (1<<HITGROUP_STOMACH) | (1<<HITGROUP_LEFTARM) | (1<<HITGROUP_RIGHTARM)| (1<<HITGROUP_LEFTLEG) | (1<<HITGROUP_RIGHTLEG);
g_zones_getHit[i] = (1<<HITGROUP_GENERIC) | (1<<HITGROUP_HEAD) | (1<<HITGROUP_CHEST) | (1<<HITGROUP_STOMACH) | (1<<HITGROUP_LEFTARM) | (1<<HITGROUP_RIGHTARM)| (1<<HITGROUP_LEFTLEG) | (1<<HITGROUP_RIGHTLEG);
// Also set to be bot until proven not in ClientDisconnect (that seems to be only called by real players...)
// g_bot[i] = true; <--- removed, only needed with akimbot
}
// JGHG added stuff above
/*
#define HITGROUP_GENERIC 0 // none == 1
#define HITGROUP_HEAD 1 = 2
#define HITGROUP_CHEST 2 = 4
#define HITGROUP_STOMACH 3 = 8
#define HITGROUP_LEFTARM 4 = 16
#define HITGROUP_RIGHTARM 5 = 32
#define HITGROUP_LEFTLEG 6 = 64
#define HITGROUP_RIGHTLEG 7 = 128
#define HITGROUP_GENERIC 0 // none
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
*/
return(TRUE);

View File

@ -56,7 +56,7 @@ LINK32=link.exe
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Cmds=echo Copying dll... copy Release\fun.dll K:\S\cstrike\addons\amxx\modules\fun_amx.dll echo Copying inc... copy ..\plugins\include\fun.inc K:\S\cstrike\addons\amxx\scripting\include
PostBuild_Cmds=echo Copying dll... copy Release\fun.dll K:\S\cstrike\addons\amx\dlls echo Copying inc... copy fun.inc K:\S\cstrike\addons\amx\examples\include copy fun.inc K:\S\cstrike\addons\amx\plugins\include
# End Special Build Tool
!ELSEIF "$(CFG)" == "fun - Win32 Debug"
@ -117,7 +117,7 @@ SOURCE=.\fun.h
# End Group
# Begin Source File
SOURCE=..\plugins\include\fun.inc
SOURCE=.\fun.inc
# End Source File
# End Target
# End Project

View File

@ -59,27 +59,27 @@ pfnmodule_engine_g* g_engModuleFunc; // These seem to be meta/amxmod related
#define NAME "Fun"
#define AUTHOR "AMX Mod X Dev Team"
#define VERSION "0.15"
#define VERSION "0.1"
#define URL "http://www.amxmodx.org"
#define LOGTAG "FUN"
#define DATE __DATE__
// Fun-specific defines below
#define CVAR_FUN_VERSION "fun_version"
#define GETCLIENTLISTENING (*g_engfuncs.pfnVoice_GetClientListening)
#define SETCLIENTLISTENING (*g_engfuncs.pfnVoice_SetClientListening)
#define SETCLIENTMAXSPEED (*g_engfuncs.pfnSetClientMaxspeed)
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
#define SF_NORESPAWN (1 << 30)// !!!set this bit on guns and stuff that should never respawn.
#define STANDARDTIMESTEPSOUND 400
#define HITGROUP_GENERIC 0 // none
#define HITGROUP_HEAD 1 // 1 << 1 = 2
#define HITGROUP_CHEST 2 // 1 << 2 = 4
#define HITGROUP_STOMACH 3 // 8
#define HITGROUP_LEFTARM 4 // 16
#define HITGROUP_RIGHTARM 5 // 32
#define HITGROUP_LEFTLEG 6 // 64
#define HITGROUP_RIGHTLEG 7 // 128
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7
// Fun-specific defines above
// Globals below
@ -101,10 +101,7 @@ module_info_s module_info = {
AMX_INTERFACE_VERSION,
RELOAD_MODULE,
};
// The stuff below might end up in a class soon
int g_zones_toHit[33]; // where can people hit other people?
int g_zones_getHit[33]; // where can people get hit by other people?
bool g_silent[33]; // used for set_user_footsteps()
//bool g_bot[33]; // is user bot? <--- removed, only needed with akimbot
cvar_t fun_version = {"fun_version", "0.1", FCVAR_EXTDLL};
int g_body = 0; // bits of parts of body to hit
bool silent[33]; // used for set_user_footsteps()
// Globals above

View File

@ -1,195 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="fun"
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"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FUN_EXPORTS"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/fun.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/fun.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\fun.def"
ProgramDatabaseFile=".\Release/fun.pdb"
ImportLibrary=".\Release/fun.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Release/fun.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="echo Copying dll...
copy Release\fun.dll K:\S\cstrike\addons\amx\dlls
echo Copying inc...
copy fun.inc K:\S\cstrike\addons\amx\examples\include
copy fun.inc K:\S\cstrike\addons\amx\plugins\include
"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1053"/>
<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"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FUN_EXPORTS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/fun.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="Debug/fun_debug.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\fun.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/fun_debug.pdb"
ImportLibrary=".\Debug/fun_debug.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\Debug/fun.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1053"/>
<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="fun.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;FUN_EXPORTS;$(NoInherit)"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;FUN_EXPORTS;$(NoInherit)"
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="fun.def">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="fun.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<File
RelativePath="fun.inc">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -48,7 +48,7 @@ new g_cmdLoopback[16]
public plugin_init()
{
register_plugin("Admin Base","0.15","AMXX Dev Team")
register_plugin("Admin Base","0.1","AMXX Dev Team")
register_cvar("amx_mode","2.0")
register_cvar("amx_password_field","_pw")
register_cvar("amx_default_access","")
@ -71,8 +71,11 @@ public plugin_init()
remove_user_flags(0,read_flags("z")) // Remove 'user' flag from server rights
server_cmd("exec addons/amxx/amx.cfg") // Execute main configuration file
loadSettings("addons/amxx/configs/users.ini") // Load admins accounts
new filename[64]
get_basedir( filename , 31 )
server_cmd("exec %s/amx.cfg" , filename ) // Execute main configuration file
format( filename, 63 , "%s/configs/users.ini" , filename )
loadSettings( filename ) // Load admins accounts
}
loadSettings(szFilename[])

View File

@ -49,7 +49,7 @@ new g_cmdLoopback[16]
public plugin_init()
{
register_plugin("Admin Base for MySQL","0.15","AMXX Dev Team")
register_plugin("Admin Base for MySQL","0.1","AMXX Dev Team")
register_cvar("amx_mode","2.0")
register_cvar("amx_password_field","_pw")
@ -80,8 +80,10 @@ public plugin_init()
remove_user_flags(0,read_flags("z")) // remove 'user' flag from server rights
server_cmd("exec addons/amxx/amx.cfg")
server_cmd("exec addons/amxx/configs/mysql.cfg;amx_sqladmins")
new filename[32]
get_basedir( filename , 31 )
server_cmd("exec %s/amx.cfg" , filename)
server_cmd("exec %s/configs/mysql.cfg;amx_sqladmins" , filename)
}
public adminSql() {

View File

@ -47,7 +47,7 @@ new g_Values[MAX_CLR][] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,
new Float:g_Pos[4][] = {{0.0,0.0},{0.05,0.55},{-1.0,0.2},{-1.0,0.7}}
public plugin_init(){
register_plugin("Admin Chat","0.15","AMXX Dev Team")
register_plugin("Admin Chat","0.1","AMXX Dev Team")
register_clcmd("say","cmdSayChat",ADMIN_CHAT,"@[@|@|@][w|r|g|b|y|m|c]<text> - displays hud message")
register_clcmd("say_team","cmdSayAdmin",0,"@<text> - displays message to admins")
register_concmd("amx_say","cmdSay",ADMIN_CHAT,"<message> - sends message to all players")

View File

@ -45,7 +45,7 @@ new bool:g_Paused
new g_addCvar[] = "amx_cvar add %s"
public plugin_init(){
register_plugin("Admin Commands","0.15","AMXX Dev Team")
register_plugin("Admin Commands","0.1","AMXX Dev Team")
register_concmd("amx_kick","cmdKick",ADMIN_KICK,"<name or #userid> [reason]")
register_concmd("amx_ban","cmdAddBan",ADMIN_BAN,"<authid or ip> <minutes> [reason]")
register_concmd("amx_banid","cmdBan",ADMIN_BAN,"<name or #userid> <minutes> [reason]")
@ -103,15 +103,9 @@ public cmdKick(id,level,cid){
else
{
#if !defined NO_STEAM
if (reason[0])
server_cmd("kick #%d ^"%s^"",userid2,reason)
else
server_cmd("kick #%d",userid2)
server_cmd("kick #%d ^"%s^"",userid2,reason)
#else
if (reason[0])
client_cmd(player,"echo ^"Kicked: Reason: %s^";disconnect",reason)
else
client_cmd(player,"echo ^"Kicked^";disconnect",reason)
client_cmd(player,"echo ^"%s^";disconnect",reason)
#endif
}
console_print(id,"Client ^"%s^" kicked",name2)
@ -189,7 +183,7 @@ public cmdBan(id,level,cid){
name,get_user_userid(id),authid, name2,userid2,authid2,minutes,reason)
new temp[64]
if (str_to_num(minutes))
if (str_to_int(minutes))
format(temp,63,"for %s min.",minutes)
else
temp = "permanently"
@ -198,30 +192,18 @@ public cmdBan(id,level,cid){
new address[32]
get_user_ip(player,address,31,1)
#if !defined NO_STEAM
if (reason[0])
server_cmd("kick #%d ^"%s (banned %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,reason,temp,minutes,address)
else
server_cmd("kick #%d ^"banned %s^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,temp,minutes,address)
server_cmd("kick #%d ^"%s (banned %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip",userid2,reason,temp,minutes,address)
#else
if (reason[0])
client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp)
else
client_cmd(player,"echo ^"banned %s^";disconnect",temp)
client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp)
server_cmd("addip ^"%s^" ^"%s^";wait;writeip",minutes,address)
#endif
}
else
{
#if !defined NO_STEAM
if (reason[0])
server_cmd("kick #%d ^"%s (banned %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,reason,temp,minutes,authid2)
else
server_cmd("kick #%d ^"banned %s^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,temp,minutes,authid2)
server_cmd("kick #%d ^"%s (banned %s)^";wait;banid ^"%s^" ^"%s^";wait;writeid",userid2,reason,temp,minutes,authid2)
#else
if (reason[0])
client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp)
else
client_cmd(player,"echo ^"banned %s^";disconnect",temp)
client_cmd(player,"echo ^"%s (banned %s)^";disconnect",reason,temp)
server_cmd("banid ^"%s^" ^"%s^";wait;writeip",minutes,authid2)
#endif
}
@ -274,7 +256,7 @@ public cmdSlap(id,level,cid){
if (!player) return PLUGIN_HANDLED
new spower[32],authid[32],name2[32],authid2[32],name[32]
read_argv(2,spower,31)
new damage = str_to_num(spower)
new damage = str_to_int(spower)
user_slap(player,damage)
get_user_authid(id,authid,31)
get_user_name(id,name,31)
@ -385,9 +367,8 @@ public cmdPlugins(id,level,cid)
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new name[32],version[32],author[32],filename[32],status[32]
/*
#if !defined NO_STEAM
#define MOTD_LEN 1024
new motd_body[MOTD_LEN],state[4]
new num = get_pluginsnum()
new running = 0
@ -399,6 +380,7 @@ public cmdPlugins(id,level,cid)
{
if (equal(state,"one")) copy(state,3,"two")
else copy(state,3,"one")
new name[32],version[32],author[32],filename[32],status[32]
get_plugin(i,filename,31,name,31,version,31,author,31,status,31)
pos += format(motd_body[pos],MOTD_LEN-pos,"<tr class=^"%s^"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",state,name,version,author,filename,status)
if (equal(status,"running"))
@ -406,19 +388,21 @@ public cmdPlugins(id,level,cid)
}
format(motd_body[pos],MOTD_LEN-pos,"</table>%d plugins, %d running</body></html>",num,running)
show_motd(id,motd_body,"Currently loaded plugins:")
*/
#else
new num = get_pluginsnum()
new running = 0
console_print(id,"Currently loaded plugins:")
console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s","name","version","author","file","status")
for (new i=0;i<num;i++)
{
new name[32],version[32],author[32],filename[32],status[32]
get_plugin(i,filename,31,name,31,version,31,author,31,status,31)
console_print(id,"%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",name,version,author,filename,status)
console_print("%-18.17s %-8.7s %-17.16s %-16.15s %-9.8s",name,version,author,filename,status)
if (equal(status,"running"))
running++
}
console_print(id,"%d plugins, %d running",num,running)
#endif
return PLUGIN_HANDLED
}
@ -428,9 +412,10 @@ public cmdModules(id,level,cid)
if (!cmd_access(id,level,cid,1))
return PLUGIN_HANDLED
new name[32],version[32],author[32],status,sStatus[16]
/*
#if !defined NO_STEAM
#if !defined MOTD_LEN
#define MOTD_LEN 1024
#endif
new motd_body[MOTD_LEN],state[4]
new num = get_modulesnum()
new pos = copy(motd_body,MOTD_LEN,"<html><head><body><style type=^"text/css^">")
@ -441,26 +426,24 @@ public cmdModules(id,level,cid)
{
if (equal(state,"one")) copy(state,3,"two")
else copy(state,3,"one")
get_module(i,name,31,author,31,version,31)
new name[32],version[32],author[32],filename[32],status[32]
get_plugin(i,filename,31,name,31,version,31,author,31,status,31)
pos += format(motd_body[pos],MOTD_LEN-pos,"<tr class=^"%s^"><td>%s</td><td>%s</td><td>%s</td></tr>",state,name,version,author)
}
format(motd_body[pos],MOTD_LEN-pos,"</table>%d modules</body></html>",num)
show_motd(id,motd_body,"Currently loaded modules:")
*/
#else
new num = get_modulesnum()
console_print(id,"Currently loaded modules:")
console_print(id,"%-23.22s %-8.7s %-20.19s","name","version","author")
for (new i=0;i<num;i++)
{
get_module(i,name,31,author,31,version,31,status)
switch (status)
{
case module_loaded: copy(sStatus,15,"running")
default: copy(sStatus,15,"error")
}
console_print(id,"%-23.22s %-8.7s %-20.19s",name,version,author)
new name[32],version[32],author[32]
get_module(i,name,31,author,31,version,31)
console_print("%-23.22s %-8.7s %-20.19s",name,version,author)
}
console_print(id,"%d modules",num)
#endif
return PLUGIN_HANDLED
}

View File

@ -41,7 +41,7 @@ new g_timeInfo1[] = "Time Left: %d:%02d min. Next Map: %s"
new g_timeInfo2[] = "No Time Limit. Next Map: %s"
public plugin_init() {
register_plugin("Admin Help","0.15","AMXX Dev Team")
register_plugin("Admin Help","0.1","AMXX Dev Team")
register_concmd("amx_help","cmdHelp",0,"- displays this help")
setHelp(0)
}
@ -51,7 +51,7 @@ public client_putinserver(id)
public cmdHelp(id,level,cid){
new arg1[8],flags = get_user_flags(id)
new start = read_argv(1,arg1,7) ? str_to_num(arg1) : 1
new start = read_argv(1,arg1,7) ? str_to_int(arg1) : 1
if (--start < 0) start = 0
new clcmdsnum = get_concmdsnum(flags,id)
if (start >= clcmdsnum) start = clcmdsnum - 1

View File

@ -42,7 +42,7 @@ new g_cmdLoopback[16]
public plugin_init()
{
register_plugin("Slots Reservation","0.15","AMXX Dev Team")
register_plugin("Slots Reservation","0.1","AMXX Dev Team")
register_cvar("amx_reservation","1")
format( g_cmdLoopback, 15, "amxres%c%c%c%c" ,

View File

@ -54,7 +54,7 @@ new bool:g_execResult
new Float:g_voteRatio
public plugin_init() {
register_plugin("Admin Votes","0.15","AMXX Dev Team")
register_plugin("Admin Votes","0.1","AMXX Dev Team")
register_menucmd(register_menuid("Change map to ") ,(1<<0)|(1<<1),"voteCount")
register_menucmd(register_menuid("Choose map: ") ,(1<<0)|(1<<1)|(1<<2)|(1<<3),"voteCount")
register_menucmd(register_menuid("Kick ") ,(1<<0)|(1<<1),"voteCount")
@ -333,7 +333,7 @@ public cmdVoteKickBan(id,level,cid) {
if (voteban)
get_user_authid(player,g_optionName[0],31)
else
num_to_str(get_user_userid(player),g_optionName[0],31)
int_to_str(get_user_userid(player),g_optionName[0],31)
new authid[32],name[32]
get_user_authid(id,authid,31)
get_user_name(id,name,31)

View File

@ -38,7 +38,7 @@ new Float:g_Flooding[33]
public plugin_init()
{
register_plugin("Anti Flood","0.15","AMXX Dev Team")
register_plugin("Anti Flood","0.1","AMXX Dev Team")
register_clcmd("say","chkFlood")
register_clcmd("say_team","chkFlood")
register_cvar("amx_flood_time","0.75")

View File

@ -88,21 +88,23 @@ new g_cstrikeRunning
public plugin_init()
{
register_plugin("Commands Menu","0.15","AMXX Dev Team")
register_plugin("Commands Menu","0.1","AMXX Dev Team")
new config[64]
new basedir[32], workdir[64]
get_basedir( basedir , 31 )
for(new a = 0; a < MAX_CMDS_LAYERS; ++a) {
register_menucmd(register_menuid( g_cmdMenuName[ a ] ),1023,"actionCmdMenu")
register_clcmd( g_cmdMenuCmd[ a ] ,"cmdCmdMenu",ADMIN_MENU, g_cmdMenuHelp[ a ] )
format(config,63,"addons/amxx/configs/%s",g_cmdMenuCfg[a])
loadCmdSettings(config,a)
format( workdir, 63, "%s/configs/%s" , basedir , g_cmdMenuCfg[ a ] )
loadCmdSettings( workdir , a )
}
register_menucmd(register_menuid("Cvars Menu"),1023,"actionCvarMenu")
register_clcmd("amx_cvarmenu","cmdCvarMenu",ADMIN_CVAR,"- displays cvars menu")
loadCvarSettings("addons/amxx/configs/cvars.ini")
format( workdir, 63, "%s/configs/cvars.ini" , basedir )
loadCvarSettings( workdir )
g_cstrikeRunning = is_running("cstrike")
}

View File

@ -46,12 +46,12 @@ new g_MessagesNum
new g_Current
public plugin_init(){
register_plugin("Info. Messages","0.15","AMXX Dev Team")
register_plugin("Info. Messages","0.1","AMXX Dev Team")
register_srvcmd("amx_imessage","setMessage")
register_cvar("amx_freq_imessage","10")
new lastinfo[8]
get_localinfo("lastinfomsg",lastinfo,7)
g_Current = str_to_num(lastinfo)
g_Current = str_to_int(lastinfo)
set_localinfo("lastinfomsg","")
}
@ -82,11 +82,11 @@ public setMessage(id,level,cid) {
while(replace(g_Messages[g_MessagesNum],380,"\n","^n")){}
new mycol[12]
read_argv(2,mycol,11) // RRRGGGBBB
g_Values[g_MessagesNum][2] = str_to_num(mycol[6])
g_Values[g_MessagesNum][2] = str_to_int(mycol[6])
mycol[6] = 0
g_Values[g_MessagesNum][1] = str_to_num(mycol[3])
g_Values[g_MessagesNum][1] = str_to_int(mycol[3])
mycol[3] = 0
g_Values[g_MessagesNum][0] = str_to_num(mycol[0])
g_Values[g_MessagesNum][0] = str_to_int(mycol[0])
g_MessagesNum++
new Float:freq_im = get_cvar_float("amx_freq_imessage")
if ( freq_im > 0.0 ) set_task( freq_im ,"infoMessage",12345)
@ -95,6 +95,6 @@ public setMessage(id,level,cid) {
public plugin_end(){
new lastinfo[8]
num_to_str(g_Current,lastinfo,7)
int_to_str(g_Current,lastinfo,7)
set_localinfo("lastinfomsg",lastinfo)
}

View File

@ -49,7 +49,7 @@ stock Entvars_Set_Byte(iIndex, iVariable, iNewValue)
return entity_set_byte(iIndex, iVariable, iNewValue)
stock CreateEntity(szClassname[])
return create_entity(szClassname)
return create_entity(szClassname[])
stock ENT_SetModel(iIndex, szModel[])
return entity_set_model(iIndex, szModel)
@ -58,7 +58,7 @@ stock ENT_SetOrigin(iIndex, Float:fNewOrigin[3])
return entity_set_origin(iIndex, fNewOrigin)
stock FindEntity(iIndex, szValue[])
return find_ent_by_class(iIndex, szValue)
return find_entity(iIndex, szValue)
stock RemoveEntity(iIndex)
return remove_entity(iIndex)

View File

@ -207,16 +207,4 @@ enum {
force_exactfile = 0, /* File on client must exactly match server's file */
force_model_samebounds, /* For model files only, the geometry must fit in the same bbox */
force_model_specifybounds, /* For model files only, the geometry must fit in the specified bbox */
}
/* Status for get_module() */
enum {
module_none = 0,
module_query,
module_badload,
module_loaded,
module_noinfo,
module_noquery,
module_noattach,
module_old,
};
}

View File

@ -42,7 +42,7 @@ stock cmd_target(id,const arg[],flags = 1) {
}
}
else if ( ( player = find_player("c",arg) )==0 && arg[0]=='#' && arg[1] )
player = find_player("k",str_to_num(arg[1]))
player = find_player("k",strtonum(arg[1]))
if (!player) {
console_print(id,"Client with that name or userid not found")
return 0
@ -92,9 +92,11 @@ stock is_running(const arg[]) {
}
stock build_path( path[] , len , {Float,_}:... ) {
new basedir[32]
get_localinfo( "amxx_basedir", basedir , 31 )
format_args( path , len , 2 )
return replace( path , len , "$basedir", "addons/amxx" )
return replace( path , len , "$basedir", basedir )
}
stock get_basedir( name[], len )
return copy(name,len,"addons/amxx")
return get_localinfo( "amxx_basedir", name , len )

View File

@ -15,23 +15,25 @@
#include <engine>
#include <fun>
native numtostr(num,string[],len)
native strtonum(const string[])
stock set_user_hitzones(index=0,target=0,body=255)
return set_hitzones(body)
stock get_user_hitzones(index,target)
return get_hitzones()
stock user_spawn(index)
return spawn(index)
/* use log_amx() instead */
stock get_logfile( name[], len )
return get_time("admin%m%d.log",name,len)
stock get_user_wonid(index)
return 0
stock get_user_money(index)
return cs_get_user_money(index)
stock set_user_money(index,money,flash=1)
return cs_set_user_money(index,money,flash)
stock numtostr(num,string[],len)
return num_to_str(num,string,len)
stock strtonum(const string[])
return str_to_num(string)
return cs_set_user_money(index,money,flash)

View File

@ -254,6 +254,9 @@ native get_user_name(index,name[],len);
/* Gets player authid. */
native get_user_authid(index, authid[] ,len);
/* Returns player wonid. */
native get_user_wonid(index);
/* Returns player userid. */
native get_user_userid(index);
@ -442,21 +445,6 @@ native register_concmd(const cmd[],const function[],flags=-1, info[]="");
/* Registers function which will be called from server console. */
native register_srvcmd(const server_cmd[],const function[],flags=-1, info[]="");
/* These functinos are used to generate client messages.
* You may generate menu, smoke, shockwaves, thunderlights,
* intermission and many many others messages.
* See HL SDK for more examples. */
native message_begin( dest, msg_type, origin[3]={0,0,0},player=0);
native message_end();
native write_byte( x );
native write_char( x );
native write_short( x );
native write_long( x );
native write_entity( x );
native write_angle( x );
native write_coord( x );
native write_string( x[] );
/* Gets info about client command. */
native get_clcmd(index, command[], len1, &flags, info[], len2, flag);
@ -548,11 +536,10 @@ native is_module_loaded(const name[]);
* authorLen - maximal length of the author
* version[] - the version of the module will be stored here
* versionLen - maximal length of the version
* status - the status of the module will be stored here
* Return value:
* id - success
* -1 - module not found */
native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen, &status);
native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen);
/* Returns number of currently registered modules */
native get_modulesnum();

View File

@ -13,6 +13,21 @@
#include <engine_const>
/* These functinos are used to generate client messages.
* You may generate menu, smoke, shockwaves, thunderlights,
* intermission and many many others messages.
* See HL SDK for more examples. */
native message_begin( dest, msg_type, origin[3]={0,0,0},player=0);
native message_end();
native write_byte( x );
native write_char( x );
native write_short( x );
native write_long( x );
native write_entity( x );
native write_angle( x );
native write_coord( x );
native write_string( x[] );
/* This is a highly experimental command that will directly hook a message in the engine!
* You can overwrite the message before anything happens and either let the message continue
* or fully block it. Here is how it works:
@ -24,7 +39,7 @@ native register_message(iMsgId, szFunction[]);
/* The get/set _msg commands will utterly fail if used outside a hooked message scope.
* They should never, NEVER, EVER be used unless inside a registered message function.
* There are eight different ways of sending a message, five are ints, two are floats, and one is string.
* These are denoted by iArgType. argn is the number
* These are denoted by iArgType. msg_tid is the message you are hooking. argn is the number
* of the argument. Exceeding the bounds of 1 to get_msg_args() is a bad idea. */
/* Gets number of arguments that were passed to this message */
@ -59,31 +74,6 @@ native set_offset_short(id, offset);
/* Precaches any file. */
native precache_generic(szFile[]);
/* Precaches an event. */
native precache_event(type, Name[], {float,_}:...);
//Drops an entity to the floor (work?)
native drop_to_floor(entity)
/* Get whole buffer containing keys and their data. */
native get_info_keybuffer(id, buffer[], length);
/* Use an entity with another entity. "used" could be a hostage, "user" a player. */
native force_use(pPlayer, pEntity);
/* Get globals from server. */
native Float:get_global_float(variable);
native get_global_int(variable);
native get_global_string(variable, string[], maxlen);
native get_global_vector(variable, Float:vector[3]);
native get_global_edict(variable);
/* Set entity bounds. */
native set_size(index, Float:mins[3], Float:maxs[3]);
/* Get decal index */
native get_decal_index(const szDecalName[]);
/* Sets/gets things in an entities Entvars Struct. */
native entity_get_int(iIndex, iKey);
@ -102,8 +92,8 @@ native entity_set_byte(iIndex, iKey, iVal);
/* Creates an entity, will return the index of the created entity. ClassName must be valid. */
native create_entity(szClassname[]);
/* Finds an entity in the world, will return 0 if nothing is found */
native find_ent_by_class(iIndex, szClass[]);
/* Finds an entity in the world, will return -1 if nothing is found */
native find_entity(iIndex, szClass[]);
native find_ent_by_owner(iIndex, szClass[], iOwner);
native find_ent_by_target(iIndex, szClass[]);
native find_ent_by_tname(iIndex, szClass[]);

View File

@ -307,49 +307,4 @@ enum {
#define EF_INVLIGHT 16 /* get lighting from ceiling */
#define EF_NOINTERP 32 /* don't interpolate the next frame */
#define EF_LIGHT 64 /* rocket flare glow sprite */
#define EF_NODRAW 128 /* don't draw entity */
enum {
// Edict
GL_trace_ent = 0,
// Float
GL_coop,
GL_deathmatch,
GL_force_retouch,
GL_found_secrets,
GL_frametime,
GL_serverflags,
GL_teamplay,
GL_time,
GL_trace_allsolid,
GL_trace_fraction,
GL_trace_inopen,
GL_trace_inwater,
GL_trace_plane_dist,
GL_trace_startsolid,
// Int
GL_cdAudioTrack,
GL_maxClients,
GL_maxEntities,
GL_msg_entity,
GL_trace_flags,
GL_trace_hitgroup,
// String
GL_pStringBase,
GL_mapname,
GL_startspot,
// Vector
GL_trace_endpos,
GL_trace_plane_normal,
GL_v_forward,
GL_v_right,
GL_v_up,
GL_vecLandmarkOffset,
// Void (not supported)
GL_pSaveData
}
#define EF_NODRAW 128 /* don't draw entity */

View File

@ -11,12 +11,6 @@
#endif
#define _engine_stocks_included
//wrapper for find_ent_by_class
stock find_ent(iStart, szClassname[])
{
return find_ent_by_classname(iStart, szClassname)
}
/* Changes an integer vec to a floating vec */
stock IVecFVec(IVec[3], Float:FVec[3])
@ -67,13 +61,13 @@ stock get_entity_distance(ent1, ent2)
/* Get grenade thrown by this user */
stock get_grenade(id)
{
new iGrenade = find_ent_by_class(-1, "grenade")
new iGrenade = find_entity(-1, "grenade")
while(iGrenade > 0)
{
if(entity_get_edict(iGrenade, EV_ENT_owner) == id)
return iGrenade
iGrenade = find_ent_by_class(iGrenade, "grenade")
iGrenade = find_entity(iGrenade, "grenade")
}
return 0
@ -98,7 +92,7 @@ stock remove_entity_name(eName[])
while (iEntity > 0)
{
remove_entity(iEntity)
iEntity = find_ent_by_class(-1, eName)
iEntity = find_entity(-1, eName)
}
return 1

View File

@ -31,29 +31,25 @@ native set_user_origin(index, origin[3]);
native set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16);
/* Gives item to player, name of item can start
* with weapon_, ammo_ and item_. This event
* is announced with proper message to all players. */
* with weapon_, ammo_ and item_. This event
* is announced with proper message to all players. */
native give_item(index, const item[]);
/* Sets hit zones for player.
* Parts of body are as bits:
* 1 - generic
* 2 - head
* 4 - chest
* 8 - stomach
* 16 - left arm
* 32 - right arm
* 64 - left leg
* 128 - right leg
* Set index to a player's index and leave target at 0 to define what bodyparts this player can hit when he is firing.
* Set index to 0 and target to a player's index to define what bodyparts on player other players can hit when they are firing.
* Set both index and target to 0 to define globally what bodyparts people can hit and what bodyparts can be hit when firing. */
native set_user_hitzones(index = 0, target = 0, body = 255);
/* (not yet implemented, don't know how to use native)
* Sets hit zones for player. This event is announced
* with proper message to all players.
* Parts of body are as bits:
* 2 - head
* 4 - chest
* 8 - stomach
* 16 - left arm
* 32 - right arm
* 64 - left leg
* 128 - right leg */
native set_hitzones(body = 255);
/* Get user hitzones.
* To get what bodyparts a player can hit when firing, set the player's index to index and target to 0.
* To get what bodyparts other players can hit when firing at player, set index to 0 and target to player's index. */
native get_user_hitzones(index, target);
/* Get current hitzones. */
native get_hitzones();
/* Sets users max. speed. */
native set_user_maxspeed(index, Float:speed = -1.0);

View File

@ -40,6 +40,18 @@ native num_to_str(num,string[],len);
/* Returns converted string to number. */
native str_to_num(const string[]);
stock int_to_str(num,string[],len)
return num_to_str(num,string,len)
stock str_to_int(const string[])
return str_to_num(string)
stock numtostr(num,string[],len)
return num_to_str(num,string,len)
stock strtonum(const string[])
return str_to_num(string)
/* Checks if two strings equal. If len var is set
* then there are only c chars comapred. */
native equal(const a[],const b[],c=0);

View File

@ -1,105 +0,0 @@
/* Xtrafun backwards compatibility
*
* by the AMX Mod X Development Team
* These natives were originally made by SpaceDude, EJ, and JustinHoMi.
*
* This file is provided as is (no warranties).
*/
#if !defined _xtrafun_included
#define _xtrafun_included
#if !defined _engine_included
#include <engine.inc>
#endif
/* Gets the velocity of an entity */
stock get_entity_velocity(index, velocity[3]) {
new Float:vector[3]
entity_get_vector(index, EV_VEC_velocity, vector)
FVecIVec(vector, velocity)
}
/* Sets the velocity of an entity */
stock set_entity_velocity(index, velocity[3]) {
new Float:vector[3]
IVecFVec(velocity, vector)
entity_set_vector(index, EV_VEC_velocity, vector)
}
/* Gets the origin of an entity */
stock get_entity_origin(index, origin[3]) {
new Float:vector[3]
entity_get_vector(index, EV_VEC_origin, vector)
FVecIVec(vector, origin)
}
/* Sets the origin of an entity */
stock set_entity_origin(index, origin[3]) {
new Float:vector[3]
IVecFVec(originvector)
entity_set_vector(index, EV_VEC_origin, vector)
}
/* Gets the velocity of a player */
stock get_user_velocity(index, velocity[3]) {
get_entity_velocity(index, velocity)
}
/* Sets the velocity of a player */
stock set_user_velocity(index, velocity[3]) {
set_entity_velocity(index, velocity)
}
/* Get the index of the grenade belonging to index.
* Model of grenade is returned in model[].
* Specify the grenadeindex to start searching from,
* or leave it at 0 to search from the start.
* Returns grenade index.
* Paths + models of grenades in Counter-Strike:
* HEGRENADE = "models/w_hegrenade.mdl"
* FLASHBANG = "models/w_flashbang.mdl"
* SMOKEGRENADE = "models/w_smokegrenade.mdl" */
stock get_grenade_index(index, model[], len, grenadeindex = 0) {
new entfind = grenadeindex
new entowner = index
for (;;) {
entfind = find_entity_by_class(entfind, "grenade")
if (entfind && is_valid_ent(entfind)) {
if (entity_get_edict(entFind, EV_ENT_owner) == entowner) {
entity_get_string(entfind, EV_SZ_model, model)
return entfind
}
}
else {
// Eventually comes here if loop fails to find a grenade with specified owner.
return 0;
}
}
}
/* Find the number of entities in the game */
stock current_num_ents() {
return entity_count();
}
enum {
classname = 0,
target,
targetname
}
/* Find an entity ID from start_from_ent id (use 0 to start from
* the beginning, category is either "classname", "target" or
* "targetname", value is the name you are searching for */
stock find_entity(start_from_ent, category, value[]) {
switch (category) {
case target: return find_entity_by_target(start_from_ent, value)
case targetname: return find_ent_by_tname(start_from_ent, value)
}
return find_entity_by_class(start_from_ent, value)
}
#endif // _xtrafun_included

View File

@ -52,7 +52,7 @@ new bool:g_selected = false
public plugin_init()
{
register_plugin("Nextmap Chooser","0.15","AMXX Dev Team")
register_plugin("Nextmap Chooser","0.1","AMXX Dev Team")
register_menucmd(register_menuid("AMX Choose nextmap:"),(-1^(-1<<(SELECTMAPS+2))),"countVote")
register_cvar("amx_extendmap_max","90")
register_cvar("amx_extendmap_step","15")
@ -63,7 +63,9 @@ public plugin_init()
get_localinfo("lastMap",g_lastMap,31)
set_localinfo("lastMap","")
if ( loadSettings("addons/amxx/configs/maps.ini") )
new filename[64]
build_path( filename , 63 , "$basedir/configs/maps.ini" )
if ( loadSettings( filename ) )
set_task(15.0,"voteNextmap",987456,"",0,"b")
}

View File

@ -54,7 +54,7 @@ new g_choosed
public plugin_init()
{
register_plugin("Maps Menu","0.15","AMXX Dev Team")
register_plugin("Maps Menu","0.1","AMXX Dev Team")
register_clcmd("amx_mapmenu","cmdMapsMenu",ADMIN_MAP,"- displays changelevel menu")
register_clcmd("amx_votemapmenu","cmdVoteMapMenu",ADMIN_MAP,"- displays votemap menu")
@ -63,8 +63,10 @@ public plugin_init()
register_menucmd(register_menuid("Change map to"),527,"voteCount")
register_menucmd(register_menuid("Votemap Menu"),1023,"actionVoteMapMenu")
register_menucmd(register_menuid("The winner: ") ,3,"actionResult")
load_settings("addons/amxx/configs/maps.ini")
new filename[64]
build_path( filename , 63 , "$basedir/configs/maps.ini" )
load_settings( filename )
g_cstrikeRunning = is_running("cstrike")
}

View File

@ -122,7 +122,7 @@ new g_funModule
public plugin_init()
{
register_plugin("Menus Front-End","0.15","AMXX Dev Team")
register_plugin("Menus Front-End","0.1","AMXX Dev Team")
register_menucmd(register_menuid("AMX Mod X Menu"),1023,"actionMenu")
register_clcmd("amxmodmenu","cmdMenu",ADMIN_MENU,"- displays menus")

View File

@ -146,7 +146,7 @@ new g_teamsNames[2][] = {
}
public plugin_init(){
register_plugin("CS Misc. Stats","0.15","AMXX Dev Team")
register_plugin("CS Misc. Stats","0.1","AMXX Dev Team")
register_event("DeathMsg","eDeathMsg","a")
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")

View File

@ -45,7 +45,7 @@ new g_pos
public plugin_init()
{
register_plugin("NextMap","0.15","AMXX Dev Team")
register_plugin("NextMap","0.1","AMXX Dev Team")
register_event("30","changeMap","a")
register_clcmd("say nextmap","sayNextMap",0,"- displays nextmap")
register_cvar("amx_nextmap","",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
@ -53,7 +53,7 @@ public plugin_init()
new szString[32], szString2[32], szString3[8]
get_localinfo( "lastmapcycle", szString , 31 )
parse( szString, szString2, 31, szString3 , 7 )
g_pos = str_to_num( szString3 )
g_pos = str_to_int( szString3 )
get_cvar_string( "mapcyclefile" , g_mapCycle , 31 )
if ( !equal( g_mapCycle , szString2 ) )

View File

@ -43,7 +43,7 @@
#define MAX_SYSTEM 32
new g_menuPos[33]
new g_fileToSave[] = "addons/amxx/configs/pausecfg.ini"
new g_fileToSave[64]
new g_cstrikeRunning
new g_Modified
new g_couldntFind[] = "Couldn't find a plugin matching ^"%s^""
@ -53,7 +53,7 @@ new g_system[MAX_SYSTEM]
new g_systemNum
public plugin_init(){
register_plugin("Pause Plugins","0.15","AMXX Dev Team")
register_plugin("Pause Plugins","0.1","AMXX Dev Team")
register_concmd("amx_pausecfg","cmdPlugin",ADMIN_CFG,"- list commands for pause/unpause managment")
register_clcmd("amx_pausecfgmenu","cmdMenu",ADMIN_CFG,"- pause/unpause plugins with menu")
#if defined DIRECT_ONOFF
@ -82,6 +82,7 @@ public cmdON(id,level,cid){
#endif
public plugin_cfg() {
build_path( g_fileToSave , 63 , "$basedir/configs/pausecfg.ini" )
loadSettings(g_fileToSave)
// Put here titles of plugins which you don't want to pause
server_cmd(g_addCmd , "Pause Plugins" )
@ -317,7 +318,7 @@ public cmdPlugin(id,level,cid){
}
else if ( equal(cmds, "list" ) ) {
new arg1[8], running = 0
new start = read_argv(2,arg1,7) ? str_to_num(arg1) : 1
new start = read_argv(2,arg1,7) ? str_to_int(arg1) : 1
if (--start < 0) start = 0
new plgnum = get_pluginsnum()
if (start >= plgnum) start = plgnum - 1

View File

@ -55,7 +55,7 @@ new g_cstrikeRunning
public plugin_init()
{
register_plugin("Players Menu","0.15","AMXX Dev Team")
register_plugin("Players Menu","0.1","AMXX Dev Team")
register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu")
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu")
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay menu")
@ -70,7 +70,9 @@ public plugin_init()
g_cstrikeRunning = is_running("cstrike")
load_settings("addons/amxx/configs/clcmds.ini")
new filename[64]
build_path( filename , 63 , "$basedir/configs/clcmds.ini" )
load_settings( filename )
}
/* Ban menu */
@ -573,7 +575,7 @@ public actionClcmdMenu(id,key)
copy(command,63,g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
get_user_authid(player,authid,31)
get_user_name(player,name,31)
num_to_str(get_user_userid(player),userid,31)
int_to_str(get_user_userid(player),userid,31)
replace(command,63,"%userid%",userid)
replace(command,63,"%authid%",authid)
replace(command,63,"%name%",name)

View File

@ -336,7 +336,7 @@ new g_Aliases2[MAXMENUPOS][] = {
#endif
public plugin_init(){
register_plugin("Restrict Weapons","0.15","AMXX Dev Team")
register_plugin("Restrict Weapons","0.1","AMXX Dev Team")
register_clcmd("buyammo1","ammoRest1")
register_clcmd("buyammo2","ammoRest2")
#if !defined NO_STEAM
@ -366,9 +366,9 @@ public plugin_init(){
#if defined MAPSETTINGS
new mapname[32]
get_mapname(mapname,31)
build_path(g_saveFile,63,"addons/amxx/configs/weaprest_%s.ini",mapname)
build_path( g_saveFile , 63 , "$basedir/configs/weaprest_%s.ini" ,mapname )
#else
build_path(g_saveFile,63,"addons/amxx/configs/weaprest.ini")
build_path( g_saveFile , 63 , "$basedir/configs/weaprest.ini" )
#endif
loadSettings(g_saveFile)
}
@ -466,7 +466,7 @@ public cmdRest(id,level,cid){
switchCommand( id, 0 )
else if ( equali( "list" , cmd ) ) {
new arg1[8]
new start = read_argv(2,arg1,7) ? str_to_num(arg1) : 1
new start = read_argv(2,arg1,7) ? str_to_int(arg1) : 1
if (--start < 0) start = 0
if (start >= MAXMENUPOS) start = MAXMENUPOS - 1
new end = start + 10

Binary file not shown.

Binary file not shown.

View File

@ -46,7 +46,7 @@ new g_Length
new g_Frequency
public plugin_init(){
register_plugin("Scrolling Message","0.15","AMXX Dev Team")
register_plugin("Scrolling Message","0.1","AMXX Dev Team")
register_srvcmd("amx_scrollmsg","setMessage")
}
@ -92,7 +92,7 @@ public setMessage(id,level,cid) {
g_Length = strlen(g_scrollMsg)
new mytime[32]
read_argv(2,mytime,31)
g_Frequency = str_to_num(mytime)
g_Frequency = str_to_int(mytime)
if (g_Frequency > 0) {
new minimal = floatround((g_Length + 48) * (SPEED + 0.1))
if (g_Frequency < minimal) {

View File

@ -71,7 +71,7 @@ new g_teamScore[2]
new g_disabledMsg[] = "Server has disabled that option"
public plugin_init() {
register_plugin("CS Stats","0.15","AMXX Dev Team")
register_plugin("CS Stats","0.1","AMXX Dev Team")
register_event("CS_DeathMsg","eCSDeathMsg","a")
register_event("ResetHUD","eResetHud","b")
register_event("SendAudio","eRoundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
@ -372,14 +372,14 @@ public displayStats(id,dest) {
pos += copy(g_Buffer[pos],2047-pos,"body{font-family:Arial,sans-serif;font-size:12px;color:#FFCC99;background-color:#000000;margin-left:8px;margin-top:3px}.header{background-color:#9C0000;}.one{background-color:#310000;}.two{background-color:#630000;}")
pos += format(g_Buffer[pos],2047-pos,"</style></head><body><table><tr class=^"one^"><td>Kills:</td><td>%d</td></tr><tr class=^"two^"><td>Deaths:</td><td>%d</td></tr><tr class=^"one^"><td>Damage:</td><td>%d</td></tr><tr class=^"two^"><td>Hits:</td><td>%d</td></tr><tr class=^"one^"><td>Shots:</td><td>%d</td></tr></table><br><br>",
stats[0],stats[1],stats[6],stats[5],stats[4])
pos += copy(g_Buffer[pos],2047-pos,"<table><tr class=^"header^"><td>Weapon</td><td>Shots</td><td>Hits</td><td>Damage</td><td>Kills</td><td>Deaths</td></tr>")
pos += copy(g_Buffer[pos],2047-pos,"<table><tr class^"header^"><td>Weapon</td><td>Shots</td><td>Hits</td><td>Damage</td><td>Kills</td><td>deaths</td></tr>")
for(new a = 1; a < 31; ++a) {
if (get_user_wstats(id,a,stats,body)) {
if (equal(state,"one")) copy(state,3,"two")
else copy(state,3,"one")
get_weaponname(a,name,31)
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"%s^"><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>",
state,name[7],stats[4],stats[5],stats[6],stats[0],stats[1])
name[7],stats[4],stats[5],stats[6],stats[0],stats[1])
}
}
copy(g_Buffer[pos],2047-pos,"</table></body></html>")
@ -419,10 +419,10 @@ displayRank(id,dest) {
pos += format(g_Buffer[pos],2047-pos,"</style></head><body><table><tr><td colspan=2>%s rank is %d of %d</td></tr>",(id==dest)?"Your":"His", rank_pos,get_statsnum())
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"one^"><td>Kills:</td><td>%d</td></tr><tr class=^"two^"><td>Deaths:</td><td>%d</td></tr><tr class=^"one^"><td>Damage:</td><td>%d</td></tr><tr class=^"two^"><td>Hits:</td><td>%d</td></tr><tr class=^"one^"><td>Shots:</td><td>%d</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr>",
stats[0],stats[1],stats[6],stats[5],stats[4])
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"header^"><td colspan=2>Hits</td></tr><tr class=^"one^"><td>%s:</td><td>%d</td></tr><tr class=^"two^"><td>%s:</td><td>%d</td></tr><tr class=^"one^"><td>%s:</td><td>%d</td></tr><tr class=^"two^"><td>%s:</td><td>%d</td></tr><tr class=^"one^"><td>%s:</td><td>%d</td></tr><tr class=^"two^"><td>%s:</td><td>%d</td></tr><tr class=^"one^"><td>%s:</td><td>%d</td></tr>",
pos += format(g_Buffer[pos],2047-pos,"<tr class=^"header^"><td colspan=2>Hits</td></tr><tr class^"one^"><td>%s:</td><td>%d</td></tr><tr class^"two^"><td>%s:</td><td>%d</td></tr><tr class^"one^"><td>%s:</td><td>%d</td></tr><tr class^"two^"><td>%s:</td><td>%d</td></tr><tr class^"one^"><td>%s:</td><td>%d</td></tr><tr class^"two^"><td>%s:</td><td>%d</td></tr><tr class^"one^"><td>%s:</td><td>%d</td></tr>",
g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4],
g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7])
copy(g_Buffer[pos],2047-pos,"</table></body></html>")
copy(g_Buffer,2047,"</table></body></html>")
#else
pos = format(g_Buffer,2047,"%s rank is %d of %d^n^n",(id==dest)?"Your":"His", rank_pos,get_statsnum())
pos += format(g_Buffer[pos],2047-pos,"%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n^n",

View File

@ -39,7 +39,7 @@ new g_pingSum[33]
new g_pingCount[33]
public plugin_init()
register_plugin("CS Stats Logging","0.15","AMXX Dev Team")
register_plugin("CS Stats Logging","0.1","AMXX Dev Team")
public client_disconnect(id) {
if ( is_user_bot( id ) ) return PLUGIN_CONTINUE

View File

@ -42,7 +42,7 @@ new g_menuDataVar[MAX_MENU_DATA][32]
new g_menuDataId[MAX_MENU_DATA]
new g_menuDataNum
new g_menuPosition[33]
new g_fileToSave[] = "addons/amxx/configs/stats.ini"
new g_fileToSave[64]
new bool:g_modified
public plugin_precache(){
@ -51,8 +51,9 @@ public plugin_precache(){
}
public plugin_init() {
register_plugin("Stats Configuration","0.15","AMXX Dev Team")
register_plugin("Stats Configuration","0.1","AMXX Dev Team")
register_menucmd(register_menuid("\yStats Configuration"),1023,"actionCfgMenu")
build_path( g_fileToSave , 63 , "$basedir/configs/stats.ini" )
loadSettings(g_fileToSave)
}
@ -104,7 +105,7 @@ public cmdCfg( id,level,cid ){
}
else if ( equali(cmds, "list" ) ) {
new arg1[8]
new start = read_argv(2,arg1,7) ? str_to_num(arg1) : 1
new start = read_argv(2,arg1,7) ? str_to_int(arg1) : 1
if (--start < 0) start = 0
if (start >= g_menuDataNum) start = g_menuDataNum - 1
new end = start + 10

View File

@ -45,7 +45,7 @@ new g_cstrikeRunning
public plugin_init()
{
register_plugin("Teleport Menu","0.15","AMXX Dev Team")
register_plugin("Teleport Menu","0.1","AMXX Dev Team")
register_clcmd("amx_teleportmenu","cmdTelMenu",ADMIN_CFG,"- displays teleport menu")
register_menucmd(register_menuid("Teleport Menu"),1023,"actionTelMenu")

View File

@ -40,7 +40,7 @@ new g_CountDown
new g_Switch
public plugin_init() {
register_plugin("TimeLeft","0.15","AMXX Dev Team")
register_plugin("TimeLeft","0.1","AMXX Dev Team")
register_cvar("amx_time_voice","1")
register_srvcmd("amx_time_display","setDisplaying")
register_cvar("amx_timeleft","00:00",FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
@ -54,8 +54,8 @@ public sayTheTime(id){
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
get_time("%H",mhours,5)
get_time("%M",mmins,5)
new mins = str_to_num(mmins)
new hrs = str_to_num(mhours)
new mins = str_to_int(mmins)
new hrs = str_to_int(mhours)
if (mins)
num_to_word(mins,wmins,31)
else
@ -154,7 +154,7 @@ public setDisplaying(){
while (i < argc && i < 32){
read_argv(i+1,arg,31)
parse(arg,flags,31,num,31)
g_TimeSet[i][0] = str_to_num(num)
g_TimeSet[i][0] = str_to_int(num)
g_TimeSet[i][1] = read_flags(flags)
i++
}

View File

@ -45,13 +45,16 @@
new g_cstrikeRunning
#if defined READ_FROM_FILE
new g_motdFile[] = "addons/amxx/configs/conmotd.txt"
new g_motdFile[64]
#endif
public plugin_init()
{
register_plugin("Welcome Message","0.15","AMXX Dev Team")
register_plugin("Welcome Message","0.1","AMXX Dev Team")
g_cstrikeRunning = is_running("cstrike")
#if defined READ_FROM_FILE
build_path( g_motdFile , 63 , "$basedir/conmotd.txt" )
#endif
}
public plugin_cfg()
@ -115,7 +118,7 @@ public alt_motd(param[]) {
new mod_ver[32]
len += copy(motdBody[len],MOTD_LENGTH-len,"<br>Server mods:<ul>")
get_cvar_string("amxmodx_version",mod_ver,31)
if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"<li>AMX Mod X %s</li>",mod_ver)
if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"<li>AMX Mod %s</li>",mod_ver)
get_cvar_string("statsme_version",mod_ver,31)
if (mod_ver[0]) len += format(motdBody[len],MOTD_LENGTH-len,"<li>StatsMe %s</li>",mod_ver)
get_cvar_string("clanmod_version",mod_ver,31)

View File

@ -43,13 +43,16 @@
new g_cstrikeRunning
#if defined READ_FROM_FILE
new g_motdFile[] = "addons/amxx/configs/conmotd.txt"
new g_motdFile[64]
#endif
public plugin_init()
{
register_plugin("Welcome Message","0.15","AMXX Dev Team")
register_plugin("Welcome Message","0.1","AMXX Dev Team")
g_cstrikeRunning = is_running("cstrike")
#if defined READ_FROM_FILE
build_path( g_motdFile , 63 , "$basedir/conmotd.txt" )
#endif
}
new g_Bar[] = "=============="
@ -101,7 +104,7 @@ public client_connect(id) {
new mod_ver[32]
client_cmd(id, "echo ;echo ^" Server mods:^"")
get_cvar_string("amxmodx_version",mod_ver,31)
if (mod_ver[0]) client_cmd(id, "echo ^" o AMX Mod X %s^"",mod_ver)
if (mod_ver[0]) client_cmd(id, "echo ^" o AMX Mod %s^"",mod_ver)
get_cvar_string("statsme_version",mod_ver,31)
if (mod_ver[0]) client_cmd(id, "echo ^" o StatsMe %s^"",mod_ver)
get_cvar_string("clanmod_version",mod_ver,31)