Compare commits
40 Commits
amxmodx-1.
...
amxmodx-1.
Author | SHA1 | Date | |
---|---|---|---|
45bccd7a7f | |||
e8a30e7187 | |||
8a93673276 | |||
ece4db4f43 | |||
8b8cc3dd6b | |||
b33e76d9c4 | |||
6fb6d7d399 | |||
5649a17502 | |||
5cfc2df359 | |||
1ac390b54c | |||
102c2b219f | |||
4e1d420495 | |||
e93e75fa39 | |||
90c213bc6d | |||
6c3e7e7ee0 | |||
8a2528108d | |||
a65d65bee4 | |||
483403aa3a | |||
2a1dbf5247 | |||
7aa687eb69 | |||
699cb2a6d6 | |||
7b82bc7b76 | |||
ed43b8a5ac | |||
d2ebca38a1 | |||
d542015214 | |||
d84c3a3798 | |||
405d9ff48e | |||
a63c728471 | |||
a60e9d205b | |||
553a950b98 | |||
955e827b19 | |||
00380cfe4c | |||
12ecf026db | |||
3fa6cd3227 | |||
fe1ebfe7bb | |||
f3057efd7d | |||
39d5ea94fb | |||
90f11b52bc | |||
9740f6469d | |||
461e7de151 |
@ -33,7 +33,7 @@
|
||||
#include "debugger.h"
|
||||
#include "binlog.h"
|
||||
|
||||
CForward::CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam *paramTypes)
|
||||
CForward::CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam *paramTypes, int fwd_type)
|
||||
{
|
||||
m_FuncName = name;
|
||||
m_ExecType = et;
|
||||
@ -47,6 +47,13 @@ CForward::CForward(const char *name, ForwardExecType et, int numParams, const Fo
|
||||
|
||||
for (CPluginMngr::iterator iter = g_plugins.begin(); iter; ++iter)
|
||||
{
|
||||
if ((fwd_type != FORWARD_ALL) &&
|
||||
((fwd_type == FORWARD_ONLY_NEW && ((*iter).getAMX()->flags & AMX_FLAG_OLDFILE))
|
||||
|| (fwd_type == FORWARD_ONLY_OLD && !((*iter).getAMX()->flags & AMX_FLAG_OLDFILE))
|
||||
))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((*iter).isValid() && amx_FindPublic((*iter).getAMX(), name, &func) == AMX_ERR_NONE)
|
||||
{
|
||||
AMXForward tmp;
|
||||
@ -352,13 +359,15 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int CForwardMngr::registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam * paramTypes)
|
||||
int CForwardMngr::registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam * paramTypes, int fwd_type)
|
||||
{
|
||||
int retVal = m_Forwards.size() << 1;
|
||||
CForward *tmp = new CForward(funcName, et, numParams, paramTypes);
|
||||
CForward *tmp = new CForward(funcName, et, numParams, paramTypes, fwd_type);
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
return -1; // should be invalid
|
||||
}
|
||||
|
||||
m_Forwards.push_back(tmp);
|
||||
|
||||
@ -519,14 +528,16 @@ void CForwardMngr::unregisterSPForward(int id)
|
||||
m_FreeSPForwards.push(id);
|
||||
}
|
||||
|
||||
int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num)
|
||||
int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num, int fwd_type)
|
||||
{
|
||||
ForwardParam params[FORWARD_MAX_PARAMS];
|
||||
|
||||
for (size_t i=0; i<num; i++)
|
||||
{
|
||||
params[i] = static_cast<ForwardParam>(list[i]);
|
||||
}
|
||||
|
||||
return g_forwards.registerForward(funcName, et, num, params);
|
||||
return g_forwards.registerForward(funcName, et, num, params, fwd_type);
|
||||
}
|
||||
|
||||
int registerForward(const char *funcName, ForwardExecType et, ...)
|
||||
|
@ -51,6 +51,10 @@
|
||||
|
||||
const int FORWARD_MAX_PARAMS = 32;
|
||||
|
||||
#define FORWARD_ONLY_OLD 1
|
||||
#define FORWARD_ONLY_NEW 2
|
||||
#define FORWARD_ALL 3
|
||||
|
||||
enum ForwardExecType
|
||||
{
|
||||
ET_IGNORE = 0, // Ignore return vaue
|
||||
@ -107,7 +111,7 @@ class CForward
|
||||
ForwardParam m_ParamTypes[FORWARD_MAX_PARAMS];
|
||||
|
||||
public:
|
||||
CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam * paramTypes);
|
||||
CForward(const char *name, ForwardExecType et, int numParams, const ForwardParam * paramTypes, int fwd_type=FORWARD_ALL);
|
||||
CForward() {} // leaves everything unitialized'
|
||||
|
||||
cell execute(cell *params, ForwardPreparedArray *preparedArrays);
|
||||
@ -203,7 +207,7 @@ public:
|
||||
|
||||
// Interface
|
||||
// Register normal forward
|
||||
int registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam *paramTypes);
|
||||
int registerForward(const char *funcName, ForwardExecType et, int numParams, const ForwardParam *paramTypes, int fwd_type=FORWARD_ALL);
|
||||
// Register single plugin forward
|
||||
int registerSPForward(const char *funcName, AMX *amx, int numParams, const ForwardParam * paramTypes);
|
||||
int registerSPForward(int func, AMX *amx, int numParams, const ForwardParam * paramTypes);
|
||||
@ -227,7 +231,7 @@ public:
|
||||
|
||||
// (un)register forward
|
||||
int registerForward(const char *funcName, ForwardExecType et, ...);
|
||||
int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num);
|
||||
int registerForwardC(const char *funcName, ForwardExecType et, cell *list, size_t num, int fwd_type=FORWARD_ALL);
|
||||
int registerSPForwardByName(AMX *amx, const char *funcName, ...);
|
||||
int registerSPForwardByNameC(AMX *amx, const char *funcName, cell *list, size_t num);
|
||||
int registerSPForward(AMX *amx, int func, ...);
|
||||
|
@ -417,16 +417,18 @@ void CPluginMngr::CPlugin::pausePlugin()
|
||||
// Unpause a plugin
|
||||
void CPluginMngr::CPlugin::unpausePlugin()
|
||||
{
|
||||
if (isValid())
|
||||
if (isValid() && (getStatusCode() != ps_stopped))
|
||||
{
|
||||
// set status first so the function will be marked executable
|
||||
setStatus(ps_running);
|
||||
|
||||
// call plugin_unpause if provided
|
||||
if (m_UnpauseFwd != -1)
|
||||
{
|
||||
executeForwards(m_UnpauseFwd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char *CPluginMngr::ReadIntoOrFromCache(const char *file, size_t &bufsize)
|
||||
{
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include "binlog.h"
|
||||
#include "libraries.h"
|
||||
|
||||
const char *invis_cvar_list[5] = {"amxmodx_version", "amxmodx_modules", "amx_debug", "amx_mldebug", "amx_client_languages"};
|
||||
|
||||
static cell AMX_NATIVE_CALL get_xvar_id(AMX *amx, cell *params)
|
||||
{
|
||||
int len;
|
||||
@ -989,7 +991,9 @@ static cell AMX_NATIVE_CALL get_user_team(AMX *amx, cell *params) /* 3 param */
|
||||
}
|
||||
//
|
||||
if (params[3])
|
||||
{
|
||||
set_amxstring(amx, params[2], pPlayer->team.c_str(), params[3]);
|
||||
}
|
||||
|
||||
return pPlayer->teamId;
|
||||
}
|
||||
@ -1589,6 +1593,19 @@ static cell AMX_NATIVE_CALL get_cvar_string(AMX *amx, cell *params) /* 3 param *
|
||||
int ilen;
|
||||
char* sptemp = get_amxstring(amx, params[1], 0, ilen);
|
||||
|
||||
if (amx->flags & AMX_FLAG_OLDFILE)
|
||||
{
|
||||
/* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */
|
||||
char *cvar = sptemp;
|
||||
for (unsigned int i=0; i<5; i++)
|
||||
{
|
||||
if (strcmp(cvar, invis_cvar_list[i]) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return set_amxstring(amx, params[2], CVAR_GET_STRING(sptemp), params[3]);
|
||||
}
|
||||
|
||||
@ -1609,6 +1626,20 @@ static cell AMX_NATIVE_CALL get_pcvar_float(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL get_cvar_float(AMX *amx, cell *params) /* 1 param */
|
||||
{
|
||||
int ilen;
|
||||
|
||||
if (amx->flags & AMX_FLAG_OLDFILE)
|
||||
{
|
||||
/* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */
|
||||
char *cvar = get_amxstring(amx, params[1], 0, ilen);
|
||||
for (unsigned int i=0; i<5; i++)
|
||||
{
|
||||
if (strcmp(cvar, invis_cvar_list[i]) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REAL pFloat = CVAR_GET_FLOAT(get_amxstring(amx, params[1], 0, ilen));
|
||||
|
||||
return amx_ftoc(pFloat);
|
||||
@ -1651,6 +1682,18 @@ static cell AMX_NATIVE_CALL get_pcvar_num(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL get_cvar_num(AMX *amx, cell *params) /* 1 param */
|
||||
{
|
||||
int ilen;
|
||||
if (amx->flags & AMX_FLAG_OLDFILE)
|
||||
{
|
||||
/* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */
|
||||
char *cvar = get_amxstring(amx, params[1], 0, ilen);
|
||||
for (unsigned int i=0; i<5; i++)
|
||||
{
|
||||
if (strcmp(cvar, invis_cvar_list[i]) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (int)CVAR_GET_FLOAT(get_amxstring(amx, params[1], 0, ilen));
|
||||
}
|
||||
|
||||
@ -2221,6 +2264,18 @@ static cell AMX_NATIVE_CALL task_exists(AMX *amx, cell *params) /* 1 param */
|
||||
static cell AMX_NATIVE_CALL cvar_exists(AMX *amx, cell *params) /* 1 param */
|
||||
{
|
||||
int ilen;
|
||||
if (amx->flags & AMX_FLAG_OLDFILE)
|
||||
{
|
||||
/* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */
|
||||
char *cvar = get_amxstring(amx, params[1], 0, ilen);
|
||||
for (unsigned int i=0; i<5; i++)
|
||||
{
|
||||
if (strcmp(cvar, invis_cvar_list[i]) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (CVAR_GET_POINTER(get_amxstring(amx, params[1], 0, ilen)) ? 1 : 0);
|
||||
}
|
||||
|
||||
@ -2741,6 +2796,20 @@ static cell AMX_NATIVE_CALL get_cvar_flags(AMX *amx, cell *params)
|
||||
{
|
||||
int ilen;
|
||||
char* sCvar = get_amxstring(amx, params[1], 0, ilen);
|
||||
|
||||
if (amx->flags & AMX_FLAG_OLDFILE)
|
||||
{
|
||||
/* :HACKHACK: Pretend we're invisible to old plugins for backward compatibility */
|
||||
char *cvar = sCvar;
|
||||
for (unsigned int i=0; i<5; i++)
|
||||
{
|
||||
if (strcmp(cvar, invis_cvar_list[i]) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cvar_t* pCvar = CVAR_GET_POINTER(sCvar);
|
||||
|
||||
return pCvar ? pCvar->flags : 0;
|
||||
@ -3234,19 +3303,30 @@ static cell AMX_NATIVE_CALL get_func_id(AMX *amx, cell *params)
|
||||
CPluginMngr::CPlugin *plugin;
|
||||
|
||||
if (params[2] < 0)
|
||||
{
|
||||
plugin = g_plugins.findPluginFast(amx);
|
||||
else
|
||||
} else {
|
||||
plugin = g_plugins.findPlugin(params[2]);
|
||||
}
|
||||
|
||||
if (!plugin)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!plugin->isValid())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int len;
|
||||
const char *funcName = get_amxstring(amx, params[1], 0, len);
|
||||
int index, err;
|
||||
|
||||
if ((err = amx_FindPublic(plugin->getAMX(), funcName, &index)) != AMX_ERR_NONE)
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
@ -3889,6 +3969,21 @@ static cell AMX_NATIVE_CALL CreateMultiForward(AMX *amx, cell *params)
|
||||
return registerForwardC(funcname, static_cast<ForwardExecType>(params[2]), ps, count-2);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL CreateMultiForwardEx(AMX *amx, cell *params)
|
||||
{
|
||||
int len;
|
||||
char *funcname = get_amxstring(amx, params[1], 0, len);
|
||||
|
||||
cell ps[FORWARD_MAX_PARAMS];
|
||||
cell count = params[0] / sizeof(cell);
|
||||
for (cell i=4; i<=count; i++)
|
||||
{
|
||||
ps[i-4] = *get_amxaddr(amx, params[i]);
|
||||
}
|
||||
|
||||
return registerForwardC(funcname, static_cast<ForwardExecType>(params[2]), ps, count-3, params[3]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL CreateOneForward(AMX *amx, cell *params)
|
||||
{
|
||||
CPluginMngr::CPlugin *p = g_plugins.findPlugin(params[1]);
|
||||
@ -4423,6 +4518,7 @@ AMX_NATIVE_INFO amxmodx_Natives[] =
|
||||
{"CreateHudSyncObj", CreateHudSyncObj},
|
||||
{"CreateLangKey", CreateLangKey},
|
||||
{"CreateMultiForward", CreateMultiForward},
|
||||
{"CreateMultiForwardEx", CreateMultiForwardEx},
|
||||
{"CreateOneForward", CreateOneForward},
|
||||
{"DestroyForward", DestroyForward},
|
||||
{"ExecuteForward", ExecuteForward},
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
#define AMXXLOG_Log g_log.Log
|
||||
#define AMXXLOG_Error g_log.LogError
|
||||
#define AMX_VERSION "1.76a"
|
||||
#define AMX_VERSION "1.76b"
|
||||
|
||||
extern AMX_NATIVE_INFO core_Natives[];
|
||||
extern AMX_NATIVE_INFO time_Natives[];
|
||||
|
@ -92,9 +92,10 @@ void Client_ShowMenu(void* mValue)
|
||||
}
|
||||
}
|
||||
|
||||
extern bool g_bmod_tfc;
|
||||
void Client_TeamInfo(void* mValue)
|
||||
{
|
||||
if (mPlayer) return;
|
||||
if (mPlayer && !g_bmod_tfc) return;
|
||||
static int index;
|
||||
|
||||
switch (mState++)
|
||||
@ -107,6 +108,7 @@ void Client_TeamInfo(void* mValue)
|
||||
char* msg = (char*)mValue;
|
||||
g_players[index].team.assign(msg);
|
||||
g_teamsIds.registerTeam(msg, -1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -799,13 +799,25 @@ static cell AMX_NATIVE_CALL amx_rmdir(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL amx_rename(AMX *amx, cell *params)
|
||||
{
|
||||
int len;
|
||||
char f_old_r[260];
|
||||
char f_new_r[260];
|
||||
|
||||
char *fold = get_amxstring(amx, params[1], 0, len);
|
||||
char *fnew = get_amxstring(amx, params[2], 1, len);
|
||||
|
||||
if (params[0] / sizeof(cell) == 3 && params[3])
|
||||
{
|
||||
build_pathname_r(f_old_r, sizeof(f_old_r)-1, "%s", fold);
|
||||
build_pathname_r(f_new_r, sizeof(f_new_r)-1, "%s", fnew);
|
||||
} else {
|
||||
snprintf(f_old_r, sizeof(f_old_r)-1, "%s", fold);
|
||||
snprintf(f_new_r, sizeof(f_new_r)-1, "%s", fnew);
|
||||
}
|
||||
|
||||
#if defined __linux__
|
||||
return (rename(fold, fnew) == 0);
|
||||
return (rename(f_old_r, f_new_r) == 0);
|
||||
#elif defined WIN32
|
||||
return MoveFileA(fold, fnew);
|
||||
return MoveFileA(f_old_r, f_new_r);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,16 @@ CStack<int> g_MenuFreeStack;
|
||||
void ClearMenus()
|
||||
{
|
||||
for (size_t i = 0; i < g_NewMenus.size(); i++)
|
||||
{
|
||||
delete g_NewMenus[i];
|
||||
}
|
||||
|
||||
g_NewMenus.clear();
|
||||
while (!g_MenuFreeStack.empty())
|
||||
{
|
||||
g_MenuFreeStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
void validate_menu_text(char *str)
|
||||
{
|
||||
@ -64,13 +68,17 @@ void validate_menu_text(char *str)
|
||||
}
|
||||
}
|
||||
if (offs)
|
||||
{
|
||||
*(str-offs) = *str;
|
||||
}
|
||||
str++;
|
||||
}
|
||||
if (offs)
|
||||
{
|
||||
*(str-offs) = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Menu::Menu(const char *title, int mid, int tid)
|
||||
{
|
||||
@ -99,7 +107,9 @@ Menu::Menu(const char *title, int mid, int tid)
|
||||
Menu::~Menu()
|
||||
{
|
||||
for (size_t i = 0; i < m_Items.size(); i++)
|
||||
{
|
||||
delete m_Items[i];
|
||||
}
|
||||
|
||||
unregisterSPForward(this->func);
|
||||
|
||||
@ -139,7 +149,9 @@ size_t Menu::GetPageCount()
|
||||
{
|
||||
size_t items = GetItemCount();
|
||||
if (items_per_page == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return ((items/items_per_page) + ((items % items_per_page) ? 1 : 0));
|
||||
}
|
||||
@ -159,15 +171,49 @@ int Menu::PagekeyToItem(page_t page, item_t key)
|
||||
//first page
|
||||
if (page == 0)
|
||||
{
|
||||
/* The algorithm for spaces here is same as a middle page. */
|
||||
item_t new_key = key;
|
||||
for (size_t i=start; i<(start+key-1) && i<m_Items.size(); i++)
|
||||
{
|
||||
for (size_t j=0; j<m_Items[i]->blanks.size(); j++)
|
||||
{
|
||||
if (m_Items[i]->blanks[j] == 1)
|
||||
{
|
||||
if (!new_key)
|
||||
{
|
||||
break;
|
||||
}
|
||||
new_key--;
|
||||
}
|
||||
if (!new_key)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
key = new_key;
|
||||
if (key == items_per_page + 1)
|
||||
{
|
||||
return MENU_MORE;
|
||||
else if (key == items_per_page + 2)
|
||||
} else if (key == items_per_page + 2) {
|
||||
return MENU_EXIT;
|
||||
else
|
||||
} else {
|
||||
return (start + key - 1);
|
||||
}
|
||||
} else if (page == num_pages - 1) {
|
||||
//last page
|
||||
size_t remaining = m_Items.size() - start;
|
||||
/* We have to add one remaining for each "bumping" space */
|
||||
for (size_t i=m_Items.size() - remaining; i<m_Items.size(); i++)
|
||||
{
|
||||
for (size_t j=0; j<m_Items[i]->blanks.size(); j++)
|
||||
{
|
||||
if (m_Items[i]->blanks[j] == 1)
|
||||
{
|
||||
remaining++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (key == remaining + 1)
|
||||
{
|
||||
return MENU_BACK;
|
||||
@ -177,6 +223,29 @@ int Menu::PagekeyToItem(page_t page, item_t key)
|
||||
return (start + key - 1);
|
||||
}
|
||||
} else {
|
||||
/* The algorithm for spaces here is a bit harder. We have to subtract
|
||||
* one from the key for each space we find along the way.
|
||||
*/
|
||||
item_t new_key = key;
|
||||
for (size_t i=start; i<(start+key-1) && i<m_Items.size(); i++)
|
||||
{
|
||||
for (size_t j=0; j<m_Items[i]->blanks.size(); j++)
|
||||
{
|
||||
if (m_Items[i]->blanks[j] == 1)
|
||||
{
|
||||
if (!new_key)
|
||||
{
|
||||
break;
|
||||
}
|
||||
new_key--;
|
||||
}
|
||||
if (!new_key)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
key = new_key;
|
||||
if (key > items_per_page && (key-items_per_page<=3))
|
||||
{
|
||||
return m_OptOrders[key-items_per_page-1];
|
||||
@ -286,27 +355,33 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
||||
{
|
||||
ret = executeForwards(pItem->handler, static_cast<cell>(player), static_cast<cell>(thisId), static_cast<cell>(i));
|
||||
if (ret == ITEM_ENABLED)
|
||||
{
|
||||
enabled = true;
|
||||
else if (ret == ITEM_DISABLED)
|
||||
} else if (ret == ITEM_DISABLED) {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (pItem->pfn)
|
||||
{
|
||||
ret = (pItem->pfn)(player, thisId, i);
|
||||
if (ret == ITEM_ENABLED)
|
||||
{
|
||||
enabled = true;
|
||||
else if (ret == ITEM_DISABLED)
|
||||
} else if (ret == ITEM_DISABLED) {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
keys |= (1<<option);
|
||||
if (m_AutoColors)
|
||||
{
|
||||
_snprintf(buffer, sizeof(buffer)-1, "\\r%d.\\w %s\n", ++option, pItem->name.c_str());
|
||||
else
|
||||
} else {
|
||||
_snprintf(buffer, sizeof(buffer)-1, "%d. %s\n", ++option, pItem->name.c_str());
|
||||
}
|
||||
} else {
|
||||
if (m_AutoColors)
|
||||
{
|
||||
@ -326,7 +401,9 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
||||
for (size_t j=0; j<pItem->blanks.size(); j++)
|
||||
{
|
||||
if (pItem->blanks[j] == 1)
|
||||
{
|
||||
option++;
|
||||
}
|
||||
m_Text.append("\n");
|
||||
slots++;
|
||||
}
|
||||
@ -337,11 +414,17 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
||||
{
|
||||
int pad = items_per_page;
|
||||
if (flags & Display_Back)
|
||||
{
|
||||
pad--;
|
||||
}
|
||||
if (flags & Display_Next)
|
||||
{
|
||||
pad--;
|
||||
}
|
||||
if (flags & Display_Exit)
|
||||
{
|
||||
pad--;
|
||||
}
|
||||
for (int i=slots+1; i<=pad; i++)
|
||||
{
|
||||
m_Text.append("\n");
|
||||
|
@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,7,6,1
|
||||
PRODUCTVERSION 1,7,6,1
|
||||
FILEVERSION 1,7,6,2
|
||||
PRODUCTVERSION 1,7,6,2
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -45,12 +45,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "Comments", "AMX Mod X"
|
||||
VALUE "FileDescription", "AMX Mod X"
|
||||
VALUE "FileVersion", "1.76a"
|
||||
VALUE "FileVersion", "1.76b"
|
||||
VALUE "InternalName", "amxmodx"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2004-2006, AMX Mod X Dev Team"
|
||||
VALUE "OriginalFilename", "amxmodx_mm.dll"
|
||||
VALUE "ProductName", "AMX Mod X"
|
||||
VALUE "ProductVersion", "1.76a"
|
||||
VALUE "ProductVersion", "1.76b"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "WinCSX.h"
|
||||
#include <stdio.h>
|
||||
#include "commctrl.h"
|
||||
|
||||
int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
@ -26,6 +27,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_WINCSX);
|
||||
|
||||
// Show the dialog box now.
|
||||
|
@ -32,6 +32,7 @@
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib"
|
||||
OutputFile="$(OutDir)/WinCSX.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
@ -77,6 +78,7 @@
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib"
|
||||
OutputFile="$(OutDir)/WinCSX.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
|
@ -61,6 +61,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib"
|
||||
OutputFile="$(OutDir)/WinCSX.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
@ -136,6 +137,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="comctl32.lib"
|
||||
OutputFile="$(OutDir)/WinCSX.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "DoD Fun"
|
||||
#define MODULE_VERSION "1.76"
|
||||
#define MODULE_VERSION "1.76b"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "DODFUN"
|
||||
|
@ -251,7 +251,7 @@ void RankSystem::loadRank(const char* filename)
|
||||
}
|
||||
|
||||
short int i = 0;
|
||||
if (!fread(&i, sizeof(short int), 1, bfp) != 1)
|
||||
if (fread(&i, sizeof(short int), 1, bfp) != 1)
|
||||
{
|
||||
fclose(bfp);
|
||||
return;
|
||||
|
@ -2773,7 +2773,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
||||
MF_FindLibrary(NULL, LibType_Class);
|
||||
MF_AddLibraries(NULL, LibType_Class, NULL);
|
||||
MF_RemoveLibraries(NULL);
|
||||
MF_OverrideNatives(NULL);
|
||||
MF_OverrideNatives(NULL, "");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "DoDX"
|
||||
#define MODULE_VERSION "1.76"
|
||||
#define MODULE_VERSION "1.76b"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "DODX"
|
||||
|
@ -798,31 +798,42 @@ static cell AMX_NATIVE_CALL in_view_cone(AMX *amx, cell *params)
|
||||
|
||||
CHECK_ENTITY(src);
|
||||
|
||||
Vector vecLOS;
|
||||
edict_t *pEdictSrc = INDEXENT(src);
|
||||
|
||||
Vector vecLOS, vecForward;
|
||||
float flDot;
|
||||
|
||||
edict_t *pEdictSrc = INDEXENT(src);
|
||||
cell *addr = MF_GetAmxAddr(amx, params[2]);
|
||||
float vecOrigin[3];
|
||||
Vector origin(amx_ctof(addr[0]), amx_ctof(addr[1]), amx_ctof(addr[2]));
|
||||
|
||||
vecOrigin[0] = amx_ctof(addr[0]);
|
||||
vecOrigin[1] = amx_ctof(addr[1]);
|
||||
vecOrigin[2] = amx_ctof(addr[2]);
|
||||
bool use2D = (params[0] / sizeof(cell)) == 2 || params[3] == 0;
|
||||
|
||||
Vector origin(vecOrigin[0], vecOrigin[1], vecOrigin[2]);
|
||||
if (use2D)
|
||||
{
|
||||
MAKE_VECTORS(pEdictSrc->v.angles);
|
||||
vecForward = gpGlobals->v_forward;
|
||||
|
||||
vecLOS = origin - pEdictSrc->v.origin;
|
||||
|
||||
vecForward.z = 0;
|
||||
vecLOS.z = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MAKE_VECTORS(pEdictSrc->v.v_angle);
|
||||
vecForward = gpGlobals->v_forward;
|
||||
|
||||
vecLOS = origin - (pEdictSrc->v.origin + pEdictSrc->v.view_ofs);
|
||||
}
|
||||
|
||||
vecLOS = vecLOS.Normalize();
|
||||
|
||||
flDot = DotProduct(vecLOS, gpGlobals->v_forward);
|
||||
flDot = DotProduct(vecLOS, vecForward);
|
||||
|
||||
if (flDot >= cos(pEdictSrc->v.fov * (M_PI / 360)))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL traceresult(AMX *amx, cell *params)
|
||||
|
@ -821,9 +821,9 @@ static cell AMX_NATIVE_CALL unregister_forward(AMX *amx, cell *params)
|
||||
|
||||
CVector<int> *peng = NULL;
|
||||
if (post)
|
||||
peng = &(Engine[func]);
|
||||
else
|
||||
peng = &(EnginePost[func]);
|
||||
else
|
||||
peng = &(Engine[func]);
|
||||
|
||||
CVector<int>::iterator begin, end=peng->end();
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "FakeMeta"
|
||||
#define MODULE_VERSION "1.76"
|
||||
#define MODULE_VERSION "1.76b"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org"
|
||||
#define MODULE_LOGTAG "FAKEMETA"
|
||||
|
@ -55,6 +55,10 @@ static cell AMX_NATIVE_CALL SQL_MakeDbTuple(AMX *amx, cell *params)
|
||||
sql->user = strdup(MF_GetAmxString(amx, params[2], 0, &len));
|
||||
sql->pass = strdup(MF_GetAmxString(amx, params[3], 0, &len));
|
||||
sql->db = strdup(MF_GetAmxString(amx, params[4], 0, &len));
|
||||
if (params[0] / sizeof(cell) >= 5)
|
||||
{
|
||||
sql->max_timeout = static_cast<unsigned int>(params[5]);
|
||||
}
|
||||
|
||||
unsigned int num = MakeHandle(sql, Handle_Connection, FreeConnection);
|
||||
|
||||
@ -87,11 +91,12 @@ static cell AMX_NATIVE_CALL SQL_Connect(AMX *amx, cell *params)
|
||||
nfo.pass = sql->pass;
|
||||
nfo.port = sql->port;
|
||||
nfo.host = sql->host;
|
||||
nfo.max_timeout = sql->max_timeout;
|
||||
|
||||
char buffer[512];
|
||||
int errcode;
|
||||
|
||||
IDatabase *pDb = g_Mysql.Connect(&nfo, &errcode, buffer, sizeof(buffer)-1);
|
||||
IDatabase *pDb = g_Mysql.Connect2(&nfo, &errcode, buffer, sizeof(buffer)-1);
|
||||
|
||||
if (!pDb)
|
||||
{
|
||||
@ -378,13 +383,15 @@ static cell AMX_NATIVE_CALL SQL_GetQueryString(AMX *amx, cell *params)
|
||||
{
|
||||
AmxQueryInfo *qInfo = (AmxQueryInfo *)GetHandle(params[1], Handle_Query);
|
||||
|
||||
if (!qInfo || !qInfo->pQuery)
|
||||
if (!qInfo || (!qInfo->pQuery && !qInfo->opt_ptr))
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid query handle: %d", params[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return MF_SetAmxString(amx, params[2], qInfo->pQuery->GetQueryString(), params[3]);
|
||||
const char *ptr = qInfo->pQuery ? qInfo->pQuery->GetQueryString() : qInfo->opt_ptr;
|
||||
|
||||
return MF_SetAmxString(amx, params[2], ptr, params[3]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL SQL_FieldNameToNum(AMX *amx, cell *params)
|
||||
|
@ -134,11 +134,13 @@ namespace SourceMod
|
||||
|
||||
struct DatabaseInfo
|
||||
{
|
||||
DatabaseInfo() : max_timeout(0) { };
|
||||
const char *host;
|
||||
const char *database;
|
||||
const char *user;
|
||||
const char *pass;
|
||||
unsigned int port;
|
||||
unsigned int max_timeout;
|
||||
};
|
||||
|
||||
class ISQLDriver
|
||||
@ -147,6 +149,8 @@ namespace SourceMod
|
||||
virtual ~ISQLDriver() { };
|
||||
public:
|
||||
virtual IDatabase *Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) =0;
|
||||
//Supports the timeout clause
|
||||
virtual IDatabase *Connect2(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) =0;
|
||||
virtual const char *NameString() =0;
|
||||
virtual bool IsCompatDriver(const char *namestring) =0;
|
||||
};
|
||||
|
@ -21,6 +21,16 @@ const char *MysqlDriver::NameString()
|
||||
}
|
||||
|
||||
IDatabase *MysqlDriver::Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength)
|
||||
{
|
||||
return _Connect(info, errcode, error, maxlength, false);
|
||||
}
|
||||
|
||||
IDatabase *MysqlDriver::Connect2(DatabaseInfo *info, int *errcode, char *error, size_t maxlength)
|
||||
{
|
||||
return _Connect(info, errcode, error, maxlength, true);
|
||||
}
|
||||
|
||||
IDatabase *MysqlDriver::_Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength, bool do_timeout)
|
||||
{
|
||||
MYSQL *mysql = mysql_init(NULL);
|
||||
|
||||
@ -35,6 +45,11 @@ IDatabase *MysqlDriver::Connect(DatabaseInfo *info, int *errcode, char *error, s
|
||||
return false;
|
||||
}
|
||||
|
||||
if (do_timeout && info->max_timeout)
|
||||
{
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&(info->max_timeout));
|
||||
}
|
||||
|
||||
if (mysql_real_connect(mysql,
|
||||
info->host,
|
||||
info->user,
|
||||
@ -45,9 +60,13 @@ IDatabase *MysqlDriver::Connect(DatabaseInfo *info, int *errcode, char *error, s
|
||||
0) == NULL)
|
||||
{
|
||||
if (errcode)
|
||||
{
|
||||
*errcode = mysql_errno(mysql);
|
||||
}
|
||||
if (error && maxlength)
|
||||
{
|
||||
snprintf(error, maxlength, "%s", mysql_error(mysql));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,11 @@ namespace SourceMod
|
||||
{
|
||||
public:
|
||||
IDatabase *Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength);
|
||||
IDatabase *Connect2(DatabaseInfo *info, int *errcode, char *error, size_t maxlength);
|
||||
const char *NameString();
|
||||
bool IsCompatDriver(const char *namestring);
|
||||
public:
|
||||
IDatabase *_Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength, bool do_timeout);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -10,9 +10,11 @@
|
||||
|
||||
struct AmxQueryInfo
|
||||
{
|
||||
AmxQueryInfo() : opt_ptr(NULL) { };
|
||||
IQuery *pQuery;
|
||||
QueryInfo info;
|
||||
char error[255];
|
||||
char *opt_ptr;
|
||||
};
|
||||
|
||||
enum HandleType
|
||||
@ -32,6 +34,7 @@ struct SQL_Connection
|
||||
char *pass;
|
||||
char *db;
|
||||
int port;
|
||||
unsigned int max_timeout;
|
||||
};
|
||||
|
||||
typedef void (*FREEHANDLE)(void *, unsigned int);
|
||||
|
@ -15,7 +15,7 @@
|
||||
* to add multiple entries.
|
||||
*/
|
||||
#define MODULE_NAME "MySQL"
|
||||
#define MODULE_VERSION "1.76a"
|
||||
#define MODULE_VERSION "1.76b"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "MySQL"
|
||||
|
@ -58,7 +58,7 @@ static cell AMX_NATIVE_CALL SQL_ThreadQuery(AMX *amx, cell *params)
|
||||
|
||||
int len;
|
||||
const char *handler = MF_GetAmxString(amx, params[2], 0, &len);
|
||||
int fwd = MF_RegisterSPForwardByName(amx, handler, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE);
|
||||
int fwd = MF_RegisterSPForwardByName(amx, handler, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
|
||||
if (fwd < 1)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Function not found: %s", handler);
|
||||
@ -76,7 +76,7 @@ static cell AMX_NATIVE_CALL SQL_ThreadQuery(AMX *amx, cell *params)
|
||||
}
|
||||
g_QueueLock->Unlock();
|
||||
|
||||
kmThread->SetInfo(cn->host, cn->user, cn->pass, cn->db, cn->port);
|
||||
kmThread->SetInfo(cn->host, cn->user, cn->pass, cn->db, cn->port, cn->max_timeout);
|
||||
kmThread->SetForward(fwd);
|
||||
kmThread->SetQuery(MF_GetAmxString(amx, params[3], 1, &len));
|
||||
kmThread->SetCellData(MF_GetAmxAddr(amx, params[4]), (ucell)params[5]);
|
||||
@ -126,13 +126,15 @@ void MysqlThread::SetForward(int forward)
|
||||
m_fwd = forward;
|
||||
}
|
||||
|
||||
void MysqlThread::SetInfo(const char *host, const char *user, const char *pass, const char *db, int port)
|
||||
void MysqlThread::SetInfo(const char *host, const char *user, const char *pass, const char *db, int port, unsigned int max_timeout)
|
||||
{
|
||||
m_host.assign(host);
|
||||
m_user.assign(user);
|
||||
m_pass.assign(pass);
|
||||
m_db.assign(db);
|
||||
m_max_timeout = m_max_timeout;
|
||||
m_port = port;
|
||||
m_qrInfo.queue_time = gpGlobals->time;
|
||||
}
|
||||
|
||||
void MysqlThread::SetQuery(const char *query)
|
||||
@ -149,10 +151,15 @@ void MysqlThread::RunThread(IThreadHandle *pHandle)
|
||||
info.user = m_user.c_str();
|
||||
info.host = m_host.c_str();
|
||||
info.port = m_port;
|
||||
info.max_timeout = m_max_timeout;
|
||||
|
||||
float save_time = m_qrInfo.queue_time;
|
||||
|
||||
memset(&m_qrInfo, 0, sizeof(m_qrInfo));
|
||||
|
||||
IDatabase *pDatabase = g_Mysql.Connect(&info, &m_qrInfo.amxinfo.info.errorcode, m_qrInfo.amxinfo.error, 254);
|
||||
m_qrInfo.queue_time = save_time;
|
||||
|
||||
IDatabase *pDatabase = g_Mysql.Connect2(&info, &m_qrInfo.amxinfo.info.errorcode, m_qrInfo.amxinfo.error, 254);
|
||||
IQuery *pQuery = NULL;
|
||||
if (!pDatabase)
|
||||
{
|
||||
@ -172,14 +179,15 @@ void MysqlThread::RunThread(IThreadHandle *pHandle)
|
||||
if (m_qrInfo.query_success && m_qrInfo.amxinfo.info.rs)
|
||||
{
|
||||
m_atomicResult.CopyFrom(m_qrInfo.amxinfo.info.rs);
|
||||
m_qrInfo.amxinfo.pQuery = pQuery;
|
||||
m_qrInfo.amxinfo.info.rs = &m_atomicResult;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (pQuery)
|
||||
{
|
||||
pQuery->FreeHandle();
|
||||
}
|
||||
pQuery = NULL;
|
||||
m_qrInfo.amxinfo.pQuery = pQuery;
|
||||
} else {
|
||||
m_qrInfo.amxinfo.opt_ptr = new char[m_query.size() + 1];
|
||||
strcpy(m_qrInfo.amxinfo.opt_ptr, m_query.c_str());
|
||||
}
|
||||
|
||||
if (pDatabase)
|
||||
@ -231,31 +239,37 @@ void MysqlThread::Execute()
|
||||
} else if (!m_qrInfo.query_success) {
|
||||
state = -1;
|
||||
}
|
||||
float diff = gpGlobals->time - m_qrInfo.queue_time;
|
||||
cell c_diff = amx_ftoc(diff);
|
||||
unsigned int hndl = MakeHandle(&m_qrInfo.amxinfo, Handle_Query, NullFunc);
|
||||
if (state != 0)
|
||||
{
|
||||
MF_ExecuteForward(m_fwd,
|
||||
(cell)state,
|
||||
(cell)0,
|
||||
(cell)hndl,
|
||||
m_qrInfo.amxinfo.error,
|
||||
m_qrInfo.amxinfo.info.errorcode,
|
||||
data_addr,
|
||||
m_datalen);
|
||||
m_datalen,
|
||||
c_diff);
|
||||
} else {
|
||||
unsigned int hndl = MakeHandle(&m_qrInfo.amxinfo, Handle_Query, NullFunc);
|
||||
MF_ExecuteForward(m_fwd,
|
||||
(cell)0,
|
||||
(cell)hndl,
|
||||
"",
|
||||
(cell)0,
|
||||
data_addr,
|
||||
m_datalen);
|
||||
/* this should always be true I think */
|
||||
m_datalen,
|
||||
c_diff);
|
||||
}
|
||||
FreeHandle(hndl);
|
||||
if (m_qrInfo.amxinfo.pQuery)
|
||||
{
|
||||
m_qrInfo.amxinfo.pQuery->FreeHandle();
|
||||
m_qrInfo.amxinfo.pQuery = NULL;
|
||||
}
|
||||
FreeHandle(hndl);
|
||||
}
|
||||
delete [] m_qrInfo.amxinfo.opt_ptr;
|
||||
m_qrInfo.amxinfo.opt_ptr = NULL;
|
||||
}
|
||||
|
||||
/*****************
|
||||
|
@ -12,6 +12,7 @@ struct QueuedResultInfo
|
||||
AmxQueryInfo amxinfo;
|
||||
bool connect_success;
|
||||
bool query_success;
|
||||
float queue_time;
|
||||
};
|
||||
|
||||
class AtomicResult :
|
||||
@ -59,7 +60,7 @@ public:
|
||||
MysqlThread();
|
||||
~MysqlThread();
|
||||
public:
|
||||
void SetInfo(const char *host, const char *user, const char *pass, const char *db, int port);
|
||||
void SetInfo(const char *host, const char *user, const char *pass, const char *db, int port, unsigned int max_timeout);
|
||||
void SetQuery(const char *query);
|
||||
void SetCellData(cell data[], ucell len);
|
||||
void SetForward(int forward);
|
||||
@ -74,6 +75,7 @@ private:
|
||||
SourceHook::String m_user;
|
||||
SourceHook::String m_pass;
|
||||
SourceHook::String m_db;
|
||||
unsigned int m_max_timeout;
|
||||
int m_port;
|
||||
cell *m_data;
|
||||
ucell m_datalen;
|
||||
|
@ -382,13 +382,16 @@ static cell AMX_NATIVE_CALL SQL_FieldNumToName(AMX *amx, cell *params)
|
||||
static cell AMX_NATIVE_CALL SQL_GetQueryString(AMX *amx, cell *params)
|
||||
{
|
||||
AmxQueryInfo *qInfo = (AmxQueryInfo *)GetHandle(params[1], Handle_Query);
|
||||
if (!qInfo)
|
||||
|
||||
if (!qInfo || (!qInfo->pQuery && !qInfo->opt_ptr))
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid query handle: %d", params[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return MF_SetAmxString(amx, params[2], qInfo->pQuery->GetQueryString(), params[3]);
|
||||
const char *ptr = qInfo->pQuery ? qInfo->pQuery->GetQueryString() : qInfo->opt_ptr;
|
||||
|
||||
return MF_SetAmxString(amx, params[2], ptr, params[3]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL SQL_FieldNameToNum(AMX *amx, cell *params)
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Module info
|
||||
#define MODULE_NAME "SQLite"
|
||||
#define MODULE_VERSION "1.76"
|
||||
#define MODULE_VERSION "1.76b"
|
||||
#define MODULE_AUTHOR "AMX Mod X Dev Team"
|
||||
#define MODULE_URL "http://www.amxmodx.org/"
|
||||
#define MODULE_LOGTAG "SQLITE"
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
namespace SourceHook
|
||||
{
|
||||
|
||||
//This class is from CSDM for AMX Mod X
|
||||
/*
|
||||
A circular, doubly-linked list with one sentinel node
|
||||
|
@ -10,9 +10,11 @@
|
||||
|
||||
struct AmxQueryInfo
|
||||
{
|
||||
AmxQueryInfo() : opt_ptr(NULL) { };
|
||||
IQuery *pQuery;
|
||||
QueryInfo info;
|
||||
char error[255];
|
||||
char *opt_ptr;
|
||||
};
|
||||
|
||||
enum HandleType
|
||||
|
@ -54,6 +54,9 @@ void ThreadWorker::RunThread(IThreadHandle *pHandle)
|
||||
/**
|
||||
* Check number of items in the queue
|
||||
*/
|
||||
m_StateLock->Lock();
|
||||
this_state = m_state;
|
||||
m_StateLock->Unlock();
|
||||
if (this_state != Worker_Stopped)
|
||||
{
|
||||
m_QueueLock->Lock();
|
||||
@ -65,6 +68,11 @@ void ThreadWorker::RunThread(IThreadHandle *pHandle)
|
||||
*/
|
||||
m_Waiting = true;
|
||||
m_QueueLock->Unlock();
|
||||
/* first check if we should end again */
|
||||
if (this_state == Worker_Stopped)
|
||||
{
|
||||
break;
|
||||
}
|
||||
m_AddSignal->Wait();
|
||||
m_Waiting = false;
|
||||
} else {
|
||||
@ -80,7 +88,9 @@ void ThreadWorker::RunThread(IThreadHandle *pHandle)
|
||||
{
|
||||
//wait until the lock is cleared.
|
||||
if (this_state == Worker_Paused)
|
||||
{
|
||||
m_PauseSignal->Wait();
|
||||
}
|
||||
if (this_state == Worker_Stopped)
|
||||
{
|
||||
//if we're supposed to flush cleanrly,
|
||||
@ -187,9 +197,12 @@ bool ThreadWorker::Stop(bool flush_cancel)
|
||||
{
|
||||
Unpause();
|
||||
} else {
|
||||
m_QueueLock->Lock();
|
||||
if (m_Waiting)
|
||||
{
|
||||
m_AddSignal->Signal();
|
||||
Pause();
|
||||
Unpause();
|
||||
}
|
||||
m_QueueLock->Unlock();
|
||||
}
|
||||
|
||||
me->WaitForThread();
|
||||
|
@ -97,7 +97,7 @@ IThreadHandle *WinThreader::MakeThread(IThread *pThread, const ThreadParams *par
|
||||
|
||||
IEventSignal *WinThreader::MakeEventSignal()
|
||||
{
|
||||
HANDLE event = CreateEventA(NULL, TRUE, TRUE, NULL);
|
||||
HANDLE event = CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||
|
||||
if (!event)
|
||||
return NULL;
|
||||
@ -275,7 +275,6 @@ WinThreader::WinEvent::~WinEvent()
|
||||
void WinThreader::WinEvent::Wait()
|
||||
{
|
||||
WaitForSingleObject(m_event, INFINITE);
|
||||
ResetEvent(m_event);
|
||||
}
|
||||
|
||||
void WinThreader::WinEvent::Signal()
|
||||
|
@ -129,6 +129,7 @@ void MysqlThread::SetForward(int forward)
|
||||
void MysqlThread::SetInfo(const char *db)
|
||||
{
|
||||
m_db.assign(db);
|
||||
m_qrInfo.queue_time = gpGlobals->time;
|
||||
}
|
||||
|
||||
void MysqlThread::SetQuery(const char *query)
|
||||
@ -146,8 +147,12 @@ void MysqlThread::RunThread(IThreadHandle *pHandle)
|
||||
info.host = "";
|
||||
info.port = 0;
|
||||
|
||||
float save_time = m_qrInfo.queue_time;
|
||||
|
||||
memset(&m_qrInfo, 0, sizeof(m_qrInfo));
|
||||
|
||||
m_qrInfo.queue_time = save_time;
|
||||
|
||||
IDatabase *pDatabase = g_Sqlite.Connect(&info, &m_qrInfo.amxinfo.info.errorcode, m_qrInfo.amxinfo.error, 254);
|
||||
IQuery *pQuery = NULL;
|
||||
if (!pDatabase)
|
||||
@ -168,15 +173,17 @@ void MysqlThread::RunThread(IThreadHandle *pHandle)
|
||||
if (m_qrInfo.query_success && m_qrInfo.amxinfo.info.rs)
|
||||
{
|
||||
m_atomicResult.CopyFrom(m_qrInfo.amxinfo.info.rs);
|
||||
m_qrInfo.amxinfo.pQuery = NULL;
|
||||
m_qrInfo.amxinfo.info.rs = &m_atomicResult;
|
||||
}
|
||||
|
||||
if (pQuery)
|
||||
{
|
||||
pQuery->FreeHandle();
|
||||
pQuery = NULL;
|
||||
m_qrInfo.amxinfo.pQuery = pQuery;
|
||||
} else {
|
||||
m_qrInfo.amxinfo.opt_ptr = new char[m_query.size() + 1];
|
||||
strcpy(m_qrInfo.amxinfo.opt_ptr, m_query.c_str());
|
||||
}
|
||||
|
||||
if (pDatabase)
|
||||
{
|
||||
pDatabase->FreeHandle();
|
||||
@ -226,26 +233,37 @@ void MysqlThread::Execute()
|
||||
} else if (!m_qrInfo.query_success) {
|
||||
state = -1;
|
||||
}
|
||||
float diff = gpGlobals->time - m_qrInfo.queue_time;
|
||||
cell c_diff = amx_ftoc(diff);
|
||||
unsigned int hndl = MakeHandle(&m_qrInfo.amxinfo, Handle_Query, NullFunc);
|
||||
if (state != 0)
|
||||
{
|
||||
MF_ExecuteForward(m_fwd,
|
||||
(cell)state,
|
||||
(cell)0,
|
||||
(cell)hndl,
|
||||
m_qrInfo.amxinfo.error,
|
||||
m_qrInfo.amxinfo.info.errorcode,
|
||||
data_addr,
|
||||
m_datalen);
|
||||
m_datalen,
|
||||
c_diff);
|
||||
} else {
|
||||
unsigned int hndl = MakeHandle(&m_qrInfo.amxinfo, Handle_Query, NullFunc);
|
||||
MF_ExecuteForward(m_fwd,
|
||||
(cell)0,
|
||||
(cell)hndl,
|
||||
"",
|
||||
(cell)0,
|
||||
data_addr,
|
||||
m_datalen);
|
||||
FreeHandle(hndl);
|
||||
m_datalen,
|
||||
c_diff);
|
||||
}
|
||||
FreeHandle(hndl);
|
||||
if (m_qrInfo.amxinfo.pQuery)
|
||||
{
|
||||
m_qrInfo.amxinfo.pQuery->FreeHandle();
|
||||
m_qrInfo.amxinfo.pQuery = NULL;
|
||||
}
|
||||
delete [] m_qrInfo.amxinfo.opt_ptr;
|
||||
m_qrInfo.amxinfo.opt_ptr = NULL;
|
||||
}
|
||||
|
||||
/*****************
|
||||
|
@ -12,6 +12,7 @@ struct QueuedResultInfo
|
||||
AmxQueryInfo amxinfo;
|
||||
bool connect_success;
|
||||
bool query_success;
|
||||
float queue_time;
|
||||
};
|
||||
|
||||
class AtomicResult :
|
||||
|
@ -115,7 +115,7 @@ AutoIncBuild=1
|
||||
MajorVer=1
|
||||
MinorVer=4
|
||||
Release=3
|
||||
Build=0
|
||||
Build=1
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
@ -126,11 +126,11 @@ CodePage=1252
|
||||
[Version Info Keys]
|
||||
CompanyName=AMX Mod X Dev Team
|
||||
FileDescription=
|
||||
FileVersion=1.4.3.0
|
||||
FileVersion=1.4.3.1
|
||||
InternalName=
|
||||
LegalCopyright=AMX Mod X Dev Team
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=AMXX-Studio
|
||||
ProductVersion=1.4.3.0
|
||||
ProductVersion=1.4.3 final
|
||||
Comments=
|
||||
|
Binary file not shown.
Binary file not shown.
@ -800,6 +800,8 @@ begin
|
||||
eCurrLine := Between(eCurrLine, '(', ')', True);
|
||||
HideBracesAndStrings(eCurrLine, True);
|
||||
eStr2.Text := StringReplace(eCurrLine, ',', #13, [rfReplaceAll]);
|
||||
if (Trim(eStr2.Text) = ')') then
|
||||
eStr2.Clear;
|
||||
|
||||
CreateCategory('Function Call');
|
||||
AddField('Function', 'Function Call', eVarName);
|
||||
|
@ -176,7 +176,7 @@ begin
|
||||
eTempIndent := eTempIndent +1;
|
||||
end;
|
||||
end
|
||||
else if (eStr[i] = 'else') or (Pos('else if', eStr[i]) = 1) and (Pos('{', eStr[i]) = 0) then
|
||||
else if (eStr[i] = 'else') or ((Pos('else if', eStr[i]) = 1) or (Pos('case', eStr[i]) = 1) or (Pos('switch', eStr[i]) = 1)) and (Pos('{', eStr[i]) = 0) then
|
||||
eTempIndent := eTempIndent +1
|
||||
else if (Pos('{', eStr[i]) = 0) and (Length(eStr[i]) > 6) then begin
|
||||
if (IsAtStart('stock', eStr[i], False)) or (IsAtStart('while', eStr[i], True)) then begin
|
||||
|
@ -751,6 +751,8 @@ begin
|
||||
else
|
||||
eCPUSpeed := 1; // otherwise the program would hang up
|
||||
frmSettings.txtLangDir.Text := IncludeTrailingPathDelimiter(eConfig.ReadString('Misc', 'LangDir', ''));
|
||||
if (frmSettings.txtLangDir.Text = '\') then
|
||||
frmSettings.txtLangDir.Text := '';
|
||||
frmSettings.chkShowStatusbar.Checked := eConfig.ReadBool('Misc', 'ShowStatusbar', True);
|
||||
frmMain.sbStatus.Visible := frmSettings.chkShowStatusbar.Checked;
|
||||
end;
|
||||
|
@ -63,6 +63,7 @@ var i, k: integer;
|
||||
eTempResult: TPawnParseResult;
|
||||
eProcedureAdded: Boolean;
|
||||
eCActive: Boolean;
|
||||
eTempBool: Boolean;
|
||||
begin
|
||||
Result := TPawnParseResult.Create;
|
||||
if not IsRecursive then
|
||||
@ -101,29 +102,38 @@ begin
|
||||
end;
|
||||
|
||||
{ Constants and Variables }
|
||||
if (IsAtStart('new', eString, False)) or (IsAtStart('stock', eString, False)) then begin // const or variable
|
||||
if (IsAtStart('new', eString, False)) or (IsAtStart('const', eString, False)) or (IsAtStart('stock', eString, False)) then begin // const or variable
|
||||
if (eBracesOpen = 0) and (not IsRecursive) and (Pos('(', eString) = Pos(')', eString)) then begin
|
||||
Delete(eString, 1, Pos(#32, eString));
|
||||
eString := Trim(eString);
|
||||
// we don't need braces so delete them...
|
||||
while (CountChars(eString, '{') <> 0) and (CountChars(eString, '}') <> 0) and (Pos('{', eString) < Pos('}', eString)) do
|
||||
eString := StringReplace(eString, '{' + Between(eString, '{', '}') + '}', '', [rfReplaceAll]);
|
||||
while (CountChars(eString, '[') <> 0) and (CountChars(eString, ']') <> 0) and (Pos('[', eString) < Pos(']', eString)) do
|
||||
eString := StringReplace(eString, '[' + Between(eString, '[', ']') + ']', '', [rfReplaceAll]);
|
||||
// done? okay, split all items if there are more than one; and if not, it's okay...
|
||||
eStr.Text := StringReplace(eString, ',', #13, [rfReplaceAll]);
|
||||
eStr.Text := StringReplace(Copy(eString, Pos(#32, eString)+1, Length(eString)), ',', #13, [rfReplaceAll]);
|
||||
for k := 0 to eStr.Count - 1 do begin
|
||||
if (Trim(eStr[k]) <> '') and (eStr[k] <> '}') then begin
|
||||
eTemp := Trim(RemoveSemicolon(eStr[k]));
|
||||
|
||||
if Pos(':', eTemp) <> 0 then
|
||||
if (IsAtStart('const', eTemp, False)) then begin
|
||||
Delete(eTemp, 1, 5);
|
||||
eTemp := Trim(eTemp);
|
||||
eTempBool := True;
|
||||
end
|
||||
else
|
||||
eTempBool := (IsAtStart('const', eString, False));
|
||||
|
||||
if (Pos(':', eTemp) <> 0) then
|
||||
eTemp := Copy(eTemp, Pos(':', eTemp) + 1, Length(eTemp));
|
||||
|
||||
if Pos('=', eTemp) <> 0 then begin // constant
|
||||
if (Pos('=', eTemp) <> 0) then begin // constant
|
||||
Result.Constants.AddObject(Copy(eTemp, 1, Pos('=', eTemp) - 1), TObject(i));
|
||||
Result.AutoComplete.Add(Copy(eTemp, 1, Pos('=', eTemp) - 1));
|
||||
end
|
||||
else begin // variable
|
||||
if (eTempBool) then
|
||||
Result.Constants.AddObject(eTemp, TObject(i))
|
||||
else
|
||||
Result.Variables.AddObject(eTemp, TObject(i));
|
||||
Result.AutoComplete.Add(eTemp);
|
||||
end;
|
||||
|
Binary file not shown.
@ -9,13 +9,14 @@ uses
|
||||
|
||||
type
|
||||
TfrmGoToLine = class(TForm)
|
||||
pnlBG: TSpTBXPanel;
|
||||
lblCaption: TLabel;
|
||||
txtGoToLine: TSpTBXEdit;
|
||||
cmdOK: TSpTBXButton;
|
||||
cmdCancel: TSpTBXButton;
|
||||
procedure txtGoToLineChange(Sender: TObject);
|
||||
cmdOK: TSpTBXButton;
|
||||
txtGoToLine: TSpTBXEdit;
|
||||
procedure txtGoToLineKeyPress(Sender: TObject; var Key: Char);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure txtGoToLineChange(Sender: TObject);
|
||||
end;
|
||||
|
||||
var
|
||||
@ -27,14 +28,6 @@ uses UnitMainTools;
|
||||
|
||||
{$R *.DFM}
|
||||
|
||||
procedure TfrmGoToLine.txtGoToLineChange(Sender: TObject);
|
||||
begin
|
||||
if not IsNumeric(txtGoToLine.Text) then
|
||||
txtGoToLine.Text := '1'
|
||||
else if txtGoToLine.Text = '0' then
|
||||
txtGoToLine.Text := '1';
|
||||
end;
|
||||
|
||||
procedure TfrmGoToLine.txtGoToLineKeyPress(Sender: TObject; var Key: Char);
|
||||
begin
|
||||
if Key = #13 then begin
|
||||
@ -46,6 +39,12 @@ end;
|
||||
procedure TfrmGoToLine.FormShow(Sender: TObject);
|
||||
begin
|
||||
txtGoToLine.SetFocus;
|
||||
txtGoToLine.SelectAll;
|
||||
end;
|
||||
|
||||
procedure TfrmGoToLine.txtGoToLineChange(Sender: TObject);
|
||||
begin
|
||||
cmdOK.Enabled := StrToIntDef(txtGoToLine.Text, -1) > 0;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
object frmMain: TfrmMain
|
||||
Left = 189
|
||||
Top = 114
|
||||
Width = 888
|
||||
Left = 184
|
||||
Top = 77
|
||||
Width = 893
|
||||
Height = 648
|
||||
Caption = 'AMXX-Studio'
|
||||
Color = clBtnFace
|
||||
@ -45,13 +45,13 @@ object frmMain: TfrmMain
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object splRight: TSplitter
|
||||
Left = 669
|
||||
Left = 674
|
||||
Top = 95
|
||||
Height = 501
|
||||
Align = alRight
|
||||
end
|
||||
object spcRight1: TImage
|
||||
Left = 877
|
||||
Left = 882
|
||||
Top = 95
|
||||
Width = 3
|
||||
Height = 501
|
||||
@ -67,7 +67,7 @@ object frmMain: TfrmMain
|
||||
object tbxTopDock: TSpTBXDock
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 880
|
||||
Width = 885
|
||||
Height = 72
|
||||
object tbxMenu: TSpTBXToolbar
|
||||
Left = 0
|
||||
@ -680,11 +680,11 @@ object frmMain: TfrmMain
|
||||
object sbStatus: TSpTBXStatusBar
|
||||
Left = 0
|
||||
Top = 596
|
||||
Width = 880
|
||||
Width = 885
|
||||
Height = 25
|
||||
object mnuFilename: TSpTBXRightAlignSpacerItem
|
||||
Caption = 'Untitled.sma'
|
||||
CustomWidth = 542
|
||||
CustomWidth = 547
|
||||
end
|
||||
object sepStatus0: TSpTBXSeparatorItem
|
||||
end
|
||||
@ -728,7 +728,7 @@ object frmMain: TfrmMain
|
||||
object tbDocs: TJvTabBar
|
||||
Left = 0
|
||||
Top = 72
|
||||
Width = 880
|
||||
Width = 885
|
||||
RightClickSelect = False
|
||||
Tabs = <
|
||||
item
|
||||
@ -740,7 +740,7 @@ object frmMain: TfrmMain
|
||||
OnMouseDown = tbDocsMouseDown
|
||||
end
|
||||
object tcTools: TSpTBXTabControl
|
||||
Left = 672
|
||||
Left = 677
|
||||
Top = 95
|
||||
Width = 205
|
||||
Height = 501
|
||||
@ -950,7 +950,7 @@ object frmMain: TfrmMain
|
||||
object pnlParent: TPanel
|
||||
Left = 3
|
||||
Top = 95
|
||||
Width = 666
|
||||
Width = 671
|
||||
Height = 501
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
@ -958,7 +958,7 @@ object frmMain: TfrmMain
|
||||
object splOutput: TSplitter
|
||||
Left = 0
|
||||
Top = 416
|
||||
Width = 666
|
||||
Width = 671
|
||||
Height = 3
|
||||
Cursor = crVSplit
|
||||
Align = alBottom
|
||||
@ -967,7 +967,7 @@ object frmMain: TfrmMain
|
||||
object sciEditor: TScintilla
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 666
|
||||
Width = 671
|
||||
Height = 416
|
||||
Color = clWhite
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
@ -4493,7 +4493,7 @@ object frmMain: TfrmMain
|
||||
object lstOutput: TListBox
|
||||
Left = 0
|
||||
Top = 419
|
||||
Width = 666
|
||||
Width = 671
|
||||
Height = 82
|
||||
Align = alBottom
|
||||
ItemHeight = 13
|
||||
|
@ -1071,9 +1071,30 @@ begin
|
||||
end;
|
||||
|
||||
procedure TfrmMain.OnCodeSnippetClick(Sender: TObject);
|
||||
var Snippet, Indentation: String;
|
||||
Line: Integer;
|
||||
begin
|
||||
if Plugin_CodeSnippetClick(TSpTBXItem(Sender).Caption, GetCat, GetSnippet(GetCat, (Sender as TSpTBXItem).Caption)) then
|
||||
sciEditor.SelText := GetSnippet(GetCat, (Sender as TSpTBXItem).Caption);
|
||||
if Plugin_CodeSnippetClick(TSpTBXItem(Sender).Caption, GetCat, GetSnippet(GetCat, (Sender as TSpTBXItem).Caption)) then begin
|
||||
Snippet := GetSnippet(GetCat, (Sender as TSpTBXItem).Caption);
|
||||
if (Pos('!APPEND!' + #13, Snippet) = 1) then begin
|
||||
Snippet := Copy(Snippet, Pos(#10, Snippet)+1, Length(Snippet));
|
||||
Line := sciEditor.Lines.Add(Snippet);
|
||||
end
|
||||
else if (Pos('!INSERT!' + #13, Snippet) = 1) then begin
|
||||
Indentation := sciEditor.Lines[sciEditor.GetCurrentLineNumber];
|
||||
if (Trim(Indentation) <> '') then
|
||||
Indentation := Copy(Indentation, 1, Pos(Copy(TrimLeft(Indentation), 1, 1), Indentation)-1);
|
||||
Snippet := StringReplace(Snippet, #10, #10 + Indentation, [rfReplaceAll]);
|
||||
Line := sciEditor.GetCurrentLineNumber;
|
||||
sciEditor.Lines.Insert(Line, Copy(Snippet, Pos(#10, Snippet)+1, Length(Snippet)));
|
||||
end
|
||||
else begin
|
||||
sciEditor.SelText := Snippet;
|
||||
Line := sciEditor.GetCurrentLineNumber;
|
||||
end;
|
||||
|
||||
sciEditor.GoToLine(Line);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.mnuCopyMessageClick(Sender: TObject);
|
||||
|
@ -64,7 +64,7 @@ object frmSettings: TfrmSettings
|
||||
Top = 0
|
||||
Width = 351
|
||||
Height = 260
|
||||
ActivePage = jspCTSettings
|
||||
ActivePage = jspCodeSnippets
|
||||
PropagateEnable = False
|
||||
Align = alClient
|
||||
OnChange = jplSettingsChange
|
||||
@ -760,6 +760,9 @@ object frmSettings: TfrmSettings
|
||||
ScrollBars = ssBoth
|
||||
TabOrder = 1
|
||||
WantTabs = True
|
||||
OnChange = txtCodeSnippetChange
|
||||
OnEnter = txtCodeSnippetEnter
|
||||
OnExit = txtCodeSnippetExit
|
||||
OnKeyUp = txtCodeSnippetKeyUp
|
||||
end
|
||||
object cmdCSAdd: TFlatButton
|
||||
|
@ -277,6 +277,9 @@ type
|
||||
procedure lvParamsDblClick(Sender: TObject);
|
||||
procedure cmdAddFunctionClick(Sender: TObject);
|
||||
procedure lstFunctionsClick(Sender: TObject);
|
||||
procedure txtCodeSnippetEnter(Sender: TObject);
|
||||
procedure txtCodeSnippetExit(Sender: TObject);
|
||||
procedure txtCodeSnippetChange(Sender: TObject);
|
||||
public
|
||||
Foreground, Background: TColor;
|
||||
CaretFore, CaretBack: TColor;
|
||||
@ -339,9 +342,14 @@ begin
|
||||
eReg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion', False);
|
||||
{ AMXX }
|
||||
AMXXDir := eReg.ReadString('ProgramFilesDir') + '\AMX Mod X\';
|
||||
if not DirectoryExists(AMXXDir) then
|
||||
if DirectoryExists(AMXXDir) then
|
||||
AMXXDir := IncludeTrailingPathDelimiter(AMXXDir)
|
||||
else
|
||||
AMXXDir := '';
|
||||
eReg.CloseKey;
|
||||
{ Language Files }
|
||||
if (DirectoryExists(AMXXDir + 'files\base\data\lang')) then
|
||||
txtLangDir.Text := AMXXDir + 'files\base\data\lang';
|
||||
{ Steam }
|
||||
if eReg.KeyExists('SOFTWARE\Valve\Steam') then begin
|
||||
eReg.OpenKey('SOFTWARE\Valve\Steam', False);
|
||||
@ -421,7 +429,7 @@ begin
|
||||
eConfig.WriteString('Misc', 'DefaultPluginAuthor', GetUser);
|
||||
eConfig.WriteInteger('Misc', 'SaveNotesTo', 0);
|
||||
eConfig.WriteInteger('Misc', 'CPUSpeed', 5);
|
||||
eConfig.WriteString('Misc', 'LangDir', '');
|
||||
eConfig.WriteString('Misc', 'LangDir', txtLangDir.Text);
|
||||
eConfig.WriteInteger('Misc', 'ShowStatusbar', 1);
|
||||
eConfig.WriteInteger('Misc', 'WindowState', 0);
|
||||
end;
|
||||
@ -434,6 +442,8 @@ begin
|
||||
2: frmMain.WindowState := wsMinimized;
|
||||
end;
|
||||
|
||||
txtCodeSnippetExit(Sender);
|
||||
|
||||
PaintForeground(clBlack);
|
||||
PaintBackground(clBlack);
|
||||
PaintCaretFore(clBlack);
|
||||
@ -778,6 +788,7 @@ begin
|
||||
lstCodeSnippets.ItemIndex := lstCodeSnippets.Items.Add(eStr);
|
||||
AddSnippet(ftcCodeSnippets.Tabs[ftcCodeSnippets.ActiveTab], eStr, '');
|
||||
txtCodeSnippet.Enabled := True;
|
||||
lstCodeSnippets.SetFocus;
|
||||
lstCodeSnippetsClick(Sender);
|
||||
end
|
||||
else
|
||||
@ -805,7 +816,9 @@ procedure TfrmSettings.lstCodeSnippetsClick(Sender: TObject);
|
||||
begin
|
||||
cmdCSRemove.Enabled := lstCodeSnippets.ItemIndex <> -1;
|
||||
if cmdCSRemove.Enabled then
|
||||
txtCodeSnippet.Lines.Text := GetSnippet(ftcCodeSnippets.Tabs[ftcCodeSnippets.ActiveTab], lstCodeSnippets.Items[lstCodeSnippets.ItemIndex]);
|
||||
txtCodeSnippet.Lines.Text := GetSnippet(ftcCodeSnippets.Tabs[ftcCodeSnippets.ActiveTab], lstCodeSnippets.Items[lstCodeSnippets.ItemIndex])
|
||||
else
|
||||
txtCodeSnippetExit(Sender);
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.ftcCodeSnippetsTabChanged(Sender: TObject);
|
||||
@ -815,8 +828,8 @@ begin
|
||||
lstCodeSnippets.ItemIndex := 0
|
||||
else
|
||||
txtCodeSnippet.Clear;
|
||||
lstCodeSnippetsClick(Sender);
|
||||
txtCodeSnippet.Enabled := lstCodeSnippets.Items.Count > 0;
|
||||
lstCodeSnippetsClick(Sender);
|
||||
cmdCSRemove.Enabled := lstCodeSnippets.ItemIndex <> -1;
|
||||
end;
|
||||
|
||||
@ -1250,4 +1263,28 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.txtCodeSnippetEnter(Sender: TObject);
|
||||
begin
|
||||
if (txtCodeSnippet.Font.Color = $008396A0) and ((ActiveControl = txtCodeSnippet) or (txtCodeSnippet.Enabled)) then begin
|
||||
txtCodeSnippet.Font.Color := clWindowText;
|
||||
txtCodeSnippet.Text := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.txtCodeSnippetExit(Sender: TObject);
|
||||
begin
|
||||
if (txtCodeSnippet.Text = '') then begin
|
||||
txtCodeSnippet.Lines.Text := 'Use "!APPEND!" to append or'#13'"!INSERT!" to insert the code'#13'snippet into a new line on click...';
|
||||
txtCodeSnippet.Font.Color := $008396A0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSettings.txtCodeSnippetChange(Sender: TObject);
|
||||
begin
|
||||
if (txtCodeSnippet.Font.Color = $008396A0) then
|
||||
txtCodeSnippet.Font.Color := clWindowText
|
||||
else if (txtCodeSnippet.Text = '') and (ActiveControl <> txtCodeSnippet) then
|
||||
txtCodeSnippetExit(Sender);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -3,4 +3,4 @@ source = R:\amxmodx
|
||||
makeopts =
|
||||
output = c:\real\done
|
||||
devenv = C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com
|
||||
release = amxmodx-1.76
|
||||
release = amxmodx-1.76b
|
||||
|
@ -2,7 +2,7 @@
|
||||
; Licensed under the GNU General Public License
|
||||
; Originally written by -=HaXoMaTiC=-
|
||||
!define PRODUCT_NAME "AMX Mod X Installer"
|
||||
!define PRODUCT_VERSION "1.76a"
|
||||
!define PRODUCT_VERSION "1.76b"
|
||||
!define PRODUCT_PUBLISHER "AMX Mod X Dev Team"
|
||||
!define PRODUCT_WEB_SITE "http://www.amxmodx.org/"
|
||||
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Installer.exe"
|
||||
|
Binary file not shown.
@ -148,7 +148,7 @@ var
|
||||
frmMain: TfrmMain;
|
||||
gMultiAccount: Boolean;
|
||||
|
||||
const VERSION = '1.76a';
|
||||
const VERSION = '1.76b';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -60,16 +60,22 @@ public plugin_init()
|
||||
public cmdSayChat(id)
|
||||
{
|
||||
if (!access(id, ADMIN_CHAT))
|
||||
{
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
new said[6], i = 0
|
||||
read_argv(1, said, 5)
|
||||
|
||||
while (said[i] == '@')
|
||||
{
|
||||
i++
|
||||
}
|
||||
|
||||
if (!i || i > 3)
|
||||
{
|
||||
return PLUGIN_CONTINUE
|
||||
}
|
||||
|
||||
new message[192], a = 0
|
||||
read_args(message, 191)
|
||||
@ -86,17 +92,32 @@ public cmdSayChat(id)
|
||||
case 'o': a = 7
|
||||
}
|
||||
|
||||
new n, s = i
|
||||
if (a)
|
||||
{
|
||||
n++
|
||||
s++
|
||||
}
|
||||
while (said[s] && isspace(said[s]))
|
||||
{
|
||||
n++
|
||||
s++
|
||||
}
|
||||
|
||||
|
||||
new name[32], authid[32], userid
|
||||
|
||||
get_user_authid(id, authid, 31)
|
||||
get_user_name(id, name, 31)
|
||||
userid = get_user_userid(id)
|
||||
|
||||
log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"", name, userid, authid, message[i + 1])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")", name, userid, authid, message[i + 1], "en", g_Colors[a])
|
||||
log_amx("Chat: ^"%s<%d><%s><>^" tsay ^"%s^"", name, userid, authid, message[i + n])
|
||||
log_message("^"%s<%d><%s><>^" triggered ^"amx_tsay^" (text ^"%s^") (color ^"%L^")", name, userid, authid, message[i + n], "en", g_Colors[a])
|
||||
|
||||
if (++g_msgChannel > 6 || g_msgChannel < 3)
|
||||
{
|
||||
g_msgChannel = 3
|
||||
}
|
||||
|
||||
new Float:verpos = g_Pos[i][1] + float(g_msgChannel) / 35.0
|
||||
|
||||
@ -104,11 +125,11 @@ public cmdSayChat(id)
|
||||
|
||||
if (get_cvar_num("amx_show_activity") == 2)
|
||||
{
|
||||
show_hudmessage(0, "%s : %s", name, message[i + 1])
|
||||
client_print(0, print_notify, "%s : %s", name, message[i + 1])
|
||||
show_hudmessage(0, "%s : %s", name, message[i + n])
|
||||
client_print(0, print_notify, "%s : %s", name, message[i + n])
|
||||
} else {
|
||||
show_hudmessage(0, "%s", message[i + 1])
|
||||
client_print(0, print_notify, "%s", message[i + 1])
|
||||
show_hudmessage(0, "%s", message[i + n])
|
||||
client_print(0, print_notify, "%s", message[i + n])
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
|
@ -40,17 +40,17 @@ VexdUM_Register()
|
||||
register_forward(FM_ClientUserInfoChanged, "Hook_ClientUserInfoChanged")
|
||||
|
||||
/* Global Forwards */
|
||||
g_FwdTouch = CreateMultiForward("entity_touch", ET_STOP, FP_CELL, FP_CELL)
|
||||
g_FwdThink = CreateMultiForward("entity_think", ET_STOP, FP_CELL)
|
||||
g_FwdSpawn = CreateMultiForward("entity_spawn", ET_STOP, FP_CELL)
|
||||
g_FwdClientPreThink = CreateMultiForward("client_prethink", ET_IGNORE, FP_CELL)
|
||||
g_FwdClientPostThink = CreateMultiForward("client_postthink", ET_IGNORE, FP_CELL)
|
||||
g_FwdEmitSound = CreateMultiForward("emitsound", ET_STOP, FP_CELL, FP_STRING)
|
||||
g_FwdEmitAmbientSound = CreateMultiForward("emitambientsound", ET_STOP, FP_CELL, FP_STRING)
|
||||
g_FwdSetModel = CreateMultiForward("set_model", ET_STOP, FP_CELL, FP_STRING)
|
||||
g_FwdTraceLine = CreateMultiForward("traceline", ET_STOP, FP_CELL)
|
||||
g_FwdSetCliKeyValue = CreateMultiForward("setclientkeyvalue", ET_STOP, FP_CELL, FP_STRING, FP_STRING)
|
||||
g_FwdKeyValue = CreateMultiForward("keyvalue", ET_STOP, FP_CELL)
|
||||
g_FwdTouch = CreateMultiForwardEx("entity_touch", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_CELL)
|
||||
g_FwdThink = CreateMultiForwardEx("entity_think", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdSpawn = CreateMultiForwardEx("entity_spawn", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdClientPreThink = CreateMultiForwardEx("client_prethink", ET_IGNORE, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdClientPostThink = CreateMultiForwardEx("client_postthink", ET_IGNORE, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdEmitSound = CreateMultiForwardEx("emitsound", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
|
||||
g_FwdEmitAmbientSound = CreateMultiForwardEx("emitambientsound", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
|
||||
g_FwdSetModel = CreateMultiForwardEx("set_model", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
|
||||
g_FwdTraceLine = CreateMultiForwardEx("traceline", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
g_FwdSetCliKeyValue = CreateMultiForwardEx("setclientkeyvalue", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING, FP_STRING)
|
||||
g_FwdKeyValue = CreateMultiForwardEx("keyvalue", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
|
||||
}
|
||||
|
||||
VexdUM_Natives()
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include <amxmodx>
|
||||
#include <csx>
|
||||
#include <cstrike>
|
||||
|
||||
public MultiKill
|
||||
public MultiKillSound
|
||||
@ -309,46 +310,80 @@ public client_death(killer, victim, wpnindex, hitplace, TK)
|
||||
}
|
||||
}
|
||||
|
||||
if (EnemyRemaining)
|
||||
if (EnemyRemaining && is_user_connected(victim))
|
||||
{
|
||||
new ppl[32], pplnum = 0
|
||||
new team = get_user_team(victim) - 1
|
||||
new ppl[32], pplnum = 0, maxplayers = get_maxplayers()
|
||||
new epplnum = 0
|
||||
new CsTeams:team = cs_get_user_team(victim)
|
||||
new CsTeams:other_team
|
||||
new CsTeams:enemy_team = (team == CS_TEAM_T) ? CS_TEAM_CT : CS_TEAM_T
|
||||
|
||||
if (team >= 0 && team < 4)
|
||||
get_players(ppl, pplnum, "e", g_teamsNames[1 - team])
|
||||
|
||||
if (pplnum)
|
||||
if (team == CS_TEAM_T || team == CS_TEAM_CT)
|
||||
{
|
||||
new eppl[32], epplnum
|
||||
|
||||
if (team >= 0 && team < 4)
|
||||
for (new i=1; i<=maxplayers; i++)
|
||||
{
|
||||
get_players(eppl, epplnum, "ae", g_teamsNames[team])
|
||||
if (!is_user_connected(i))
|
||||
{
|
||||
continue
|
||||
}
|
||||
if (i == victim)
|
||||
{
|
||||
continue
|
||||
}
|
||||
other_team = cs_get_user_team(i)
|
||||
if (other_team == team && is_user_alive(i))
|
||||
{
|
||||
epplnum++
|
||||
} else if (other_team == enemy_team) {
|
||||
ppl[pplnum++] = i
|
||||
}
|
||||
}
|
||||
|
||||
if (epplnum)
|
||||
if (pplnum && epplnum)
|
||||
{
|
||||
new message[128], team_name[32]
|
||||
|
||||
set_hudmessage(255, 255, 255, 0.02, 0.85, 2, 0.05, 0.1, 0.02, 3.0, -1)
|
||||
|
||||
/* This is a pretty stupid thing to translate, but whatever */
|
||||
new _teamname[32]
|
||||
if (team == CS_TEAM_T)
|
||||
{
|
||||
format(_teamname, 31, "TERRORIST%s", (epplnum == 1) ? "" : "S")
|
||||
} else if (team == CS_TEAM_CT) {
|
||||
format(_teamname, 31, "CT%s", (epplnum == 1) ? "" : "S")
|
||||
}
|
||||
|
||||
for (new a = 0; a < pplnum; ++a)
|
||||
{
|
||||
format(team_name, 31, "%L", ppl[a], (epplnum == 1) ? g_teamsNames[team] : g_teamsNames[team + 2])
|
||||
format(team_name, 31, "%L", ppl[a], _teamname)
|
||||
format(message, 127, "%L", ppl[a], "REMAINING", epplnum, team_name)
|
||||
|
||||
ShowSyncHudMsg(ppl[a], g_bottom_sync, "%s", message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (LastMan)
|
||||
{
|
||||
new cts[32], ts[32], ctsnum, tsnum
|
||||
new maxplayers = get_maxplayers()
|
||||
new CsTeams:team
|
||||
|
||||
get_players(cts, ctsnum, "ae", g_teamsNames[1])
|
||||
get_players(ts, tsnum, "ae", g_teamsNames[0])
|
||||
for (new i=1; i<=maxplayers; i++)
|
||||
{
|
||||
if (!is_user_connected(i) || !is_user_alive(i))
|
||||
{
|
||||
continue
|
||||
}
|
||||
team = cs_get_user_team(i)
|
||||
if (team == CS_TEAM_T)
|
||||
{
|
||||
ts[tsnum++] = i
|
||||
} else if (team == CS_TEAM_CT) {
|
||||
cts[ctsnum++] = i
|
||||
}
|
||||
}
|
||||
|
||||
if (ctsnum == 1 && tsnum == 1)
|
||||
{
|
||||
@ -364,19 +399,19 @@ public client_death(killer, victim, wpnindex, hitplace, TK)
|
||||
}
|
||||
else if (!g_LastAnnounce)
|
||||
{
|
||||
new oposite = 0, team = 0
|
||||
new oposite = 0, _team = 0
|
||||
|
||||
if (ctsnum == 1 && tsnum > 1)
|
||||
{
|
||||
g_LastAnnounce = cts[0]
|
||||
oposite = tsnum
|
||||
team = 0
|
||||
_team = 0
|
||||
}
|
||||
else if (tsnum == 1 && ctsnum > 1)
|
||||
{
|
||||
g_LastAnnounce = ts[0]
|
||||
oposite = ctsnum
|
||||
team = 1
|
||||
_team = 1
|
||||
}
|
||||
|
||||
if (g_LastAnnounce)
|
||||
@ -386,13 +421,15 @@ public client_death(killer, victim, wpnindex, hitplace, TK)
|
||||
get_user_name(g_LastAnnounce, name, 31)
|
||||
|
||||
set_hudmessage(0, 255, 255, -1.0, 0.35, 0, 6.0, 6.0, 0.5, 0.15, -1)
|
||||
ShowSyncHudMsg(0, g_center1_sync, "%s (%d HP) vs. %d %s%s: %L", name, get_user_health(g_LastAnnounce), oposite, g_teamsNames[team], (oposite == 1) ? "" : "S", LANG_PLAYER, g_LastMessages[random_num(0, 3)])
|
||||
ShowSyncHudMsg(0, g_center1_sync, "%s (%d HP) vs. %d %s%s: %L", name, get_user_health(g_LastAnnounce), oposite, g_teamsNames[_team], (oposite == 1) ? "" : "S", LANG_PLAYER, g_LastMessages[random_num(0, 3)])
|
||||
|
||||
if (!is_user_connecting(g_LastAnnounce))
|
||||
{
|
||||
client_cmd(g_LastAnnounce, "spk misc/oneandonly")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wpnindex == CSW_KNIFE && (KnifeKill || KnifeKillSound))
|
||||
{
|
||||
@ -588,6 +625,11 @@ public checkKills(param[])
|
||||
|
||||
if (a > -1)
|
||||
{
|
||||
if (a > 6)
|
||||
{
|
||||
a = 6
|
||||
}
|
||||
|
||||
if (MultiKill)
|
||||
{
|
||||
new name[32]
|
||||
@ -595,9 +637,6 @@ public checkKills(param[])
|
||||
get_user_name(id, name, 31)
|
||||
set_hudmessage(255, 0, 100, 0.05, 0.50, 2, 0.02, 6.0, 0.01, 0.1, -1)
|
||||
|
||||
if (a > 6)
|
||||
a = 6
|
||||
|
||||
ShowSyncHudMsg(0, g_left_sync, g_MultiKillMsg[a], name, LANG_PLAYER, "WITH", g_multiKills[id][0], LANG_PLAYER, "KILLS", g_multiKills[id][1], LANG_PLAYER, "HS")
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ showStatsMenu(id,pos){
|
||||
}
|
||||
|
||||
else len += format(menu_body[len],511-len,"^n0. %s" , pos ? "Back" : "Exit" )
|
||||
show_menu(id,keys,menu_body)
|
||||
show_menu(id,keys,menu_body,-1,"Server Stats")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
||||
#endif
|
||||
#define _amxconst_included
|
||||
|
||||
#define AMXX_VERSION 1.761
|
||||
#define AMXX_VERSION 1.762
|
||||
#define AMXX_VERSION_NUM 176
|
||||
stock const AMXX_VERSION_STR[]="1.76a"
|
||||
stock const AMXX_VERSION_STR[]="1.76b"
|
||||
|
||||
#define M_PI 3.1415926535
|
||||
|
||||
@ -264,6 +264,7 @@ enum {
|
||||
#define AMX_ERR_DIVIDE 11
|
||||
#define AMX_ERR_NOTFOUND 19
|
||||
#define AMX_ERR_PARAMS 25
|
||||
#define AMX_ERR_GENERAL 27
|
||||
|
||||
#define INVALID_HANDLE -1
|
||||
|
||||
@ -277,6 +278,10 @@ enum {
|
||||
#define FP_STRING 2
|
||||
#define FP_ARRAY 4
|
||||
|
||||
#define FORWARD_ONLY_OLD 1
|
||||
#define FORWARD_ONLY_NEW 2
|
||||
#define FORWARD_ALL 3
|
||||
|
||||
#define MEXIT_ALL 1
|
||||
#define MEXIT_NORMAL 0
|
||||
#define MEXIT_NEVER -1
|
||||
|
@ -71,8 +71,8 @@ stock can_see(ent1, ent2)
|
||||
return 0;
|
||||
} else {
|
||||
new Float:flFraction;
|
||||
get_tr2(0, TraceResult:TR_Fraction, flFraction);
|
||||
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_Hit) == ent2))
|
||||
get_tr2(0, TraceResult:TR_flFraction, flFraction);
|
||||
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == ent2))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -11,6 +11,11 @@
|
||||
#define _Vexd_Utilities_included
|
||||
|
||||
#include <engine>
|
||||
#if defined AMXMOD_BCOMPAT
|
||||
#if !defined _vexd_bcompat_included
|
||||
#include <VexdUM>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
stock Entvars_Get_Int(iIndex, iVariable)
|
||||
return entity_get_int(iIndex, iVariable)
|
||||
|
@ -205,7 +205,9 @@ native get_amxx_verstring(buffer[], length);
|
||||
|
||||
/* If player is not attacked function returns 0, in other
|
||||
* case returns index of attacking player. On second and third
|
||||
* parameter you may get info about weapon and body hit place. */
|
||||
* parameter you may get info about weapon and body hit place.
|
||||
* As of 1.75, get_user_attacker can return a non-player index if the player was attacked by a non-player entity.
|
||||
*/
|
||||
native get_user_attacker(index,...);
|
||||
|
||||
/* If player doesn't hit at anything function returns 0.0,
|
||||
@ -1014,11 +1016,20 @@ native set_addr_val(addr, val);
|
||||
|
||||
|
||||
/**
|
||||
* creates a multi-plugin forward.
|
||||
* Creates a multi-plugin forward.
|
||||
* Stop type must be one of the ET_ values in amxconst.inc
|
||||
* results will be > 0 for success
|
||||
*/
|
||||
native CreateMultiForward(const name[], stop_type, ...);
|
||||
|
||||
/**
|
||||
* Creates a multi-forward plugin that can filter between old/new plugins.
|
||||
* Old plugins are used by the AMX Mod backwards compatibility layer.
|
||||
* Stop type must be one of the ET_ values in amxconst.inc
|
||||
* Forward type must be one of the FORWARD_ values in amxconst.inc.
|
||||
*/
|
||||
native CreateMultiForwardEx(const name[], stop_type, forward_type, ...);
|
||||
|
||||
/**
|
||||
* Creates a forward for one plugin.
|
||||
* Results will be > 0 for success.
|
||||
|
@ -226,8 +226,10 @@ forward pfn_spawn(entid);
|
||||
*/
|
||||
native find_sphere_class(aroundent, _lookforclassname[], Float:radius, entlist[], maxents, Float:origin[3] = {0.0, 0.0, 0.0});
|
||||
|
||||
//SDK function - checks if an origin is in an entity's view cone
|
||||
native is_in_viewcone(entity, Float:origin[3]);
|
||||
/* SDK function - checks if an origin is in an entity's view cone
|
||||
* Set use3d to 1 to do the calculation in 3D. Otherwise it will be in 2D.
|
||||
*/
|
||||
native is_in_viewcone(entity, Float:origin[3], use3d = 0);
|
||||
|
||||
//SDK function - checks if an entity is visible to an entity
|
||||
native is_visible(entity, target);
|
||||
|
@ -29,8 +29,11 @@ native delete_file(const file[]);
|
||||
native file_exists(const file[]);
|
||||
|
||||
/* renames a file. returns 0 on failure, 1 on success.
|
||||
* if relative true, rename_file will act like other natives which
|
||||
* use the moddir as a base directory. otherwise, the current directory is
|
||||
* undefined (but assumed to be hlds).
|
||||
*/
|
||||
native rename_file(const oldname[], const newname[]);
|
||||
native rename_file(const oldname[], const newname[], relative=0);
|
||||
|
||||
/* Checks if a directory exists */
|
||||
native dir_exists(const dir[]);
|
||||
|
@ -3,7 +3,7 @@
|
||||
(C)Copyrighted under the GNU General Public License, Version 2
|
||||
*/
|
||||
|
||||
#if defined geoip_included
|
||||
#if defined _geoip_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _geoip_included
|
||||
|
@ -30,8 +30,12 @@ enum Handle
|
||||
* !!NOTE!! I have seen most people think that this connects to the DB.
|
||||
* Nowhere does it say this, and in fact it does not. It only caches
|
||||
* the connection information, the host/user/pass/etc.
|
||||
*
|
||||
* The optional timeout parameter specifies how long connections should wait before
|
||||
* giving up. If 0, the default (which is undefined) is used.
|
||||
*
|
||||
*/
|
||||
native Handle:SQL_MakeDbTuple(const host[], const user[], const pass[], const db[]);
|
||||
native Handle:SQL_MakeDbTuple(const host[], const user[], const pass[], const db[], timeout=0);
|
||||
|
||||
|
||||
/**
|
||||
@ -74,8 +78,9 @@ native Handle:SQL_PrepareQuery(Handle:db, const fmt[], {Float,_}:...);
|
||||
* @param errnum - An error code, if any.
|
||||
* @param data - Data array you passed in.
|
||||
* @param size - Size of the data array you passed in.
|
||||
* @param queuetime - Amount of gametime that passed while the query was resolving.
|
||||
*
|
||||
* public QueryHandler(failstate, Handle:query, error[], errnum, data[], size)
|
||||
* public QueryHandler(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime)
|
||||
*
|
||||
* Note! The handle you pass in is a DB Tuple, NOT an active connection!
|
||||
* Note! The handle does not need to be freed.
|
||||
|
@ -6,6 +6,7 @@ public plugin_init()
|
||||
|
||||
register_clcmd("menu_test1", "Test_Menu1")
|
||||
register_clcmd("menu_test2", "Test_Menu2")
|
||||
register_clcmd("menu_test3", "Test_Menu3")
|
||||
}
|
||||
|
||||
public Test_Menu1(id, level, cid)
|
||||
@ -54,3 +55,38 @@ public Test_Menu1_Handler(id, menu, item)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public Test_Menu3(id)
|
||||
{
|
||||
new mHandleID = menu_create("Test Menu 3", "Test_Menu3_Handler")
|
||||
menu_additem(mHandleID, "test1", "1", 0)
|
||||
menu_additem(mHandleID, "test2", "2", 0)
|
||||
menu_additem(mHandleID, "test3", "3", 0)
|
||||
menu_additem(mHandleID, "test4", "4", 0)
|
||||
menu_additem(mHandleID, "test5", "5", 0)
|
||||
menu_additem(mHandleID, "test6", "6", 0)
|
||||
menu_additem(mHandleID, "test7", "7", 0)
|
||||
menu_additem(mHandleID, "test8", "8", 0)
|
||||
menu_additem(mHandleID, "test9", "9", 0)
|
||||
menu_additem(mHandleID, "test10", "10", 0)
|
||||
menu_additem(mHandleID, "test11", "11", 0)
|
||||
menu_addblank(mHandleID, 1) // add blank got problem
|
||||
|
||||
menu_display(id, mHandleID, 0)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public Test_Menu3_Handler(id, menu, item)
|
||||
{
|
||||
if (item == MENU_EXIT)
|
||||
{
|
||||
menu_destroy(menu)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
client_print(id, print_chat, "item = %d", item)
|
||||
|
||||
menu_destroy(menu)
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
@ -15,6 +15,7 @@ public plugin_init()
|
||||
register_srvcmd("sqlx_test_old1", "SqlxTest_Old1")
|
||||
register_srvcmd("sqlx_test_old2", "SqlxTest_Old2")
|
||||
register_srvcmd("sqlx_test_thread_end", "SqlxTest_ThreadEnd")
|
||||
register_srvcmd("sqlx_test_bad", "SqlxTest_Bad")
|
||||
|
||||
new configsDir[64]
|
||||
get_configsdir(configsDir, 63)
|
||||
@ -73,6 +74,22 @@ public plugin_cfg()
|
||||
g_DbInfo = SQL_MakeDbTuple(host, user, pass, db)
|
||||
}
|
||||
|
||||
public SqlxTest_Bad()
|
||||
{
|
||||
new errnum, error[255]
|
||||
new Handle:tempinfo = SQL_MakeDbTuple("1.2.3.4", "asdf", "gasdf", "gaben", 2)
|
||||
new Handle:db = SQL_Connect(tempinfo, errnum, error, 254)
|
||||
|
||||
if (db == Empty_Handle)
|
||||
{
|
||||
server_print(" --> Errored out! %d, %s", errnum, error)
|
||||
} else {
|
||||
server_print(" --> Something is wrong here.")
|
||||
}
|
||||
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
/**
|
||||
* Note that this function works for both threaded and non-threaded queries.
|
||||
*/
|
||||
@ -106,18 +123,22 @@ PrintQueryData(Handle:query)
|
||||
/**
|
||||
* Handler for when a threaded query is resolved.
|
||||
*/
|
||||
public GetMyStuff(failstate, Handle:query, error[], errnum, data[], size)
|
||||
public GetMyStuff(failstate, Handle:query, error[], errnum, data[], size, Float:queuetime)
|
||||
{
|
||||
server_print("Resolved query %d at: %f", data[0], get_gametime())
|
||||
server_print(" --> Resolved query %d, took %f seconds", data[0], queuetime)
|
||||
if (failstate)
|
||||
{
|
||||
if (failstate == TQUERY_CONNECT_FAILED)
|
||||
{
|
||||
server_print("Connection failed!")
|
||||
server_print(" --> Connection failed!")
|
||||
} else if (failstate == TQUERY_QUERY_FAILED) {
|
||||
server_print("Query failed!")
|
||||
server_print(" --> Query failed!")
|
||||
}
|
||||
server_print("Error code: %d (Message: ^"%s^")", errnum, error)
|
||||
server_print(" --> Error code: %d (Message: ^"%s^")", errnum, error)
|
||||
|
||||
new querystring[1024]
|
||||
SQL_GetQueryString(query, querystring, 1023)
|
||||
server_print(" --> Original query: %s", querystring)
|
||||
} else {
|
||||
PrintQueryData(query)
|
||||
}
|
||||
|
Reference in New Issue
Block a user