Normalize all the line endings
This commit is contained in:
parent
afc3cac54d
commit
48d6a3354a
|
@ -90,9 +90,9 @@ void CTaskMngr::CTask::changeBase(float fNewBase)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTaskMngr::CTask::resetNextExecTime(float fCurrentTime)
|
void CTaskMngr::CTask::resetNextExecTime(float fCurrentTime)
|
||||||
{
|
{
|
||||||
// If we're here while we're executing we would add m_fBase twice
|
// If we're here while we're executing we would add m_fBase twice
|
||||||
if (!m_bInExecute)
|
if (!m_bInExecute)
|
||||||
m_fNextExecTime = fCurrentTime + m_fBase;
|
m_fNextExecTime = fCurrentTime + m_fBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,208 +6,208 @@
|
||||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#ifndef DATASTRUCTS_H
|
#ifndef DATASTRUCTS_H
|
||||||
#define DATASTRUCTS_H
|
#define DATASTRUCTS_H
|
||||||
|
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
|
|
||||||
class CellArray
|
class CellArray
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CellArray(size_t blocksize, size_t basesize = 0) : m_Data(NULL), m_BlockSize(blocksize), m_AllocSize(0), m_BaseSize(basesize > 0 ? basesize : 8), m_Size(0)
|
CellArray(size_t blocksize, size_t basesize = 0) : m_Data(NULL), m_BlockSize(blocksize), m_AllocSize(0), m_BaseSize(basesize > 0 ? basesize : 8), m_Size(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~CellArray()
|
~CellArray()
|
||||||
{
|
{
|
||||||
free(m_Data);
|
free(m_Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size() const
|
size_t size() const
|
||||||
{
|
{
|
||||||
return m_Size;
|
return m_Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell *push()
|
cell *push()
|
||||||
{
|
{
|
||||||
if (!GrowIfNeeded(1))
|
if (!GrowIfNeeded(1))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cell *arr = &m_Data[m_Size * m_BlockSize];
|
cell *arr = &m_Data[m_Size * m_BlockSize];
|
||||||
m_Size++;
|
m_Size++;
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell *at(size_t b) const
|
cell *at(size_t b) const
|
||||||
{
|
{
|
||||||
return &m_Data[b * m_BlockSize];
|
return &m_Data[b * m_BlockSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t blocksize() const
|
size_t blocksize() const
|
||||||
{
|
{
|
||||||
return m_BlockSize;
|
return m_BlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
m_Size = 0;
|
m_Size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool swap(size_t item1, size_t item2)
|
bool swap(size_t item1, size_t item2)
|
||||||
{
|
{
|
||||||
/* Make sure there is extra space available */
|
/* Make sure there is extra space available */
|
||||||
if (!GrowIfNeeded(1))
|
if (!GrowIfNeeded(1))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell *pri = at(item1);
|
cell *pri = at(item1);
|
||||||
cell *alt = at(item2);
|
cell *alt = at(item2);
|
||||||
|
|
||||||
/* Get our temporary array 1 after the limit */
|
/* Get our temporary array 1 after the limit */
|
||||||
cell *temp = &m_Data[m_Size * m_BlockSize];
|
cell *temp = &m_Data[m_Size * m_BlockSize];
|
||||||
|
|
||||||
memcpy(temp, pri, sizeof(cell)* m_BlockSize);
|
memcpy(temp, pri, sizeof(cell)* m_BlockSize);
|
||||||
memcpy(pri, alt, sizeof(cell)* m_BlockSize);
|
memcpy(pri, alt, sizeof(cell)* m_BlockSize);
|
||||||
memcpy(alt, temp, sizeof(cell)* m_BlockSize);
|
memcpy(alt, temp, sizeof(cell)* m_BlockSize);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove(size_t index)
|
void remove(size_t index)
|
||||||
{
|
{
|
||||||
/* If we're at the end, take the easy way out */
|
/* If we're at the end, take the easy way out */
|
||||||
if (index == m_Size - 1)
|
if (index == m_Size - 1)
|
||||||
{
|
{
|
||||||
m_Size--;
|
m_Size--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, it's time to move stuff! */
|
/* Otherwise, it's time to move stuff! */
|
||||||
size_t remaining_indexes = (m_Size - 1) - index;
|
size_t remaining_indexes = (m_Size - 1) - index;
|
||||||
cell *src = at(index + 1);
|
cell *src = at(index + 1);
|
||||||
cell *dest = at(index);
|
cell *dest = at(index);
|
||||||
memmove(dest, src, sizeof(cell)* m_BlockSize * remaining_indexes);
|
memmove(dest, src, sizeof(cell)* m_BlockSize * remaining_indexes);
|
||||||
|
|
||||||
m_Size--;
|
m_Size--;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell *insert_at(size_t index)
|
cell *insert_at(size_t index)
|
||||||
{
|
{
|
||||||
/* Make sure it'll fit */
|
/* Make sure it'll fit */
|
||||||
if (!GrowIfNeeded(1))
|
if (!GrowIfNeeded(1))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move everything up */
|
/* move everything up */
|
||||||
cell *src = at(index);
|
cell *src = at(index);
|
||||||
cell *dst = at(index + 1);
|
cell *dst = at(index + 1);
|
||||||
memmove(dst, src, sizeof(cell)* m_BlockSize * (m_Size - index));
|
memmove(dst, src, sizeof(cell)* m_BlockSize * (m_Size - index));
|
||||||
|
|
||||||
m_Size++;
|
m_Size++;
|
||||||
|
|
||||||
return src;
|
return src;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool resize(size_t count)
|
bool resize(size_t count)
|
||||||
{
|
{
|
||||||
if (count <= m_Size)
|
if (count <= m_Size)
|
||||||
{
|
{
|
||||||
m_Size = count;
|
m_Size = count;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GrowIfNeeded(count - m_Size))
|
if (!GrowIfNeeded(count - m_Size))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Size = count;
|
m_Size = count;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CellArray *clone()
|
CellArray *clone()
|
||||||
{
|
{
|
||||||
CellArray *array = new CellArray(m_BlockSize);
|
CellArray *array = new CellArray(m_BlockSize);
|
||||||
array->m_AllocSize = m_AllocSize;
|
array->m_AllocSize = m_AllocSize;
|
||||||
array->m_Size = m_Size;
|
array->m_Size = m_Size;
|
||||||
array->m_Data = (cell *)malloc(sizeof(cell)* m_BlockSize * m_AllocSize);
|
array->m_Data = (cell *)malloc(sizeof(cell)* m_BlockSize * m_AllocSize);
|
||||||
memcpy(array->m_Data, m_Data, sizeof(cell)* m_BlockSize * m_Size);
|
memcpy(array->m_Data, m_Data, sizeof(cell)* m_BlockSize * m_Size);
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell *base()
|
cell *base()
|
||||||
{
|
{
|
||||||
return m_Data;
|
return m_Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t mem_usage()
|
size_t mem_usage()
|
||||||
{
|
{
|
||||||
return m_AllocSize * m_BlockSize * sizeof(cell);
|
return m_AllocSize * m_BlockSize * sizeof(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool GrowIfNeeded(size_t count)
|
bool GrowIfNeeded(size_t count)
|
||||||
{
|
{
|
||||||
/* Shortcut out if we can store this */
|
/* Shortcut out if we can store this */
|
||||||
if (m_Size + count <= m_AllocSize)
|
if (m_Size + count <= m_AllocSize)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/* Set a base allocation size of 8 items */
|
/* Set a base allocation size of 8 items */
|
||||||
if (!m_AllocSize)
|
if (!m_AllocSize)
|
||||||
{
|
{
|
||||||
m_AllocSize = m_BaseSize;
|
m_AllocSize = m_BaseSize;
|
||||||
}
|
}
|
||||||
/* If it's not enough, keep doubling */
|
/* If it's not enough, keep doubling */
|
||||||
while (m_Size + count > m_AllocSize)
|
while (m_Size + count > m_AllocSize)
|
||||||
{
|
{
|
||||||
m_AllocSize *= 2;
|
m_AllocSize *= 2;
|
||||||
}
|
}
|
||||||
/* finally, allocate the new block */
|
/* finally, allocate the new block */
|
||||||
if (m_Data)
|
if (m_Data)
|
||||||
{
|
{
|
||||||
m_Data = (cell *)realloc(m_Data, sizeof(cell)* m_BlockSize * m_AllocSize);
|
m_Data = (cell *)realloc(m_Data, sizeof(cell)* m_BlockSize * m_AllocSize);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_Data = (cell *)malloc(sizeof(cell)* m_BlockSize * m_AllocSize);
|
m_Data = (cell *)malloc(sizeof(cell)* m_BlockSize * m_AllocSize);
|
||||||
}
|
}
|
||||||
return (m_Data != NULL);
|
return (m_Data != NULL);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
cell *m_Data;
|
cell *m_Data;
|
||||||
size_t m_BlockSize;
|
size_t m_BlockSize;
|
||||||
size_t m_AllocSize;
|
size_t m_AllocSize;
|
||||||
size_t m_BaseSize;
|
size_t m_BaseSize;
|
||||||
size_t m_Size;
|
size_t m_Size;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ke::Vector<CellArray*> VectorHolder;
|
extern ke::Vector<CellArray*> VectorHolder;
|
||||||
|
|
||||||
|
|
||||||
inline CellArray* HandleToVector(AMX* amx, int handle)
|
inline CellArray* HandleToVector(AMX* amx, int handle)
|
||||||
{
|
{
|
||||||
if (handle <= 0 || handle > (int)VectorHolder.length())
|
if (handle <= 0 || handle > (int)VectorHolder.length())
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", handle);
|
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", handle);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CellArray* ret = VectorHolder[handle - 1];
|
CellArray* ret = VectorHolder[handle - 1];
|
||||||
|
|
||||||
if (ret == NULL)
|
if (ret == NULL)
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", handle);
|
LogError(amx, AMX_ERR_NATIVE, "Invalid array handle provided (%d)", handle);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,11 +52,11 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FileTimeType
|
enum FileTimeType
|
||||||
{
|
{
|
||||||
FileTime_LastAccess = 0, /* Last access (not available on FAT) */
|
FileTime_LastAccess = 0, /* Last access (not available on FAT) */
|
||||||
FileTime_Created = 1, /* Creation (not available on FAT) */
|
FileTime_Created = 1, /* Creation (not available on FAT) */
|
||||||
FileTime_LastChange = 2, /* Last modification */
|
FileTime_LastChange = 2, /* Last modification */
|
||||||
};
|
};
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL read_dir(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL read_dir(AMX *amx, cell *params)
|
||||||
|
@ -855,26 +855,26 @@ static cell AMX_NATIVE_CALL GetFileTime(AMX *amx, cell *params)
|
||||||
char path[256];
|
char path[256];
|
||||||
build_pathname_r(path, sizeof(path), "%s", file);
|
build_pathname_r(path, sizeof(path), "%s", file);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
struct _stat s;
|
struct _stat s;
|
||||||
if (_stat(path, &s) != 0)
|
if (_stat(path, &s) != 0)
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
struct stat s;
|
struct stat s;
|
||||||
if (stat(path, &s) != 0)
|
if (stat(path, &s) != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t time_val = -1;
|
time_t time_val = -1;
|
||||||
|
|
||||||
switch( params[2] )
|
switch( params[2] )
|
||||||
{
|
{
|
||||||
case FileTime_LastAccess : time_val = s.st_atime; break;
|
case FileTime_LastAccess : time_val = s.st_atime; break;
|
||||||
case FileTime_Created : time_val = s.st_ctime; break;
|
case FileTime_Created : time_val = s.st_ctime; break;
|
||||||
case FileTime_LastChange : time_val = s.st_mtime; break;
|
case FileTime_LastChange : time_val = s.st_mtime; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (cell)time_val;
|
return (cell)time_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,14 +58,14 @@ void validate_menu_text(char *str)
|
||||||
*(str-offs) = '\0';
|
*(str-offs) = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu *get_menu_by_id(int id)
|
Menu *get_menu_by_id(int id)
|
||||||
{
|
{
|
||||||
if (id < 0 || size_t(id) >= g_NewMenus.size() || !g_NewMenus[id])
|
if (id < 0 || size_t(id) >= g_NewMenus.size() || !g_NewMenus[id])
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return g_NewMenus[id];
|
return g_NewMenus[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu::Menu(const char *title, AMX *amx, int fid) : m_Title(title), m_ItemColor("\\r"),
|
Menu::Menu(const char *title, AMX *amx, int fid) : m_Title(title), m_ItemColor("\\r"),
|
||||||
|
@ -311,11 +311,11 @@ bool Menu::Display(int player, page_t page)
|
||||||
void Menu::Close(int player)
|
void Menu::Close(int player)
|
||||||
{
|
{
|
||||||
CPlayer *pPlayer = GET_PLAYER_POINTER_I(player);
|
CPlayer *pPlayer = GET_PLAYER_POINTER_I(player);
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
if (gpGlobals->time > pPlayer->menuexpire)
|
if (gpGlobals->time > pPlayer->menuexpire)
|
||||||
status = MENU_TIMEOUT;
|
status = MENU_TIMEOUT;
|
||||||
else
|
else
|
||||||
status = MENU_EXIT;
|
status = MENU_EXIT;
|
||||||
|
|
||||||
pPlayer->keys = 0;
|
pPlayer->keys = 0;
|
||||||
|
@ -700,40 +700,40 @@ static cell AMX_NATIVE_CALL menu_addtext(AMX *amx, cell *params)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL menu_addblank2(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL menu_addblank2(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
GETMENU(params[1]);
|
GETMENU(params[1]);
|
||||||
|
|
||||||
if (!pMenu->items_per_page && pMenu->GetItemCount() >= 10)
|
if (!pMenu->items_per_page && pMenu->GetItemCount() >= 10)
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "Non-paginated menus are limited to 10 items.");
|
LogError(amx, AMX_ERR_NATIVE, "Non-paginated menus are limited to 10 items.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
menuitem *pItem = pMenu->AddItem("", "", 0);
|
menuitem *pItem = pMenu->AddItem("", "", 0);
|
||||||
pItem->isBlank = true;
|
pItem->isBlank = true;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL menu_addtext2(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL menu_addtext2(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
GETMENU(params[1]);
|
GETMENU(params[1]);
|
||||||
|
|
||||||
if (!pMenu->items_per_page && pMenu->GetItemCount() >= 10)
|
if (!pMenu->items_per_page && pMenu->GetItemCount() >= 10)
|
||||||
{
|
{
|
||||||
LogError(amx, AMX_ERR_NATIVE, "Non-paginated menus are limited to 10 items.");
|
LogError(amx, AMX_ERR_NATIVE, "Non-paginated menus are limited to 10 items.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = get_amxstring(amx, params[2], 0, len);
|
name = get_amxstring(amx, params[2], 0, len);
|
||||||
validate_menu_text(name);
|
validate_menu_text(name);
|
||||||
|
|
||||||
menuitem *pItem = pMenu->AddItem(name, "", 0);
|
menuitem *pItem = pMenu->AddItem(name, "", 0);
|
||||||
pItem->isBlank = true;
|
pItem->isBlank = true;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,7 +805,7 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu *pOther = g_NewMenus[menu];
|
Menu *pOther = g_NewMenus[menu];
|
||||||
pOther->Close(pPlayer->index);
|
pOther->Close(pPlayer->index);
|
||||||
|
|
||||||
/* Infinite loop counter */
|
/* Infinite loop counter */
|
||||||
|
@ -822,7 +822,7 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
|
||||||
|
|
||||||
if (time < 0)
|
if (time < 0)
|
||||||
pPlayer->menuexpire = INFINITE;
|
pPlayer->menuexpire = INFINITE;
|
||||||
else
|
else
|
||||||
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
|
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
|
||||||
|
|
||||||
return pMenu->Display(player, page);
|
return pMenu->Display(player, page);
|
||||||
|
@ -1082,7 +1082,7 @@ static cell AMX_NATIVE_CALL menu_destroy(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
player = GET_PLAYER_POINTER_I(i);
|
player = GET_PLAYER_POINTER_I(i);
|
||||||
if (player->newmenu == pMenu->thisId)
|
if (player->newmenu == pMenu->thisId)
|
||||||
{
|
{
|
||||||
pMenu->Close(player->index);
|
pMenu->Close(player->index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,42 +7,42 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "nongpl_matches.h"
|
#include "nongpl_matches.h"
|
||||||
|
|
||||||
NONGPL_PLUGIN_T NONGPL_PLUGIN_LIST[] =
|
NONGPL_PLUGIN_T NONGPL_PLUGIN_LIST[] =
|
||||||
{
|
{
|
||||||
{"Live", "CZ Gun Game", "czgungame.amxx"},
|
{"Live", "CZ Gun Game", "czgungame.amxx"},
|
||||||
{"Live", "AMXX Gun Game", "czgungame.amxx"},
|
{"Live", "AMXX Gun Game", "czgungame.amxx"},
|
||||||
{NULL, NULL, NULL},
|
{NULL, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
NONGPL_CVAR_T NONGPL_CVAR_LIST[] =
|
NONGPL_CVAR_T NONGPL_CVAR_LIST[] =
|
||||||
{
|
{
|
||||||
{"gg_mode", 0},
|
{"gg_mode", 0},
|
||||||
{"gg_warmuptimer", 0},
|
{"gg_warmuptimer", 0},
|
||||||
{"gg_ff", 0},
|
{"gg_ff", 0},
|
||||||
{"gg_fflevel", 0},
|
{"gg_fflevel", 0},
|
||||||
{"gg_stats", 0},
|
{"gg_stats", 0},
|
||||||
{"gg_dm", 0},
|
{"gg_dm", 0},
|
||||||
{"gg_turbo", 0},
|
{"gg_turbo", 0},
|
||||||
{"amx_ggreset", 1},
|
{"amx_ggreset", 1},
|
||||||
{"amx_gg", 1},
|
{"amx_gg", 1},
|
||||||
{NULL, 0},
|
{NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool CheckBadConList(const char *cvar, int type)
|
bool CheckBadConList(const char *cvar, int type)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (NONGPL_CVAR_LIST[i].cvar != NULL)
|
while (NONGPL_CVAR_LIST[i].cvar != NULL)
|
||||||
{
|
{
|
||||||
if (NONGPL_CVAR_LIST[i].type == type
|
if (NONGPL_CVAR_LIST[i].type == type
|
||||||
&& strcmp(NONGPL_CVAR_LIST[i].cvar, cvar) == 0)
|
&& strcmp(NONGPL_CVAR_LIST[i].cvar, cvar) == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,25 +6,25 @@
|
||||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#ifndef _INCLUDE_AMXMODX_NONGPL_MATCHES_H_
|
#ifndef _INCLUDE_AMXMODX_NONGPL_MATCHES_H_
|
||||||
#define _INCLUDE_AMXMODX_NONGPL_MATCHES_H_
|
#define _INCLUDE_AMXMODX_NONGPL_MATCHES_H_
|
||||||
|
|
||||||
struct NONGPL_PLUGIN_T
|
struct NONGPL_PLUGIN_T
|
||||||
{
|
{
|
||||||
const char *author;
|
const char *author;
|
||||||
const char *title;
|
const char *title;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NONGPL_CVAR_T
|
struct NONGPL_CVAR_T
|
||||||
{
|
{
|
||||||
const char *cvar;
|
const char *cvar;
|
||||||
int type;
|
int type;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NONGPL_PLUGIN_T NONGPL_PLUGIN_LIST[];
|
extern NONGPL_PLUGIN_T NONGPL_PLUGIN_LIST[];
|
||||||
extern NONGPL_CVAR_T NONGPL_CVAR_LIST[];
|
extern NONGPL_CVAR_T NONGPL_CVAR_LIST[];
|
||||||
extern bool CheckBadConList(const char *cvar, int type);
|
extern bool CheckBadConList(const char *cvar, int type);
|
||||||
|
|
||||||
#endif //_INCLUDE_AMXMODX_NONGPL_MATCHES_H_
|
#endif //_INCLUDE_AMXMODX_NONGPL_MATCHES_H_
|
||||||
|
|
|
@ -75,21 +75,21 @@ int sort_ints_desc(const void *int1, const void *int2)
|
||||||
return (*(int *)int2) - (*(int *)int1);
|
return (*(int *)int2) - (*(int *)int1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sort_random(cell *array, cell size)
|
void sort_random(cell *array, cell size)
|
||||||
{
|
{
|
||||||
srand((unsigned int)time(NULL));
|
srand((unsigned int)time(NULL));
|
||||||
|
|
||||||
for (int i = size-1; i > 0; i--)
|
for (int i = size-1; i > 0; i--)
|
||||||
{
|
{
|
||||||
int n = rand() % (i + 1);
|
int n = rand() % (i + 1);
|
||||||
|
|
||||||
if (array[i] != array[n])
|
if (array[i] != array[n])
|
||||||
{
|
{
|
||||||
array[i] ^= array[n];
|
array[i] ^= array[n];
|
||||||
array[n] ^= array[i];
|
array[n] ^= array[i];
|
||||||
array[i] ^= array[n];
|
array[i] ^= array[n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL SortIntegers(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL SortIntegers(AMX *amx, cell *params)
|
||||||
|
@ -395,92 +395,92 @@ static cell AMX_NATIVE_CALL SortCustom2D(AMX *amx, cell *params)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum SortType
|
enum SortType
|
||||||
{
|
{
|
||||||
Sort_Integer = 0,
|
Sort_Integer = 0,
|
||||||
Sort_Float,
|
Sort_Float,
|
||||||
Sort_String,
|
Sort_String,
|
||||||
};
|
};
|
||||||
|
|
||||||
int sort_adtarray_strings_asc(const void *str1, const void *str2)
|
int sort_adtarray_strings_asc(const void *str1, const void *str2)
|
||||||
{
|
{
|
||||||
return strcmp((char *) str1, (char *) str2);
|
return strcmp((char *) str1, (char *) str2);
|
||||||
}
|
|
||||||
|
|
||||||
int sort_adtarray_strings_desc(const void *str1, const void *str2)
|
|
||||||
{
|
|
||||||
return strcmp((char *) str2, (char *) str1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sort_adt_random(CellArray *cArray)
|
int sort_adtarray_strings_desc(const void *str1, const void *str2)
|
||||||
{
|
{
|
||||||
size_t arraysize = cArray->size();
|
return strcmp((char *) str2, (char *) str1);
|
||||||
|
}
|
||||||
srand((unsigned int)time(NULL));
|
|
||||||
|
void sort_adt_random(CellArray *cArray)
|
||||||
for (int i = arraysize-1; i > 0; i--)
|
{
|
||||||
{
|
size_t arraysize = cArray->size();
|
||||||
int n = rand() % (i + 1);
|
|
||||||
|
srand((unsigned int)time(NULL));
|
||||||
cArray->swap(i, n);
|
|
||||||
}
|
for (int i = arraysize-1; i > 0; i--)
|
||||||
|
{
|
||||||
|
int n = rand() % (i + 1);
|
||||||
|
|
||||||
|
cArray->swap(i, n);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL SortADTArray(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL SortADTArray(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CellArray* vec = HandleToVector(amx, params[1]);
|
CellArray* vec = HandleToVector(amx, params[1]);
|
||||||
|
|
||||||
if (vec == NULL)
|
if (vec == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell order = params[2];
|
cell order = params[2];
|
||||||
|
|
||||||
if (order == Sort_Random)
|
if (order == Sort_Random)
|
||||||
{
|
{
|
||||||
sort_adt_random(vec);
|
sort_adt_random(vec);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell type = params[3];
|
cell type = params[3];
|
||||||
size_t arraysize = vec->size();
|
size_t arraysize = vec->size();
|
||||||
size_t blocksize = vec->blocksize();
|
size_t blocksize = vec->blocksize();
|
||||||
cell *array = vec->base();
|
cell *array = vec->base();
|
||||||
|
|
||||||
if (type == Sort_Integer)
|
if (type == Sort_Integer)
|
||||||
{
|
{
|
||||||
if (order == Sort_Ascending)
|
if (order == Sort_Ascending)
|
||||||
{
|
{
|
||||||
qsort(array, arraysize, blocksize * sizeof(cell), sort_ints_asc);
|
qsort(array, arraysize, blocksize * sizeof(cell), sort_ints_asc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qsort(array, arraysize, blocksize * sizeof(cell), sort_ints_desc);
|
qsort(array, arraysize, blocksize * sizeof(cell), sort_ints_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == Sort_Float)
|
else if (type == Sort_Float)
|
||||||
{
|
{
|
||||||
if (order == Sort_Ascending)
|
if (order == Sort_Ascending)
|
||||||
{
|
{
|
||||||
qsort(array, arraysize, blocksize * sizeof(cell), sort_floats_asc);
|
qsort(array, arraysize, blocksize * sizeof(cell), sort_floats_asc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qsort(array, arraysize, blocksize * sizeof(cell), sort_floats_desc);
|
qsort(array, arraysize, blocksize * sizeof(cell), sort_floats_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type == Sort_String)
|
else if (type == Sort_String)
|
||||||
{
|
{
|
||||||
if (order == Sort_Ascending)
|
if (order == Sort_Ascending)
|
||||||
{
|
{
|
||||||
qsort(array, arraysize, blocksize * sizeof(cell), sort_adtarray_strings_asc);
|
qsort(array, arraysize, blocksize * sizeof(cell), sort_adtarray_strings_asc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qsort(array, arraysize, blocksize * sizeof(cell), sort_adtarray_strings_desc);
|
qsort(array, arraysize, blocksize * sizeof(cell), sort_adtarray_strings_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
4794
configs/hamdata.ini
4794
configs/hamdata.ini
File diff suppressed because it is too large
Load Diff
|
@ -11,375 +11,375 @@
|
||||||
// Counter-Strike Module
|
// Counter-Strike Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "CstrikeDatas.h"
|
#include "CstrikeDatas.h"
|
||||||
#include "CstrikeUtils.h"
|
#include "CstrikeUtils.h"
|
||||||
#include "CDetour/detours.h"
|
#include "CDetour/detours.h"
|
||||||
#include <sm_stringhashmap.h>
|
#include <sm_stringhashmap.h>
|
||||||
|
|
||||||
void CtrlDetours_ClientCommand(bool set);
|
void CtrlDetours_ClientCommand(bool set);
|
||||||
void CtrlDetours_BuyCommands(bool set);
|
void CtrlDetours_BuyCommands(bool set);
|
||||||
|
|
||||||
int ForwardInternalCommand = -1;
|
int ForwardInternalCommand = -1;
|
||||||
int ForwardOnBuy = -1;
|
int ForwardOnBuy = -1;
|
||||||
int ForwardOnBuyAttempt = -1;
|
int ForwardOnBuyAttempt = -1;
|
||||||
|
|
||||||
int *UseBotArgs = NULL;
|
int *UseBotArgs = NULL;
|
||||||
const char **BotArgs = NULL;
|
const char **BotArgs = NULL;
|
||||||
|
|
||||||
CDetour *ClientCommandDetour = NULL;
|
CDetour *ClientCommandDetour = NULL;
|
||||||
CDetour *GiveShieldDetour = NULL;
|
CDetour *GiveShieldDetour = NULL;
|
||||||
CDetour *GiveNamedItemDetour = NULL;
|
CDetour *GiveNamedItemDetour = NULL;
|
||||||
CDetour *AddAccountDetour = NULL;
|
CDetour *AddAccountDetour = NULL;
|
||||||
|
|
||||||
int CurrentItemId = 0;
|
int CurrentItemId = 0;
|
||||||
StringHashMap<int> ItemAliasList;
|
StringHashMap<int> ItemAliasList;
|
||||||
|
|
||||||
extern enginefuncs_t *g_pengfuncsTable;
|
extern enginefuncs_t *g_pengfuncsTable;
|
||||||
|
|
||||||
void InitializeHacks()
|
void InitializeHacks()
|
||||||
{
|
{
|
||||||
#if defined AMD64
|
#if defined AMD64
|
||||||
#error UNSUPPORTED
|
#error UNSUPPORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CtrlDetours_ClientCommand(true);
|
CtrlDetours_ClientCommand(true);
|
||||||
CtrlDetours_BuyCommands(true);
|
CtrlDetours_BuyCommands(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShutdownHacks()
|
void ShutdownHacks()
|
||||||
{
|
{
|
||||||
CtrlDetours_ClientCommand(false);
|
CtrlDetours_ClientCommand(false);
|
||||||
CtrlDetours_BuyCommands(false);
|
CtrlDetours_BuyCommands(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef CMD_ARGV
|
#undef CMD_ARGV
|
||||||
|
|
||||||
const char *CMD_ARGV(int i)
|
const char *CMD_ARGV(int i)
|
||||||
{
|
{
|
||||||
if (*UseBotArgs)
|
if (*UseBotArgs)
|
||||||
{
|
{
|
||||||
if (i < 4)
|
if (i < 4)
|
||||||
{
|
{
|
||||||
return BotArgs[i];
|
return BotArgs[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_engfuncs.pfnCmd_Argv(i);
|
return g_engfuncs.pfnCmd_Argv(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEmitSound(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch)
|
void OnEmitSound(edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch)
|
||||||
{
|
{
|
||||||
// If shield is blocked with CS_OnBuy, we need to block the pickup sound ("items/gunpickup2.wav")
|
// If shield is blocked with CS_OnBuy, we need to block the pickup sound ("items/gunpickup2.wav")
|
||||||
// as well played right after. Why this sound is not contained in GiveShield()?
|
// as well played right after. Why this sound is not contained in GiveShield()?
|
||||||
|
|
||||||
g_pengfuncsTable->pfnEmitSound = NULL;
|
g_pengfuncsTable->pfnEmitSound = NULL;
|
||||||
|
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DETOUR_DECL_STATIC1(C_ClientCommand, void, edict_t*, pEdict) // void ClientCommand(edict_t *pEntity)
|
DETOUR_DECL_STATIC1(C_ClientCommand, void, edict_t*, pEdict) // void ClientCommand(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
const char *command = CMD_ARGV(0);
|
const char *command = CMD_ARGV(0);
|
||||||
|
|
||||||
// A new command is triggered, reset variable, always.
|
// A new command is triggered, reset variable, always.
|
||||||
CurrentItemId = 0;
|
CurrentItemId = 0;
|
||||||
|
|
||||||
// Purpose is to retrieve an item id based on alias name or selected item from menu,
|
// Purpose is to retrieve an item id based on alias name or selected item from menu,
|
||||||
// to be used in OnBuy* forwards.
|
// to be used in OnBuy* forwards.
|
||||||
if ((ForwardOnBuyAttempt != -1 || ForwardOnBuy != -1) && command && *command)
|
if ((ForwardOnBuyAttempt != -1 || ForwardOnBuy != -1) && command && *command)
|
||||||
{
|
{
|
||||||
int itemId = 0;
|
int itemId = 0;
|
||||||
|
|
||||||
// Handling buy via menu.
|
// Handling buy via menu.
|
||||||
if (!strcmp(command, "menuselect"))
|
if (!strcmp(command, "menuselect"))
|
||||||
{
|
{
|
||||||
int slot = atoi(CMD_ARGV(1));
|
int slot = atoi(CMD_ARGV(1));
|
||||||
|
|
||||||
if (slot > 0 && slot < 9)
|
if (slot > 0 && slot < 9)
|
||||||
{
|
{
|
||||||
static const int menuItemsTe[][9] =
|
static const int menuItemsTe[][9] =
|
||||||
{
|
{
|
||||||
/* Menu_Buy */ { 0, 0, 0, 0, 0, 0, CSI_PRIMAMMO, CSI_SECAMMO, 0 },
|
/* Menu_Buy */ { 0, 0, 0, 0, 0, 0, CSI_PRIMAMMO, CSI_SECAMMO, 0 },
|
||||||
/* Menu_BuyPistol */ { 0, CSI_GLOCK18, CSI_USP, CSI_P228, CSI_DEAGLE, CSI_ELITE, 0, 0, 0 },
|
/* Menu_BuyPistol */ { 0, CSI_GLOCK18, CSI_USP, CSI_P228, CSI_DEAGLE, CSI_ELITE, 0, 0, 0 },
|
||||||
/* Menu_BuyRifle */ { 0, CSI_GALI, CSI_AK47, CSI_SCOUT, CSI_SG552, CSI_AWP, CSI_G3SG1, 0, 0 },
|
/* Menu_BuyRifle */ { 0, CSI_GALI, CSI_AK47, CSI_SCOUT, CSI_SG552, CSI_AWP, CSI_G3SG1, 0, 0 },
|
||||||
/* Menu_BuyMachineGun */ { 0, CSI_M249, 0, 0, 0, 0, 0, 0, 0 },
|
/* Menu_BuyMachineGun */ { 0, CSI_M249, 0, 0, 0, 0, 0, 0, 0 },
|
||||||
/* Menu_BuyShotgun */ { 0, CSI_M3, CSI_XM1014, 0, 0, 0, 0, 0, 0 },
|
/* Menu_BuyShotgun */ { 0, CSI_M3, CSI_XM1014, 0, 0, 0, 0, 0, 0 },
|
||||||
/* Menu_BuySubMachineGun */ { 0, CSI_MAC10, CSI_MP5NAVY, CSI_UMP45, CSI_P90, 0, 0, 0, 0 },
|
/* Menu_BuySubMachineGun */ { 0, CSI_MAC10, CSI_MP5NAVY, CSI_UMP45, CSI_P90, 0, 0, 0, 0 },
|
||||||
/* Menu_BuyItem */ { 0, CSI_VEST, CSI_VESTHELM, CSI_FLASHBANG, CSI_HEGRENADE, CSI_SMOKEGRENADE, CSI_NVGS, 0, 0 }
|
/* Menu_BuyItem */ { 0, CSI_VEST, CSI_VESTHELM, CSI_FLASHBANG, CSI_HEGRENADE, CSI_SMOKEGRENADE, CSI_NVGS, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int menuItemsCt[][9] =
|
static const int menuItemsCt[][9] =
|
||||||
{
|
{
|
||||||
/* Menu_Buy */ { 0, 0, 0, 0, 0, 0, CSI_PRIMAMMO, CSI_SECAMMO, 0 },
|
/* Menu_Buy */ { 0, 0, 0, 0, 0, 0, CSI_PRIMAMMO, CSI_SECAMMO, 0 },
|
||||||
/* Menu_BuyPistol */ { 0, CSI_GLOCK18, CSI_USP, CSI_P228, CSI_DEAGLE, CSI_FIVESEVEN, 0, 0, 0 },
|
/* Menu_BuyPistol */ { 0, CSI_GLOCK18, CSI_USP, CSI_P228, CSI_DEAGLE, CSI_FIVESEVEN, 0, 0, 0 },
|
||||||
/* Menu_BuyRifle */ { 0, CSI_FAMAS, CSI_SCOUT, CSI_M4A1, CSI_AUG, CSI_SG550, CSI_AWP, 0, 0 },
|
/* Menu_BuyRifle */ { 0, CSI_FAMAS, CSI_SCOUT, CSI_M4A1, CSI_AUG, CSI_SG550, CSI_AWP, 0, 0 },
|
||||||
/* Menu_BuyMachineGun */ { 0, CSI_M249, 0, 0, 0, 0, 0, 0, 0 },
|
/* Menu_BuyMachineGun */ { 0, CSI_M249, 0, 0, 0, 0, 0, 0, 0 },
|
||||||
/* Menu_BuyShotgun */ { 0, CSI_M3, CSI_XM1014, 0, 0, 0, 0, 0, 0 },
|
/* Menu_BuyShotgun */ { 0, CSI_M3, CSI_XM1014, 0, 0, 0, 0, 0, 0 },
|
||||||
/* Menu_BuySubMachineGun */ { 0, CSI_TMP, CSI_MP5NAVY, CSI_UMP45, CSI_P90, 0, 0, 0, 0 },
|
/* Menu_BuySubMachineGun */ { 0, CSI_TMP, CSI_MP5NAVY, CSI_UMP45, CSI_P90, 0, 0, 0, 0 },
|
||||||
/* Menu_BuyItem */ { 0, CSI_VEST, CSI_VESTHELM, CSI_FLASHBANG, CSI_HEGRENADE, CSI_SMOKEGRENADE, CSI_NVGS, CSI_DEFUSER, CSI_SHIELDGUN }
|
/* Menu_BuyItem */ { 0, CSI_VEST, CSI_VESTHELM, CSI_FLASHBANG, CSI_HEGRENADE, CSI_SMOKEGRENADE, CSI_NVGS, CSI_DEFUSER, CSI_SHIELDGUN }
|
||||||
};
|
};
|
||||||
|
|
||||||
int menuId = *((int *)pEdict->pvPrivateData + OFFSET_MENU);
|
int menuId = *((int *)pEdict->pvPrivateData + OFFSET_MENU);
|
||||||
if (menuId >= Menu_Buy && menuId <= Menu_BuyItem)
|
if (menuId >= Menu_Buy && menuId <= Menu_BuyItem)
|
||||||
{
|
{
|
||||||
int team = *((int *)pEdict->pvPrivateData + OFFSET_TEAM);
|
int team = *((int *)pEdict->pvPrivateData + OFFSET_TEAM);
|
||||||
switch (team)
|
switch (team)
|
||||||
{
|
{
|
||||||
case TEAM_T: itemId = menuItemsTe[menuId - 4][slot]; break; // -4 because array is zero-based and Menu_Buy* constants starts from 4.
|
case TEAM_T: itemId = menuItemsTe[menuId - 4][slot]; break; // -4 because array is zero-based and Menu_Buy* constants starts from 4.
|
||||||
case TEAM_CT:itemId = menuItemsCt[menuId - 4][slot]; break;
|
case TEAM_CT:itemId = menuItemsCt[menuId - 4][slot]; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemId)
|
if (itemId)
|
||||||
{
|
{
|
||||||
CurrentItemId = itemId;
|
CurrentItemId = itemId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Handling buy via alias
|
else // Handling buy via alias
|
||||||
{
|
{
|
||||||
if (ItemAliasList.retrieve(command, &itemId))
|
if (ItemAliasList.retrieve(command, &itemId))
|
||||||
{
|
{
|
||||||
CurrentItemId = itemId;
|
CurrentItemId = itemId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int client = ENTINDEX(pEdict);
|
int client = ENTINDEX(pEdict);
|
||||||
|
|
||||||
if (ForwardInternalCommand != -1 && *UseBotArgs)
|
if (ForwardInternalCommand != -1 && *UseBotArgs)
|
||||||
{
|
{
|
||||||
const char *args = *BotArgs;
|
const char *args = *BotArgs;
|
||||||
|
|
||||||
if (MF_ExecuteForward(ForwardInternalCommand, static_cast<cell>(client), args) > 0)
|
if (MF_ExecuteForward(ForwardInternalCommand, static_cast<cell>(client), args) > 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ForwardOnBuyAttempt != -1 &&
|
if (ForwardOnBuyAttempt != -1 &&
|
||||||
CurrentItemId &&
|
CurrentItemId &&
|
||||||
MF_IsPlayerAlive(client) &&
|
MF_IsPlayerAlive(client) &&
|
||||||
MF_ExecuteForward(ForwardOnBuyAttempt, static_cast<cell>(client), static_cast<cell>(CurrentItemId)) > 0)
|
MF_ExecuteForward(ForwardOnBuyAttempt, static_cast<cell>(client), static_cast<cell>(CurrentItemId)) > 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DETOUR_STATIC_CALL(C_ClientCommand)(pEdict);
|
DETOUR_STATIC_CALL(C_ClientCommand)(pEdict);
|
||||||
}
|
}
|
||||||
|
|
||||||
DETOUR_DECL_MEMBER1(GiveNamedItem, void, const char*, pszName) // void CBasePlayer::GiveNamedItem(const char *pszName)
|
DETOUR_DECL_MEMBER1(GiveNamedItem, void, const char*, pszName) // void CBasePlayer::GiveNamedItem(const char *pszName)
|
||||||
{
|
{
|
||||||
// If the current item id is not null, this means player has triggers a buy command.
|
// If the current item id is not null, this means player has triggers a buy command.
|
||||||
if (CurrentItemId)
|
if (CurrentItemId)
|
||||||
{
|
{
|
||||||
int client = PrivateToIndex(this);
|
int client = PrivateToIndex(this);
|
||||||
|
|
||||||
if (MF_IsPlayerAlive(client) && MF_ExecuteForward(ForwardOnBuy, static_cast<cell>(client), static_cast<cell>(CurrentItemId)) > 0)
|
if (MF_IsPlayerAlive(client) && MF_ExecuteForward(ForwardOnBuy, static_cast<cell>(client), static_cast<cell>(CurrentItemId)) > 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// From here, forward is not blocked, resetting this
|
// From here, forward is not blocked, resetting this
|
||||||
// to ignore code in AddAccount which is called right after.
|
// to ignore code in AddAccount which is called right after.
|
||||||
CurrentItemId = 0;
|
CurrentItemId = 0;
|
||||||
|
|
||||||
// Give me my item!
|
// Give me my item!
|
||||||
DETOUR_MEMBER_CALL(GiveNamedItem)(pszName);
|
DETOUR_MEMBER_CALL(GiveNamedItem)(pszName);
|
||||||
}
|
}
|
||||||
|
|
||||||
DETOUR_DECL_MEMBER1(GiveShield, void, bool, bRetire) // void CBasePlayer::GiveShield(bool bRetire)
|
DETOUR_DECL_MEMBER1(GiveShield, void, bool, bRetire) // void CBasePlayer::GiveShield(bool bRetire)
|
||||||
{
|
{
|
||||||
// Special case for shield. Game doesn't use GiveNamedItem() to give a shield.
|
// Special case for shield. Game doesn't use GiveNamedItem() to give a shield.
|
||||||
if (CurrentItemId == CSI_SHIELDGUN)
|
if (CurrentItemId == CSI_SHIELDGUN)
|
||||||
{
|
{
|
||||||
int client = PrivateToIndex(this);
|
int client = PrivateToIndex(this);
|
||||||
|
|
||||||
if (MF_IsPlayerAlive(client) && MF_ExecuteForward(ForwardOnBuy, static_cast<cell>(client), CSI_SHIELDGUN) > 0)
|
if (MF_IsPlayerAlive(client) && MF_ExecuteForward(ForwardOnBuy, static_cast<cell>(client), CSI_SHIELDGUN) > 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// From here, forward is not blocked, resetting this
|
// From here, forward is not blocked, resetting this
|
||||||
// to ignore code in AddAccount which is called right after.
|
// to ignore code in AddAccount which is called right after.
|
||||||
CurrentItemId = 0;
|
CurrentItemId = 0;
|
||||||
|
|
||||||
// Give me my shield!
|
// Give me my shield!
|
||||||
DETOUR_MEMBER_CALL(GiveShield)(bRetire);
|
DETOUR_MEMBER_CALL(GiveShield)(bRetire);
|
||||||
}
|
}
|
||||||
|
|
||||||
DETOUR_DECL_MEMBER2(AddAccount, void, int, amount, bool, bTrackChange) // void CBasePlayer::AddAccount(int amount, bool bTrackChange)
|
DETOUR_DECL_MEMBER2(AddAccount, void, int, amount, bool, bTrackChange) // void CBasePlayer::AddAccount(int amount, bool bTrackChange)
|
||||||
{
|
{
|
||||||
// No buy command or forward not blocked.
|
// No buy command or forward not blocked.
|
||||||
// Resuming game flow.
|
// Resuming game flow.
|
||||||
if (!CurrentItemId)
|
if (!CurrentItemId)
|
||||||
{
|
{
|
||||||
DETOUR_MEMBER_CALL(AddAccount)(amount, bTrackChange);
|
DETOUR_MEMBER_CALL(AddAccount)(amount, bTrackChange);
|
||||||
}
|
}
|
||||||
// Shield is blocked.
|
// Shield is blocked.
|
||||||
// We need to hook EmitSound to block pickup sound played right after.
|
// We need to hook EmitSound to block pickup sound played right after.
|
||||||
else if (CurrentItemId == CSI_SHIELDGUN)
|
else if (CurrentItemId == CSI_SHIELDGUN)
|
||||||
{
|
{
|
||||||
g_pengfuncsTable->pfnEmitSound = OnEmitSound;
|
g_pengfuncsTable->pfnEmitSound = OnEmitSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's reset this right away to avoid issues.
|
// Let's reset this right away to avoid issues.
|
||||||
CurrentItemId = 0;
|
CurrentItemId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CtrlDetours_ClientCommand(bool set)
|
void CtrlDetours_ClientCommand(bool set)
|
||||||
{
|
{
|
||||||
if (set)
|
if (set)
|
||||||
{
|
{
|
||||||
void *target = (void *)MDLL_ClientCommand;
|
void *target = (void *)MDLL_ClientCommand;
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
|
||||||
UseBotArgs = *(int **)((unsigned char *)target + CS_CLICMD_OFFS_USEBOTARGS);
|
UseBotArgs = *(int **)((unsigned char *)target + CS_CLICMD_OFFS_USEBOTARGS);
|
||||||
BotArgs = (const char **)*(const char **)((unsigned char *)target + CS_CLICMD_OFFS_BOTARGS);
|
BotArgs = (const char **)*(const char **)((unsigned char *)target + CS_CLICMD_OFFS_BOTARGS);
|
||||||
|
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
|
|
||||||
UseBotArgs = (int *)UTIL_FindAddressFromEntry(CS_IDENT_USEBOTARGS, CS_IDENT_HIDDEN_STATE);
|
UseBotArgs = (int *)UTIL_FindAddressFromEntry(CS_IDENT_USEBOTARGS, CS_IDENT_HIDDEN_STATE);
|
||||||
BotArgs = (const char **)UTIL_FindAddressFromEntry(CS_IDENT_BOTARGS, CS_IDENT_HIDDEN_STATE);
|
BotArgs = (const char **)UTIL_FindAddressFromEntry(CS_IDENT_BOTARGS, CS_IDENT_HIDDEN_STATE);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
ClientCommandDetour = DETOUR_CREATE_STATIC_FIXED(C_ClientCommand, target);
|
ClientCommandDetour = DETOUR_CREATE_STATIC_FIXED(C_ClientCommand, target);
|
||||||
|
|
||||||
if (!ClientCommandDetour)
|
if (!ClientCommandDetour)
|
||||||
{
|
{
|
||||||
MF_Log("ClientCommand is not available - forward client_command has been disabled");
|
MF_Log("ClientCommand is not available - forward client_command has been disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ClientCommandDetour)
|
if (ClientCommandDetour)
|
||||||
ClientCommandDetour->Destroy();
|
ClientCommandDetour->Destroy();
|
||||||
|
|
||||||
ItemAliasList.clear();
|
ItemAliasList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleDetour_ClientCommands(bool enable)
|
void ToggleDetour_ClientCommands(bool enable)
|
||||||
{
|
{
|
||||||
if (ClientCommandDetour)
|
if (ClientCommandDetour)
|
||||||
(enable) ? ClientCommandDetour->EnableDetour() : ClientCommandDetour->DisableDetour();
|
(enable) ? ClientCommandDetour->EnableDetour() : ClientCommandDetour->DisableDetour();
|
||||||
|
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
// Build the item alias list.
|
// Build the item alias list.
|
||||||
// Used in ClientCommand to check and get fastly item id from alias name.
|
// Used in ClientCommand to check and get fastly item id from alias name.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
const char *alias;
|
const char *alias;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
} itemBuyAliasInfo;
|
} itemBuyAliasInfo;
|
||||||
|
|
||||||
itemBuyAliasInfo aliasToId[] =
|
itemBuyAliasInfo aliasToId[] =
|
||||||
{
|
{
|
||||||
{ "p228" , CSI_P228 }, { "228compact" , CSI_P228 },
|
{ "p228" , CSI_P228 }, { "228compact" , CSI_P228 },
|
||||||
{ "scout" , CSI_SCOUT }, { "hegren" , CSI_HEGRENADE },
|
{ "scout" , CSI_SCOUT }, { "hegren" , CSI_HEGRENADE },
|
||||||
{ "xm1014" , CSI_XM1014 }, { "autoshotgun", CSI_XM1014 },
|
{ "xm1014" , CSI_XM1014 }, { "autoshotgun", CSI_XM1014 },
|
||||||
{ "mac10" , CSI_MAC10 }, { "aug" , CSI_AUG },
|
{ "mac10" , CSI_MAC10 }, { "aug" , CSI_AUG },
|
||||||
{ "bullpup" , CSI_AUG }, { "sgren" , CSI_SMOKEGRENADE },
|
{ "bullpup" , CSI_AUG }, { "sgren" , CSI_SMOKEGRENADE },
|
||||||
{ "elites" , CSI_ELITE }, { "fn57" , CSI_FIVESEVEN },
|
{ "elites" , CSI_ELITE }, { "fn57" , CSI_FIVESEVEN },
|
||||||
{ "fiveseven" , CSI_FIVESEVEN }, { "ump45" , CSI_UMP45 },
|
{ "fiveseven" , CSI_FIVESEVEN }, { "ump45" , CSI_UMP45 },
|
||||||
{ "sg550" , CSI_SG550 }, { "krieg550" , CSI_SG550 },
|
{ "sg550" , CSI_SG550 }, { "krieg550" , CSI_SG550 },
|
||||||
{ "galil" , CSI_GALI }, { "defender" , CSI_GALI },
|
{ "galil" , CSI_GALI }, { "defender" , CSI_GALI },
|
||||||
{ "famas" , CSI_FAMAS }, { "clarion" , CSI_FAMAS },
|
{ "famas" , CSI_FAMAS }, { "clarion" , CSI_FAMAS },
|
||||||
{ "usp" , CSI_USP }, { "km45" , CSI_USP },
|
{ "usp" , CSI_USP }, { "km45" , CSI_USP },
|
||||||
{ "glock" , CSI_GLOCK18 }, { "9x19mm" , CSI_GLOCK18 },
|
{ "glock" , CSI_GLOCK18 }, { "9x19mm" , CSI_GLOCK18 },
|
||||||
{ "awp" , CSI_AWP }, { "magnum" , CSI_AWP },
|
{ "awp" , CSI_AWP }, { "magnum" , CSI_AWP },
|
||||||
{ "mp5" , CSI_MP5NAVY }, { "smg" , CSI_MP5NAVY },
|
{ "mp5" , CSI_MP5NAVY }, { "smg" , CSI_MP5NAVY },
|
||||||
{ "m249" , CSI_M249 }, { "m3" , CSI_M3 },
|
{ "m249" , CSI_M249 }, { "m3" , CSI_M3 },
|
||||||
{ "12gauge" , CSI_M3 }, { "m4a1" , CSI_M4A1 },
|
{ "12gauge" , CSI_M3 }, { "m4a1" , CSI_M4A1 },
|
||||||
{ "tmp" , CSI_TMP }, { "mp" , CSI_TMP },
|
{ "tmp" , CSI_TMP }, { "mp" , CSI_TMP },
|
||||||
{ "g3sg1" , CSI_G3SG1 }, { "d3au1" , CSI_G3SG1 },
|
{ "g3sg1" , CSI_G3SG1 }, { "d3au1" , CSI_G3SG1 },
|
||||||
{ "flash" , CSI_FLASHBANG }, { "deagle" , CSI_DEAGLE },
|
{ "flash" , CSI_FLASHBANG }, { "deagle" , CSI_DEAGLE },
|
||||||
{ "nighthawk" , CSI_DEAGLE }, { "sg552" , CSI_SG552 },
|
{ "nighthawk" , CSI_DEAGLE }, { "sg552" , CSI_SG552 },
|
||||||
{ "krieg552" , CSI_SG552 }, { "ak47" , CSI_AK47 },
|
{ "krieg552" , CSI_SG552 }, { "ak47" , CSI_AK47 },
|
||||||
{ "cv47" , CSI_AK47 }, { "p90" , CSI_P90 },
|
{ "cv47" , CSI_AK47 }, { "p90" , CSI_P90 },
|
||||||
{ "c90" , CSI_P90 }, { "vest" , CSI_VEST },
|
{ "c90" , CSI_P90 }, { "vest" , CSI_VEST },
|
||||||
{ "vesthelm" , CSI_VESTHELM }, { "defuser" , CSI_DEFUSER },
|
{ "vesthelm" , CSI_VESTHELM }, { "defuser" , CSI_DEFUSER },
|
||||||
{ "nvgs" , CSI_NVGS }, { "shield" , CSI_SHIELDGUN },
|
{ "nvgs" , CSI_NVGS }, { "shield" , CSI_SHIELDGUN },
|
||||||
{ "buyammo1" , CSI_PRIMAMMO }, { "primammo" , CSI_PRIMAMMO },
|
{ "buyammo1" , CSI_PRIMAMMO }, { "primammo" , CSI_PRIMAMMO },
|
||||||
{ "buyammo2" , CSI_SECAMMO }, { "secammo" , CSI_SECAMMO },
|
{ "buyammo2" , CSI_SECAMMO }, { "secammo" , CSI_SECAMMO },
|
||||||
{ NULL , 0 }
|
{ NULL , 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t i = 0; aliasToId[i].alias != NULL; ++i)
|
for (size_t i = 0; aliasToId[i].alias != NULL; ++i)
|
||||||
{
|
{
|
||||||
ItemAliasList.insert(aliasToId[i].alias, aliasToId[i].id);
|
ItemAliasList.insert(aliasToId[i].alias, aliasToId[i].id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemAliasList.clear();
|
ItemAliasList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CtrlDetours_BuyCommands(bool set)
|
void CtrlDetours_BuyCommands(bool set)
|
||||||
{
|
{
|
||||||
if (set)
|
if (set)
|
||||||
{
|
{
|
||||||
void *giveShieldAddress = UTIL_FindAddressFromEntry(CS_IDENT_GIVENSHIELD , CS_IDENT_HIDDEN_STATE);
|
void *giveShieldAddress = UTIL_FindAddressFromEntry(CS_IDENT_GIVENSHIELD , CS_IDENT_HIDDEN_STATE);
|
||||||
void *giveNamedItemAddress = UTIL_FindAddressFromEntry(CS_IDENT_GIVENAMEDITEM, CS_IDENT_HIDDEN_STATE);
|
void *giveNamedItemAddress = UTIL_FindAddressFromEntry(CS_IDENT_GIVENAMEDITEM, CS_IDENT_HIDDEN_STATE);
|
||||||
void *addAccountAddress = UTIL_FindAddressFromEntry(CS_IDENT_ADDACCOUNT , CS_IDENT_HIDDEN_STATE);
|
void *addAccountAddress = UTIL_FindAddressFromEntry(CS_IDENT_ADDACCOUNT , CS_IDENT_HIDDEN_STATE);
|
||||||
|
|
||||||
GiveShieldDetour = DETOUR_CREATE_MEMBER_FIXED(GiveShield, giveShieldAddress);
|
GiveShieldDetour = DETOUR_CREATE_MEMBER_FIXED(GiveShield, giveShieldAddress);
|
||||||
GiveNamedItemDetour = DETOUR_CREATE_MEMBER_FIXED(GiveNamedItem, giveNamedItemAddress);
|
GiveNamedItemDetour = DETOUR_CREATE_MEMBER_FIXED(GiveNamedItem, giveNamedItemAddress);
|
||||||
AddAccountDetour = DETOUR_CREATE_MEMBER_FIXED(AddAccount, addAccountAddress);
|
AddAccountDetour = DETOUR_CREATE_MEMBER_FIXED(AddAccount, addAccountAddress);
|
||||||
|
|
||||||
if (!GiveShieldDetour || !GiveNamedItemDetour || !AddAccountDetour)
|
if (!GiveShieldDetour || !GiveNamedItemDetour || !AddAccountDetour)
|
||||||
{
|
{
|
||||||
if (!GiveShieldDetour)
|
if (!GiveShieldDetour)
|
||||||
{
|
{
|
||||||
MF_Log("GiveShield is not available");
|
MF_Log("GiveShield is not available");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GiveNamedItemDetour)
|
if (!GiveNamedItemDetour)
|
||||||
{
|
{
|
||||||
MF_Log("GiveNamedItem is not available");
|
MF_Log("GiveNamedItem is not available");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AddAccountDetour)
|
if (!AddAccountDetour)
|
||||||
{
|
{
|
||||||
MF_Log("AddAccount is not available");
|
MF_Log("AddAccount is not available");
|
||||||
}
|
}
|
||||||
|
|
||||||
MF_Log("Some functions are not available - forward CS_OnBuyAttempt and CS_OnBuy have been disabled");
|
MF_Log("Some functions are not available - forward CS_OnBuyAttempt and CS_OnBuy have been disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GiveShieldDetour)
|
if (GiveShieldDetour)
|
||||||
GiveShieldDetour->Destroy();
|
GiveShieldDetour->Destroy();
|
||||||
|
|
||||||
if (GiveNamedItemDetour)
|
if (GiveNamedItemDetour)
|
||||||
GiveNamedItemDetour->Destroy();
|
GiveNamedItemDetour->Destroy();
|
||||||
|
|
||||||
if (AddAccountDetour)
|
if (AddAccountDetour)
|
||||||
AddAccountDetour->Destroy();
|
AddAccountDetour->Destroy();
|
||||||
|
|
||||||
ItemAliasList.clear();
|
ItemAliasList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleDetour_BuyCommands(bool enable)
|
void ToggleDetour_BuyCommands(bool enable)
|
||||||
{
|
{
|
||||||
if (GiveShieldDetour)
|
if (GiveShieldDetour)
|
||||||
(enable) ? GiveShieldDetour->EnableDetour() : GiveShieldDetour->DisableDetour();
|
(enable) ? GiveShieldDetour->EnableDetour() : GiveShieldDetour->DisableDetour();
|
||||||
|
|
||||||
if (GiveNamedItemDetour)
|
if (GiveNamedItemDetour)
|
||||||
(enable) ? GiveNamedItemDetour->EnableDetour() : GiveNamedItemDetour->DisableDetour();
|
(enable) ? GiveNamedItemDetour->EnableDetour() : GiveNamedItemDetour->DisableDetour();
|
||||||
|
|
||||||
if (AddAccountDetour)
|
if (AddAccountDetour)
|
||||||
(enable) ? AddAccountDetour->EnableDetour() : AddAccountDetour->DisableDetour();
|
(enable) ? AddAccountDetour->EnableDetour() : AddAccountDetour->DisableDetour();
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,10 +153,10 @@ qboolean Voice_SetClientListening(int iReceiver, int iSender, qboolean bListen)
|
||||||
|
|
||||||
int AddToFullPack_Post(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet)
|
int AddToFullPack_Post(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet)
|
||||||
{
|
{
|
||||||
if( player && ent == host && plinfo[ENTINDEX(ent)].iViewType != CAMERA_NONE )
|
if( player && ent == host && plinfo[ENTINDEX(ent)].iViewType != CAMERA_NONE )
|
||||||
{
|
{
|
||||||
state->rendermode = kRenderTransTexture;
|
state->rendermode = kRenderTransTexture;
|
||||||
state->renderamt = 100;
|
state->renderamt = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||||
|
|
|
@ -161,15 +161,15 @@ void CmdStart(const edict_t *player, const struct usercmd_s *_cmd, unsigned int
|
||||||
g_cmd->impulse = 0;
|
g_cmd->impulse = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// client_CmdStart
|
// client_CmdStart
|
||||||
if (CmdStartForward != -1)
|
if (CmdStartForward != -1)
|
||||||
{
|
{
|
||||||
incmd = true;
|
incmd = true;
|
||||||
retVal = MF_ExecuteForward(CmdStartForward, (cell)ENTINDEX(pEntity));
|
retVal = MF_ExecuteForward(CmdStartForward, (cell)ENTINDEX(pEntity));
|
||||||
incmd = false;
|
incmd = false;
|
||||||
|
|
||||||
if (retVal)
|
if (retVal)
|
||||||
RETURN_META(MRES_SUPERCEDE);
|
RETURN_META(MRES_SUPERCEDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
|
|
|
@ -292,97 +292,97 @@ static cell AMX_NATIVE_CALL SetHamParamItemInfo(AMX *amx, cell *params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL GetHamItemInfo(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL GetHamItemInfo(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (params[1] == 0)
|
if (params[1] == 0)
|
||||||
{
|
{
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Null iteminfo handle provided.");
|
MF_LogError(amx, AMX_ERR_NATIVE, "Null iteminfo handle provided.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int type = params[2];
|
int type = params[2];
|
||||||
|
|
||||||
if ((type == ItemInfo_pszAmmo1 || type == ItemInfo_pszAmmo2 || type == ItemInfo_pszName) && (*params / sizeof(cell)) != 4)
|
if ((type == ItemInfo_pszAmmo1 || type == ItemInfo_pszAmmo2 || type == ItemInfo_pszName) && (*params / sizeof(cell)) != 4)
|
||||||
{
|
{
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Bad arg count. Expected %d, got %d.", 4, *params / sizeof(cell));
|
MF_LogError(amx, AMX_ERR_NATIVE, "Bad arg count. Expected %d, got %d.", 4, *params / sizeof(cell));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemInfo *pItem = reinterpret_cast<ItemInfo *>(params[1]);
|
ItemInfo *pItem = reinterpret_cast<ItemInfo *>(params[1]);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case ItemInfo_iSlot:
|
case ItemInfo_iSlot:
|
||||||
return pItem->iSlot;
|
return pItem->iSlot;
|
||||||
|
|
||||||
case ItemInfo_iPosition:
|
case ItemInfo_iPosition:
|
||||||
return pItem->iPosition;
|
return pItem->iPosition;
|
||||||
|
|
||||||
case ItemInfo_pszAmmo1:
|
case ItemInfo_pszAmmo1:
|
||||||
return MF_SetAmxString( amx, params[3], pItem->pszAmmo1 > 0 ? pItem->pszAmmo1 : "", params[4] );
|
return MF_SetAmxString( amx, params[3], pItem->pszAmmo1 > 0 ? pItem->pszAmmo1 : "", params[4] );
|
||||||
|
|
||||||
case ItemInfo_iMaxAmmo1:
|
case ItemInfo_iMaxAmmo1:
|
||||||
return pItem->iMaxAmmo1;
|
return pItem->iMaxAmmo1;
|
||||||
|
|
||||||
case ItemInfo_pszAmmo2:
|
case ItemInfo_pszAmmo2:
|
||||||
return MF_SetAmxString( amx, params[3], pItem->pszAmmo2 > 0 ? pItem->pszAmmo2 : "", params[4] );
|
return MF_SetAmxString( amx, params[3], pItem->pszAmmo2 > 0 ? pItem->pszAmmo2 : "", params[4] );
|
||||||
|
|
||||||
case ItemInfo_iMaxAmmo2:
|
case ItemInfo_iMaxAmmo2:
|
||||||
return pItem->iMaxAmmo2;
|
return pItem->iMaxAmmo2;
|
||||||
|
|
||||||
case ItemInfo_pszName:
|
case ItemInfo_pszName:
|
||||||
return MF_SetAmxString( amx, params[3], pItem->pszName > 0 ? pItem->pszName : "", params[4] );
|
return MF_SetAmxString( amx, params[3], pItem->pszName > 0 ? pItem->pszName : "", params[4] );
|
||||||
|
|
||||||
case ItemInfo_iMaxClip:
|
case ItemInfo_iMaxClip:
|
||||||
return pItem->iMaxClip;
|
return pItem->iMaxClip;
|
||||||
|
|
||||||
case ItemInfo_iId:
|
case ItemInfo_iId:
|
||||||
return pItem->iId;
|
return pItem->iId;
|
||||||
|
|
||||||
case ItemInfo_iFlags:
|
case ItemInfo_iFlags:
|
||||||
return pItem->iFlags;
|
return pItem->iFlags;
|
||||||
|
|
||||||
case ItemInfo_iWeight:
|
case ItemInfo_iWeight:
|
||||||
return pItem->iWeight;
|
return pItem->iWeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown ItemInfo type %d", type);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown ItemInfo type %d", type);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CStack<ItemInfo *> g_FreeIIs;
|
CStack<ItemInfo *> g_FreeIIs;
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL CreateHamItemInfo(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL CreateHamItemInfo(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
ItemInfo *ii;
|
ItemInfo *ii;
|
||||||
|
|
||||||
if (g_FreeIIs.empty())
|
if (g_FreeIIs.empty())
|
||||||
{
|
{
|
||||||
ii = new ItemInfo;
|
ii = new ItemInfo;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ii = g_FreeIIs.front();
|
ii = g_FreeIIs.front();
|
||||||
g_FreeIIs.pop();
|
g_FreeIIs.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(ii, 0, sizeof(ItemInfo));
|
memset(ii, 0, sizeof(ItemInfo));
|
||||||
|
|
||||||
return reinterpret_cast<cell>(ii);
|
return reinterpret_cast<cell>(ii);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL FreeHamItemInfo(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL FreeHamItemInfo(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
ItemInfo *ii = reinterpret_cast<ItemInfo *>(params[1]);
|
ItemInfo *ii = reinterpret_cast<ItemInfo *>(params[1]);
|
||||||
|
|
||||||
if (!ii)
|
if (!ii)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_FreeIIs.push(ii);
|
g_FreeIIs.push(ii);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,61 +394,61 @@ static cell AMX_NATIVE_CALL SetHamItemInfo(AMX *amx, cell *params)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemInfo *pItem = reinterpret_cast<ItemInfo *>(params[1]);
|
ItemInfo *pItem = reinterpret_cast<ItemInfo *>(params[1]);
|
||||||
cell *ptr = MF_GetAmxAddr(amx, params[3]);
|
cell *ptr = MF_GetAmxAddr(amx, params[3]);
|
||||||
int iLen;
|
int iLen;
|
||||||
|
|
||||||
switch (params[2])
|
switch (params[2])
|
||||||
{
|
{
|
||||||
case ItemInfo_iSlot:
|
case ItemInfo_iSlot:
|
||||||
pItem->iSlot = *ptr;
|
pItem->iSlot = *ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemInfo_iPosition:
|
case ItemInfo_iPosition:
|
||||||
pItem->iPosition = *ptr;
|
pItem->iPosition = *ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemInfo_pszAmmo1:
|
case ItemInfo_pszAmmo1:
|
||||||
pItem->pszAmmo1 = MF_GetAmxString(amx, params[3], 0, &iLen);
|
pItem->pszAmmo1 = MF_GetAmxString(amx, params[3], 0, &iLen);
|
||||||
return iLen;
|
return iLen;
|
||||||
|
|
||||||
case ItemInfo_iMaxAmmo1:
|
case ItemInfo_iMaxAmmo1:
|
||||||
pItem->iMaxAmmo1 = *ptr;
|
pItem->iMaxAmmo1 = *ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemInfo_pszAmmo2:
|
case ItemInfo_pszAmmo2:
|
||||||
pItem->pszAmmo2 = MF_GetAmxString(amx, params[3], 0, &iLen);
|
pItem->pszAmmo2 = MF_GetAmxString(amx, params[3], 0, &iLen);
|
||||||
return iLen;
|
return iLen;
|
||||||
|
|
||||||
case ItemInfo_iMaxAmmo2:
|
case ItemInfo_iMaxAmmo2:
|
||||||
pItem->iMaxAmmo2 = *ptr;
|
pItem->iMaxAmmo2 = *ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemInfo_pszName:
|
case ItemInfo_pszName:
|
||||||
pItem->pszName = MF_GetAmxString(amx, params[3], 0, &iLen);
|
pItem->pszName = MF_GetAmxString(amx, params[3], 0, &iLen);
|
||||||
return iLen;
|
return iLen;
|
||||||
|
|
||||||
case ItemInfo_iMaxClip:
|
case ItemInfo_iMaxClip:
|
||||||
pItem->iMaxClip = *ptr;
|
pItem->iMaxClip = *ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemInfo_iId:
|
case ItemInfo_iId:
|
||||||
pItem->iId = *ptr;
|
pItem->iId = *ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemInfo_iFlags:
|
case ItemInfo_iFlags:
|
||||||
pItem->iFlags = *ptr;
|
pItem->iFlags = *ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ItemInfo_iWeight:
|
case ItemInfo_iWeight:
|
||||||
pItem->iWeight = *ptr;
|
pItem->iWeight = *ptr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown ItemInfo type %d", params[2]);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown ItemInfo type %d", params[2]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,47 +22,47 @@
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
RET_VOID,
|
RET_VOID,
|
||||||
RET_BOOL,
|
RET_BOOL,
|
||||||
RET_INTEGER,
|
RET_INTEGER,
|
||||||
RET_SHORT,
|
RET_SHORT,
|
||||||
RET_FLOAT,
|
RET_FLOAT,
|
||||||
RET_VECTOR,
|
RET_VECTOR,
|
||||||
RET_STRING,
|
RET_STRING,
|
||||||
RET_CBASE,
|
RET_CBASE,
|
||||||
RET_ENTVAR,
|
RET_ENTVAR,
|
||||||
RET_EDICT,
|
RET_EDICT,
|
||||||
RET_TRACE,
|
RET_TRACE,
|
||||||
RET_ITEMINFO
|
RET_ITEMINFO
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int iSlot;
|
int iSlot;
|
||||||
int iPosition;
|
int iPosition;
|
||||||
const char *pszAmmo1;
|
const char *pszAmmo1;
|
||||||
int iMaxAmmo1;
|
int iMaxAmmo1;
|
||||||
const char *pszAmmo2;
|
const char *pszAmmo2;
|
||||||
int iMaxAmmo2;
|
int iMaxAmmo2;
|
||||||
const char *pszName;
|
const char *pszName;
|
||||||
int iMaxClip;
|
int iMaxClip;
|
||||||
int iId;
|
int iId;
|
||||||
int iFlags;
|
int iFlags;
|
||||||
int iWeight;
|
int iWeight;
|
||||||
}
|
}
|
||||||
ItemInfo;
|
ItemInfo;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ItemInfo_iSlot,
|
ItemInfo_iSlot,
|
||||||
ItemInfo_iPosition,
|
ItemInfo_iPosition,
|
||||||
ItemInfo_pszAmmo1,
|
ItemInfo_pszAmmo1,
|
||||||
ItemInfo_iMaxAmmo1,
|
ItemInfo_iMaxAmmo1,
|
||||||
ItemInfo_pszAmmo2,
|
ItemInfo_pszAmmo2,
|
||||||
ItemInfo_iMaxAmmo2,
|
ItemInfo_iMaxAmmo2,
|
||||||
ItemInfo_pszName,
|
ItemInfo_pszName,
|
||||||
ItemInfo_iMaxClip,
|
ItemInfo_iMaxClip,
|
||||||
ItemInfo_iId,
|
ItemInfo_iId,
|
||||||
ItemInfo_iFlags,
|
ItemInfo_iFlags,
|
||||||
ItemInfo_iWeight
|
ItemInfo_iWeight
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -53,18 +53,18 @@ void OnAmxxAttach(void)
|
||||||
assert(strcmp(hooklist[Ham_NS_UpdateOnRemove].name, "ns_updateonremove")==0);
|
assert(strcmp(hooklist[Ham_NS_UpdateOnRemove].name, "ns_updateonremove")==0);
|
||||||
assert(strcmp(hooklist[Ham_TS_ShouldCollide].name, "ts_shouldcollide")==0);
|
assert(strcmp(hooklist[Ham_TS_ShouldCollide].name, "ts_shouldcollide")==0);
|
||||||
|
|
||||||
assert(strcmp(hooklist[Ham_GetDeathActivity].name, "getdeathactivity")==0);
|
assert(strcmp(hooklist[Ham_GetDeathActivity].name, "getdeathactivity")==0);
|
||||||
assert(strcmp(hooklist[Ham_StopFollowing].name, "stopfollowing")==0);
|
assert(strcmp(hooklist[Ham_StopFollowing].name, "stopfollowing")==0);
|
||||||
assert(strcmp(hooklist[Ham_CS_Player_OnTouchingWeapon].name, "cstrike_player_ontouchingweapon")==0);
|
assert(strcmp(hooklist[Ham_CS_Player_OnTouchingWeapon].name, "cstrike_player_ontouchingweapon")==0);
|
||||||
assert(strcmp(hooklist[Ham_DOD_Weapon_Special].name, "dod_weapon_special")==0);
|
assert(strcmp(hooklist[Ham_DOD_Weapon_Special].name, "dod_weapon_special")==0);
|
||||||
assert(strcmp(hooklist[Ham_TFC_RadiusDamage2].name, "tfc_radiusdamage2")==0);
|
assert(strcmp(hooklist[Ham_TFC_RadiusDamage2].name, "tfc_radiusdamage2")==0);
|
||||||
assert(strcmp(hooklist[Ham_ESF_Weapon_HolsterWhenMeleed].name, "esf_weapon_holsterwhenmeleed") == 0);
|
assert(strcmp(hooklist[Ham_ESF_Weapon_HolsterWhenMeleed].name, "esf_weapon_holsterwhenmeleed") == 0);
|
||||||
assert(strcmp(hooklist[Ham_NS_Weapon_GetDeployTime].name, "ns_weapon_getdeploytime")==0);
|
assert(strcmp(hooklist[Ham_NS_Weapon_GetDeployTime].name, "ns_weapon_getdeploytime")==0);
|
||||||
assert(strcmp(hooklist[Ham_SC_MedicCallSound].name, "sc_mediccallsound")==0);
|
assert(strcmp(hooklist[Ham_SC_MedicCallSound].name, "sc_mediccallsound")==0);
|
||||||
assert(strcmp(hooklist[Ham_SC_Player_CanTouchPlayer].name, "sc_player_cantouchplayer")==0);
|
assert(strcmp(hooklist[Ham_SC_Player_CanTouchPlayer].name, "sc_player_cantouchplayer")==0);
|
||||||
assert(strcmp(hooklist[Ham_SC_Weapon_ChangeWeaponSkin].name, "sc_weapon_changeweaponskin")==0);
|
assert(strcmp(hooklist[Ham_SC_Weapon_ChangeWeaponSkin].name, "sc_weapon_changeweaponskin")==0);
|
||||||
assert(strcmp(hooklist[Ham_Item_GetItemInfo].name, "item_getiteminfo") == 0);
|
assert(strcmp(hooklist[Ham_Item_GetItemInfo].name, "item_getiteminfo") == 0);
|
||||||
|
|
||||||
MF_AddNatives(pdata_natives_safe);
|
MF_AddNatives(pdata_natives_safe);
|
||||||
if (ReadConfig() > 0)
|
if (ReadConfig() > 0)
|
||||||
{
|
{
|
||||||
|
@ -91,15 +91,15 @@ void OnAmxxAttach(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern CStack<ItemInfo *> g_FreeIIs;
|
extern CStack<ItemInfo *> g_FreeIIs;
|
||||||
|
|
||||||
void OnAmxxDetach()
|
void OnAmxxDetach()
|
||||||
{
|
{
|
||||||
while (!g_FreeIIs.empty())
|
while (!g_FreeIIs.empty())
|
||||||
{
|
{
|
||||||
delete g_FreeIIs.front();
|
delete g_FreeIIs.front();
|
||||||
g_FreeIIs.pop();
|
g_FreeIIs.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HamCommand(void);
|
void HamCommand(void);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,12 +25,12 @@ cell Call_Void_Cbase(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Float_Int(AMX *amx, cell *params);
|
cell Call_Int_Float_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Float_Int_Int(AMX *amx, cell *params);
|
cell Call_Int_Float_Int_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Entvar_Int(AMX *amx, cell *params);
|
cell Call_Void_Entvar_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Entvar_Entvar_Int(AMX *amx, cell *params);
|
cell Call_Void_Entvar_Entvar_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Cbase(AMX *amx, cell *params);
|
cell Call_Int_Cbase(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Int_Int(AMX *amx, cell *params);
|
cell Call_Void_Int_Int(AMX *amx, cell *params);
|
||||||
|
@ -49,8 +49,8 @@ cell Call_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Int(AMX *amx, cell *params);
|
cell Call_Void_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Vector_Float_Cbase_Int(AMX *amx, cell *params);
|
cell Call_Vector_Float_Cbase_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params);
|
cell Call_Void_Cbase_Cbase_Int_Float(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params);
|
cell Call_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, cell *params);
|
||||||
|
@ -81,111 +81,111 @@ cell Call_Float_Void(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Float_Int(AMX* amx, cell* params);
|
cell Call_Void_Float_Int(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Float_Float_Cbase(AMX* amx, cell* params);
|
cell Call_Float_Float_Cbase(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Float(AMX* amx, cell* params);
|
cell Call_Void_Float(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Float_Float_Float_Int(AMX* amx, cell* params);
|
cell Call_Void_Float_Float_Float_Int(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Float_Int(AMX* amx, cell* params);
|
cell Call_Float_Int(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Vector_Float(AMX* amx, cell* params);
|
cell Call_Vector_Float(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Float_Cbase(AMX *amx, cell *params);
|
cell Call_Void_Float_Cbase(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Float_Float(AMX *amx, cell *params);
|
cell Call_Int_Float_Float(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Float(AMX *amx, cell *params);
|
cell Call_Int_Float(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Int_Int(AMX *amx, cell *params);
|
cell Call_Int_Int_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Str_Float_Float_Float(AMX *amx, cell *params);
|
cell Call_Void_Str_Float_Float_Float(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, cell *params);
|
cell Call_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params);
|
cell Call_Int_Vector_Vector_Float_Float(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Short(AMX *amx, cell *params);
|
cell Call_Int_Short(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, cell *params);
|
cell Call_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, cell *params);
|
cell Call_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Float_Int_Float(AMX* amx, cell* params);
|
cell Call_Float_Int_Float(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_Str(AMX* amx, cell* params);
|
cell Call_Int_Str(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Edict(AMX* amx, cell* params);
|
cell Call_Void_Edict(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Int_Str_Bool(AMX* amx, cell* params);
|
cell Call_Void_Int_Str_Bool(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Vector_Vector(AMX* amx, cell* params);
|
cell Call_Void_Vector_Vector(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Str_Bool(AMX* amx, cell* params);
|
cell Call_Void_Str_Bool(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_Str_Str_Int_Str_Int_Int(AMX* amx, cell* params);
|
cell Call_Int_Str_Str_Int_Str_Int_Int(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_Int_Int_Float_Int(AMX* amx, cell* params);
|
cell Call_Int_Int_Int_Float_Int(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Str_Int(AMX* amx, cell* params);
|
cell Call_Void_Str_Int(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Cbase_Int(AMX* amx, cell* params);
|
cell Call_Void_Cbase_Int(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Str(AMX* amx, cell* params);
|
cell Call_Void_Str(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Vector(AMX* amx, cell* params);
|
cell Call_Void_Vector(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_Str_Vector_Str(AMX* amx, cell* params);
|
cell Call_Int_Str_Vector_Str(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_Str_Str(AMX* amx, cell* params);
|
cell Call_Int_Str_Str(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Float_Float(AMX* amx, cell* params);
|
cell Call_Void_Float_Float(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Str_Str_Int(AMX* amx, cell* params);
|
cell Call_Void_Str_Str_Int(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_pVector_pVector_Cbase_pFloat(AMX* amx, cell* params);
|
cell Call_Int_pVector_pVector_Cbase_pFloat(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Cbase_pVector_Float(AMX* amx, cell* params);
|
cell Call_Void_Cbase_pVector_Float(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_pVector_pVector_Float_Cbase_pVector(AMX* amx, cell* params);
|
cell Call_Int_pVector_pVector_Float_Cbase_pVector(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_Cbase_Bool(AMX* amx, cell* params);
|
cell Call_Int_Cbase_Bool(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_Vector_Vector(AMX *amx, cell *params);
|
cell Call_Int_Vector_Vector(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Entvar_Float(AMX *amx, cell *params);
|
cell Call_Int_Entvar_Float(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Float_Float(AMX* amx, cell* params);
|
cell Call_Float_Float(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Entvar_Entvar_Float(AMX *amx, cell *params);
|
cell Call_Void_Entvar_Entvar_Float(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Bool_Void(AMX *amx, cell *params);
|
cell Call_Bool_Void(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX* amx, cell* params);
|
cell Call_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Int_Vector_Cbase(AMX *amx, cell *params);
|
cell Call_Int_Vector_Cbase(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Vector(AMX *amx, cell *params);
|
cell Call_Int_Vector(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Int_Cbase_pVector(AMX *amx, cell *params);
|
cell Call_Int_Cbase_pVector(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Bool(AMX *amx, cell *params);
|
cell Call_Void_Bool(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Bool_Cbase(AMX *amx, cell *params);
|
cell Call_Bool_Cbase(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Bool_Int(AMX *amx, cell *params);
|
cell Call_Bool_Int(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Cbase_Float(AMX* amx, cell* params);
|
cell Call_Void_Cbase_Float(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Void_Cbase_Bool(AMX* amx, cell* params);
|
cell Call_Void_Cbase_Bool(AMX* amx, cell* params);
|
||||||
|
|
||||||
cell Call_Vector_Vector_Vector_Vector(AMX *amx, cell *params);
|
cell Call_Vector_Vector_Vector_Vector(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Str_Str(AMX *amx, cell *params);
|
cell Call_Str_Str(AMX *amx, cell *params);
|
||||||
|
|
||||||
cell Call_Void_Short(AMX *amx, cell *params);
|
cell Call_Void_Short(AMX *amx, cell *params);
|
||||||
|
|
||||||
|
|
||||||
cell Call_Deprecated(AMX* amx, cell* params);
|
cell Call_Deprecated(AMX* amx, cell* params);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,57 +11,57 @@
|
||||||
// Ham Sandwich Module
|
// Ham Sandwich Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CELLTOTYPE_H
|
#ifndef CELLTOTYPE_H
|
||||||
#define CELLTOTYPE_H
|
#define CELLTOTYPE_H
|
||||||
|
|
||||||
#include <extdll.h>
|
#include <extdll.h>
|
||||||
#include "sdk/amxxmodule.h"
|
#include "sdk/amxxmodule.h"
|
||||||
|
|
||||||
#include "CVector.h"
|
#include "CVector.h"
|
||||||
|
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
#include "forward.h"
|
#include "forward.h"
|
||||||
|
|
||||||
#include "ham_const.h"
|
#include "ham_const.h"
|
||||||
#include "ham_utils.h"
|
#include "ham_utils.h"
|
||||||
|
|
||||||
inline void CellToType(const AMX*& amx, const cell& in, int& out)
|
inline void CellToType(const AMX*& amx, const cell& in, int& out)
|
||||||
{
|
{
|
||||||
out=static_cast<int>(in);
|
out=static_cast<int>(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CellToType(const AMX*& amx, const cell& in, float& out)
|
inline void CellToType(const AMX*& amx, const cell& in, float& out)
|
||||||
{
|
{
|
||||||
out=amx_ctof2(in);
|
out=amx_ctof2(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CellToType(const AMX*& amx, const cell& in, edict_t*& out)
|
inline void CellToType(const AMX*& amx, const cell& in, edict_t*& out)
|
||||||
{
|
{
|
||||||
out=INDEXENT_NEW(in);
|
out=INDEXENT_NEW(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CellToType(const AMX*& amx, const cell& in, entvars_t*& out)
|
inline void CellToType(const AMX*& amx, const cell& in, entvars_t*& out)
|
||||||
{
|
{
|
||||||
out=&(INDEXENT_NEW(in)->v);
|
out=&(INDEXENT_NEW(in)->v);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CellToType(const AMX*& amx, const cell& in, HLBaseEntity*& out)
|
inline void CellToType(const AMX*& amx, const cell& in, HLBaseEntity*& out)
|
||||||
{
|
{
|
||||||
out=(HLBaseEntity *)(INDEXENT_NEW(in)->pvPrivateData);
|
out=(HLBaseEntity *)(INDEXENT_NEW(in)->pvPrivateData);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CellToType(const AMX*& amx, const cell& in, Vector& out)
|
inline void CellToType(const AMX*& amx, const cell& in, Vector& out)
|
||||||
{
|
{
|
||||||
float *v=(float *)MF_GetAmxAddr(amx, in);
|
float *v=(float *)MF_GetAmxAddr(amx, in);
|
||||||
|
|
||||||
out.x=v[0];
|
out.x=v[0];
|
||||||
out.y=v[1];
|
out.y=v[1];
|
||||||
out.z=v[2];
|
out.z=v[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CellToType(const AMX*& amx, const cell& in, TraceResult*& out)
|
inline void CellToType(const AMX*& amx, const cell& in, TraceResult*& out)
|
||||||
{
|
{
|
||||||
out=reinterpret_cast<TraceResult*>(in);
|
out=reinterpret_cast<TraceResult*>(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -90,7 +90,7 @@ enum
|
||||||
Ham_Player_ShouldFadeOnDeath,
|
Ham_Player_ShouldFadeOnDeath,
|
||||||
Ham_Player_ImpulseCommands,
|
Ham_Player_ImpulseCommands,
|
||||||
Ham_Player_UpdateClientData,
|
Ham_Player_UpdateClientData,
|
||||||
|
|
||||||
Ham_Item_AddToPlayer,
|
Ham_Item_AddToPlayer,
|
||||||
Ham_Item_AddDuplicate,
|
Ham_Item_AddDuplicate,
|
||||||
Ham_Item_CanDeploy,
|
Ham_Item_CanDeploy,
|
||||||
|
@ -167,323 +167,323 @@ enum
|
||||||
Ham_TS_OnFreeEntPrivateData,
|
Ham_TS_OnFreeEntPrivateData,
|
||||||
Ham_TS_ShouldCollide,
|
Ham_TS_ShouldCollide,
|
||||||
|
|
||||||
//
|
//
|
||||||
// New addition - 2011
|
// New addition - 2011
|
||||||
//
|
//
|
||||||
|
|
||||||
Ham_ChangeYaw,
|
Ham_ChangeYaw,
|
||||||
Ham_HasHumanGibs,
|
Ham_HasHumanGibs,
|
||||||
Ham_HasAlienGibs,
|
Ham_HasAlienGibs,
|
||||||
Ham_FadeMonster,
|
Ham_FadeMonster,
|
||||||
Ham_GibMonster,
|
Ham_GibMonster,
|
||||||
Ham_BecomeDead,
|
Ham_BecomeDead,
|
||||||
Ham_IRelationship,
|
Ham_IRelationship,
|
||||||
Ham_PainSound,
|
Ham_PainSound,
|
||||||
Ham_ReportAIState,
|
Ham_ReportAIState,
|
||||||
Ham_MonsterInitDead,
|
Ham_MonsterInitDead,
|
||||||
Ham_Look,
|
Ham_Look,
|
||||||
Ham_BestVisibleEnemy,
|
Ham_BestVisibleEnemy,
|
||||||
Ham_FInViewCone,
|
Ham_FInViewCone,
|
||||||
Ham_FVecInViewCone,
|
Ham_FVecInViewCone,
|
||||||
Ham_GetDeathActivity,
|
Ham_GetDeathActivity,
|
||||||
|
|
||||||
// Not valid in CS, NS and TS.
|
// Not valid in CS, NS and TS.
|
||||||
Ham_RunAI,
|
Ham_RunAI,
|
||||||
Ham_MonsterThink,
|
Ham_MonsterThink,
|
||||||
Ham_MonsterInit,
|
Ham_MonsterInit,
|
||||||
Ham_CheckLocalMove,
|
Ham_CheckLocalMove,
|
||||||
Ham_Move,
|
Ham_Move,
|
||||||
Ham_MoveExecute,
|
Ham_MoveExecute,
|
||||||
Ham_ShouldAdvanceRoute,
|
Ham_ShouldAdvanceRoute,
|
||||||
Ham_GetStoppedActivity,
|
Ham_GetStoppedActivity,
|
||||||
Ham_Stop,
|
Ham_Stop,
|
||||||
Ham_CheckRangeAttack1,
|
Ham_CheckRangeAttack1,
|
||||||
Ham_CheckRangeAttack2,
|
Ham_CheckRangeAttack2,
|
||||||
Ham_CheckMeleeAttack1,
|
Ham_CheckMeleeAttack1,
|
||||||
Ham_CheckMeleeAttack2,
|
Ham_CheckMeleeAttack2,
|
||||||
Ham_ScheduleChange,
|
Ham_ScheduleChange,
|
||||||
Ham_CanPlaySequence,
|
Ham_CanPlaySequence,
|
||||||
Ham_CanPlaySentence,
|
Ham_CanPlaySentence,
|
||||||
Ham_PlaySentence,
|
Ham_PlaySentence,
|
||||||
Ham_PlayScriptedSentence,
|
Ham_PlayScriptedSentence,
|
||||||
Ham_SentenceStop,
|
Ham_SentenceStop,
|
||||||
Ham_GetIdealState,
|
Ham_GetIdealState,
|
||||||
Ham_SetActivity,
|
Ham_SetActivity,
|
||||||
Ham_CheckEnemy,
|
Ham_CheckEnemy,
|
||||||
Ham_FTriangulate,
|
Ham_FTriangulate,
|
||||||
Ham_SetYawSpeed,
|
Ham_SetYawSpeed,
|
||||||
Ham_BuildNearestRoute,
|
Ham_BuildNearestRoute,
|
||||||
Ham_FindCover,
|
Ham_FindCover,
|
||||||
Ham_CoverRadius,
|
Ham_CoverRadius,
|
||||||
Ham_FCanCheckAttacks,
|
Ham_FCanCheckAttacks,
|
||||||
Ham_CheckAmmo,
|
Ham_CheckAmmo,
|
||||||
Ham_IgnoreConditions,
|
Ham_IgnoreConditions,
|
||||||
Ham_FValidateHintType,
|
Ham_FValidateHintType,
|
||||||
Ham_FCanActiveIdle,
|
Ham_FCanActiveIdle,
|
||||||
Ham_ISoundMask,
|
Ham_ISoundMask,
|
||||||
Ham_HearingSensitivity,
|
Ham_HearingSensitivity,
|
||||||
Ham_BarnacleVictimBitten,
|
Ham_BarnacleVictimBitten,
|
||||||
Ham_BarnacleVictimReleased,
|
Ham_BarnacleVictimReleased,
|
||||||
Ham_PrescheduleThink,
|
Ham_PrescheduleThink,
|
||||||
Ham_DeathSound,
|
Ham_DeathSound,
|
||||||
Ham_AlertSound,
|
Ham_AlertSound,
|
||||||
Ham_IdleSound,
|
Ham_IdleSound,
|
||||||
Ham_StopFollowing,
|
Ham_StopFollowing,
|
||||||
|
|
||||||
Ham_CS_Weapon_SendWeaponAnim,
|
Ham_CS_Weapon_SendWeaponAnim,
|
||||||
Ham_CS_Player_ResetMaxSpeed,
|
Ham_CS_Player_ResetMaxSpeed,
|
||||||
Ham_CS_Player_IsBot,
|
Ham_CS_Player_IsBot,
|
||||||
Ham_CS_Player_GetAutoaimVector,
|
Ham_CS_Player_GetAutoaimVector,
|
||||||
Ham_CS_Player_Blind,
|
Ham_CS_Player_Blind,
|
||||||
Ham_CS_Player_OnTouchingWeapon,
|
Ham_CS_Player_OnTouchingWeapon,
|
||||||
|
|
||||||
Ham_DOD_SetScriptReset,
|
Ham_DOD_SetScriptReset,
|
||||||
Ham_DOD_Item_SpawnDeploy,
|
Ham_DOD_Item_SpawnDeploy,
|
||||||
Ham_DOD_Item_SetDmgTime,
|
Ham_DOD_Item_SetDmgTime,
|
||||||
Ham_DOD_Item_DropGren,
|
Ham_DOD_Item_DropGren,
|
||||||
Ham_DOD_Weapon_IsUseable,
|
Ham_DOD_Weapon_IsUseable,
|
||||||
Ham_DOD_Weapon_Aim,
|
Ham_DOD_Weapon_Aim,
|
||||||
Ham_DOD_Weapon_flAim,
|
Ham_DOD_Weapon_flAim,
|
||||||
Ham_DOD_Weapon_RemoveStamina,
|
Ham_DOD_Weapon_RemoveStamina,
|
||||||
Ham_DOD_Weapon_ChangeFOV,
|
Ham_DOD_Weapon_ChangeFOV,
|
||||||
Ham_DOD_Weapon_ZoomOut,
|
Ham_DOD_Weapon_ZoomOut,
|
||||||
Ham_DOD_Weapon_ZoomIn,
|
Ham_DOD_Weapon_ZoomIn,
|
||||||
Ham_DOD_Weapon_GetFOV,
|
Ham_DOD_Weapon_GetFOV,
|
||||||
Ham_DOD_Weapon_IsWaterSniping,
|
Ham_DOD_Weapon_IsWaterSniping,
|
||||||
Ham_DOD_Weapon_UpdateZoomSpeed,
|
Ham_DOD_Weapon_UpdateZoomSpeed,
|
||||||
Ham_DOD_Weapon_Special,
|
Ham_DOD_Weapon_Special,
|
||||||
|
|
||||||
Ham_TFC_DB_GetItemName,
|
Ham_TFC_DB_GetItemName,
|
||||||
Ham_TFC_RadiusDamage,
|
Ham_TFC_RadiusDamage,
|
||||||
Ham_TFC_RadiusDamage2,
|
Ham_TFC_RadiusDamage2,
|
||||||
|
|
||||||
Ham_ESF_IsFighter,
|
Ham_ESF_IsFighter,
|
||||||
Ham_ESF_IsBuddy,
|
Ham_ESF_IsBuddy,
|
||||||
Ham_ESF_EmitSound,
|
Ham_ESF_EmitSound,
|
||||||
Ham_ESF_EmitNullSound,
|
Ham_ESF_EmitNullSound,
|
||||||
Ham_ESF_IncreaseStrength,
|
Ham_ESF_IncreaseStrength,
|
||||||
Ham_ESF_IncreasePL,
|
Ham_ESF_IncreasePL,
|
||||||
Ham_ESF_SetPowerLevel,
|
Ham_ESF_SetPowerLevel,
|
||||||
Ham_ESF_SetMaxPowerLevel,
|
Ham_ESF_SetMaxPowerLevel,
|
||||||
Ham_ESF_StopAniTrigger,
|
Ham_ESF_StopAniTrigger,
|
||||||
Ham_ESF_StopFly,
|
Ham_ESF_StopFly,
|
||||||
Ham_ESF_HideWeapon,
|
Ham_ESF_HideWeapon,
|
||||||
Ham_ESF_ClientRemoveWeapon,
|
Ham_ESF_ClientRemoveWeapon,
|
||||||
Ham_ESF_SendClientsCustomModel,
|
Ham_ESF_SendClientsCustomModel,
|
||||||
Ham_ESF_CanTurbo,
|
Ham_ESF_CanTurbo,
|
||||||
Ham_ESF_CanPrimaryFire,
|
Ham_ESF_CanPrimaryFire,
|
||||||
Ham_ESF_CanSecondaryFire,
|
Ham_ESF_CanSecondaryFire,
|
||||||
Ham_ESF_CanStopFly,
|
Ham_ESF_CanStopFly,
|
||||||
Ham_ESF_CanBlock,
|
Ham_ESF_CanBlock,
|
||||||
Ham_ESF_CanRaiseKi,
|
Ham_ESF_CanRaiseKi,
|
||||||
Ham_ESF_CanRaiseStamina,
|
Ham_ESF_CanRaiseStamina,
|
||||||
Ham_ESF_CanTeleport,
|
Ham_ESF_CanTeleport,
|
||||||
Ham_ESF_CanStartFly,
|
Ham_ESF_CanStartFly,
|
||||||
Ham_ESF_CanStartPowerup,
|
Ham_ESF_CanStartPowerup,
|
||||||
Ham_ESF_CanJump,
|
Ham_ESF_CanJump,
|
||||||
Ham_ESF_CanWallJump,
|
Ham_ESF_CanWallJump,
|
||||||
Ham_ESF_IsSuperJump,
|
Ham_ESF_IsSuperJump,
|
||||||
Ham_ESF_IsMoveBack,
|
Ham_ESF_IsMoveBack,
|
||||||
Ham_ESF_CheckWallJump,
|
Ham_ESF_CheckWallJump,
|
||||||
Ham_ESF_EnableWallJump,
|
Ham_ESF_EnableWallJump,
|
||||||
Ham_ESF_DisableWallJump,
|
Ham_ESF_DisableWallJump,
|
||||||
Ham_ESF_ResetWallJumpVars,
|
Ham_ESF_ResetWallJumpVars,
|
||||||
Ham_ESF_GetWallJumpAnim,
|
Ham_ESF_GetWallJumpAnim,
|
||||||
Ham_ESF_GetWallJumpAnim2,
|
Ham_ESF_GetWallJumpAnim2,
|
||||||
Ham_ESF_SetWallJumpAnimation,
|
Ham_ESF_SetWallJumpAnimation,
|
||||||
Ham_ESF_SetFlyMoveType,
|
Ham_ESF_SetFlyMoveType,
|
||||||
Ham_ESF_IsFlyMoveType,
|
Ham_ESF_IsFlyMoveType,
|
||||||
Ham_ESF_IsWalkMoveType,
|
Ham_ESF_IsWalkMoveType,
|
||||||
Ham_ESF_SetWalkMoveType,
|
Ham_ESF_SetWalkMoveType,
|
||||||
Ham_ESF_DrawChargeBar,
|
Ham_ESF_DrawChargeBar,
|
||||||
Ham_ESF_StartBlock,
|
Ham_ESF_StartBlock,
|
||||||
Ham_ESF_StopBlock,
|
Ham_ESF_StopBlock,
|
||||||
Ham_ESF_StartFly,
|
Ham_ESF_StartFly,
|
||||||
Ham_ESF_GetMaxSpeed,
|
Ham_ESF_GetMaxSpeed,
|
||||||
Ham_ESF_SetAnimation,
|
Ham_ESF_SetAnimation,
|
||||||
Ham_ESF_PlayAnimation,
|
Ham_ESF_PlayAnimation,
|
||||||
Ham_ESF_GetMoveForward,
|
Ham_ESF_GetMoveForward,
|
||||||
Ham_ESF_GetMoveRight,
|
Ham_ESF_GetMoveRight,
|
||||||
Ham_ESF_GetMoveUp,
|
Ham_ESF_GetMoveUp,
|
||||||
Ham_ESF_AddBlindFX,
|
Ham_ESF_AddBlindFX,
|
||||||
Ham_ESF_RemoveBlindFX,
|
Ham_ESF_RemoveBlindFX,
|
||||||
Ham_ESF_DisablePSBar,
|
Ham_ESF_DisablePSBar,
|
||||||
Ham_ESF_AddBeamBoxCrosshair,
|
Ham_ESF_AddBeamBoxCrosshair,
|
||||||
Ham_ESF_RemoveBeamBoxCrosshair,
|
Ham_ESF_RemoveBeamBoxCrosshair,
|
||||||
Ham_ESF_DrawPSWinBonus,
|
Ham_ESF_DrawPSWinBonus,
|
||||||
Ham_ESF_DrawPSBar,
|
Ham_ESF_DrawPSBar,
|
||||||
Ham_ESF_LockCrosshair,
|
Ham_ESF_LockCrosshair,
|
||||||
Ham_ESF_UnLockCrosshair,
|
Ham_ESF_UnLockCrosshair,
|
||||||
Ham_ESF_RotateCrosshair,
|
Ham_ESF_RotateCrosshair,
|
||||||
Ham_ESF_UnRotateCrosshair,
|
Ham_ESF_UnRotateCrosshair,
|
||||||
Ham_ESF_WaterMove,
|
Ham_ESF_WaterMove,
|
||||||
Ham_ESF_CheckTimeBasedDamage,
|
Ham_ESF_CheckTimeBasedDamage,
|
||||||
Ham_ESF_DoesSecondaryAttack,
|
Ham_ESF_DoesSecondaryAttack,
|
||||||
Ham_ESF_DoesPrimaryAttack,
|
Ham_ESF_DoesPrimaryAttack,
|
||||||
Ham_ESF_RemoveSpecialModes,
|
Ham_ESF_RemoveSpecialModes,
|
||||||
Ham_ESF_StopTurbo,
|
Ham_ESF_StopTurbo,
|
||||||
Ham_ESF_TakeBean,
|
Ham_ESF_TakeBean,
|
||||||
Ham_ESF_GetPowerLevel,
|
Ham_ESF_GetPowerLevel,
|
||||||
Ham_ESF_RemoveAllOtherWeapons,
|
Ham_ESF_RemoveAllOtherWeapons,
|
||||||
Ham_ESF_StopSwoop,
|
Ham_ESF_StopSwoop,
|
||||||
Ham_ESF_SetDeathAnimation,
|
Ham_ESF_SetDeathAnimation,
|
||||||
Ham_ESF_SetModel,
|
Ham_ESF_SetModel,
|
||||||
Ham_ESF_AddAttacks,
|
Ham_ESF_AddAttacks,
|
||||||
Ham_ESF_EmitClassSound,
|
Ham_ESF_EmitClassSound,
|
||||||
Ham_ESF_CheckLightning,
|
Ham_ESF_CheckLightning,
|
||||||
Ham_ESF_FreezeControls,
|
Ham_ESF_FreezeControls,
|
||||||
Ham_ESF_UnFreezeControls,
|
Ham_ESF_UnFreezeControls,
|
||||||
Ham_ESF_UpdateKi,
|
Ham_ESF_UpdateKi,
|
||||||
Ham_ESF_UpdateHealth,
|
Ham_ESF_UpdateHealth,
|
||||||
Ham_ESF_GetTeleportDir,
|
Ham_ESF_GetTeleportDir,
|
||||||
Ham_ESF_Weapon_HolsterWhenMeleed,
|
Ham_ESF_Weapon_HolsterWhenMeleed,
|
||||||
|
|
||||||
Ham_NS_SetBoneController,
|
Ham_NS_SetBoneController,
|
||||||
Ham_NS_SaveDataForReset,
|
Ham_NS_SaveDataForReset,
|
||||||
Ham_NS_GetHull,
|
Ham_NS_GetHull,
|
||||||
Ham_NS_GetMaxWalkSpeed,
|
Ham_NS_GetMaxWalkSpeed,
|
||||||
Ham_NS_SetTeamID,
|
Ham_NS_SetTeamID,
|
||||||
Ham_NS_GetEffectivePlayerClass,
|
Ham_NS_GetEffectivePlayerClass,
|
||||||
Ham_NS_GetAuthenticationMask,
|
Ham_NS_GetAuthenticationMask,
|
||||||
Ham_NS_EffectivePlayerClassChanged,
|
Ham_NS_EffectivePlayerClassChanged,
|
||||||
Ham_NS_NeedsTeamUpdate,
|
Ham_NS_NeedsTeamUpdate,
|
||||||
Ham_NS_SendTeamUpdate,
|
Ham_NS_SendTeamUpdate,
|
||||||
Ham_NS_SendWeaponUpdate,
|
Ham_NS_SendWeaponUpdate,
|
||||||
Ham_NS_InitPlayerFromSpawn,
|
Ham_NS_InitPlayerFromSpawn,
|
||||||
Ham_NS_PackDeadPlayerItems,
|
Ham_NS_PackDeadPlayerItems,
|
||||||
Ham_NS_GetAnimationForActivity,
|
Ham_NS_GetAnimationForActivity,
|
||||||
Ham_NS_StartObserver,
|
Ham_NS_StartObserver,
|
||||||
Ham_NS_StopObserver,
|
Ham_NS_StopObserver,
|
||||||
Ham_NS_GetAdrenalineFactor,
|
Ham_NS_GetAdrenalineFactor,
|
||||||
Ham_NS_GetNamedItem,
|
Ham_NS_GetNamedItem,
|
||||||
Ham_NS_Suicide,
|
Ham_NS_Suicide,
|
||||||
Ham_NS_GetCanUseWeapon,
|
Ham_NS_GetCanUseWeapon,
|
||||||
Ham_NS_Weapon_GetWeapPrimeTime,
|
Ham_NS_Weapon_GetWeapPrimeTime,
|
||||||
Ham_NS_Weapon_PrimeWeapon,
|
Ham_NS_Weapon_PrimeWeapon,
|
||||||
Ham_NS_Weapon_GetIsWeaponPrimed,
|
Ham_NS_Weapon_GetIsWeaponPrimed,
|
||||||
Ham_NS_Weapon_GetIsWeaponPriming,
|
Ham_NS_Weapon_GetIsWeaponPriming,
|
||||||
Ham_NS_Weapon_DefaultDeploy,
|
Ham_NS_Weapon_DefaultDeploy,
|
||||||
Ham_NS_Weapon_DefaultReload,
|
Ham_NS_Weapon_DefaultReload,
|
||||||
Ham_NS_Weapon_GetDeployTime,
|
Ham_NS_Weapon_GetDeployTime,
|
||||||
|
|
||||||
Ham_SC_GetClassification,
|
Ham_SC_GetClassification,
|
||||||
Ham_SC_IsMonster,
|
Ham_SC_IsMonster,
|
||||||
Ham_SC_IsPhysX,
|
Ham_SC_IsPhysX,
|
||||||
Ham_SC_IsPointEntity,
|
Ham_SC_IsPointEntity,
|
||||||
Ham_SC_IsMachine,
|
Ham_SC_IsMachine,
|
||||||
Ham_SC_CriticalRemove,
|
Ham_SC_CriticalRemove,
|
||||||
Ham_SC_UpdateOnRemove,
|
Ham_SC_UpdateOnRemove,
|
||||||
Ham_SC_FVisible,
|
Ham_SC_FVisible,
|
||||||
Ham_SC_FVisibleFromPos,
|
Ham_SC_FVisibleFromPos,
|
||||||
Ham_SC_IsFacings,
|
Ham_SC_IsFacings,
|
||||||
Ham_SC_GetPointsForDamage,
|
Ham_SC_GetPointsForDamage,
|
||||||
Ham_SC_GetDamagePoints,
|
Ham_SC_GetDamagePoints,
|
||||||
Ham_SC_OnCreate,
|
Ham_SC_OnCreate,
|
||||||
Ham_SC_OnDestroy,
|
Ham_SC_OnDestroy,
|
||||||
Ham_SC_IsValidEntity,
|
Ham_SC_IsValidEntity,
|
||||||
Ham_SC_ShouldFadeOnDeath,
|
Ham_SC_ShouldFadeOnDeath,
|
||||||
Ham_SC_SetupFriendly,
|
Ham_SC_SetupFriendly,
|
||||||
Ham_SC_ReviveThink,
|
Ham_SC_ReviveThink,
|
||||||
Ham_SC_Revive,
|
Ham_SC_Revive,
|
||||||
Ham_SC_StartMonster,
|
Ham_SC_StartMonster,
|
||||||
Ham_SC_CheckRangeAttack1_Move,
|
Ham_SC_CheckRangeAttack1_Move,
|
||||||
Ham_SC_CheckRangeAttack2_Move,
|
Ham_SC_CheckRangeAttack2_Move,
|
||||||
Ham_SC_CheckMeleeAttack1_Move,
|
Ham_SC_CheckMeleeAttack1_Move,
|
||||||
Ham_SC_CheckMeleeAttack2_Move,
|
Ham_SC_CheckMeleeAttack2_Move,
|
||||||
Ham_SC_CheckTankUsage,
|
Ham_SC_CheckTankUsage,
|
||||||
Ham_SC_SetGaitActivity,
|
Ham_SC_SetGaitActivity,
|
||||||
Ham_SC_FTriangulate,
|
Ham_SC_FTriangulate,
|
||||||
Ham_SC_FTriangulateExtension,
|
Ham_SC_FTriangulateExtension,
|
||||||
Ham_SC_FindCoverGrenade,
|
Ham_SC_FindCoverGrenade,
|
||||||
Ham_SC_FindCoverDistance,
|
Ham_SC_FindCoverDistance,
|
||||||
Ham_SC_FindAttackPoint,
|
Ham_SC_FindAttackPoint,
|
||||||
Ham_SC_FValidateCover,
|
Ham_SC_FValidateCover,
|
||||||
Ham_SC_NoFriendlyFire1,
|
Ham_SC_NoFriendlyFire1,
|
||||||
Ham_SC_NoFriendlyFire2,
|
Ham_SC_NoFriendlyFire2,
|
||||||
Ham_SC_NoFriendlyFire3,
|
Ham_SC_NoFriendlyFire3,
|
||||||
Ham_SC_NoFriendlyFireToPos,
|
Ham_SC_NoFriendlyFireToPos,
|
||||||
Ham_SC_FVisibleGunPos,
|
Ham_SC_FVisibleGunPos,
|
||||||
Ham_SC_FInBulletCone,
|
Ham_SC_FInBulletCone,
|
||||||
Ham_SC_CallGibMonster,
|
Ham_SC_CallGibMonster,
|
||||||
Ham_SC_CheckTimeBasedDamage,
|
Ham_SC_CheckTimeBasedDamage,
|
||||||
Ham_SC_IsMoving,
|
Ham_SC_IsMoving,
|
||||||
Ham_SC_IsPlayerFollowing,
|
Ham_SC_IsPlayerFollowing,
|
||||||
Ham_SC_StartPlayerFollowing,
|
Ham_SC_StartPlayerFollowing,
|
||||||
Ham_SC_StopPlayerFollowing,
|
Ham_SC_StopPlayerFollowing,
|
||||||
Ham_SC_UseSound,
|
Ham_SC_UseSound,
|
||||||
Ham_SC_UnUseSound,
|
Ham_SC_UnUseSound,
|
||||||
Ham_SC_RideMonster,
|
Ham_SC_RideMonster,
|
||||||
Ham_SC_CheckApplyGenericAttacks,
|
Ham_SC_CheckApplyGenericAttacks,
|
||||||
Ham_SC_CheckScared,
|
Ham_SC_CheckScared,
|
||||||
Ham_SC_CheckCreatureDanger,
|
Ham_SC_CheckCreatureDanger,
|
||||||
Ham_SC_CheckFallDamage,
|
Ham_SC_CheckFallDamage,
|
||||||
Ham_SC_CheckRevival,
|
Ham_SC_CheckRevival,
|
||||||
Ham_SC_MedicCallSound,
|
Ham_SC_MedicCallSound,
|
||||||
|
|
||||||
Ham_SC_Player_MenuInputPerformed,
|
Ham_SC_Player_MenuInputPerformed,
|
||||||
Ham_SC_Player_IsMenuInputDone,
|
Ham_SC_Player_IsMenuInputDone,
|
||||||
Ham_SC_Player_SpecialSpawn,
|
Ham_SC_Player_SpecialSpawn,
|
||||||
Ham_SC_Player_IsValidInfoEntity,
|
Ham_SC_Player_IsValidInfoEntity,
|
||||||
Ham_SC_Player_LevelEnd,
|
Ham_SC_Player_LevelEnd,
|
||||||
Ham_SC_Player_VoteStarted,
|
Ham_SC_Player_VoteStarted,
|
||||||
Ham_SC_Player_CanStartNextVote,
|
Ham_SC_Player_CanStartNextVote,
|
||||||
Ham_SC_Player_Vote,
|
Ham_SC_Player_Vote,
|
||||||
Ham_SC_Player_HasVoted,
|
Ham_SC_Player_HasVoted,
|
||||||
Ham_SC_Player_ResetVote,
|
Ham_SC_Player_ResetVote,
|
||||||
Ham_SC_Player_LastVoteInput,
|
Ham_SC_Player_LastVoteInput,
|
||||||
Ham_SC_Player_InitVote,
|
Ham_SC_Player_InitVote,
|
||||||
Ham_SC_Player_TimeToStartNextVote,
|
Ham_SC_Player_TimeToStartNextVote,
|
||||||
Ham_SC_Player_ResetView,
|
Ham_SC_Player_ResetView,
|
||||||
Ham_SC_Player_GetLogFrequency,
|
Ham_SC_Player_GetLogFrequency,
|
||||||
Ham_SC_Player_LogPlayerStats,
|
Ham_SC_Player_LogPlayerStats,
|
||||||
Ham_SC_Player_DisableCollisionWithPlayer,
|
Ham_SC_Player_DisableCollisionWithPlayer,
|
||||||
Ham_SC_Player_EnableCollisionWithPlayer,
|
Ham_SC_Player_EnableCollisionWithPlayer,
|
||||||
Ham_SC_Player_CanTouchPlayer,
|
Ham_SC_Player_CanTouchPlayer,
|
||||||
|
|
||||||
Ham_SC_Item_Materialize,
|
Ham_SC_Item_Materialize,
|
||||||
|
|
||||||
Ham_SC_Weapon_BulletAccuracy,
|
Ham_SC_Weapon_BulletAccuracy,
|
||||||
Ham_SC_Weapon_TertiaryAttack,
|
Ham_SC_Weapon_TertiaryAttack,
|
||||||
Ham_SC_Weapon_BurstSupplement,
|
Ham_SC_Weapon_BurstSupplement,
|
||||||
Ham_SC_Weapon_GetP_Model,
|
Ham_SC_Weapon_GetP_Model,
|
||||||
Ham_SC_Weapon_GetW_Model,
|
Ham_SC_Weapon_GetW_Model,
|
||||||
Ham_SC_Weapon_GetV_Model,
|
Ham_SC_Weapon_GetV_Model,
|
||||||
Ham_SC_Weapon_PrecacheCustomModels,
|
Ham_SC_Weapon_PrecacheCustomModels,
|
||||||
Ham_SC_Weapon_IsMultiplayer,
|
Ham_SC_Weapon_IsMultiplayer,
|
||||||
Ham_SC_Weapon_FRunfuncs,
|
Ham_SC_Weapon_FRunfuncs,
|
||||||
Ham_SC_Weapon_SetFOV,
|
Ham_SC_Weapon_SetFOV,
|
||||||
Ham_SC_Weapon_FCanRun,
|
Ham_SC_Weapon_FCanRun,
|
||||||
Ham_SC_Weapon_CustomDecrement,
|
Ham_SC_Weapon_CustomDecrement,
|
||||||
Ham_SC_Weapon_SetV_Model,
|
Ham_SC_Weapon_SetV_Model,
|
||||||
Ham_SC_Weapon_SetP_Model,
|
Ham_SC_Weapon_SetP_Model,
|
||||||
Ham_SC_Weapon_ChangeWeaponSkin,
|
Ham_SC_Weapon_ChangeWeaponSkin,
|
||||||
|
|
||||||
//
|
//
|
||||||
// New addition - 2013
|
// New addition - 2013
|
||||||
//
|
//
|
||||||
|
|
||||||
Ham_TFC_Killed,
|
Ham_TFC_Killed,
|
||||||
Ham_TFC_IsTriggered,
|
Ham_TFC_IsTriggered,
|
||||||
Ham_TFC_Weapon_SendWeaponAnim,
|
Ham_TFC_Weapon_SendWeaponAnim,
|
||||||
Ham_TFC_Weapon_GetNextAttackDelay,
|
Ham_TFC_Weapon_GetNextAttackDelay,
|
||||||
|
|
||||||
Ham_SC_TakeHealth,
|
Ham_SC_TakeHealth,
|
||||||
Ham_SC_TakeArmor,
|
Ham_SC_TakeArmor,
|
||||||
Ham_SC_GiveAmmo,
|
Ham_SC_GiveAmmo,
|
||||||
Ham_SC_CheckAttacker,
|
Ham_SC_CheckAttacker,
|
||||||
Ham_SC_Player_IsConnected,
|
Ham_SC_Player_IsConnected,
|
||||||
|
|
||||||
Ham_DOD_Weapon_SendWeaponAnim,
|
Ham_DOD_Weapon_SendWeaponAnim,
|
||||||
|
|
||||||
Ham_CS_Item_IsWeapon,
|
Ham_CS_Item_IsWeapon,
|
||||||
|
|
||||||
Ham_OPF_MySquadTalkMonsterPointer,
|
Ham_OPF_MySquadTalkMonsterPointer,
|
||||||
Ham_OPF_WeaponTimeBase,
|
Ham_OPF_WeaponTimeBase,
|
||||||
|
|
||||||
Ham_TS_Weapon_AlternateAttack,
|
Ham_TS_Weapon_AlternateAttack,
|
||||||
|
|
||||||
Ham_Item_GetItemInfo,
|
Ham_Item_GetItemInfo,
|
||||||
|
|
||||||
HAM_LAST_ENTRY_DONT_USE_ME_LOL
|
HAM_LAST_ENTRY_DONT_USE_ME_LOL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -114,21 +114,21 @@ inline int EntvarToIndex(entvars_t *pev)
|
||||||
return ENTINDEX_NEW(pev->pContainingEntity);
|
return ENTINDEX_NEW(pev->pContainingEntity);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline int EdictToIndex(edict_t *v)
|
inline int EdictToIndex(edict_t *v)
|
||||||
{
|
{
|
||||||
if (v==NULL)
|
if (v==NULL)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENTINDEX_NEW(v);
|
return ENTINDEX_NEW(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline edict_t *IndexToEdict(int index)
|
inline edict_t *IndexToEdict(int index)
|
||||||
{
|
{
|
||||||
return INDEXENT_NEW(index);
|
return INDEXENT_NEW(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline edict_t *EntvarToEdict(entvars_t *pev)
|
inline edict_t *EntvarToEdict(entvars_t *pev)
|
||||||
{
|
{
|
||||||
if (pev==NULL)
|
if (pev==NULL)
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
#include "Trampolines.h"
|
#include "Trampolines.h"
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
|
|
||||||
#define ALIGN(ar) ((intptr_t)ar & ~(sysconf(_SC_PAGESIZE)-1))
|
#define ALIGN(ar) ((intptr_t)ar & ~(sysconf(_SC_PAGESIZE)-1))
|
||||||
|
|
||||||
// This is just a simple container for data so I only have to add 1 extra
|
// This is just a simple container for data so I only have to add 1 extra
|
||||||
// parameter to calls that get trampolined
|
// parameter to calls that get trampolined
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public:
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
DWORD OldFlags;
|
DWORD OldFlags;
|
||||||
VirtualProtect(&ivtable[entry],sizeof(int*),PAGE_READWRITE,&OldFlags);
|
VirtualProtect(&ivtable[entry],sizeof(int*),PAGE_READWRITE,&OldFlags);
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
void *addr = (void *)ALIGN(&ivtable[entry]);
|
void *addr = (void *)ALIGN(&ivtable[entry]);
|
||||||
mprotect(addr,sysconf(_SC_PAGESIZE),PROT_READ|PROT_WRITE);
|
mprotect(addr,sysconf(_SC_PAGESIZE),PROT_READ|PROT_WRITE);
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -45,21 +45,21 @@ const bool RB_Int_Float_Int = false;
|
||||||
const int PC_Int_Float_Int = 2;
|
const int PC_Int_Float_Int = 2;
|
||||||
int Hook_Int_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
int Hook_Int_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
||||||
|
|
||||||
const bool RT_Int_Float_Int_Int = false;
|
const bool RT_Int_Float_Int_Int = false;
|
||||||
const bool RB_Int_Float_Int_Int = false;
|
const bool RB_Int_Float_Int_Int = false;
|
||||||
const int PC_Int_Float_Int_Int = 3;
|
const int PC_Int_Float_Int_Int = 3;
|
||||||
int Hook_Int_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2);
|
int Hook_Int_Float_Int_Int(Hook *hook, void *pthis, float f1, int i1, int i2);
|
||||||
|
|
||||||
const bool RT_Void_Entvar_Int = true;
|
const bool RT_Void_Entvar_Int = true;
|
||||||
const bool RB_Void_Entvar_Int = false;
|
const bool RB_Void_Entvar_Int = false;
|
||||||
const int PC_Void_Entvar_Int = 2;
|
const int PC_Void_Entvar_Int = 2;
|
||||||
void Hook_Void_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, int i1);
|
void Hook_Void_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, int i1);
|
||||||
|
|
||||||
const bool RT_Void_Entvar_Entvar_Int = true;
|
const bool RT_Void_Entvar_Entvar_Int = true;
|
||||||
const bool RB_Void_Entvar_Entvar_Int = false;
|
const bool RB_Void_Entvar_Entvar_Int = false;
|
||||||
const int PC_Void_Entvar_Entvar_Int = 3;
|
const int PC_Void_Entvar_Entvar_Int = 3;
|
||||||
void Hook_Void_Entvar_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, entvars_t *ev2, int i1);
|
void Hook_Void_Entvar_Entvar_Int(Hook *hook, void *ptis, entvars_t *ev1, entvars_t *ev2, int i1);
|
||||||
|
|
||||||
const bool RT_Int_Cbase = false;
|
const bool RT_Int_Cbase = false;
|
||||||
const bool RB_Int_Cbase = false;
|
const bool RB_Int_Cbase = false;
|
||||||
const int PC_Int_Cbase = 1;
|
const int PC_Int_Cbase = 1;
|
||||||
|
@ -76,9 +76,9 @@ const int PC_Int_Int_Str_Int = 3;
|
||||||
int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1,
|
int Hook_Int_Int_Str_Int(Hook *hook, void *pthis, int i1, const char *sz1,
|
||||||
int i2);
|
int i2);
|
||||||
|
|
||||||
const bool RT_Int_Int_Str_Int_Int = false;
|
const bool RT_Int_Int_Str_Int_Int = false;
|
||||||
const bool RB_Int_Int_Str_Int_Int = false;
|
const bool RB_Int_Int_Str_Int_Int = false;
|
||||||
const int PC_Int_Int_Str_Int_Int = 4;
|
const int PC_Int_Int_Str_Int_Int = 4;
|
||||||
int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i2, int i3);
|
int Hook_Int_Int_Str_Int_Int(Hook *hook, void *pthis, int i1, const char *sz1, int i2, int i3);
|
||||||
|
|
||||||
const bool RT_Int_Int = false;
|
const bool RT_Int_Int = false;
|
||||||
|
@ -118,15 +118,15 @@ const int PC_Void_Cbase_Cbase_Int_Float = 4;
|
||||||
void Hook_Void_Cbase_Cbase_Int_Float(Hook *hook, void *pthis, void *cb1,
|
void Hook_Void_Cbase_Cbase_Int_Float(Hook *hook, void *pthis, void *cb1,
|
||||||
void *cb2, int i1, float f1);
|
void *cb2, int i1, float f1);
|
||||||
|
|
||||||
const bool RT_Vector_Float_Cbase_Int = true;
|
const bool RT_Vector_Float_Cbase_Int = true;
|
||||||
const bool RB_Vector_Float_Cbase_Int = true;
|
const bool RB_Vector_Float_Cbase_Int = true;
|
||||||
const int PC_Vector_Float_Cbase_Int = 4;
|
const int PC_Vector_Float_Cbase_Int = 4;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
void Hook_Vector_Float_Cbase_Int(Hook *hook, void *pthis, Vector *out, float f1, void *cb, int i1);
|
void Hook_Vector_Float_Cbase_Int(Hook *hook, void *pthis, Vector *out, float f1, void *cb, int i1);
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
void Hook_Vector_Float_Cbase_Int(Hook *hook, Vector *out, void *pthis, float f1, void *cb, int i1);
|
void Hook_Vector_Float_Cbase_Int(Hook *hook, Vector *out, void *pthis, float f1, void *cb, int i1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const bool RT_Void_Entvar_Float_Vector_Trace_Int = true;
|
const bool RT_Void_Entvar_Float_Vector_Trace_Int = true;
|
||||||
const bool RB_Void_Entvar_Float_Vector_Trace_Int = false;
|
const bool RB_Void_Entvar_Float_Vector_Trace_Int = false;
|
||||||
const int PC_Void_Entvar_Float_Vector_Trace_Int = 7;
|
const int PC_Void_Entvar_Float_Vector_Trace_Int = 7;
|
||||||
|
@ -157,7 +157,7 @@ void *Hook_Cbase_Void(Hook *hook, void *pthis);
|
||||||
const bool RT_Vector_Void = true;
|
const bool RT_Vector_Void = true;
|
||||||
const bool RB_Vector_Void = true;
|
const bool RB_Vector_Void = true;
|
||||||
const int PC_Vector_Void = 1;
|
const int PC_Vector_Void = 1;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
void Hook_Vector_Void(Hook *hook, void *pthis, Vector *out);
|
void Hook_Vector_Void(Hook *hook, void *pthis, Vector *out);
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis);
|
void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis);
|
||||||
|
@ -166,7 +166,7 @@ void Hook_Vector_Void(Hook *hook, Vector *out, void *pthis);
|
||||||
const bool RT_Vector_pVector = true;
|
const bool RT_Vector_pVector = true;
|
||||||
const bool RB_Vector_pVector = true;
|
const bool RB_Vector_pVector = true;
|
||||||
const int PC_Vector_pVector = 2;
|
const int PC_Vector_pVector = 2;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
void Hook_Vector_pVector(Hook *hook, void *pthis, Vector *out, Vector *v1);
|
void Hook_Vector_pVector(Hook *hook, void *pthis, Vector *out, Vector *v1);
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1);
|
void Hook_Vector_pVector(Hook *hook, Vector *out, void *pthis, Vector *v1);
|
||||||
|
@ -209,290 +209,290 @@ const bool RB_Float_Void = false;
|
||||||
const int PC_Float_Void = 0;
|
const int PC_Float_Void = 0;
|
||||||
float Hook_Float_Void(Hook *hook, void *pthis);
|
float Hook_Float_Void(Hook *hook, void *pthis);
|
||||||
|
|
||||||
const bool RT_Float_Int = false;
|
const bool RT_Float_Int = false;
|
||||||
const bool RB_Float_Int = false;
|
const bool RB_Float_Int = false;
|
||||||
const int PC_Float_Int = 1;
|
const int PC_Float_Int = 1;
|
||||||
float Hook_Float_Int(Hook *hook, void *pthis, int i1);
|
float Hook_Float_Int(Hook *hook, void *pthis, int i1);
|
||||||
|
|
||||||
const bool RT_Void_Float_Int = true;
|
const bool RT_Void_Float_Int = true;
|
||||||
const bool RB_Void_Float_Int = false;
|
const bool RB_Void_Float_Int = false;
|
||||||
const int PC_Void_Float_Int = 2;
|
const int PC_Void_Float_Int = 2;
|
||||||
void Hook_Void_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
void Hook_Void_Float_Int(Hook *hook, void *pthis, float f1, int i1);
|
||||||
|
|
||||||
const bool RT_Float_Float_Cbase = true;
|
const bool RT_Float_Float_Cbase = true;
|
||||||
const bool RB_Float_Float_Cbase = false;
|
const bool RB_Float_Float_Cbase = false;
|
||||||
const int PC_Float_Float_Cbase = 2;
|
const int PC_Float_Float_Cbase = 2;
|
||||||
float Hook_Float_Float_Cbase(Hook *hook, void *pthis, float f1, void *cb1);
|
float Hook_Float_Float_Cbase(Hook *hook, void *pthis, float f1, void *cb1);
|
||||||
|
|
||||||
const bool RT_Void_Float = true;
|
|
||||||
const bool RB_Void_Float = false;
|
|
||||||
const int PC_Void_Float = 1;
|
|
||||||
void Hook_Void_Float(Hook *hook, void *pthis, float f1);
|
|
||||||
|
|
||||||
const bool RT_Void_Float_Float_Float_Int = true;
|
|
||||||
const bool RB_Void_Float_Float_Float_Int = false;
|
|
||||||
const int PC_Void_Float_Float_Float_Int = 4;
|
|
||||||
void Hook_Void_Float_Float_Float_Int(Hook *hook, void *pthis, float f1, float f2, float f3, int i1);
|
|
||||||
|
|
||||||
const bool RT_Vector_Float = true;
|
|
||||||
const bool RB_Vector_Float = true;
|
|
||||||
const int PC_Vector_Float = 2;
|
|
||||||
#if defined(_WIN32)
|
|
||||||
void Hook_Vector_Float(Hook *hook, void *pthis, Vector *out, float f1);
|
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
|
||||||
void Hook_Vector_Float(Hook *hook, Vector *out, void *pthis, float f1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const bool RT_Void_Float_Cbase = true;
|
|
||||||
const bool RB_Void_Float_Cbase = false;
|
|
||||||
const int PC_Void_Float_Cbase = 2;
|
|
||||||
void Hook_Void_Float_Cbase(Hook *hook, void *pthis, float f1, void *cb);
|
|
||||||
|
|
||||||
const bool RT_Int_Float_Float = false;
|
|
||||||
const bool RB_Int_Float_Float = false;
|
|
||||||
const int PC_Int_Float_Float = 2;
|
|
||||||
int Hook_Int_Float_Float(Hook *hook, void *pthis, float f1, float f2);
|
|
||||||
|
|
||||||
const bool RT_Int_Float = false;
|
|
||||||
const bool RB_Int_Float = false;
|
|
||||||
const int PC_Int_Float = 1;
|
|
||||||
int Hook_Int_Float(Hook *hook, void *pthis, float f1);
|
|
||||||
|
|
||||||
const bool RT_Int_Int_Int = false;
|
|
||||||
const bool RB_Int_Int_Int = false;
|
|
||||||
const int PC_Int_Int_Int = 2;
|
|
||||||
int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2);
|
|
||||||
|
|
||||||
const bool RT_Void_Str_Float_Float_Float = true;
|
|
||||||
const bool RB_Void_Str_Float_Float_Float = false;
|
|
||||||
const int PC_Void_Str_Float_Float_Float = 4;
|
|
||||||
void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3);
|
|
||||||
|
|
||||||
const bool RT_Void_Str_Float_Float_Float_Int_Cbase = true;
|
|
||||||
const bool RB_Void_Str_Float_Float_Float_Int_Cbase = false;
|
|
||||||
const int PC_Void_Str_Float_Float_Float_Int_Cbase = 6;
|
|
||||||
void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3, int i1, void *cb);
|
|
||||||
|
|
||||||
const bool RT_Int_Vector_Vector_Float_Float= false;
|
|
||||||
const bool RB_Int_Vector_Vector_Float_Float = false;
|
|
||||||
const int PC_Int_Vector_Vector_Float_Float = 8;
|
|
||||||
int Hook_Int_Vector_Vector_Float_Float(Hook *hook, void *pthis, Vector v1, Vector v2, float f1, float f2);
|
|
||||||
|
|
||||||
const bool RT_Int_Short = false;
|
|
||||||
const bool RB_Int_Short = false;
|
|
||||||
const int PC_Int_Short = 1;
|
|
||||||
int Hook_Int_Short(Hook *hook, void *pthis, short s1);
|
|
||||||
|
|
||||||
const bool RT_Void_Entvar_Entvar_Float_Int_Int = true;
|
|
||||||
const bool RB_Void_Entvar_Entvar_Float_Int_Int = false;
|
|
||||||
const int PC_Void_Entvar_Entvar_Float_Int_Int = 5;
|
|
||||||
void Hook_Void_Entvar_Entvar_Float_Int_Int(Hook *hook, void *pthis,
|
|
||||||
entvars_t *inflictor,
|
|
||||||
entvars_t *attacker, float damage,
|
|
||||||
int classignore, int damagebits);
|
|
||||||
|
|
||||||
const bool RT_Void_Vector_Entvar_Entvar_Float_Int_Int = true;
|
|
||||||
const bool RB_Void_Vector_Entvar_Entvar_Float_Int_Int = false;
|
|
||||||
const int PC_Void_Vector_Entvar_Entvar_Float_Int_Int = 8;
|
|
||||||
void Hook_Void_Vector_Entvar_Entvar_Float_Int_Int(Hook *hook, void *pthis,
|
|
||||||
Vector source,
|
|
||||||
entvars_t *inflictor,
|
|
||||||
entvars_t *attacker, float damage,
|
|
||||||
int classignore, int damagebits);
|
|
||||||
|
|
||||||
|
|
||||||
const bool RT_Float_Int_Float = false;
|
|
||||||
const bool RB_Float_Int_Float = false;
|
|
||||||
const int PC_Float_Int_Float = 2;
|
|
||||||
float Hook_Float_Int_Float(Hook *hook, void *pthis, int i1, float f2);
|
|
||||||
|
|
||||||
const bool RT_Int_Str = false;
|
|
||||||
const bool RB_Int_Str = false;
|
|
||||||
const int PC_Int_Str = 1;
|
|
||||||
int Hook_Int_Str(Hook *hook, void *pthis, const char *sz1);
|
|
||||||
|
|
||||||
const bool RT_Void_Edict = true;
|
|
||||||
const bool RB_Void_Edict = false;
|
|
||||||
const int PC_Void_Edict = 1;
|
|
||||||
void Hook_Void_Edict(Hook *hook, void *pthis, edict_t *ed1 );
|
|
||||||
|
|
||||||
const bool RT_Void_Int_Str_Bool = true;
|
const bool RT_Void_Float = true;
|
||||||
const bool RB_Void_Int_Str_Bool = false;
|
const bool RB_Void_Float = false;
|
||||||
const int PC_Void_Int_Str_Bool = 3;
|
const int PC_Void_Float = 1;
|
||||||
void Hook_Void_Int_Str_Bool(Hook *hook, void *pthis, int i1, const char *sz2, bool b3);
|
void Hook_Void_Float(Hook *hook, void *pthis, float f1);
|
||||||
|
|
||||||
const bool RT_Void_Vector_Vector= true;
|
const bool RT_Void_Float_Float_Float_Int = true;
|
||||||
const bool RB_Void_Vector_Vector = false;
|
const bool RB_Void_Float_Float_Float_Int = false;
|
||||||
const int PC_Void_Vector_Vector = 6;
|
const int PC_Void_Float_Float_Float_Int = 4;
|
||||||
void Hook_Void_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2);
|
void Hook_Void_Float_Float_Float_Int(Hook *hook, void *pthis, float f1, float f2, float f3, int i1);
|
||||||
|
|
||||||
const bool RT_Void_Str_Bool = true;
|
const bool RT_Vector_Float = true;
|
||||||
const bool RB_Void_Str_Bool = false;
|
const bool RB_Vector_Float = true;
|
||||||
const int PC_Void_Str_Bool = 2;
|
const int PC_Vector_Float = 2;
|
||||||
void Hook_Void_Str_Bool(Hook *hook, void *pthis, const char *sz1, bool b2);
|
#if defined(_WIN32)
|
||||||
|
void Hook_Vector_Float(Hook *hook, void *pthis, Vector *out, float f1);
|
||||||
const bool RT_Int_Str_Str_Int_Str_Int_Int = false;
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
const bool RB_Int_Str_Str_Int_Str_Int_Int = false;
|
void Hook_Vector_Float(Hook *hook, Vector *out, void *pthis, float f1);
|
||||||
const int PC_Int_Str_Str_Int_Str_Int_Int = 6;
|
#endif
|
||||||
int Hook_Int_Str_Str_Int_Str_Int_Int(Hook *hook, void *pthis, const char *sz1, const char *sz2, int i1, const char *sz3, int i2, int i3);
|
|
||||||
|
const bool RT_Void_Float_Cbase = true;
|
||||||
const bool RT_Int_Int_Int_Float_Int = false;
|
const bool RB_Void_Float_Cbase = false;
|
||||||
const bool RB_Int_Int_Int_Float_Int = false;
|
const int PC_Void_Float_Cbase = 2;
|
||||||
const int PC_Int_Int_Int_Float_Int = 4;
|
void Hook_Void_Float_Cbase(Hook *hook, void *pthis, float f1, void *cb);
|
||||||
int Hook_Int_Int_Int_Float_Int(Hook *hook, void *pthis, int i1, int i2, float f1, int i3);
|
|
||||||
|
const bool RT_Int_Float_Float = false;
|
||||||
const bool RT_Void_Str_Int = true;
|
const bool RB_Int_Float_Float = false;
|
||||||
const bool RB_Void_Str_Int = false;
|
const int PC_Int_Float_Float = 2;
|
||||||
const int PC_Void_Str_Int = 2;
|
int Hook_Int_Float_Float(Hook *hook, void *pthis, float f1, float f2);
|
||||||
void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2);
|
|
||||||
|
const bool RT_Int_Float = false;
|
||||||
const bool RT_Void_Cbase_Int = true;
|
const bool RB_Int_Float = false;
|
||||||
const bool RB_Void_Cbase_Int = false;
|
const int PC_Int_Float = 1;
|
||||||
const int PC_Void_Cbase_Int = 2;
|
int Hook_Int_Float(Hook *hook, void *pthis, float f1);
|
||||||
void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1);
|
|
||||||
|
const bool RT_Int_Int_Int = false;
|
||||||
const bool RT_Void_Str = true;
|
const bool RB_Int_Int_Int = false;
|
||||||
const bool RB_Void_Str = false;
|
const int PC_Int_Int_Int = 2;
|
||||||
const int PC_Void_Str = 1;
|
int Hook_Int_Int_Int(Hook *hook, void *pthis, int i1, int i2);
|
||||||
void Hook_Void_Str(Hook *hook, void *pthis, const char *sz1);
|
|
||||||
|
const bool RT_Void_Str_Float_Float_Float = true;
|
||||||
const bool RT_Void_Vector = true;
|
const bool RB_Void_Str_Float_Float_Float = false;
|
||||||
const bool RB_Void_Vector = false;
|
const int PC_Void_Str_Float_Float_Float = 4;
|
||||||
const int PC_Void_Vector = 3;
|
void Hook_Void_Str_Float_Float_Float(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3);
|
||||||
void Hook_Void_Vector(Hook *hook, void *pthis, Vector v1);
|
|
||||||
|
const bool RT_Void_Str_Float_Float_Float_Int_Cbase = true;
|
||||||
const bool RT_Int_Str_Vector_Str = false;
|
const bool RB_Void_Str_Float_Float_Float_Int_Cbase = false;
|
||||||
const bool RB_Int_Str_Vector_Str = false;
|
const int PC_Void_Str_Float_Float_Float_Int_Cbase = 6;
|
||||||
const int PC_Int_Str_Vector_Str = 5;
|
void Hook_Void_Str_Float_Float_Float_Int_Cbase(Hook *hook, void *pthis, const char *sz1, float f1, float f2, float f3, int i1, void *cb);
|
||||||
int Hook_Int_Str_Vector_Str(Hook *hook, void *pthis, const char *sz1, Vector v2, const char *sz2);
|
|
||||||
|
const bool RT_Int_Vector_Vector_Float_Float= false;
|
||||||
const bool RT_Int_Str_Str = false;
|
const bool RB_Int_Vector_Vector_Float_Float = false;
|
||||||
const bool RB_Int_Str_Str = false;
|
const int PC_Int_Vector_Vector_Float_Float = 8;
|
||||||
const int PC_Int_Str_Str = 2;
|
int Hook_Int_Vector_Vector_Float_Float(Hook *hook, void *pthis, Vector v1, Vector v2, float f1, float f2);
|
||||||
int Hook_Int_Str_Str(Hook *hook, void *pthis, const char *sz1, const char *sz2);
|
|
||||||
|
const bool RT_Int_Short = false;
|
||||||
const bool RT_Void_Float_Float = true;
|
const bool RB_Int_Short = false;
|
||||||
const bool RB_Void_Float_Float = false;
|
const int PC_Int_Short = 1;
|
||||||
const int PC_Void_Float_Float = 2;
|
int Hook_Int_Short(Hook *hook, void *pthis, short s1);
|
||||||
void Hook_Void_Float_Float(Hook *hook, void *pthis, float f1, float f2);
|
|
||||||
|
const bool RT_Void_Entvar_Entvar_Float_Int_Int = true;
|
||||||
const bool RT_Void_Str_Str_Int = true;
|
const bool RB_Void_Entvar_Entvar_Float_Int_Int = false;
|
||||||
const bool RB_Void_Str_Str_Int = false;
|
const int PC_Void_Entvar_Entvar_Float_Int_Int = 5;
|
||||||
const int PC_Void_Str_Str_Int = 3;
|
void Hook_Void_Entvar_Entvar_Float_Int_Int(Hook *hook, void *pthis,
|
||||||
void Hook_Void_Str_Str_Int(Hook *hook, void *pthis, const char *sz1, const char *sz2, int i3);
|
entvars_t *inflictor,
|
||||||
|
entvars_t *attacker, float damage,
|
||||||
const bool RT_Int_pVector_pVector_Cbase_pFloat = false;
|
int classignore, int damagebits);
|
||||||
const bool RB_Int_pVector_pVector_Cbase_pFloat = false;
|
|
||||||
const int PC_Int_pVector_pVector_Cbase_pFloat = 4;
|
const bool RT_Void_Vector_Entvar_Entvar_Float_Int_Int = true;
|
||||||
int Hook_Int_pVector_pVector_Cbase_pFloat(Hook *hook, void *pthis, Vector *v1, Vector *v2, void* cb, float* fl);
|
const bool RB_Void_Vector_Entvar_Entvar_Float_Int_Int = false;
|
||||||
|
const int PC_Void_Vector_Entvar_Entvar_Float_Int_Int = 8;
|
||||||
const bool RT_Void_Cbase_pVector_Float = true;
|
void Hook_Void_Vector_Entvar_Entvar_Float_Int_Int(Hook *hook, void *pthis,
|
||||||
const bool RB_Void_Cbase_pVector_Float = false;
|
Vector source,
|
||||||
const int PC_Void_Cbase_pVector_Float = 3;
|
entvars_t *inflictor,
|
||||||
void Hook_Void_Cbase_pVector_Float(Hook *hook, void *pthis, void *p1, Vector *v1, float fl);
|
entvars_t *attacker, float damage,
|
||||||
|
int classignore, int damagebits);
|
||||||
const bool RT_Int_pVector_pVector_Float_Cbase_pVector = false;
|
|
||||||
const bool RB_Int_pVector_pVector_Float_Cbase_pVector = false;
|
|
||||||
const int PC_Int_pVector_pVector_Float_Cbase_pVector = 5;
|
const bool RT_Float_Int_Float = false;
|
||||||
int Hook_Int_pVector_pVector_Float_Cbase_pVector(Hook *hook, void *pthis, Vector *v1, Vector *v2, float fl, void* cb, Vector *v3);
|
const bool RB_Float_Int_Float = false;
|
||||||
|
const int PC_Float_Int_Float = 2;
|
||||||
const bool RT_Int_Cbase_Bool = false;
|
float Hook_Float_Int_Float(Hook *hook, void *pthis, int i1, float f2);
|
||||||
const bool RB_Int_Cbase_Bool = false;
|
|
||||||
const int PC_Int_Cbase_Bool = 2;
|
const bool RT_Int_Str = false;
|
||||||
int Hook_Int_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1);
|
const bool RB_Int_Str = false;
|
||||||
|
const int PC_Int_Str = 1;
|
||||||
const bool RT_Int_Vector_Vector = false;
|
int Hook_Int_Str(Hook *hook, void *pthis, const char *sz1);
|
||||||
const bool RB_Int_Vector_Vector = false;
|
|
||||||
const int PC_Int_Vector_Vector = 6;
|
const bool RT_Void_Edict = true;
|
||||||
int Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2);
|
const bool RB_Void_Edict = false;
|
||||||
|
const int PC_Void_Edict = 1;
|
||||||
const bool RT_Int_Entvar_Float = false;
|
void Hook_Void_Edict(Hook *hook, void *pthis, edict_t *ed1 );
|
||||||
const bool RB_Int_Entvar_Float = false;
|
|
||||||
const int PC_Int_Entvar_Float = 2;
|
const bool RT_Void_Int_Str_Bool = true;
|
||||||
int Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1);
|
const bool RB_Void_Int_Str_Bool = false;
|
||||||
|
const int PC_Void_Int_Str_Bool = 3;
|
||||||
const bool RT_Float_Float = false;
|
void Hook_Void_Int_Str_Bool(Hook *hook, void *pthis, int i1, const char *sz2, bool b3);
|
||||||
const bool RB_Float_Float = false;
|
|
||||||
const int PC_Float_Float = 1;
|
const bool RT_Void_Vector_Vector= true;
|
||||||
float Hook_Float_Float(Hook *hook, void *pthis, float f1);
|
const bool RB_Void_Vector_Vector = false;
|
||||||
|
const int PC_Void_Vector_Vector = 6;
|
||||||
const bool RT_Void_Entvar_Entvar_Float = true;
|
void Hook_Void_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2);
|
||||||
const bool RB_Void_Entvar_Entvar_Float = false;
|
|
||||||
const int PC_Void_Entvar_Entvar_Float = 3;
|
const bool RT_Void_Str_Bool = true;
|
||||||
void Hook_Void_Entvar_Entvar_Float(Hook *hook, void *pthis, entvars_t *attacker, entvars_t *inflictor, float damage);
|
const bool RB_Void_Str_Bool = false;
|
||||||
|
const int PC_Void_Str_Bool = 2;
|
||||||
const bool RT_Bool_Void = false;
|
void Hook_Void_Str_Bool(Hook *hook, void *pthis, const char *sz1, bool b2);
|
||||||
const bool RB_Bool_Void = false;
|
|
||||||
const int PC_Bool_Void = 0;
|
const bool RT_Int_Str_Str_Int_Str_Int_Int = false;
|
||||||
bool Hook_Bool_Void(Hook *hook, void *pthis);
|
const bool RB_Int_Str_Str_Int_Str_Int_Int = false;
|
||||||
|
const int PC_Int_Str_Str_Int_Str_Int_Int = 6;
|
||||||
const bool RT_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = false;
|
int Hook_Int_Str_Str_Int_Str_Int_Int(Hook *hook, void *pthis, const char *sz1, const char *sz2, int i1, const char *sz3, int i2, int i3);
|
||||||
const bool RB_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = false;
|
|
||||||
const int PC_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = 7;
|
const bool RT_Int_Int_Int_Float_Int = false;
|
||||||
int Hook_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(Hook *hook, void *pthis, Vector *v1, Vector *v2, float fl, void* cb, Vector *v3, Vector *v4, bool b1);
|
const bool RB_Int_Int_Int_Float_Int = false;
|
||||||
|
const int PC_Int_Int_Int_Float_Int = 4;
|
||||||
const bool RT_Int_Vector_Cbase = false;
|
int Hook_Int_Int_Int_Float_Int(Hook *hook, void *pthis, int i1, int i2, float f1, int i3);
|
||||||
const bool RB_Int_Vector_Cbase = false;
|
|
||||||
const int PC_Int_Vector_Cbase = 4;
|
const bool RT_Void_Str_Int = true;
|
||||||
int Hook_Int_Vector_Cbase(Hook *hook, void *pthis, Vector v1, void *cb);
|
const bool RB_Void_Str_Int = false;
|
||||||
|
const int PC_Void_Str_Int = 2;
|
||||||
const bool RT_Int_Vector= false;
|
void Hook_Void_Str_Int(Hook *hook, void *pthis, const char *sz1, int i2);
|
||||||
const bool RB_Int_Vector = false;
|
|
||||||
const int PC_Int_Vector = 3;
|
const bool RT_Void_Cbase_Int = true;
|
||||||
int Hook_Int_Vector(Hook *hook, void *pthis, Vector v1);
|
const bool RB_Void_Cbase_Int = false;
|
||||||
|
const int PC_Void_Cbase_Int = 2;
|
||||||
const bool RT_Int_Cbase_pVector = false;
|
void Hook_Void_Cbase_Int(Hook *hook, void *pthis, void *p1, int i1);
|
||||||
const bool RB_Int_Cbase_pVector = false;
|
|
||||||
const int PC_Int_Cbase_pVector = 2;
|
const bool RT_Void_Str = true;
|
||||||
int Hook_Int_Cbase_pVector(Hook *hook, void *pthis, void *cb1, Vector *v1);
|
const bool RB_Void_Str = false;
|
||||||
|
const int PC_Void_Str = 1;
|
||||||
const bool RT_Void_Bool = true;
|
void Hook_Void_Str(Hook *hook, void *pthis, const char *sz1);
|
||||||
const bool RB_Void_Bool = false;
|
|
||||||
const int PC_Void_Bool = 1;
|
const bool RT_Void_Vector = true;
|
||||||
void Hook_Void_Bool(Hook *hook, void *pthis, bool b1);
|
const bool RB_Void_Vector = false;
|
||||||
|
const int PC_Void_Vector = 3;
|
||||||
const bool RT_Bool_Cbase = false;
|
void Hook_Void_Vector(Hook *hook, void *pthis, Vector v1);
|
||||||
const bool RB_Bool_Cbase = false;
|
|
||||||
const int PC_Bool_Cbase = 1;
|
const bool RT_Int_Str_Vector_Str = false;
|
||||||
bool Hook_Bool_Cbase(Hook *hook, void *pthis, void *cb);
|
const bool RB_Int_Str_Vector_Str = false;
|
||||||
|
const int PC_Int_Str_Vector_Str = 5;
|
||||||
const bool RT_Bool_Int = false;
|
int Hook_Int_Str_Vector_Str(Hook *hook, void *pthis, const char *sz1, Vector v2, const char *sz2);
|
||||||
const bool RB_Bool_Int = false;
|
|
||||||
const int PC_Bool_Int = 1;
|
const bool RT_Int_Str_Str = false;
|
||||||
bool Hook_Bool_Int(Hook *hook, void *pthis, int i1);
|
const bool RB_Int_Str_Str = false;
|
||||||
|
const int PC_Int_Str_Str = 2;
|
||||||
const bool RT_Void_Cbase_Float = true;
|
int Hook_Int_Str_Str(Hook *hook, void *pthis, const char *sz1, const char *sz2);
|
||||||
const bool RB_Void_Cbase_Float = false;
|
|
||||||
const int PC_Void_Cbase_Float = 2;
|
const bool RT_Void_Float_Float = true;
|
||||||
void Hook_Void_Cbase_Float(Hook *hook, void *pthis, void *p1, float f1);
|
const bool RB_Void_Float_Float = false;
|
||||||
|
const int PC_Void_Float_Float = 2;
|
||||||
const bool RT_Void_Cbase_Bool = true;
|
void Hook_Void_Float_Float(Hook *hook, void *pthis, float f1, float f2);
|
||||||
const bool RB_Void_Cbase_Bool = false;
|
|
||||||
const int PC_Void_Cbase_Bool = 2;
|
const bool RT_Void_Str_Str_Int = true;
|
||||||
void Hook_Void_Cbase_Bool(Hook *hook, void *pthis, void *p1, bool b1);
|
const bool RB_Void_Str_Str_Int = false;
|
||||||
|
const int PC_Void_Str_Str_Int = 3;
|
||||||
const bool RT_Vector_Vector_Vector_Vector = true;
|
void Hook_Void_Str_Str_Int(Hook *hook, void *pthis, const char *sz1, const char *sz2, int i3);
|
||||||
const bool RB_Vector_Vector_Vector_Vector = true;
|
|
||||||
const int PC_Vector_Vector_Vector_Vector = 10;
|
const bool RT_Int_pVector_pVector_Cbase_pFloat = false;
|
||||||
#if defined(_WIN32)
|
const bool RB_Int_pVector_pVector_Cbase_pFloat = false;
|
||||||
void Hook_Vector_Vector_Vector_Vector(Hook *hook, void *pthis, Vector *out, Vector v1, Vector v2, Vector v3);
|
const int PC_Int_pVector_pVector_Cbase_pFloat = 4;
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
int Hook_Int_pVector_pVector_Cbase_pFloat(Hook *hook, void *pthis, Vector *v1, Vector *v2, void* cb, float* fl);
|
||||||
void Hook_Vector_Vector_Vector_Vector(Hook *hook, Vector *out, void *pthis, Vector v1, Vector v2, Vector v3);
|
|
||||||
#endif
|
const bool RT_Void_Cbase_pVector_Float = true;
|
||||||
|
const bool RB_Void_Cbase_pVector_Float = false;
|
||||||
const bool RT_Str_Str = false;
|
const int PC_Void_Cbase_pVector_Float = 3;
|
||||||
const bool RB_Str_Str = false;
|
void Hook_Void_Cbase_pVector_Float(Hook *hook, void *pthis, void *p1, Vector *v1, float fl);
|
||||||
const int PC_Str_Str = 1;
|
|
||||||
const char *Hook_Str_Str(Hook *hook, void *pthis, const char* str);
|
const bool RT_Int_pVector_pVector_Float_Cbase_pVector = false;
|
||||||
|
const bool RB_Int_pVector_pVector_Float_Cbase_pVector = false;
|
||||||
const bool RT_Void_Short = true;
|
const int PC_Int_pVector_pVector_Float_Cbase_pVector = 5;
|
||||||
const bool RB_Void_Short = false;
|
int Hook_Int_pVector_pVector_Float_Cbase_pVector(Hook *hook, void *pthis, Vector *v1, Vector *v2, float fl, void* cb, Vector *v3);
|
||||||
const int PC_Void_Short = 1;
|
|
||||||
void Hook_Void_Short(Hook *hook, void *pthis, short i1);
|
const bool RT_Int_Cbase_Bool = false;
|
||||||
|
const bool RB_Int_Cbase_Bool = false;
|
||||||
|
const int PC_Int_Cbase_Bool = 2;
|
||||||
const bool RT_Deprecated = true;
|
int Hook_Int_Cbase_Bool(Hook *hook, void *pthis, void *cb1, bool b1);
|
||||||
const bool RB_Deprecated = false;
|
|
||||||
const int PC_Deprecated = 0;
|
const bool RT_Int_Vector_Vector = false;
|
||||||
void Hook_Deprecated(Hook* hook);
|
const bool RB_Int_Vector_Vector = false;
|
||||||
|
const int PC_Int_Vector_Vector = 6;
|
||||||
|
int Hook_Int_Vector_Vector(Hook *hook, void *pthis, Vector v1, Vector v2);
|
||||||
|
|
||||||
|
const bool RT_Int_Entvar_Float = false;
|
||||||
|
const bool RB_Int_Entvar_Float = false;
|
||||||
|
const int PC_Int_Entvar_Float = 2;
|
||||||
|
int Hook_Int_Entvar_Float(Hook *hook, void *pthis, entvars_t *ev1, float f1);
|
||||||
|
|
||||||
|
const bool RT_Float_Float = false;
|
||||||
|
const bool RB_Float_Float = false;
|
||||||
|
const int PC_Float_Float = 1;
|
||||||
|
float Hook_Float_Float(Hook *hook, void *pthis, float f1);
|
||||||
|
|
||||||
|
const bool RT_Void_Entvar_Entvar_Float = true;
|
||||||
|
const bool RB_Void_Entvar_Entvar_Float = false;
|
||||||
|
const int PC_Void_Entvar_Entvar_Float = 3;
|
||||||
|
void Hook_Void_Entvar_Entvar_Float(Hook *hook, void *pthis, entvars_t *attacker, entvars_t *inflictor, float damage);
|
||||||
|
|
||||||
|
const bool RT_Bool_Void = false;
|
||||||
|
const bool RB_Bool_Void = false;
|
||||||
|
const int PC_Bool_Void = 0;
|
||||||
|
bool Hook_Bool_Void(Hook *hook, void *pthis);
|
||||||
|
|
||||||
|
const bool RT_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = false;
|
||||||
|
const bool RB_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = false;
|
||||||
|
const int PC_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool = 7;
|
||||||
|
int Hook_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(Hook *hook, void *pthis, Vector *v1, Vector *v2, float fl, void* cb, Vector *v3, Vector *v4, bool b1);
|
||||||
|
|
||||||
|
const bool RT_Int_Vector_Cbase = false;
|
||||||
|
const bool RB_Int_Vector_Cbase = false;
|
||||||
|
const int PC_Int_Vector_Cbase = 4;
|
||||||
|
int Hook_Int_Vector_Cbase(Hook *hook, void *pthis, Vector v1, void *cb);
|
||||||
|
|
||||||
|
const bool RT_Int_Vector= false;
|
||||||
|
const bool RB_Int_Vector = false;
|
||||||
|
const int PC_Int_Vector = 3;
|
||||||
|
int Hook_Int_Vector(Hook *hook, void *pthis, Vector v1);
|
||||||
|
|
||||||
|
const bool RT_Int_Cbase_pVector = false;
|
||||||
|
const bool RB_Int_Cbase_pVector = false;
|
||||||
|
const int PC_Int_Cbase_pVector = 2;
|
||||||
|
int Hook_Int_Cbase_pVector(Hook *hook, void *pthis, void *cb1, Vector *v1);
|
||||||
|
|
||||||
|
const bool RT_Void_Bool = true;
|
||||||
|
const bool RB_Void_Bool = false;
|
||||||
|
const int PC_Void_Bool = 1;
|
||||||
|
void Hook_Void_Bool(Hook *hook, void *pthis, bool b1);
|
||||||
|
|
||||||
|
const bool RT_Bool_Cbase = false;
|
||||||
|
const bool RB_Bool_Cbase = false;
|
||||||
|
const int PC_Bool_Cbase = 1;
|
||||||
|
bool Hook_Bool_Cbase(Hook *hook, void *pthis, void *cb);
|
||||||
|
|
||||||
|
const bool RT_Bool_Int = false;
|
||||||
|
const bool RB_Bool_Int = false;
|
||||||
|
const int PC_Bool_Int = 1;
|
||||||
|
bool Hook_Bool_Int(Hook *hook, void *pthis, int i1);
|
||||||
|
|
||||||
|
const bool RT_Void_Cbase_Float = true;
|
||||||
|
const bool RB_Void_Cbase_Float = false;
|
||||||
|
const int PC_Void_Cbase_Float = 2;
|
||||||
|
void Hook_Void_Cbase_Float(Hook *hook, void *pthis, void *p1, float f1);
|
||||||
|
|
||||||
|
const bool RT_Void_Cbase_Bool = true;
|
||||||
|
const bool RB_Void_Cbase_Bool = false;
|
||||||
|
const int PC_Void_Cbase_Bool = 2;
|
||||||
|
void Hook_Void_Cbase_Bool(Hook *hook, void *pthis, void *p1, bool b1);
|
||||||
|
|
||||||
|
const bool RT_Vector_Vector_Vector_Vector = true;
|
||||||
|
const bool RB_Vector_Vector_Vector_Vector = true;
|
||||||
|
const int PC_Vector_Vector_Vector_Vector = 10;
|
||||||
|
#if defined(_WIN32)
|
||||||
|
void Hook_Vector_Vector_Vector_Vector(Hook *hook, void *pthis, Vector *out, Vector v1, Vector v2, Vector v3);
|
||||||
|
#elif defined(__linux__) || defined(__APPLE__)
|
||||||
|
void Hook_Vector_Vector_Vector_Vector(Hook *hook, Vector *out, void *pthis, Vector v1, Vector v2, Vector v3);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const bool RT_Str_Str = false;
|
||||||
|
const bool RB_Str_Str = false;
|
||||||
|
const int PC_Str_Str = 1;
|
||||||
|
const char *Hook_Str_Str(Hook *hook, void *pthis, const char* str);
|
||||||
|
|
||||||
|
const bool RT_Void_Short = true;
|
||||||
|
const bool RB_Void_Short = false;
|
||||||
|
const int PC_Void_Short = 1;
|
||||||
|
void Hook_Void_Short(Hook *hook, void *pthis, short i1);
|
||||||
|
|
||||||
|
|
||||||
|
const bool RT_Deprecated = true;
|
||||||
|
const bool RB_Deprecated = false;
|
||||||
|
const int PC_Deprecated = 0;
|
||||||
|
void Hook_Deprecated(Hook* hook);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,20 +38,20 @@ int Create_Int_Float_Int(AMX *amx, const char *func)
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Float_Int_Int(AMX *amx, const char *func)
|
int Create_Int_Float_Int_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Entvar_Int(AMX *amx, const char *func)
|
int Create_Void_Entvar_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Entvar_Entvar_Int(AMX *amx, const char *func)
|
int Create_Void_Entvar_Entvar_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Cbase(AMX *amx, const char *func)
|
int Create_Int_Cbase(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
|
@ -68,9 +68,9 @@ int Create_Int_Int_Str_Int(AMX *amx, const char *func)
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Int_Str_Int_Int(AMX *amx, const char *func)
|
int Create_Int_Int_Str_Int_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Int(AMX *amx, const char *func)
|
int Create_Int_Int(AMX *amx, const char *func)
|
||||||
|
@ -103,11 +103,11 @@ int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func)
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Vector_Float_Cbase_Int(AMX* amx, const char* func)
|
int Create_Vector_Float_Cbase_Int(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func)
|
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_ARRAY, FP_CELL, FP_CELL, FP_DONE);
|
||||||
|
@ -157,289 +157,289 @@ int Create_Void_Entvar_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Int_Int_Int(AMX *amx, const char *func)
|
int Create_Void_Int_Int_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_ItemInfo(AMX *amx, const char *func)
|
int Create_Void_ItemInfo(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Float_Void(AMX *amx, const char *func)
|
int Create_Float_Void(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Float_Int(AMX *amx, const char *func)
|
int Create_Float_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Float_Int(AMX* amx, const char* func)
|
int Create_Void_Float_Int(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Float_Float_Cbase(AMX* amx, const char* func)
|
int Create_Float_Float_Cbase(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Float(AMX* amx, const char* func)
|
int Create_Void_Float(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Float_Float_Float_Int(AMX* amx, const char* func)
|
int Create_Void_Float_Float_Float_Int(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Vector_Float(AMX* amx, const char* func)
|
int Create_Vector_Float(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Float_Cbase(AMX* amx, const char* func)
|
int Create_Void_Float_Cbase(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Float_Float(AMX* amx, const char* func)
|
int Create_Int_Float_Float(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Float(AMX* amx, const char* func)
|
int Create_Int_Float(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Int_Int(AMX* amx, const char* func)
|
int Create_Int_Int_Int(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Str_Float_Float_Float(AMX *amx, const char *func)
|
int Create_Void_Str_Float_Float_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func)
|
int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_FLOAT, FP_FLOAT, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Vector_Vector_Float_Float(AMX *amx, const char *func)
|
int Create_Int_Vector_Vector_Float_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Short(AMX* amx, const char* func)
|
int Create_Int_Short(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func)
|
int Create_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func)
|
int Create_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Float_Int_Float(AMX *amx, const char *func)
|
int Create_Float_Int_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Str(AMX *amx, const char *func)
|
int Create_Int_Str(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Edict(AMX *amx, const char *func)
|
int Create_Void_Edict(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Int_Str_Bool(AMX *amx, const char *func)
|
int Create_Void_Int_Str_Bool(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Vector_Vector(AMX *amx, const char *func)
|
int Create_Void_Vector_Vector(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Str_Bool(AMX *amx, const char *func)
|
int Create_Void_Str_Bool(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Str_Str_Int_Str_Int_Int(AMX *amx, const char *func)
|
int Create_Int_Str_Str_Int_Str_Int_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_STRING, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Int_Int_Float_Int(AMX *amx, const char *func)
|
int Create_Int_Int_Int_Float_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Str_Int(AMX *amx, const char *func)
|
int Create_Void_Str_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Cbase_Int(AMX *amx, const char *func)
|
int Create_Void_Cbase_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Str(AMX *amx, const char *func)
|
int Create_Void_Str(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Vector(AMX *amx, const char *func)
|
int Create_Void_Vector(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Str_Vector_Str(AMX *amx, const char *func)
|
int Create_Int_Str_Vector_Str(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_ARRAY, FP_STRING, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_ARRAY, FP_STRING, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Str_Str(AMX *amx, const char *func)
|
int Create_Int_Str_Str(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Float_Float(AMX *amx, const char *func)
|
int Create_Void_Float_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Str_Str_Int(AMX *amx, const char *func)
|
int Create_Void_Str_Str_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_STRING, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_pVector_pVector_Cbase_pFloat(AMX *amx, const char *func)
|
int Create_Int_pVector_pVector_Cbase_pFloat(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Cbase_pVector_Float(AMX *amx, const char *func)
|
int Create_Void_Cbase_pVector_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_ARRAY, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_ARRAY, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_pVector_pVector_Float_Cbase_pVector(AMX *amx, const char *func)
|
int Create_Int_pVector_pVector_Float_Cbase_pVector(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_CELL, FP_ARRAY, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_CELL, FP_ARRAY, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Cbase_Bool(AMX *amx, const char *func)
|
int Create_Int_Cbase_Bool(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Vector_Vector(AMX *amx, const char *func)
|
int Create_Int_Vector_Vector(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Entvar_Float(AMX *amx, const char *func)
|
int Create_Int_Entvar_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Float_Float(AMX *amx, const char *func)
|
int Create_Float_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Entvar_Entvar_Float(AMX *amx, const char *func)
|
int Create_Void_Entvar_Entvar_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Bool_Void(AMX *amx, const char *func)
|
int Create_Bool_Void(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX *amx, const char *func)
|
int Create_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_FLOAT, FP_CELL, FP_ARRAY, FP_ARRAY, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Vector_Cbase(AMX *amx, const char *func)
|
int Create_Int_Vector_Cbase(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Vector(AMX *amx, const char *func)
|
int Create_Int_Vector(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Int_Cbase_pVector(AMX *amx, const char *func)
|
int Create_Int_Cbase_pVector(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_ARRAY, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_ARRAY, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Bool(AMX *amx, const char *func)
|
int Create_Void_Bool(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Bool_Cbase(AMX *amx, const char *func)
|
int Create_Bool_Cbase(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Bool_Int(AMX *amx, const char *func)
|
int Create_Bool_Int(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Cbase_Float(AMX *amx, const char *func)
|
int Create_Void_Cbase_Float(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_FLOAT, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Cbase_Bool(AMX *amx, const char *func)
|
int Create_Void_Cbase_Bool(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Vector_Vector_Vector_Vector(AMX *amx, const char *func)
|
int Create_Vector_Vector_Vector_Vector(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_ARRAY, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_ARRAY, FP_ARRAY, FP_ARRAY, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Str_Str(AMX *amx, const char *func)
|
int Create_Str_Str(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_STRING, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Create_Void_Short(AMX *amx, const char *func)
|
int Create_Void_Short(AMX *amx, const char *func)
|
||||||
{
|
{
|
||||||
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
return MF_RegisterSPForwardByName(amx, func, FP_CELL, FP_CELL, FP_DONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Create_Deprecated(AMX* amx, const char* func)
|
int Create_Deprecated(AMX* amx, const char* func)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -24,13 +24,13 @@ int Create_Void_Entvar(AMX *amx, const char *func);
|
||||||
int Create_Void_Cbase(AMX *amx, const char *func);
|
int Create_Void_Cbase(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Float_Int(AMX *amx, const char *func);
|
int Create_Int_Float_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Float_Int_Int(AMX *amx, const char *func);
|
int Create_Int_Float_Int_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Entvar_Int(AMX *amx, const char *func);
|
int Create_Void_Entvar_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Entvar_Entvar_Int(AMX *amx, const char *func);
|
int Create_Void_Entvar_Entvar_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Cbase(AMX *amx, const char *func);
|
int Create_Int_Cbase(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Int_Int(AMX *amx, const char *func);
|
int Create_Void_Int_Int(AMX *amx, const char *func);
|
||||||
|
@ -49,8 +49,8 @@ int Create_Int_Entvar_Entvar_Float_Float_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Int(AMX *amx, const char *func);
|
int Create_Void_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Vector_Float_Cbase_Int(AMX *amx, const char *func);
|
int Create_Vector_Float_Cbase_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func);
|
int Create_Void_Cbase_Cbase_Int_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func);
|
int Create_Void_Entvar_Float_Vector_Trace_Int(AMX *amx, const char *func);
|
||||||
|
@ -79,112 +79,112 @@ int Create_Void_ItemInfo(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Float_Void(AMX *amx, const char *func);
|
int Create_Float_Void(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Float_Int(AMX *amx, const char *func);
|
int Create_Float_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Float_Int(AMX *amx, const char *func);
|
int Create_Void_Float_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Float_Float_Cbase(AMX *amx, const char *func);
|
int Create_Float_Float_Cbase(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Float(AMX *amx, const char *func);
|
int Create_Void_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Float_Float_Float_Int(AMX *amx, const char *func);
|
int Create_Void_Float_Float_Float_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Vector_Float(AMX *amx, const char *func);
|
int Create_Vector_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Float_Cbase(AMX *amx, const char *func);
|
int Create_Void_Float_Cbase(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Float_Float(AMX* amx, const char* func);
|
int Create_Int_Float_Float(AMX* amx, const char* func);
|
||||||
|
|
||||||
int Create_Int_Float(AMX* amx, const char* func);
|
int Create_Int_Float(AMX* amx, const char* func);
|
||||||
|
|
||||||
int Create_Int_Int_Int(AMX* amx, const char* func);
|
int Create_Int_Int_Int(AMX* amx, const char* func);
|
||||||
|
|
||||||
int Create_Void_Str_Float_Float_Float(AMX* amx, const char* func);
|
int Create_Void_Str_Float_Float_Float(AMX* amx, const char* func);
|
||||||
|
|
||||||
int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func);
|
int Create_Void_Str_Float_Float_Float_Int_Cbase(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Vector_Vector_Float_Float(AMX *amx, const char *func);
|
int Create_Int_Vector_Vector_Float_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Short(AMX* amx, const char* func);
|
int Create_Int_Short(AMX* amx, const char* func);
|
||||||
|
|
||||||
int Create_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func);
|
int Create_Void_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func);
|
int Create_Void_Vector_Entvar_Entvar_Float_Int_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Float_Int_Float(AMX *amx, const char *func);
|
int Create_Float_Int_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Str(AMX *amx, const char *func);
|
int Create_Int_Str(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Edict(AMX *amx, const char *func);
|
int Create_Void_Edict(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Int_Str_Bool(AMX *amx, const char *func);
|
int Create_Void_Int_Str_Bool(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Vector_Vector(AMX *amx, const char *func);
|
int Create_Void_Vector_Vector(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Str_Bool(AMX *amx, const char *func);
|
int Create_Void_Str_Bool(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Str_Str_Int_Str_Int_Int(AMX *amx, const char *func);
|
int Create_Int_Str_Str_Int_Str_Int_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Int_Int_Float_Int(AMX *amx, const char *func);
|
int Create_Int_Int_Int_Float_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Str_Int(AMX *amx, const char *func);
|
int Create_Void_Str_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Cbase_Int(AMX *amx, const char *func);
|
int Create_Void_Cbase_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Str(AMX *amx, const char *func);
|
int Create_Void_Str(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Vector(AMX *amx, const char *func);
|
int Create_Void_Vector(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Str_Vector_Str(AMX *amx, const char *func);
|
int Create_Int_Str_Vector_Str(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Str_Str(AMX *amx, const char *func);
|
int Create_Int_Str_Str(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Float_Float(AMX *amx, const char *func);
|
int Create_Void_Float_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Str_Str_Int(AMX *amx, const char *func);
|
int Create_Void_Str_Str_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_pVector_pVector_Cbase_pFloat(AMX *amx, const char *func);
|
int Create_Int_pVector_pVector_Cbase_pFloat(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Cbase_pVector_Float(AMX *amx, const char *func);
|
int Create_Void_Cbase_pVector_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_pVector_pVector_Float_Cbase_pVector(AMX *amx, const char *func);
|
int Create_Int_pVector_pVector_Float_Cbase_pVector(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Cbase_Bool(AMX *amx, const char *func);
|
int Create_Int_Cbase_Bool(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Vector_Vector(AMX *amx, const char *func);
|
int Create_Int_Vector_Vector(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Entvar_Float(AMX *amx, const char *func);
|
int Create_Int_Entvar_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Float_Float(AMX *amx, const char *func);
|
int Create_Float_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Entvar_Entvar_Float(AMX *amx, const char *func);
|
int Create_Void_Entvar_Entvar_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Bool_Void(AMX *amx, const char *func);
|
int Create_Bool_Void(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX *amx, const char *func);
|
int Create_Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Vector_Cbase(AMX *amx, const char *func);
|
int Create_Int_Vector_Cbase(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Vector(AMX *amx, const char *func);
|
int Create_Int_Vector(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Int_Cbase_pVector(AMX *amx, const char *func);
|
int Create_Int_Cbase_pVector(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Bool(AMX *amx, const char *func);
|
int Create_Void_Bool(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Bool_Cbase(AMX *amx, const char *func);
|
int Create_Bool_Cbase(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Bool_Int(AMX *amx, const char *func);
|
int Create_Bool_Int(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Cbase_Float(AMX *amx, const char *func);
|
int Create_Void_Cbase_Float(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Cbase_Bool(AMX *amx, const char *func);
|
int Create_Void_Cbase_Bool(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Vector_Vector_Vector_Vector(AMX *amx, const char *func);
|
int Create_Vector_Vector_Vector_Vector(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Str_Str(AMX *amx, const char *func);
|
int Create_Str_Str(AMX *amx, const char *func);
|
||||||
|
|
||||||
int Create_Void_Short(AMX *amx, const char *func);
|
int Create_Void_Short(AMX *amx, const char *func);
|
||||||
|
|
||||||
|
|
||||||
int Create_Deprecated(AMX* amx, const char* func);
|
int Create_Deprecated(AMX* amx, const char* func);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ hook_t hooklist[] =
|
||||||
{ V("illumination", Int_Void) },
|
{ V("illumination", Int_Void) },
|
||||||
{ V("fvisible", Int_Cbase) },
|
{ V("fvisible", Int_Cbase) },
|
||||||
{ V("fvecvisible", Int_pVector) },
|
{ V("fvecvisible", Int_pVector) },
|
||||||
|
|
||||||
/** Entity specific hooks **/
|
/** Entity specific hooks **/
|
||||||
|
|
||||||
/* CBasePlayer */
|
/* CBasePlayer */
|
||||||
|
@ -127,7 +127,7 @@ hook_t hooklist[] =
|
||||||
{ V("item_updateclientdata", Int_Cbase) },
|
{ V("item_updateclientdata", Int_Cbase) },
|
||||||
{ V("item_getweaponptr", Cbase_Void) },
|
{ V("item_getweaponptr", Cbase_Void) },
|
||||||
{ V("item_itemslot", Int_Void) },
|
{ V("item_itemslot", Int_Void) },
|
||||||
|
|
||||||
/* CBasePlayerWeapon */
|
/* CBasePlayerWeapon */
|
||||||
{ V("weapon_extractammo", Int_Cbase) },
|
{ V("weapon_extractammo", Int_Cbase) },
|
||||||
{ V("weapon_extractclipammo", Int_Cbase) },
|
{ V("weapon_extractclipammo", Int_Cbase) },
|
||||||
|
@ -143,7 +143,7 @@ hook_t hooklist[] =
|
||||||
{ V("weapon_retireweapon", Void_Void) },
|
{ V("weapon_retireweapon", Void_Void) },
|
||||||
{ V("weapon_shouldweaponidle", Int_Void) },
|
{ V("weapon_shouldweaponidle", Int_Void) },
|
||||||
{ V("weapon_usedecrement", Int_Void) },
|
{ V("weapon_usedecrement", Int_Void) },
|
||||||
|
|
||||||
/** Mod specific hooks **/
|
/** Mod specific hooks **/
|
||||||
|
|
||||||
/* The Specialists */
|
/* The Specialists */
|
||||||
|
@ -195,326 +195,326 @@ hook_t hooklist[] =
|
||||||
{ V("ts_onfreeentprivatedata", Void_Void) },
|
{ V("ts_onfreeentprivatedata", Void_Void) },
|
||||||
{ V("ts_shouldcollide", Int_Cbase) },
|
{ V("ts_shouldcollide", Int_Cbase) },
|
||||||
|
|
||||||
/** New Additions (2011) **/
|
/** New Additions (2011) **/
|
||||||
|
|
||||||
{ V("changeyaw", Float_Int) },
|
{ V("changeyaw", Float_Int) },
|
||||||
{ V("hashumangibs", Int_Void) },
|
{ V("hashumangibs", Int_Void) },
|
||||||
{ V("hasaliengibs", Int_Void) },
|
{ V("hasaliengibs", Int_Void) },
|
||||||
{ V("fademonster", Void_Void) },
|
{ V("fademonster", Void_Void) },
|
||||||
{ V("gibmonster", Void_Void) },
|
{ V("gibmonster", Void_Void) },
|
||||||
{ V("becomedead", Void_Void) },
|
{ V("becomedead", Void_Void) },
|
||||||
{ V("irelationship", Int_Cbase) },
|
{ V("irelationship", Int_Cbase) },
|
||||||
{ V("painsound", Void_Void) },
|
{ V("painsound", Void_Void) },
|
||||||
{ V("reportaistate", Void_Void) },
|
{ V("reportaistate", Void_Void) },
|
||||||
{ V("monsterinitdead", Void_Void) },
|
{ V("monsterinitdead", Void_Void) },
|
||||||
{ V("look", Void_Int) },
|
{ V("look", Void_Int) },
|
||||||
{ V("bestvisibleenemy", Cbase_Void) },
|
{ V("bestvisibleenemy", Cbase_Void) },
|
||||||
{ V("finviewcone", Int_Cbase) },
|
{ V("finviewcone", Int_Cbase) },
|
||||||
{ V("fvecinviewcone", Int_pVector) },
|
{ V("fvecinviewcone", Int_pVector) },
|
||||||
{ V("getdeathactivity", Int_Void) },
|
{ V("getdeathactivity", Int_Void) },
|
||||||
|
|
||||||
/* Not supported by Counter-Strike, The Specialists and Natural Selection mods. */
|
/* Not supported by Counter-Strike, The Specialists and Natural Selection mods. */
|
||||||
{ V("runai", Void_Void) },
|
{ V("runai", Void_Void) },
|
||||||
{ V("monsterthink", Void_Void) },
|
{ V("monsterthink", Void_Void) },
|
||||||
{ V("monsterinit", Void_Void) },
|
{ V("monsterinit", Void_Void) },
|
||||||
{ V("checklocalmove", Int_pVector_pVector_Cbase_pFloat) },
|
{ V("checklocalmove", Int_pVector_pVector_Cbase_pFloat) },
|
||||||
{ V("move", Void_Float) },
|
{ V("move", Void_Float) },
|
||||||
{ V("moveexecute", Void_Cbase_pVector_Float) },
|
{ V("moveexecute", Void_Cbase_pVector_Float) },
|
||||||
{ V("shouldadvanceroute", Int_Float) },
|
{ V("shouldadvanceroute", Int_Float) },
|
||||||
{ V("getstoppedactivity", Int_Void) },
|
{ V("getstoppedactivity", Int_Void) },
|
||||||
{ V("stop", Void_Void) },
|
{ V("stop", Void_Void) },
|
||||||
{ V("checkrangeattack1", Int_Float_Float) },
|
{ V("checkrangeattack1", Int_Float_Float) },
|
||||||
{ V("checkrangeattack2", Int_Float_Float) },
|
{ V("checkrangeattack2", Int_Float_Float) },
|
||||||
{ V("checkmeleeattack1", Int_Float_Float) },
|
{ V("checkmeleeattack1", Int_Float_Float) },
|
||||||
{ V("checkmeleeattack2", Int_Float_Float) },
|
{ V("checkmeleeattack2", Int_Float_Float) },
|
||||||
{ V("schedulechange", Void_Void) },
|
{ V("schedulechange", Void_Void) },
|
||||||
{ V("canplaysequence", Int_Int_Int) },
|
{ V("canplaysequence", Int_Int_Int) },
|
||||||
{ V("canplaysentence", Int_Int) },
|
{ V("canplaysentence", Int_Int) },
|
||||||
{ V("playsentence", Void_Str_Float_Float_Float) },
|
{ V("playsentence", Void_Str_Float_Float_Float) },
|
||||||
{ V("playscriptedsentence", Void_Str_Float_Float_Float_Int_Cbase) },
|
{ V("playscriptedsentence", Void_Str_Float_Float_Float_Int_Cbase) },
|
||||||
{ V("sentencestop", Void_Void) },
|
{ V("sentencestop", Void_Void) },
|
||||||
{ V("getidealstate", Int_Void) },
|
{ V("getidealstate", Int_Void) },
|
||||||
{ V("setactivity", Void_Int) },
|
{ V("setactivity", Void_Int) },
|
||||||
{ V("checkenemy", Int_Cbase) },
|
{ V("checkenemy", Int_Cbase) },
|
||||||
{ V("ftriangulate", Int_pVector_pVector_Float_Cbase_pVector) },
|
{ V("ftriangulate", Int_pVector_pVector_Float_Cbase_pVector) },
|
||||||
{ V("setyawspeed", Void_Void) },
|
{ V("setyawspeed", Void_Void) },
|
||||||
{ V("buildnearestroute", Int_Vector_Vector_Float_Float) },
|
{ V("buildnearestroute", Int_Vector_Vector_Float_Float) },
|
||||||
{ V("findcover", Int_Vector_Vector_Float_Float) },
|
{ V("findcover", Int_Vector_Vector_Float_Float) },
|
||||||
{ V("coverradius", Float_Void) },
|
{ V("coverradius", Float_Void) },
|
||||||
{ V("fcancheckattacks", Int_Void) },
|
{ V("fcancheckattacks", Int_Void) },
|
||||||
{ V("checkammo", Void_Void) },
|
{ V("checkammo", Void_Void) },
|
||||||
{ V("ignoreconditions", Int_Void) },
|
{ V("ignoreconditions", Int_Void) },
|
||||||
{ V("fvalidatehinttype", Int_Short) },
|
{ V("fvalidatehinttype", Int_Short) },
|
||||||
{ V("fcanactiveidle", Int_Void) },
|
{ V("fcanactiveidle", Int_Void) },
|
||||||
{ V("isoundmask", Int_Void) },
|
{ V("isoundmask", Int_Void) },
|
||||||
{ V("hearingsensitivity", Float_Void) },
|
{ V("hearingsensitivity", Float_Void) },
|
||||||
{ V("barnaclevictimbitten", Void_Entvar) },
|
{ V("barnaclevictimbitten", Void_Entvar) },
|
||||||
{ V("barnaclevictimreleased", Void_Void) },
|
{ V("barnaclevictimreleased", Void_Void) },
|
||||||
{ V("preschedulethink", Void_Void) },
|
{ V("preschedulethink", Void_Void) },
|
||||||
{ V("deathsound", Void_Void) },
|
{ V("deathsound", Void_Void) },
|
||||||
{ V("alertsound", Void_Void) },
|
{ V("alertsound", Void_Void) },
|
||||||
{ V("idlesound", Void_Void) },
|
{ V("idlesound", Void_Void) },
|
||||||
{ V("stopfollowing", Void_Int) },
|
{ V("stopfollowing", Void_Int) },
|
||||||
|
|
||||||
/** Mod specific hooks **/
|
/** Mod specific hooks **/
|
||||||
|
|
||||||
/* Counter-Strike */
|
/* Counter-Strike */
|
||||||
{ V("cstrike_weapon_sendweaponanim",Void_Int_Int) },
|
{ V("cstrike_weapon_sendweaponanim",Void_Int_Int) },
|
||||||
{ V("cstrike_player_resetmaxspeed", Void_Void) },
|
{ V("cstrike_player_resetmaxspeed", Void_Void) },
|
||||||
{ V("cstrike_player_isbot", Int_Void) },
|
{ V("cstrike_player_isbot", Int_Void) },
|
||||||
{ V("cstrike_player_getautoaimvector", Vector_Float) },
|
{ V("cstrike_player_getautoaimvector", Vector_Float) },
|
||||||
{ V("cstrike_player_blind", Void_Float_Float_Float_Int) },
|
{ V("cstrike_player_blind", Void_Float_Float_Float_Int) },
|
||||||
{ V("cstrike_player_ontouchingweapon",Void_Cbase) },
|
{ V("cstrike_player_ontouchingweapon",Void_Cbase) },
|
||||||
|
|
||||||
/* Day of Defeat */
|
/* Day of Defeat */
|
||||||
{ V("dod_setscriptreset", Void_Void) },
|
{ V("dod_setscriptreset", Void_Void) },
|
||||||
{ V("dod_item_spawndeploy", Int_Void) },
|
{ V("dod_item_spawndeploy", Int_Void) },
|
||||||
{ V("dod_item_setdmgtime", Void_Float) },
|
{ V("dod_item_setdmgtime", Void_Float) },
|
||||||
{ V("dod_item_dropgren", Void_Void) },
|
{ V("dod_item_dropgren", Void_Void) },
|
||||||
{ V("dod_weapon_isuseable", Int_Void) },
|
{ V("dod_weapon_isuseable", Int_Void) },
|
||||||
{ V("dod_weapon_aim", Vector_Float_Cbase_Int) },
|
{ V("dod_weapon_aim", Vector_Float_Cbase_Int) },
|
||||||
{ V("dod_weapon_flaim", Float_Float_Cbase) },
|
{ V("dod_weapon_flaim", Float_Float_Cbase) },
|
||||||
{ V("dod_weapon_removestamina", Void_Float_Cbase) },
|
{ V("dod_weapon_removestamina", Void_Float_Cbase) },
|
||||||
{ V("dod_weapon_changefov", Int_Int) },
|
{ V("dod_weapon_changefov", Int_Int) },
|
||||||
{ V("dod_weapon_zoomout", Int_Void) },
|
{ V("dod_weapon_zoomout", Int_Void) },
|
||||||
{ V("dod_weapon_zoomin", Int_Void) },
|
{ V("dod_weapon_zoomin", Int_Void) },
|
||||||
{ V("dod_weapon_getfov", Int_Void) },
|
{ V("dod_weapon_getfov", Int_Void) },
|
||||||
{ V("dod_weapon_playeriswatersniping", Bool_Void) },
|
{ V("dod_weapon_playeriswatersniping", Bool_Void) },
|
||||||
{ V("dod_weapon_updatezoomspeed", Void_Void) },
|
{ V("dod_weapon_updatezoomspeed", Void_Void) },
|
||||||
{ V("dod_weapon_special", Void_Void) },
|
{ V("dod_weapon_special", Void_Void) },
|
||||||
|
|
||||||
/* Team Fortress Classic */
|
/* Team Fortress Classic */
|
||||||
{ V("tfc_dbgetitemname", Str_Void) },
|
{ V("tfc_dbgetitemname", Str_Void) },
|
||||||
{ V("tfc_radiusdamage", Void_Entvar_Entvar_Float_Int_Int) },
|
{ V("tfc_radiusdamage", Void_Entvar_Entvar_Float_Int_Int) },
|
||||||
{ V("tfc_radiusdamage2", Void_Vector_Entvar_Entvar_Float_Int_Int) },
|
{ V("tfc_radiusdamage2", Void_Vector_Entvar_Entvar_Float_Int_Int) },
|
||||||
|
|
||||||
/* Earth's Special Forces */
|
/* Earth's Special Forces */
|
||||||
{ V("esf_isfighter", Int_Void) },
|
{ V("esf_isfighter", Int_Void) },
|
||||||
{ V("esf_isbuddy", Int_Void) },
|
{ V("esf_isbuddy", Int_Void) },
|
||||||
{ V("esf_emitsound", Void_Str_Int) },
|
{ V("esf_emitsound", Void_Str_Int) },
|
||||||
{ V("esf_emitnullsound", Void_Int) },
|
{ V("esf_emitnullsound", Void_Int) },
|
||||||
{ V("esf_increasestrength", Void_Cbase_Int) },
|
{ V("esf_increasestrength", Void_Cbase_Int) },
|
||||||
{ V("esf_increasepl", Void_Int) },
|
{ V("esf_increasepl", Void_Int) },
|
||||||
{ V("esf_setpowerlevel", Void_Int) },
|
{ V("esf_setpowerlevel", Void_Int) },
|
||||||
{ V("esf_setmaxpowerlevel", Void_Int) },
|
{ V("esf_setmaxpowerlevel", Void_Int) },
|
||||||
{ V("esf_stopanitrigger", Void_Int) },
|
{ V("esf_stopanitrigger", Void_Int) },
|
||||||
{ V("esf_stopfly", Void_Void) },
|
{ V("esf_stopfly", Void_Void) },
|
||||||
{ V("esf_hideweapon", Void_Void) },
|
{ V("esf_hideweapon", Void_Void) },
|
||||||
{ V("esf_clientremoveweapon", Void_Int) },
|
{ V("esf_clientremoveweapon", Void_Int) },
|
||||||
{ V("esf_sendclientcustommodel",Void_Str) },
|
{ V("esf_sendclientcustommodel",Void_Str) },
|
||||||
{ V("esf_canturbo", Int_Void) },
|
{ V("esf_canturbo", Int_Void) },
|
||||||
{ V("esf_canprimaryfire", Int_Void) },
|
{ V("esf_canprimaryfire", Int_Void) },
|
||||||
{ V("esf_cansecondaryfire", Int_Void) },
|
{ V("esf_cansecondaryfire", Int_Void) },
|
||||||
{ V("esf_canstopfly", Int_Void) },
|
{ V("esf_canstopfly", Int_Void) },
|
||||||
{ V("esf_canblock", Int_Void) },
|
{ V("esf_canblock", Int_Void) },
|
||||||
{ V("esf_canraiseKi", Int_Void) },
|
{ V("esf_canraiseKi", Int_Void) },
|
||||||
{ V("esf_canraisestamina", Int_Void) },
|
{ V("esf_canraisestamina", Int_Void) },
|
||||||
{ V("esf_canteleport", Int_Void) },
|
{ V("esf_canteleport", Int_Void) },
|
||||||
{ V("esf_canstartfly", Int_Void) },
|
{ V("esf_canstartfly", Int_Void) },
|
||||||
{ V("esf_canstartpowerup", Int_Void) },
|
{ V("esf_canstartpowerup", Int_Void) },
|
||||||
{ V("esf_canjump", Int_Void) },
|
{ V("esf_canjump", Int_Void) },
|
||||||
{ V("esf_canwalljump", Int_Void) },
|
{ V("esf_canwalljump", Int_Void) },
|
||||||
{ V("esf_issuperjump", Int_Void) },
|
{ V("esf_issuperjump", Int_Void) },
|
||||||
{ V("esf_ismoveback", Int_Void) },
|
{ V("esf_ismoveback", Int_Void) },
|
||||||
{ V("esf_checkwalljump", Int_Void) },
|
{ V("esf_checkwalljump", Int_Void) },
|
||||||
{ V("esf_enablewalljump", Void_Vector) },
|
{ V("esf_enablewalljump", Void_Vector) },
|
||||||
{ V("esf_disablewalljump", Void_Void) },
|
{ V("esf_disablewalljump", Void_Void) },
|
||||||
{ V("esf_resetwalljumpvars", Void_Void) },
|
{ V("esf_resetwalljumpvars", Void_Void) },
|
||||||
{ V("esf_getwalljumpanim", Int_Str_Vector_Str) },
|
{ V("esf_getwalljumpanim", Int_Str_Vector_Str) },
|
||||||
{ V("esf_getwalljumpanim2", Int_Str_Str) },
|
{ V("esf_getwalljumpanim2", Int_Str_Str) },
|
||||||
{ V("esf_setwalljumpanimation", Void_Void) },
|
{ V("esf_setwalljumpanimation", Void_Void) },
|
||||||
{ V("esf_setflymovetype", Void_Void) },
|
{ V("esf_setflymovetype", Void_Void) },
|
||||||
{ V("esf_isflymovetype", Int_Void) },
|
{ V("esf_isflymovetype", Int_Void) },
|
||||||
{ V("esf_iswalkmovetype", Int_Void) },
|
{ V("esf_iswalkmovetype", Int_Void) },
|
||||||
{ V("esf_setwalkmovetype", Void_Void) },
|
{ V("esf_setwalkmovetype", Void_Void) },
|
||||||
{ V("esf_drawchargebar", Void_Int) },
|
{ V("esf_drawchargebar", Void_Int) },
|
||||||
{ V("esf_startblock", Void_Void) },
|
{ V("esf_startblock", Void_Void) },
|
||||||
{ V("esf_stopblock", Void_Void) },
|
{ V("esf_stopblock", Void_Void) },
|
||||||
{ V("esf_startfly", Void_Void) },
|
{ V("esf_startfly", Void_Void) },
|
||||||
{ V("esf_getmaxspeed", Float_Void) },
|
{ V("esf_getmaxspeed", Float_Void) },
|
||||||
{ V("esf_setanimation", Void_Int) },
|
{ V("esf_setanimation", Void_Int) },
|
||||||
{ V("esf_playanimation", Void_Void) },
|
{ V("esf_playanimation", Void_Void) },
|
||||||
{ V("esf_getmoveforward", Int_Void) },
|
{ V("esf_getmoveforward", Int_Void) },
|
||||||
{ V("esf_getmoveright", Int_Void) },
|
{ V("esf_getmoveright", Int_Void) },
|
||||||
{ V("esf_getmoveup", Void_Void) },
|
{ V("esf_getmoveup", Void_Void) },
|
||||||
{ V("esf_addblindfx", Void_Void) },
|
{ V("esf_addblindfx", Void_Void) },
|
||||||
{ V("esf_removeblindfx", Void_Void) },
|
{ V("esf_removeblindfx", Void_Void) },
|
||||||
{ V("esf_disablepsbar", Void_Void) },
|
{ V("esf_disablepsbar", Void_Void) },
|
||||||
{ V("esf_addbeamboxcrosshair", Void_Int) },
|
{ V("esf_addbeamboxcrosshair", Void_Int) },
|
||||||
{ V("esf_removebeamboxcrosshair", Void_Void) },
|
{ V("esf_removebeamboxcrosshair", Void_Void) },
|
||||||
{ V("esf_drawpswinbonus", Void_Void) },
|
{ V("esf_drawpswinbonus", Void_Void) },
|
||||||
{ V("esf_drawpsbar", Void_Float_Float) },
|
{ V("esf_drawpsbar", Void_Float_Float) },
|
||||||
{ V("esf_lockcrosshair", Void_Void) },
|
{ V("esf_lockcrosshair", Void_Void) },
|
||||||
{ V("esf_unlockcrosshair", Void_Void) },
|
{ V("esf_unlockcrosshair", Void_Void) },
|
||||||
{ V("esf_rotatecrosshair", Void_Void) },
|
{ V("esf_rotatecrosshair", Void_Void) },
|
||||||
{ V("esf_unrotatecrosshair", Void_Void) },
|
{ V("esf_unrotatecrosshair", Void_Void) },
|
||||||
{ V("esf_watermove", Void_Void) },
|
{ V("esf_watermove", Void_Void) },
|
||||||
{ V("esf_checktimebaseddamage", Void_Void) },
|
{ V("esf_checktimebaseddamage", Void_Void) },
|
||||||
{ V("esf_doessecondaryattack", Int_Void) },
|
{ V("esf_doessecondaryattack", Int_Void) },
|
||||||
{ V("esf_doesprimaryattack", Int_Void) },
|
{ V("esf_doesprimaryattack", Int_Void) },
|
||||||
{ V("esf_removespecialmodes", Void_Void) },
|
{ V("esf_removespecialmodes", Void_Void) },
|
||||||
{ V("esf_stopturbo", Void_Void) },
|
{ V("esf_stopturbo", Void_Void) },
|
||||||
{ V("esf_takebean", Void_Void) },
|
{ V("esf_takebean", Void_Void) },
|
||||||
{ V("esf_getpowerlevel", Void_Void) },
|
{ V("esf_getpowerlevel", Void_Void) },
|
||||||
{ V("esf_removeallotherweapons",Void_Void) },
|
{ V("esf_removeallotherweapons",Void_Void) },
|
||||||
{ V("esf_stopswoop", Void_Void) },
|
{ V("esf_stopswoop", Void_Void) },
|
||||||
{ V("esf_setdeathanimation", Void_Void) },
|
{ V("esf_setdeathanimation", Void_Void) },
|
||||||
{ V("esf_setmodel", Void_Void) },
|
{ V("esf_setmodel", Void_Void) },
|
||||||
{ V("esf_addattacks", Void_Void) },
|
{ V("esf_addattacks", Void_Void) },
|
||||||
{ V("esf_emitclasssound", Void_Str_Str_Int) },
|
{ V("esf_emitclasssound", Void_Str_Str_Int) },
|
||||||
{ V("esf_checklightning", Void_Void) },
|
{ V("esf_checklightning", Void_Void) },
|
||||||
{ V("esf_freezecontrols", Void_Void) },
|
{ V("esf_freezecontrols", Void_Void) },
|
||||||
{ V("esf_unfreezecontrols", Void_Void) },
|
{ V("esf_unfreezecontrols", Void_Void) },
|
||||||
{ V("esf_updateki", Void_Void) },
|
{ V("esf_updateki", Void_Void) },
|
||||||
{ V("esf_updatehealth", Void_Void) },
|
{ V("esf_updatehealth", Void_Void) },
|
||||||
{ V("esf_getteleportdir", Vector_Void) },
|
{ V("esf_getteleportdir", Vector_Void) },
|
||||||
{ V("esf_weapon_holsterwhenmeleed", Void_Void) },
|
{ V("esf_weapon_holsterwhenmeleed", Void_Void) },
|
||||||
|
|
||||||
/* Natural-Selection */
|
/* Natural-Selection */
|
||||||
{ V("ns_setbonecontroller", Float_Int_Float) },
|
{ V("ns_setbonecontroller", Float_Int_Float) },
|
||||||
{ V("ns_savedataforreset", Void_Void) },
|
{ V("ns_savedataforreset", Void_Void) },
|
||||||
{ V("ns_gethull", Int_Void) },
|
{ V("ns_gethull", Int_Void) },
|
||||||
{ V("ns_getmaxwalkspeed", Float_Void) },
|
{ V("ns_getmaxwalkspeed", Float_Void) },
|
||||||
{ V("ns_setteamid", Str_Str) },
|
{ V("ns_setteamid", Str_Str) },
|
||||||
{ V("ns_geteffectiveplayerclass", Int_Void) },
|
{ V("ns_geteffectiveplayerclass", Int_Void) },
|
||||||
{ V("ns_getauthenticationmask", Int_Void) },
|
{ V("ns_getauthenticationmask", Int_Void) },
|
||||||
{ V("ns_effectiveplayerclasschanged", Void_Void) },
|
{ V("ns_effectiveplayerclasschanged", Void_Void) },
|
||||||
{ V("ns_needsteamupdate", Void_Void) },
|
{ V("ns_needsteamupdate", Void_Void) },
|
||||||
{ V("ns_sendteamupdate", Void_Void) },
|
{ V("ns_sendteamupdate", Void_Void) },
|
||||||
{ V("ns_sendweaponupdate", Void_Void) },
|
{ V("ns_sendweaponupdate", Void_Void) },
|
||||||
{ V("ns_initplayerfromspawn", Void_Edict) },
|
{ V("ns_initplayerfromspawn", Void_Edict) },
|
||||||
{ V("ns_packdeadplayeritems", Void_Void) },
|
{ V("ns_packdeadplayeritems", Void_Void) },
|
||||||
{ V("ns_getanimationforactivity",Void_Int_Str_Bool) },
|
{ V("ns_getanimationforactivity",Void_Int_Str_Bool) },
|
||||||
{ V("ns_startobserver", Void_Vector_Vector) },
|
{ V("ns_startobserver", Void_Vector_Vector) },
|
||||||
{ V("ns_stopobserver", Void_Void) },
|
{ V("ns_stopobserver", Void_Void) },
|
||||||
{ V("ns_getadrenalinefactor", Float_Void) },
|
{ V("ns_getadrenalinefactor", Float_Void) },
|
||||||
{ V("ns_givenameditem", Void_Str_Bool) },
|
{ V("ns_givenameditem", Void_Str_Bool) },
|
||||||
{ V("ns_suicide", Void_Void) },
|
{ V("ns_suicide", Void_Void) },
|
||||||
{ V("ns_getcanuseweapon", Int_Void) },
|
{ V("ns_getcanuseweapon", Int_Void) },
|
||||||
{ V("ns_weapon_getweaponprimetime", Float_Void) },
|
{ V("ns_weapon_getweaponprimetime", Float_Void) },
|
||||||
{ V("ns_weapon_primeweapon", Void_Void) },
|
{ V("ns_weapon_primeweapon", Void_Void) },
|
||||||
{ V("ns_weapon_getisweaponprimed", Int_Void) },
|
{ V("ns_weapon_getisweaponprimed", Int_Void) },
|
||||||
{ V("ns_weapon_getisweaponpriming", Int_Void) },
|
{ V("ns_weapon_getisweaponpriming", Int_Void) },
|
||||||
{ V("ns_weapon_defaultdeploy", Int_Str_Str_Int_Str_Int_Int) },
|
{ V("ns_weapon_defaultdeploy", Int_Str_Str_Int_Str_Int_Int) },
|
||||||
{ V("ns_weapon_defaultreload", Int_Int_Int_Float_Int) },
|
{ V("ns_weapon_defaultreload", Int_Int_Int_Float_Int) },
|
||||||
{ V("ns_weapon_getdeploytime", Float_Void) },
|
{ V("ns_weapon_getdeploytime", Float_Void) },
|
||||||
|
|
||||||
/* Sven co-op */
|
/* Sven co-op */
|
||||||
{ V("sc_getclassification", Int_Int) },
|
{ V("sc_getclassification", Int_Int) },
|
||||||
{ V("sc_ismonster", Int_Void) },
|
{ V("sc_ismonster", Int_Void) },
|
||||||
{ V("sc_isphysx", Int_Void) },
|
{ V("sc_isphysx", Int_Void) },
|
||||||
{ V("sc_ispointentity", Int_Void) },
|
{ V("sc_ispointentity", Int_Void) },
|
||||||
{ V("sc_ismachine", Int_Void) },
|
{ V("sc_ismachine", Int_Void) },
|
||||||
{ V("sc_criticalremove", Int_Void) },
|
{ V("sc_criticalremove", Int_Void) },
|
||||||
{ V("sc_updateonremove", Void_Void) },
|
{ V("sc_updateonremove", Void_Void) },
|
||||||
{ V("sc_fvisible", Int_Cbase_Bool) },
|
{ V("sc_fvisible", Int_Cbase_Bool) },
|
||||||
{ V("sc_fvisiblefrompos", Int_Vector_Vector) },
|
{ V("sc_fvisiblefrompos", Int_Vector_Vector) },
|
||||||
{ V("sc_isfacing", Int_Entvar_Float) },
|
{ V("sc_isfacing", Int_Entvar_Float) },
|
||||||
{ V("sc_getpointsfordamage", Float_Float) },
|
{ V("sc_getpointsfordamage", Float_Float) },
|
||||||
{ V("sc_getdamagepoints", Void_Entvar_Entvar_Float) },
|
{ V("sc_getdamagepoints", Void_Entvar_Entvar_Float) },
|
||||||
{ V("sc_oncreate", Void_Void) },
|
{ V("sc_oncreate", Void_Void) },
|
||||||
{ V("sc_ondestroy", Void_Void) },
|
{ V("sc_ondestroy", Void_Void) },
|
||||||
{ V("sc_isvalidentity", Bool_Void) },
|
{ V("sc_isvalidentity", Bool_Void) },
|
||||||
{ V("sc_shouldfadeondeath", Int_Void) },
|
{ V("sc_shouldfadeondeath", Int_Void) },
|
||||||
{ V("sc_setupfriendly", Void_Void) },
|
{ V("sc_setupfriendly", Void_Void) },
|
||||||
{ V("sc_revivethink", Void_Void) },
|
{ V("sc_revivethink", Void_Void) },
|
||||||
{ V("sc_revive", Void_Void) },
|
{ V("sc_revive", Void_Void) },
|
||||||
{ V("sc_startmonster", Void_Void) },
|
{ V("sc_startmonster", Void_Void) },
|
||||||
{ V("sc_checkrangeattack1_move",Int_Float_Float) },
|
{ V("sc_checkrangeattack1_move",Int_Float_Float) },
|
||||||
{ V("sc_checkrangeattack2_move",Int_Float_Float) },
|
{ V("sc_checkrangeattack2_move",Int_Float_Float) },
|
||||||
{ V("sc_checkmeleeattack1_move",Int_Float_Float) },
|
{ V("sc_checkmeleeattack1_move",Int_Float_Float) },
|
||||||
{ V("sc_checkmeleeattack2_move",Int_Float_Float) },
|
{ V("sc_checkmeleeattack2_move",Int_Float_Float) },
|
||||||
{ V("sc_checktankusage", Int_Void) },
|
{ V("sc_checktankusage", Int_Void) },
|
||||||
{ V("sc_setgaitactivity", Int_Void) },
|
{ V("sc_setgaitactivity", Int_Void) },
|
||||||
{ V("sc_ftriangulate", Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool) },
|
{ V("sc_ftriangulate", Int_pVector_pVector_Float_Cbase_pVector_pVector_Bool) },
|
||||||
{ V("sc_ftriangulateextension", Int_pVector_pVector_Float_Cbase_pVector) },
|
{ V("sc_ftriangulateextension", Int_pVector_pVector_Float_Cbase_pVector) },
|
||||||
{ V("sc_findcovergrenade", Int_Vector_Vector_Float_Float) },
|
{ V("sc_findcovergrenade", Int_Vector_Vector_Float_Float) },
|
||||||
{ V("sc_findcoverdistance", Int_Vector_Vector_Float_Float) },
|
{ V("sc_findcoverdistance", Int_Vector_Vector_Float_Float) },
|
||||||
{ V("sc_findattackpoint", Int_Vector_Vector_Float_Float) },
|
{ V("sc_findattackpoint", Int_Vector_Vector_Float_Float) },
|
||||||
{ V("sc_fvalidatecover", Int_pVector) },
|
{ V("sc_fvalidatecover", Int_pVector) },
|
||||||
{ V("sc_nofriendlyfire1", Int_Void) },
|
{ V("sc_nofriendlyfire1", Int_Void) },
|
||||||
{ V("sc_nofriendlyfire2", Int_Vector) },
|
{ V("sc_nofriendlyfire2", Int_Vector) },
|
||||||
{ V("sc_nofriendlyfire3", Int_Vector_Cbase) },
|
{ V("sc_nofriendlyfire3", Int_Vector_Cbase) },
|
||||||
{ V("sc_nofriendlyfiretopos", Int_Vector) },
|
{ V("sc_nofriendlyfiretopos", Int_Vector) },
|
||||||
{ V("sc_fvisiblegunpos", Int_Cbase_pVector) },
|
{ V("sc_fvisiblegunpos", Int_Cbase_pVector) },
|
||||||
{ V("sc_finbulletcone", Int_Cbase_pVector) },
|
{ V("sc_finbulletcone", Int_Cbase_pVector) },
|
||||||
{ V("sc_callgibmonster", Void_Void) },
|
{ V("sc_callgibmonster", Void_Void) },
|
||||||
{ V("sc_checktimebaseddamage", Void_Void) },
|
{ V("sc_checktimebaseddamage", Void_Void) },
|
||||||
{ V("sc_ismoving", Int_Void) },
|
{ V("sc_ismoving", Int_Void) },
|
||||||
{ V("sc_isplayerfollowing", Int_Void) },
|
{ V("sc_isplayerfollowing", Int_Void) },
|
||||||
{ V("sc_startplayerfollowing", Void_Cbase) },
|
{ V("sc_startplayerfollowing", Void_Cbase) },
|
||||||
{ V("sc_stopplayerfollowing", Void_Int) },
|
{ V("sc_stopplayerfollowing", Void_Int) },
|
||||||
{ V("sc_usesound", Void_Void) },
|
{ V("sc_usesound", Void_Void) },
|
||||||
{ V("sc_unusesound", Void_Void) },
|
{ V("sc_unusesound", Void_Void) },
|
||||||
{ V("sc_ridemonster", Void_Cbase) },
|
{ V("sc_ridemonster", Void_Cbase) },
|
||||||
{ V("sc_checkandapplygenericattacks", Void_Void) },
|
{ V("sc_checkandapplygenericattacks", Void_Void) },
|
||||||
{ V("sc_checkscared", Bool_Void) },
|
{ V("sc_checkscared", Bool_Void) },
|
||||||
{ V("sc_checkcreaturedanger", Void_Void) },
|
{ V("sc_checkcreaturedanger", Void_Void) },
|
||||||
{ V("sc_checkfalldamage", Void_Void) },
|
{ V("sc_checkfalldamage", Void_Void) },
|
||||||
{ V("sc_checkrevival", Void_Void) },
|
{ V("sc_checkrevival", Void_Void) },
|
||||||
{ V("sc_mediccallsound", Void_Void) },
|
{ V("sc_mediccallsound", Void_Void) },
|
||||||
|
|
||||||
{ V("sc_player_menuinputperformed", Void_Bool) },
|
{ V("sc_player_menuinputperformed", Void_Bool) },
|
||||||
{ V("sc_player_ismenuinputdone",Bool_Void) },
|
{ V("sc_player_ismenuinputdone",Bool_Void) },
|
||||||
{ V("sc_player_specialspawn", Void_Void) },
|
{ V("sc_player_specialspawn", Void_Void) },
|
||||||
{ V("sc_player_isvalidinfoentity", Bool_Void) },
|
{ V("sc_player_isvalidinfoentity", Bool_Void) },
|
||||||
{ V("sc_player_levelend", Void_Void) },
|
{ V("sc_player_levelend", Void_Void) },
|
||||||
{ V("sc_player_votestarted", Void_Int) },
|
{ V("sc_player_votestarted", Void_Int) },
|
||||||
{ V("sc_player_canstartnextvote", Bool_Int) },
|
{ V("sc_player_canstartnextvote", Bool_Int) },
|
||||||
{ V("sc_player_vote", Void_Int) },
|
{ V("sc_player_vote", Void_Int) },
|
||||||
{ V("sc_player_hasvoted", Bool_Void) },
|
{ V("sc_player_hasvoted", Bool_Void) },
|
||||||
{ V("sc_player_resetvote", Void_Void) },
|
{ V("sc_player_resetvote", Void_Void) },
|
||||||
{ V("sc_player_lastvoteinput", Int_Void) },
|
{ V("sc_player_lastvoteinput", Int_Void) },
|
||||||
{ V("sc_player_initvote", Void_Void) },
|
{ V("sc_player_initvote", Void_Void) },
|
||||||
{ V("sc_player_timetostartnextvote", Float_Void) },
|
{ V("sc_player_timetostartnextvote", Float_Void) },
|
||||||
{ V("sc_player_resetview", Void_Void) },
|
{ V("sc_player_resetview", Void_Void) },
|
||||||
{ V("sc_player_getlogfrequency",Float_Void) },
|
{ V("sc_player_getlogfrequency",Float_Void) },
|
||||||
{ V("sc_player_logplayerstats", Bool_Void) },
|
{ V("sc_player_logplayerstats", Bool_Void) },
|
||||||
{ V("sc_player_disablecollisionwithplayer", Void_Cbase_Float) },
|
{ V("sc_player_disablecollisionwithplayer", Void_Cbase_Float) },
|
||||||
{ V("sc_player_enablecollisionwithplayer", Void_Cbase_Bool) },
|
{ V("sc_player_enablecollisionwithplayer", Void_Cbase_Bool) },
|
||||||
{ V("sc_player_cantouchplayer", Bool_Cbase) },
|
{ V("sc_player_cantouchplayer", Bool_Cbase) },
|
||||||
|
|
||||||
{ V("sc_item_materialize", Void_Void) },
|
{ V("sc_item_materialize", Void_Void) },
|
||||||
|
|
||||||
{ V("sc_weapon_bulletaccuracy", Vector_Vector_Vector_Vector) },
|
{ V("sc_weapon_bulletaccuracy", Vector_Vector_Vector_Vector) },
|
||||||
{ V("sc_weapon_tertiaryattack", Void_Void) },
|
{ V("sc_weapon_tertiaryattack", Void_Void) },
|
||||||
{ V("sc_weapon_burstsupplement",Void_Void) },
|
{ V("sc_weapon_burstsupplement",Void_Void) },
|
||||||
{ V("sc_weapon_getp_model", Str_Str) },
|
{ V("sc_weapon_getp_model", Str_Str) },
|
||||||
{ V("sc_weapon_getw_model", Str_Str) },
|
{ V("sc_weapon_getw_model", Str_Str) },
|
||||||
{ V("sc_weapon_getv_model", Str_Str) },
|
{ V("sc_weapon_getv_model", Str_Str) },
|
||||||
{ V("sc_weapon_precachecustommodels", Void_Void) },
|
{ V("sc_weapon_precachecustommodels", Void_Void) },
|
||||||
{ V("sc_weapon_ismultiplayer", Int_Void) },
|
{ V("sc_weapon_ismultiplayer", Int_Void) },
|
||||||
{ V("sc_weapon_frunfuncs", Int_Void) },
|
{ V("sc_weapon_frunfuncs", Int_Void) },
|
||||||
{ V("sc_weapon_setfov", Void_Int) },
|
{ V("sc_weapon_setfov", Void_Int) },
|
||||||
{ V("sc_weapon_fcanrun", Int_Void) },
|
{ V("sc_weapon_fcanrun", Int_Void) },
|
||||||
{ V("sc_weapon_customdecrement",Void_Float) },
|
{ V("sc_weapon_customdecrement",Void_Float) },
|
||||||
{ V("sc_weapon_setv_model", Void_Str) },
|
{ V("sc_weapon_setv_model", Void_Str) },
|
||||||
{ V("sc_weapon_setp_model", Void_Str) },
|
{ V("sc_weapon_setp_model", Void_Str) },
|
||||||
{ V("sc_weapon_changeweaponskin",Void_Short) },
|
{ V("sc_weapon_changeweaponskin",Void_Short) },
|
||||||
|
|
||||||
/** New Additions (2013) **/
|
/** New Additions (2013) **/
|
||||||
|
|
||||||
{ V("tfc_killed",Void_Entvar_Entvar_Int) },
|
{ V("tfc_killed",Void_Entvar_Entvar_Int) },
|
||||||
{ V("tfc_istriggered", Int_Void) },
|
{ V("tfc_istriggered", Int_Void) },
|
||||||
{ V("tfc_weapon_sendweaponanim", Void_Int_Int) },
|
{ V("tfc_weapon_sendweaponanim", Void_Int_Int) },
|
||||||
{ V("tfc_weapon_getnextattackdelay", Float_Float) },
|
{ V("tfc_weapon_getnextattackdelay", Float_Float) },
|
||||||
|
|
||||||
{ V("sc_takehealth",Int_Float_Int_Int) },
|
{ V("sc_takehealth",Int_Float_Int_Int) },
|
||||||
{ V("sc_takearmor", Int_Float_Int_Int) },
|
{ V("sc_takearmor", Int_Float_Int_Int) },
|
||||||
{ V("sc_giveammo", Int_Int_Str_Int_Int) },
|
{ V("sc_giveammo", Int_Int_Str_Int_Int) },
|
||||||
{ V("sc_checkattacker", Int_Cbase) },
|
{ V("sc_checkattacker", Int_Cbase) },
|
||||||
{ V("sc_player_isconnected", Int_Void) },
|
{ V("sc_player_isconnected", Int_Void) },
|
||||||
|
|
||||||
{ V("dod_weapon_sendweaponanim", Void_Int_Int) },
|
{ V("dod_weapon_sendweaponanim", Void_Int_Int) },
|
||||||
|
|
||||||
{ V("cstrike_item_isweapon", Int_Void) },
|
{ V("cstrike_item_isweapon", Int_Void) },
|
||||||
|
|
||||||
{ V("gearbox_mysquadtalkmonsterpointer", Cbase_Void) },
|
{ V("gearbox_mysquadtalkmonsterpointer", Cbase_Void) },
|
||||||
{ V("gearbox_weapontimebase", Float_Void) },
|
{ V("gearbox_weapontimebase", Float_Void) },
|
||||||
|
|
||||||
{ V("ts_weapon_alternateattack", Void_Void) },
|
{ V("ts_weapon_alternateattack", Void_Void) },
|
||||||
|
|
||||||
{ V("item_getiteminfo", Void_ItemInfo) }
|
{ V("item_getiteminfo", Void_ItemInfo) }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
#include "NEW_Util.h"
|
#include "NEW_Util.h"
|
||||||
#include "ham_utils.h"
|
#include "ham_utils.h"
|
||||||
|
|
||||||
inline edict_t* INDEXENT2( int iEdictNum )
|
inline edict_t* INDEXENT2( int iEdictNum )
|
||||||
{
|
{
|
||||||
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
|
if (iEdictNum >= 1 && iEdictNum <= gpGlobals->maxClients)
|
||||||
return MF_GetPlayerEdict(iEdictNum);
|
return MF_GetPlayerEdict(iEdictNum);
|
||||||
else
|
else
|
||||||
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
|
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
|
||||||
|
|
|
@ -10,91 +10,91 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* This file is a replacement for the engine call of ALLOC_STRING
|
/* This file is a replacement for the engine call of ALLOC_STRING
|
||||||
* The main difference is that a string will not be allocated twice
|
* The main difference is that a string will not be allocated twice
|
||||||
* as to try to avoid wasting the HL zone space.
|
* as to try to avoid wasting the HL zone space.
|
||||||
*
|
*
|
||||||
* NOTE: The lookup uses strcmp() in a linked list! It is not fast
|
* NOTE: The lookup uses strcmp() in a linked list! It is not fast
|
||||||
* Its implementation in the NS module is on rarely used
|
* Its implementation in the NS module is on rarely used
|
||||||
* natives.
|
* natives.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ALLOCSTRING_H
|
#ifndef ALLOCSTRING_H
|
||||||
#define ALLOCSTRING_H
|
#define ALLOCSTRING_H
|
||||||
|
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
#include <am-linkedlist.h>
|
#include <am-linkedlist.h>
|
||||||
|
|
||||||
class StringManager
|
class StringManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ke::LinkedList<ke::AString *> m_StringList;
|
ke::LinkedList<ke::AString *> m_StringList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* sh_list.h does not delete objects put into
|
* sh_list.h does not delete objects put into
|
||||||
* the list, so I need to delete those and clear()
|
* the list, so I need to delete those and clear()
|
||||||
*/
|
*/
|
||||||
inline void Clear(void)
|
inline void Clear(void)
|
||||||
{
|
{
|
||||||
ke::LinkedList<ke::AString *>::iterator end;
|
ke::LinkedList<ke::AString *>::iterator end;
|
||||||
ke::LinkedList<ke::AString *>::iterator iter;
|
ke::LinkedList<ke::AString *>::iterator iter;
|
||||||
|
|
||||||
iter=m_StringList.begin();
|
iter=m_StringList.begin();
|
||||||
end=m_StringList.end();
|
end=m_StringList.end();
|
||||||
|
|
||||||
while (iter!=end)
|
while (iter!=end)
|
||||||
{
|
{
|
||||||
delete (*iter++);
|
delete (*iter++);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_StringList.clear();
|
m_StringList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate the list to see if the string exists
|
* Iterate the list to see if the string exists
|
||||||
* This is slow and not very ideal, however
|
* This is slow and not very ideal, however
|
||||||
* this is *very* rarely used so it won't matter
|
* this is *very* rarely used so it won't matter
|
||||||
*/
|
*/
|
||||||
inline int Allocate(const char *str)
|
inline int Allocate(const char *str)
|
||||||
{
|
{
|
||||||
ke::LinkedList<ke::AString *>::iterator end;
|
ke::LinkedList<ke::AString *>::iterator end;
|
||||||
ke::LinkedList<ke::AString *>::iterator iter;
|
ke::LinkedList<ke::AString *>::iterator iter;
|
||||||
|
|
||||||
iter=m_StringList.begin();
|
iter=m_StringList.begin();
|
||||||
end=m_StringList.end();
|
end=m_StringList.end();
|
||||||
|
|
||||||
while (iter!=end)
|
while (iter!=end)
|
||||||
{
|
{
|
||||||
if (strcmp(str, (*iter)->chars()) == 0)
|
if (strcmp(str, (*iter)->chars()) == 0)
|
||||||
{
|
{
|
||||||
// String is already in the list, do not allocate it again
|
// String is already in the list, do not allocate it again
|
||||||
return MAKE_STRING((*iter)->chars());
|
return MAKE_STRING((*iter)->chars());
|
||||||
}
|
}
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Was not found in the linked list, allocate it and add it to the list
|
// Was not found in the linked list, allocate it and add it to the list
|
||||||
ke::AString *AllocStr = new ke::AString(str);
|
ke::AString *AllocStr = new ke::AString(str);
|
||||||
|
|
||||||
m_StringList.append(AllocStr);
|
m_StringList.append(AllocStr);
|
||||||
|
|
||||||
return MAKE_STRING(AllocStr->chars());
|
return MAKE_STRING(AllocStr->chars());
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern StringManager AllocStringList;
|
extern StringManager AllocStringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple wrapper to make conversion easier
|
* Simple wrapper to make conversion easier
|
||||||
*/
|
*/
|
||||||
inline int ALLOC_STRING2(const char *InputString)
|
inline int ALLOC_STRING2(const char *InputString)
|
||||||
{
|
{
|
||||||
return AllocStringList.Allocate(InputString);
|
return AllocStringList.Allocate(InputString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // ALLOCSTRING_H
|
#endif // ALLOCSTRING_H
|
||||||
|
|
|
@ -10,88 +10,88 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* This holds the functions which determine which hooks I need forwareded */
|
/* This holds the functions which determine which hooks I need forwareded */
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "CPlayer.h"
|
#include "CPlayer.h"
|
||||||
|
|
||||||
void GameManager::HookPreThink(void)
|
void GameManager::HookPreThink(void)
|
||||||
{
|
{
|
||||||
// Only need to hook prethink if at least 1 plugins has any of these forwards:
|
// Only need to hook prethink if at least 1 plugins has any of these forwards:
|
||||||
// client_spawn, client_changeteam, client_changeclass
|
// client_spawn, client_changeteam, client_changeclass
|
||||||
|
|
||||||
if (UTIL_CheckForPublic("client_spawn") ||
|
if (UTIL_CheckForPublic("client_spawn") ||
|
||||||
UTIL_CheckForPublic("client_changeteam") ||
|
UTIL_CheckForPublic("client_changeteam") ||
|
||||||
UTIL_CheckForPublic("client_changeclass"))
|
UTIL_CheckForPublic("client_changeclass"))
|
||||||
{
|
{
|
||||||
g_pFunctionTable->pfnPlayerPreThink=PlayerPreThink;
|
g_pFunctionTable->pfnPlayerPreThink=PlayerPreThink;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pFunctionTable->pfnPlayerPreThink=NULL;
|
g_pFunctionTable->pfnPlayerPreThink=NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GameManager::HookPostThink_Post(void)
|
void GameManager::HookPostThink_Post(void)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
while (i++<gpGlobals->maxClients)
|
while (i++<gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
if (GET_PLAYER_I(i)->NeedPostThink_Post())
|
if (GET_PLAYER_I(i)->NeedPostThink_Post())
|
||||||
{
|
{
|
||||||
g_pFunctionTable_Post->pfnPlayerPostThink=PlayerPostThink_Post;
|
g_pFunctionTable_Post->pfnPlayerPostThink=PlayerPostThink_Post;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pFunctionTable_Post->pfnPlayerPostThink=NULL;
|
g_pFunctionTable_Post->pfnPlayerPostThink=NULL;
|
||||||
};
|
};
|
||||||
void GameManager::HookPreThink_Post(void)
|
void GameManager::HookPreThink_Post(void)
|
||||||
{
|
{
|
||||||
int i=1;
|
int i=1;
|
||||||
while (i<gpGlobals->maxClients)
|
while (i<gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
if (GET_PLAYER_I(i++)->NeedPreThink_Post())
|
if (GET_PLAYER_I(i++)->NeedPreThink_Post())
|
||||||
{
|
{
|
||||||
g_pFunctionTable_Post->pfnPlayerPreThink=PlayerPreThink_Post;
|
g_pFunctionTable_Post->pfnPlayerPreThink=PlayerPreThink_Post;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pFunctionTable_Post->pfnPlayerPreThink=NULL;
|
g_pFunctionTable_Post->pfnPlayerPreThink=NULL;
|
||||||
};
|
};
|
||||||
void GameManager::HookUpdateClientData(void)
|
void GameManager::HookUpdateClientData(void)
|
||||||
{
|
{
|
||||||
int i=1;
|
int i=1;
|
||||||
while (i<gpGlobals->maxClients)
|
while (i<gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
if (GET_PLAYER_I(i++)->NeedUpdateClientData())
|
if (GET_PLAYER_I(i++)->NeedUpdateClientData())
|
||||||
{
|
{
|
||||||
g_pFunctionTable->pfnUpdateClientData=UpdateClientData;
|
g_pFunctionTable->pfnUpdateClientData=UpdateClientData;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pFunctionTable->pfnUpdateClientData=NULL;
|
g_pFunctionTable->pfnUpdateClientData=NULL;
|
||||||
};
|
};
|
||||||
void GameManager::HookLogs()
|
void GameManager::HookLogs()
|
||||||
{
|
{
|
||||||
// These forwards only are needed in classic NS
|
// These forwards only are needed in classic NS
|
||||||
if (!IsCombat() && UTIL_CheckForPublic("client_built"))
|
if (!IsCombat() && UTIL_CheckForPublic("client_built"))
|
||||||
{
|
{
|
||||||
// Only hook if this public exists (wasteful otherwise)
|
// Only hook if this public exists (wasteful otherwise)
|
||||||
m_BuiltForward = MF_RegisterForward("client_built", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
m_BuiltForward = MF_RegisterForward("client_built", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
g_pengfuncsTable_Post->pfnAlertMessage=AlertMessage_Post;
|
g_pengfuncsTable_Post->pfnAlertMessage=AlertMessage_Post;
|
||||||
g_pengfuncsTable_Post->pfnCreateNamedEntity=CreateNamedEntity_Post;
|
g_pengfuncsTable_Post->pfnCreateNamedEntity=CreateNamedEntity_Post;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no need for these hooks in co
|
// no need for these hooks in co
|
||||||
g_pengfuncsTable_Post->pfnAlertMessage=NULL;
|
g_pengfuncsTable_Post->pfnAlertMessage=NULL;
|
||||||
g_pengfuncsTable_Post->pfnCreateNamedEntity=NULL;
|
g_pengfuncsTable_Post->pfnCreateNamedEntity=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,287 +10,287 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* This file includes game-related stuff, such as message IDs
|
/* This file includes game-related stuff, such as message IDs
|
||||||
* and forwards
|
* and forwards
|
||||||
*/
|
*/
|
||||||
#ifndef GAMEMANAGER_H
|
#ifndef GAMEMANAGER_H
|
||||||
#define GAMEMANAGER_H
|
#define GAMEMANAGER_H
|
||||||
|
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
|
|
||||||
class GameManager
|
class GameManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Basic game variables
|
// Basic game variables
|
||||||
int m_IsCombat;
|
int m_IsCombat;
|
||||||
|
|
||||||
int m_HudText2; // Message IDS
|
int m_HudText2; // Message IDS
|
||||||
int m_SetFOV;
|
int m_SetFOV;
|
||||||
|
|
||||||
// Forwards
|
// Forwards
|
||||||
int m_ChangeclassForward;
|
int m_ChangeclassForward;
|
||||||
int m_BuiltForward;
|
int m_BuiltForward;
|
||||||
int m_SpawnForward;
|
int m_SpawnForward;
|
||||||
int m_TeamForward;
|
int m_TeamForward;
|
||||||
int m_RoundStartForward;
|
int m_RoundStartForward;
|
||||||
int m_RoundEndForward;
|
int m_RoundEndForward;
|
||||||
int m_MapResetForward;
|
int m_MapResetForward;
|
||||||
|
|
||||||
REAL m_fRoundStartTime; // Time the match should start
|
REAL m_fRoundStartTime; // Time the match should start
|
||||||
int m_RoundInProgress; // Whether or not there is a match in progress
|
int m_RoundInProgress; // Whether or not there is a match in progress
|
||||||
|
|
||||||
edict_t *m_SavedEdict; // saved edict for client_built
|
edict_t *m_SavedEdict; // saved edict for client_built
|
||||||
|
|
||||||
int m_iTitlesMap;
|
int m_iTitlesMap;
|
||||||
|
|
||||||
bool m_SendMapReset;
|
bool m_SendMapReset;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameManager()
|
GameManager()
|
||||||
{
|
{
|
||||||
m_SendMapReset = true;
|
m_SendMapReset = true;
|
||||||
m_IsCombat=0;
|
m_IsCombat=0;
|
||||||
m_HudText2=0;
|
m_HudText2=0;
|
||||||
m_SetFOV=0;
|
m_SetFOV=0;
|
||||||
|
|
||||||
m_SavedEdict=NULL;
|
m_SavedEdict=NULL;
|
||||||
|
|
||||||
m_RoundInProgress=0;
|
m_RoundInProgress=0;
|
||||||
|
|
||||||
ResetForwards();
|
ResetForwards();
|
||||||
};
|
};
|
||||||
inline void CheckMap(void)
|
inline void CheckMap(void)
|
||||||
{
|
{
|
||||||
ke::AString MapName;
|
ke::AString MapName;
|
||||||
|
|
||||||
MapName = UTIL_ToLowerCase(STRING(gpGlobals->mapname));
|
MapName = UTIL_ToLowerCase(STRING(gpGlobals->mapname));
|
||||||
|
|
||||||
m_iTitlesMap=0;
|
m_iTitlesMap=0;
|
||||||
|
|
||||||
if (MapName.compare("ns_bast")==0 ||
|
if (MapName.compare("ns_bast")==0 ||
|
||||||
MapName.compare("ns_bast_classic") == 0 ||
|
MapName.compare("ns_bast_classic") == 0 ||
|
||||||
MapName.compare("ns_hera") == 0 ||
|
MapName.compare("ns_hera") == 0 ||
|
||||||
MapName.compare("ns_nothing") == 0 ||
|
MapName.compare("ns_nothing") == 0 ||
|
||||||
MapName.compare("ns_caged") == 0 ||
|
MapName.compare("ns_caged") == 0 ||
|
||||||
MapName.compare("ns_tanith") == 0 ||
|
MapName.compare("ns_tanith") == 0 ||
|
||||||
MapName.compare("ns_eclipse") == 0 ||
|
MapName.compare("ns_eclipse") == 0 ||
|
||||||
MapName.compare("ns_veil") == 0 ||
|
MapName.compare("ns_veil") == 0 ||
|
||||||
MapName.compare("ns_nancy") == 0)
|
MapName.compare("ns_nancy") == 0)
|
||||||
{
|
{
|
||||||
m_iTitlesMap=1;
|
m_iTitlesMap=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
inline int &TitleMap(void)
|
inline int &TitleMap(void)
|
||||||
{
|
{
|
||||||
return m_iTitlesMap;
|
return m_iTitlesMap;
|
||||||
};
|
};
|
||||||
inline void SetCombat(int value)
|
inline void SetCombat(int value)
|
||||||
{
|
{
|
||||||
m_IsCombat=value;
|
m_IsCombat=value;
|
||||||
};
|
};
|
||||||
inline int &IsCombat(void)
|
inline int &IsCombat(void)
|
||||||
{
|
{
|
||||||
return m_IsCombat;
|
return m_IsCombat;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void UpdateHudText2(void)
|
inline void UpdateHudText2(void)
|
||||||
{
|
{
|
||||||
if (!m_HudText2)
|
if (!m_HudText2)
|
||||||
{
|
{
|
||||||
GetMessageIDs();
|
GetMessageIDs();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
inline void UpdateSetFOV(void)
|
inline void UpdateSetFOV(void)
|
||||||
{
|
{
|
||||||
if (!m_SetFOV)
|
if (!m_SetFOV)
|
||||||
{
|
{
|
||||||
GetMessageIDs();
|
GetMessageIDs();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
inline int &GetHudText2(void)
|
inline int &GetHudText2(void)
|
||||||
{
|
{
|
||||||
return m_HudText2;
|
return m_HudText2;
|
||||||
};
|
};
|
||||||
inline int &GetSetFOV(void)
|
inline int &GetSetFOV(void)
|
||||||
{
|
{
|
||||||
return m_SetFOV;
|
return m_SetFOV;
|
||||||
};
|
};
|
||||||
inline void GetMessageIDs(void)
|
inline void GetMessageIDs(void)
|
||||||
{
|
{
|
||||||
m_HudText2=GET_USER_MSG_ID(&Plugin_info,"HudText2",NULL);
|
m_HudText2=GET_USER_MSG_ID(&Plugin_info,"HudText2",NULL);
|
||||||
m_SetFOV=GET_USER_MSG_ID(&Plugin_info,"SetFOV",NULL);
|
m_SetFOV=GET_USER_MSG_ID(&Plugin_info,"SetFOV",NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void EvaluateCombat(void)
|
inline void EvaluateCombat(void)
|
||||||
{
|
{
|
||||||
const char *Map=STRING(gpGlobals->mapname);
|
const char *Map=STRING(gpGlobals->mapname);
|
||||||
|
|
||||||
// if map starts with co_ it is combat
|
// if map starts with co_ it is combat
|
||||||
// otherwise it is classic gameplay
|
// otherwise it is classic gameplay
|
||||||
if ((Map[0]=='c' || Map[0]=='C') &&
|
if ((Map[0]=='c' || Map[0]=='C') &&
|
||||||
(Map[1]=='o' || Map[1]=='O') &&
|
(Map[1]=='o' || Map[1]=='O') &&
|
||||||
(Map[2]=='_'))
|
(Map[2]=='_'))
|
||||||
{
|
{
|
||||||
SetCombat(1);
|
SetCombat(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCombat(0);
|
SetCombat(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void ResetForwards(void)
|
inline void ResetForwards(void)
|
||||||
{
|
{
|
||||||
m_ChangeclassForward=-1;
|
m_ChangeclassForward=-1;
|
||||||
m_BuiltForward=-1;
|
m_BuiltForward=-1;
|
||||||
m_SpawnForward=-1;
|
m_SpawnForward=-1;
|
||||||
m_TeamForward=-1;
|
m_TeamForward=-1;
|
||||||
m_RoundStartForward=-1;
|
m_RoundStartForward=-1;
|
||||||
m_RoundEndForward=-1;
|
m_RoundEndForward=-1;
|
||||||
m_MapResetForward=-1;
|
m_MapResetForward=-1;
|
||||||
};
|
};
|
||||||
inline void RegisterForwards(void)
|
inline void RegisterForwards(void)
|
||||||
{
|
{
|
||||||
ResetForwards();
|
ResetForwards();
|
||||||
|
|
||||||
|
|
||||||
m_SpawnForward = MF_RegisterForward("client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
|
m_SpawnForward = MF_RegisterForward("client_spawn",ET_IGNORE,FP_CELL/*id*/,FP_DONE);
|
||||||
m_TeamForward = MF_RegisterForward("client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*new team*/,FP_CELL/*old team*/,FP_DONE);
|
m_TeamForward = MF_RegisterForward("client_changeteam",ET_IGNORE,FP_CELL/*id*/,FP_CELL/*new team*/,FP_CELL/*old team*/,FP_DONE);
|
||||||
m_ChangeclassForward = MF_RegisterForward("client_changeclass", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
m_ChangeclassForward = MF_RegisterForward("client_changeclass", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL, FP_DONE);
|
||||||
m_RoundStartForward = MF_RegisterForward("round_start", ET_IGNORE, FP_DONE);
|
m_RoundStartForward = MF_RegisterForward("round_start", ET_IGNORE, FP_DONE);
|
||||||
m_RoundEndForward = MF_RegisterForward("round_end", ET_IGNORE, FP_FLOAT, FP_DONE);
|
m_RoundEndForward = MF_RegisterForward("round_end", ET_IGNORE, FP_FLOAT, FP_DONE);
|
||||||
m_MapResetForward = MF_RegisterForward("map_reset", ET_IGNORE, FP_CELL, FP_DONE);
|
m_MapResetForward = MF_RegisterForward("map_reset", ET_IGNORE, FP_CELL, FP_DONE);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void StartFrame(void)
|
inline void StartFrame(void)
|
||||||
{
|
{
|
||||||
if (gpGlobals->time >= m_fRoundStartTime)
|
if (gpGlobals->time >= m_fRoundStartTime)
|
||||||
{
|
{
|
||||||
g_pFunctionTable->pfnStartFrame=NULL;
|
g_pFunctionTable->pfnStartFrame=NULL;
|
||||||
RoundStart();
|
RoundStart();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called from MessageHandler's Countdown
|
* This is called from MessageHandler's Countdown
|
||||||
* hook. It passes the only byte sent (time)
|
* hook. It passes the only byte sent (time)
|
||||||
*/
|
*/
|
||||||
inline void HandleCountdown(int &Time)
|
inline void HandleCountdown(int &Time)
|
||||||
{
|
{
|
||||||
// Begin hooking start frame
|
// Begin hooking start frame
|
||||||
g_pFunctionTable->pfnStartFrame=::StartFrame;
|
g_pFunctionTable->pfnStartFrame=::StartFrame;
|
||||||
|
|
||||||
// set time of round start
|
// set time of round start
|
||||||
m_fRoundStartTime=gpGlobals->time + Time;
|
m_fRoundStartTime=gpGlobals->time + Time;
|
||||||
|
|
||||||
m_SendMapReset = true;
|
m_SendMapReset = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called from MessageHandler's GameStatus
|
* This is called from MessageHandler's GameStatus
|
||||||
* hook. It passes the first byte sent.
|
* hook. It passes the first byte sent.
|
||||||
* 2 = Round End
|
* 2 = Round End
|
||||||
*/
|
*/
|
||||||
inline void HandleGameStatus(int &FirstByte)
|
inline void HandleGameStatus(int &FirstByte)
|
||||||
{
|
{
|
||||||
switch (FirstByte)
|
switch (FirstByte)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (m_SendMapReset)
|
if (m_SendMapReset)
|
||||||
{
|
{
|
||||||
MF_ExecuteForward(m_MapResetForward, 0);
|
MF_ExecuteForward(m_MapResetForward, 0);
|
||||||
}
|
}
|
||||||
m_SendMapReset = false;
|
m_SendMapReset = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
MF_ExecuteForward(m_MapResetForward, 1);
|
MF_ExecuteForward(m_MapResetForward, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
RoundEnd();
|
RoundEnd();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void RoundStart()
|
inline void RoundStart()
|
||||||
{
|
{
|
||||||
m_RoundInProgress=1;
|
m_RoundInProgress=1;
|
||||||
MF_ExecuteForward(m_RoundStartForward);
|
MF_ExecuteForward(m_RoundStartForward);
|
||||||
};
|
};
|
||||||
inline void RoundEnd()
|
inline void RoundEnd()
|
||||||
{
|
{
|
||||||
m_RoundInProgress=0;
|
m_RoundInProgress=0;
|
||||||
|
|
||||||
MF_ExecuteForward(m_RoundEndForward,gpGlobals->time - m_fRoundStartTime);
|
MF_ExecuteForward(m_RoundEndForward,gpGlobals->time - m_fRoundStartTime);
|
||||||
};
|
};
|
||||||
inline int &RoundInProgress()
|
inline int &RoundInProgress()
|
||||||
{
|
{
|
||||||
return m_RoundInProgress;
|
return m_RoundInProgress;
|
||||||
};
|
};
|
||||||
// no need to check -1 forwards in these
|
// no need to check -1 forwards in these
|
||||||
// amxmodx checks it anyway
|
// amxmodx checks it anyway
|
||||||
inline void ExecuteClientBuilt(int &PlayerID, int StructureID, int &StructureType, int &Impulse)
|
inline void ExecuteClientBuilt(int &PlayerID, int StructureID, int &StructureType, int &Impulse)
|
||||||
{
|
{
|
||||||
MF_ExecuteForward(m_BuiltForward,PlayerID, StructureID, StructureType, Impulse);
|
MF_ExecuteForward(m_BuiltForward,PlayerID, StructureID, StructureType, Impulse);
|
||||||
};
|
};
|
||||||
inline void ExecuteClientSpawn(int &PlayerID)
|
inline void ExecuteClientSpawn(int &PlayerID)
|
||||||
{
|
{
|
||||||
MF_ExecuteForward(m_SpawnForward,PlayerID);
|
MF_ExecuteForward(m_SpawnForward,PlayerID);
|
||||||
};
|
};
|
||||||
inline void ExecuteClientChangeTeam(int &PlayerID, int &NewTeam, int &OldTeam)
|
inline void ExecuteClientChangeTeam(int &PlayerID, int &NewTeam, int &OldTeam)
|
||||||
{
|
{
|
||||||
MF_ExecuteForward(m_TeamForward, PlayerID, NewTeam, OldTeam);
|
MF_ExecuteForward(m_TeamForward, PlayerID, NewTeam, OldTeam);
|
||||||
};
|
};
|
||||||
inline void ExecuteClientChangeClass(int &PlayerID, int &NewClass, int &OldClass)
|
inline void ExecuteClientChangeClass(int &PlayerID, int &NewClass, int &OldClass)
|
||||||
{
|
{
|
||||||
MF_ExecuteForward(m_ChangeclassForward,PlayerID,NewClass,OldClass);
|
MF_ExecuteForward(m_ChangeclassForward,PlayerID,NewClass,OldClass);
|
||||||
};
|
};
|
||||||
inline void ExecuteRoundStart(void)
|
inline void ExecuteRoundStart(void)
|
||||||
{
|
{
|
||||||
MF_ExecuteForward(m_RoundStartForward);
|
MF_ExecuteForward(m_RoundStartForward);
|
||||||
};
|
};
|
||||||
inline void ExecuteRoundEnd(void)
|
inline void ExecuteRoundEnd(void)
|
||||||
{
|
{
|
||||||
MF_ExecuteForward(m_RoundEndForward);
|
MF_ExecuteForward(m_RoundEndForward);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The next few functions tell the module what metamod hooks
|
* The next few functions tell the module what metamod hooks
|
||||||
* i need. This tries to run-time optimize out what we
|
* i need. This tries to run-time optimize out what we
|
||||||
* do not need.
|
* do not need.
|
||||||
*/
|
*/
|
||||||
void HookPreThink(void);
|
void HookPreThink(void);
|
||||||
void HookPostThink_Post(void);
|
void HookPostThink_Post(void);
|
||||||
void HookPreThink_Post(void);
|
void HookPreThink_Post(void);
|
||||||
void HookUpdateClientData(void);
|
void HookUpdateClientData(void);
|
||||||
void HookLogs(void); // AlertMessage AND CreateNamedEntity
|
void HookLogs(void); // AlertMessage AND CreateNamedEntity
|
||||||
|
|
||||||
inline void CheckAllHooks(void)
|
inline void CheckAllHooks(void)
|
||||||
{
|
{
|
||||||
HookPreThink();
|
HookPreThink();
|
||||||
HookPostThink_Post();
|
HookPostThink_Post();
|
||||||
HookPreThink_Post();
|
HookPreThink_Post();
|
||||||
HookUpdateClientData();
|
HookUpdateClientData();
|
||||||
HookLogs();
|
HookLogs();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void SetTemporaryEdict(edict_t *Edict)
|
inline void SetTemporaryEdict(edict_t *Edict)
|
||||||
{
|
{
|
||||||
m_SavedEdict=Edict;
|
m_SavedEdict=Edict;
|
||||||
};
|
};
|
||||||
inline edict_t *GetTemporaryEdict(void)
|
inline edict_t *GetTemporaryEdict(void)
|
||||||
{
|
{
|
||||||
return m_SavedEdict;
|
return m_SavedEdict;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GameManager GameMan;
|
extern GameManager GameMan;
|
||||||
|
|
||||||
#endif // GAMEMANAGER_H
|
#endif // GAMEMANAGER_H
|
||||||
|
|
330
dlls/ns/Hash.h
330
dlls/ns/Hash.h
|
@ -11,168 +11,168 @@
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef _HASH_H_
|
#ifndef _HASH_H_
|
||||||
#define _HASH_H_
|
#define _HASH_H_
|
||||||
|
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
|
|
||||||
|
|
||||||
// Just a very simple hash map, no iteration or anything of the like (not needed)
|
// Just a very simple hash map, no iteration or anything of the like (not needed)
|
||||||
|
|
||||||
|
|
||||||
inline int HashFunction(const ke::AString& name)
|
inline int HashFunction(const ke::AString& name)
|
||||||
{
|
{
|
||||||
static const int kHashNumTable[128] =
|
static const int kHashNumTable[128] =
|
||||||
{
|
{
|
||||||
0x1148FC3E, 0x0577C975, 0x3BED3AED, 0x62FBBD5F, 0x07DE2DA0, 0x6555C5E5, 0x24DB841A, 0x2AF3F568,
|
0x1148FC3E, 0x0577C975, 0x3BED3AED, 0x62FBBD5F, 0x07DE2DA0, 0x6555C5E5, 0x24DB841A, 0x2AF3F568,
|
||||||
0x01EA1B65, 0x46F7D976, 0x18172B99, 0x394B2A58, 0x1ED39AA8, 0x1214E706, 0x5DD47295, 0x53574932,
|
0x01EA1B65, 0x46F7D976, 0x18172B99, 0x394B2A58, 0x1ED39AA8, 0x1214E706, 0x5DD47295, 0x53574932,
|
||||||
0x2CE25D5C, 0x7A2E5BB4, 0x0F2F0153, 0x33888669, 0x729AC55F, 0x2A7BCA9E, 0x36C60816, 0x40F9A7E3,
|
0x2CE25D5C, 0x7A2E5BB4, 0x0F2F0153, 0x33888669, 0x729AC55F, 0x2A7BCA9E, 0x36C60816, 0x40F9A7E3,
|
||||||
0x2A37DF30, 0x3D81BB17, 0x6450B311, 0x75FA2DC9, 0x2A2678A5, 0x4C5E3675, 0x743F4486, 0x3B6F74E3,
|
0x2A37DF30, 0x3D81BB17, 0x6450B311, 0x75FA2DC9, 0x2A2678A5, 0x4C5E3675, 0x743F4486, 0x3B6F74E3,
|
||||||
0x51D5FFEA, 0x302C7F74, 0x1E6B3243, 0x59B42D8A, 0x15824559, 0x4346B65D, 0x04A822F2, 0x176C60BF,
|
0x51D5FFEA, 0x302C7F74, 0x1E6B3243, 0x59B42D8A, 0x15824559, 0x4346B65D, 0x04A822F2, 0x176C60BF,
|
||||||
0x0A3E8FD3, 0x1CBF4E8B, 0x50B78B17, 0x29122A7B, 0x2ED43591, 0x2E8BFDAC, 0x7C6973AE, 0x5BB692EE,
|
0x0A3E8FD3, 0x1CBF4E8B, 0x50B78B17, 0x29122A7B, 0x2ED43591, 0x2E8BFDAC, 0x7C6973AE, 0x5BB692EE,
|
||||||
0x28BA5960, 0x0B987501, 0x0F3F1957, 0x1B551EBF, 0x36143F9F, 0x4605216D, 0x5C4EC6A2, 0x604C1ECF,
|
0x28BA5960, 0x0B987501, 0x0F3F1957, 0x1B551EBF, 0x36143F9F, 0x4605216D, 0x5C4EC6A2, 0x604C1ECF,
|
||||||
0x0386DC84, 0x409F79B4, 0x56464C99, 0x2DAD5529, 0x0CFDB029, 0x4A85911F, 0x691CCA0D, 0x5ED3B013,
|
0x0386DC84, 0x409F79B4, 0x56464C99, 0x2DAD5529, 0x0CFDB029, 0x4A85911F, 0x691CCA0D, 0x5ED3B013,
|
||||||
0x7AB21093, 0x0787FC50, 0x3887DD9D, 0x103455ED, 0x4ACEB2AD, 0x3D30008F, 0x27A0B6AC, 0x550D4280,
|
0x7AB21093, 0x0787FC50, 0x3887DD9D, 0x103455ED, 0x4ACEB2AD, 0x3D30008F, 0x27A0B6AC, 0x550D4280,
|
||||||
0x59EF4F1B, 0x785841C3, 0x7E1F6CFC, 0x08C384AC, 0x26E43F70, 0x7A88E0AA, 0x647A179A, 0x4F9E98D0,
|
0x59EF4F1B, 0x785841C3, 0x7E1F6CFC, 0x08C384AC, 0x26E43F70, 0x7A88E0AA, 0x647A179A, 0x4F9E98D0,
|
||||||
0x062155AB, 0x73B930F1, 0x6AF3B790, 0x3C35954B, 0x39BE525E, 0x47427E32, 0x1C81B41A, 0x3D452EE2,
|
0x062155AB, 0x73B930F1, 0x6AF3B790, 0x3C35954B, 0x39BE525E, 0x47427E32, 0x1C81B41A, 0x3D452EE2,
|
||||||
0x07E1F7E6, 0x72C800B3, 0x6AF2840C, 0x14DFA80F, 0x3D4D91D3, 0x540F4E19, 0x73B35822, 0x37FFA266,
|
0x07E1F7E6, 0x72C800B3, 0x6AF2840C, 0x14DFA80F, 0x3D4D91D3, 0x540F4E19, 0x73B35822, 0x37FFA266,
|
||||||
0x5B974A69, 0x2C3B35BF, 0x4833F853, 0x2665FD16, 0x696B364F, 0x6FD4AEFF, 0x7B733F96, 0x435A856A,
|
0x5B974A69, 0x2C3B35BF, 0x4833F853, 0x2665FD16, 0x696B364F, 0x6FD4AEFF, 0x7B733F96, 0x435A856A,
|
||||||
0x682CF0C3, 0x7992AC92, 0x4C1E0A16, 0x0F113033, 0x741B8D3C, 0x309821B1, 0x5EAFC903, 0x7A3CE2E8,
|
0x682CF0C3, 0x7992AC92, 0x4C1E0A16, 0x0F113033, 0x741B8D3C, 0x309821B1, 0x5EAFC903, 0x7A3CE2E8,
|
||||||
0x245152A2, 0x49A38093, 0x36727833, 0x5E0FA501, 0x10E5FEC6, 0x52F42C4D, 0x1B54D3E3, 0x18C7F6AC,
|
0x245152A2, 0x49A38093, 0x36727833, 0x5E0FA501, 0x10E5FEC6, 0x52F42C4D, 0x1B54D3E3, 0x18C7F6AC,
|
||||||
0x45BC2D01, 0x064757EF, 0x2DA79EBC, 0x0309BED4, 0x5A56A608, 0x215AF6DE, 0x3B09613A, 0x35EDF071
|
0x45BC2D01, 0x064757EF, 0x2DA79EBC, 0x0309BED4, 0x5A56A608, 0x215AF6DE, 0x3B09613A, 0x35EDF071
|
||||||
};
|
};
|
||||||
size_t size = name.length();
|
size_t size = name.length();
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hasha = kHashNumTable[(*(name.chars() + (size - 1))) & 0x7F];
|
int hasha = kHashNumTable[(*(name.chars() + (size - 1))) & 0x7F];
|
||||||
int hashb = kHashNumTable[size % 128];
|
int hashb = kHashNumTable[size % 128];
|
||||||
|
|
||||||
|
|
||||||
unsigned char c = 0;
|
unsigned char c = 0;
|
||||||
for (size_t i = 0; i < size; i++)
|
for (size_t i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
c = (*(name.chars() + (size - 1))) & 0x7F;
|
c = (*(name.chars() + (size - 1))) & 0x7F;
|
||||||
|
|
||||||
hasha = (hasha + hashb) ^ kHashNumTable[c];
|
hasha = (hasha + hashb) ^ kHashNumTable[c];
|
||||||
hashb = hasha + hashb + c + (hasha << 8) + (hashb & 0xFF);
|
hashb = hasha + hashb + c + (hasha << 8) + (hashb & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return hasha;
|
return hasha;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param K Key type.
|
* @param K Key type.
|
||||||
* @param D Data type.
|
* @param D Data type.
|
||||||
* @param F Hash function.
|
* @param F Hash function.
|
||||||
* @param B Bucket count.
|
* @param B Bucket count.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename K = ke::AString, typename D = ke::AString, int (*F)(const K&) = HashFunction, int B = 1024>
|
template <typename K = ke::AString, typename D = ke::AString, int (*F)(const K&) = HashFunction, int B = 1024>
|
||||||
class Hash
|
class Hash
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
ke::Vector<int> m_HashBuckets[B];
|
ke::Vector<int> m_HashBuckets[B];
|
||||||
ke::Vector<K> m_KeyBuckets[B];
|
ke::Vector<K> m_KeyBuckets[B];
|
||||||
ke::Vector<D> m_DataBuckets[B];
|
ke::Vector<D> m_DataBuckets[B];
|
||||||
|
|
||||||
inline int GetBucket(int hash)
|
inline int GetBucket(int hash)
|
||||||
{
|
{
|
||||||
return (*reinterpret_cast<unsigned int*>(&hash)) % B;
|
return (*reinterpret_cast<unsigned int*>(&hash)) % B;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// prints bucket distribution
|
// prints bucket distribution
|
||||||
inline void printbuckets() const
|
inline void printbuckets() const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < B; i++)
|
for (int i = 0; i < B; i++)
|
||||||
{
|
{
|
||||||
if (i % 32 == 0 && i != 0)
|
if (i % 32 == 0 && i != 0)
|
||||||
{
|
{
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("%d ", m_HashBuckets[i].size());
|
printf("%d ", m_HashBuckets[i].size());
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
inline void insert(const K& key, const D& value)
|
inline void insert(const K& key, const D& value)
|
||||||
{
|
{
|
||||||
D* ptr;
|
D* ptr;
|
||||||
if ((ptr = this->find(key)) != NULL)
|
if ((ptr = this->find(key)) != NULL)
|
||||||
{
|
{
|
||||||
*ptr = value;
|
*ptr = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hash = F(key);
|
int hash = F(key);
|
||||||
|
|
||||||
int bucketnum = GetBucket(hash);
|
int bucketnum = GetBucket(hash);
|
||||||
|
|
||||||
m_HashBuckets[bucketnum].append(hash);
|
m_HashBuckets[bucketnum].append(hash);
|
||||||
m_KeyBuckets[bucketnum].append(key);
|
m_KeyBuckets[bucketnum].append(key);
|
||||||
m_DataBuckets[bucketnum].append(value);
|
m_DataBuckets[bucketnum].append(value);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
inline D& lookup_or_add(const K& key)
|
inline D& lookup_or_add(const K& key)
|
||||||
{
|
{
|
||||||
D* ptr;
|
D* ptr;
|
||||||
if ((ptr = this->find(key)) != NULL)
|
if ((ptr = this->find(key)) != NULL)
|
||||||
{
|
{
|
||||||
return *ptr;
|
return *ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hash = F(key);
|
int hash = F(key);
|
||||||
|
|
||||||
int bucketnum = GetBucket(hash);
|
int bucketnum = GetBucket(hash);
|
||||||
|
|
||||||
m_HashBuckets[bucketnum].append(hash);
|
m_HashBuckets[bucketnum].append(hash);
|
||||||
m_KeyBuckets[bucketnum].append(key);
|
m_KeyBuckets[bucketnum].append(key);
|
||||||
m_DataBuckets[bucketnum].append(D());
|
m_DataBuckets[bucketnum].append(D());
|
||||||
|
|
||||||
return m_DataBuckets[bucketnum].at(m_DataBuckets[bucketnum].size() - 1);
|
return m_DataBuckets[bucketnum].at(m_DataBuckets[bucketnum].size() - 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
inline bool exists(const K& key)
|
inline bool exists(const K& key)
|
||||||
{
|
{
|
||||||
return this->find(key) != NULL;
|
return this->find(key) != NULL;
|
||||||
}
|
}
|
||||||
inline D* find(const K& key)
|
inline D* find(const K& key)
|
||||||
{
|
{
|
||||||
int hash = F(key);
|
int hash = F(key);
|
||||||
|
|
||||||
int bucketnum = GetBucket(hash);
|
int bucketnum = GetBucket(hash);
|
||||||
|
|
||||||
// TODO: Possibly make this binary search?
|
// TODO: Possibly make this binary search?
|
||||||
// insertion would be annoying, don't think it is worth it
|
// insertion would be annoying, don't think it is worth it
|
||||||
ke::Vector<int>* hashbucket = &m_HashBuckets[bucketnum];
|
ke::Vector<int>* hashbucket = &m_HashBuckets[bucketnum];
|
||||||
ke::Vector<K>* keybucket = &m_KeyBuckets[bucketnum];
|
ke::Vector<K>* keybucket = &m_KeyBuckets[bucketnum];
|
||||||
|
|
||||||
size_t bucketsize = hashbucket->length();
|
size_t bucketsize = hashbucket->length();
|
||||||
|
|
||||||
for (size_t i = 0; i < bucketsize; i++)
|
for (size_t i = 0; i < bucketsize; i++)
|
||||||
{
|
{
|
||||||
if (hashbucket->at(i) == hash)
|
if (hashbucket->at(i) == hash)
|
||||||
{
|
{
|
||||||
if (key.compare(keybucket->at(i).chars()) == 0)
|
if (key.compare(keybucket->at(i).chars()) == 0)
|
||||||
{
|
{
|
||||||
return &(m_DataBuckets[bucketnum].at(i));
|
return &(m_DataBuckets[bucketnum].at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,89 +10,89 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef LOCATIONMANAGER_H
|
#ifndef LOCATIONMANAGER_H
|
||||||
#define LOCATIONMANAGER_H
|
#define LOCATIONMANAGER_H
|
||||||
|
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "TitleManager.h"
|
#include "TitleManager.h"
|
||||||
|
|
||||||
typedef struct location_data_s
|
typedef struct location_data_s
|
||||||
{
|
{
|
||||||
char name[128];
|
char name[128];
|
||||||
vec3_t mins;
|
vec3_t mins;
|
||||||
vec3_t maxs;
|
vec3_t maxs;
|
||||||
|
|
||||||
const char *titlelookup;
|
const char *titlelookup;
|
||||||
} location_data_t;
|
} location_data_t;
|
||||||
|
|
||||||
|
|
||||||
class LocationManager
|
class LocationManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ke::Vector<location_data_t> m_LocationList;
|
ke::Vector<location_data_t> m_LocationList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LocationManager()
|
LocationManager()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Clear(void)
|
inline void Clear(void)
|
||||||
{
|
{
|
||||||
m_LocationList.clear();
|
m_LocationList.clear();
|
||||||
m_LocationList.ensure(32);
|
m_LocationList.ensure(32);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Add(const char *Name, edict_t *Entity)
|
inline void Add(const char *Name, edict_t *Entity)
|
||||||
{
|
{
|
||||||
location_data_t Temp;
|
location_data_t Temp;
|
||||||
|
|
||||||
Temp.mins=Entity->v.mins;
|
Temp.mins=Entity->v.mins;
|
||||||
Temp.maxs=Entity->v.maxs;
|
Temp.maxs=Entity->v.maxs;
|
||||||
|
|
||||||
strncpy(Temp.name,Name,sizeof(Temp.name)-1);
|
strncpy(Temp.name,Name,sizeof(Temp.name)-1);
|
||||||
|
|
||||||
ke::AString NameString(UTIL_ToLowerCase(Name));
|
ke::AString NameString(UTIL_ToLowerCase(Name));
|
||||||
|
|
||||||
Temp.titlelookup=TitleMan.Lookup(NameString);
|
Temp.titlelookup=TitleMan.Lookup(NameString);
|
||||||
|
|
||||||
m_LocationList.append(Temp);
|
m_LocationList.append(Temp);
|
||||||
};
|
};
|
||||||
inline const char *Lookup(vec3_t origin, cell titlelookup)
|
inline const char *Lookup(vec3_t origin, cell titlelookup)
|
||||||
{
|
{
|
||||||
unsigned int i=0;
|
unsigned int i=0;
|
||||||
location_data_t Temp;
|
location_data_t Temp;
|
||||||
while (i<m_LocationList.length())
|
while (i<m_LocationList.length())
|
||||||
{
|
{
|
||||||
Temp=m_LocationList[i++];
|
Temp=m_LocationList[i++];
|
||||||
|
|
||||||
if (origin.x <= Temp.maxs.x &&
|
if (origin.x <= Temp.maxs.x &&
|
||||||
origin.y <= Temp.maxs.y &&
|
origin.y <= Temp.maxs.y &&
|
||||||
origin.x >= Temp.mins.x &&
|
origin.x >= Temp.mins.x &&
|
||||||
origin.y >= Temp.mins.y)
|
origin.y >= Temp.mins.y)
|
||||||
{
|
{
|
||||||
if (titlelookup==0)
|
if (titlelookup==0)
|
||||||
{
|
{
|
||||||
return &(m_LocationList[i-1].name[0]);
|
return &(m_LocationList[i-1].name[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_LocationList[i-1].titlelookup!=NULL)
|
if (m_LocationList[i-1].titlelookup!=NULL)
|
||||||
{
|
{
|
||||||
return m_LocationList[i-1].titlelookup;
|
return m_LocationList[i-1].titlelookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &(m_LocationList[i-1].name[0]);
|
return &(m_LocationList[i-1].name[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LocationManager LocationMan;
|
extern LocationManager LocationMan;
|
||||||
|
|
||||||
#endif // LOCATIONMANAGER_H
|
#endif // LOCATIONMANAGER_H
|
||||||
|
|
|
@ -10,173 +10,173 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* This file contains the initialization routine and message hooks
|
/* This file contains the initialization routine and message hooks
|
||||||
* for the message handler. Note that all of the message hooks
|
* for the message handler. Note that all of the message hooks
|
||||||
* except for MessageBegin_Post are NOT hooked unless the gameDLL
|
* except for MessageBegin_Post are NOT hooked unless the gameDLL
|
||||||
* is sending a message we care about.
|
* is sending a message we care about.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "MessageHandler.h"
|
#include "MessageHandler.h"
|
||||||
|
|
||||||
MessageHandler *MessageLists[256];
|
MessageHandler *MessageLists[256];
|
||||||
|
|
||||||
MessageHandler *HookedMessage;
|
MessageHandler *HookedMessage;
|
||||||
|
|
||||||
bool MessageHandler_Initialized=false;
|
bool MessageHandler_Initialized=false;
|
||||||
|
|
||||||
// This is called through ServerActivate_Post
|
// This is called through ServerActivate_Post
|
||||||
void Initialize_MessageHandler(void)
|
void Initialize_MessageHandler(void)
|
||||||
{
|
{
|
||||||
if (MessageHandler_Initialized)
|
if (MessageHandler_Initialized)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageHandler_Initialized=true;
|
MessageHandler_Initialized=true;
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
while (i<255)
|
while (i<255)
|
||||||
{
|
{
|
||||||
MessageLists[i++]=NULL;
|
MessageLists[i++]=NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Hook our messages
|
// Hook our messages
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
index=GET_USER_MSG_ID(&Plugin_info,"Countdown",NULL);
|
index=GET_USER_MSG_ID(&Plugin_info,"Countdown",NULL);
|
||||||
|
|
||||||
if (index)
|
if (index)
|
||||||
{
|
{
|
||||||
MessageLists[index]=new MessageCountDown;
|
MessageLists[index]=new MessageCountDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
index=GET_USER_MSG_ID(&Plugin_info,"GameStatus",NULL);
|
index=GET_USER_MSG_ID(&Plugin_info,"GameStatus",NULL);
|
||||||
|
|
||||||
if (index)
|
if (index)
|
||||||
{
|
{
|
||||||
MessageLists[index]=new MessageGameStatus;
|
MessageLists[index]=new MessageGameStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
index=GET_USER_MSG_ID(&Plugin_info,"Particles",NULL);
|
index=GET_USER_MSG_ID(&Plugin_info,"Particles",NULL);
|
||||||
|
|
||||||
if (index)
|
if (index)
|
||||||
{
|
{
|
||||||
MessageLists[index]=new MessageDebug;
|
MessageLists[index]=new MessageDebug;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Start hooking messagebegin_post
|
// Start hooking messagebegin_post
|
||||||
g_pengfuncsTable_Post->pfnMessageBegin=MessageBegin_Post;
|
g_pengfuncsTable_Post->pfnMessageBegin=MessageBegin_Post;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
|
void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
|
||||||
{
|
{
|
||||||
// Sanity check, should never matter
|
// Sanity check, should never matter
|
||||||
if (msg_type < 0 || msg_type > 255)
|
if (msg_type < 0 || msg_type > 255)
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has a hooked message?
|
// Has a hooked message?
|
||||||
if (MessageLists[msg_type]!=NULL)
|
if (MessageLists[msg_type]!=NULL)
|
||||||
{
|
{
|
||||||
// Should this message be hooked?
|
// Should this message be hooked?
|
||||||
if (MessageLists[msg_type]->Begin(msg_dest,msg_type,pOrigin,ed)==1)
|
if (MessageLists[msg_type]->Begin(msg_dest,msg_type,pOrigin,ed)==1)
|
||||||
{
|
{
|
||||||
// This message is going to all be hooked
|
// This message is going to all be hooked
|
||||||
|
|
||||||
// save pointer to our class
|
// save pointer to our class
|
||||||
HookedMessage=MessageLists[msg_type];
|
HookedMessage=MessageLists[msg_type];
|
||||||
|
|
||||||
// Tell metamod to forward
|
// Tell metamod to forward
|
||||||
g_pengfuncsTable_Post->pfnWriteByte=WriteByte_Post;
|
g_pengfuncsTable_Post->pfnWriteByte=WriteByte_Post;
|
||||||
g_pengfuncsTable_Post->pfnWriteChar=WriteChar_Post;
|
g_pengfuncsTable_Post->pfnWriteChar=WriteChar_Post;
|
||||||
g_pengfuncsTable_Post->pfnWriteShort=WriteShort_Post;
|
g_pengfuncsTable_Post->pfnWriteShort=WriteShort_Post;
|
||||||
g_pengfuncsTable_Post->pfnWriteLong=WriteLong_Post;
|
g_pengfuncsTable_Post->pfnWriteLong=WriteLong_Post;
|
||||||
g_pengfuncsTable_Post->pfnWriteAngle=WriteAngle_Post;
|
g_pengfuncsTable_Post->pfnWriteAngle=WriteAngle_Post;
|
||||||
g_pengfuncsTable_Post->pfnWriteCoord=WriteCoord_Post;
|
g_pengfuncsTable_Post->pfnWriteCoord=WriteCoord_Post;
|
||||||
g_pengfuncsTable_Post->pfnWriteString=WriteString_Post;
|
g_pengfuncsTable_Post->pfnWriteString=WriteString_Post;
|
||||||
g_pengfuncsTable_Post->pfnWriteEntity=WriteEntity_Post;
|
g_pengfuncsTable_Post->pfnWriteEntity=WriteEntity_Post;
|
||||||
g_pengfuncsTable_Post->pfnMessageEnd=MessageEnd_Post;
|
g_pengfuncsTable_Post->pfnMessageEnd=MessageEnd_Post;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageEnd_Post(void)
|
void MessageEnd_Post(void)
|
||||||
{
|
{
|
||||||
HookedMessage->End();
|
HookedMessage->End();
|
||||||
|
|
||||||
HookedMessage=NULL;
|
HookedMessage=NULL;
|
||||||
|
|
||||||
// Stop metamod forwarding
|
// Stop metamod forwarding
|
||||||
g_pengfuncsTable_Post->pfnWriteByte=NULL;
|
g_pengfuncsTable_Post->pfnWriteByte=NULL;
|
||||||
g_pengfuncsTable_Post->pfnWriteChar=NULL;
|
g_pengfuncsTable_Post->pfnWriteChar=NULL;
|
||||||
g_pengfuncsTable_Post->pfnWriteShort=NULL;
|
g_pengfuncsTable_Post->pfnWriteShort=NULL;
|
||||||
g_pengfuncsTable_Post->pfnWriteLong=NULL;
|
g_pengfuncsTable_Post->pfnWriteLong=NULL;
|
||||||
g_pengfuncsTable_Post->pfnWriteAngle=NULL;
|
g_pengfuncsTable_Post->pfnWriteAngle=NULL;
|
||||||
g_pengfuncsTable_Post->pfnWriteCoord=NULL;
|
g_pengfuncsTable_Post->pfnWriteCoord=NULL;
|
||||||
g_pengfuncsTable_Post->pfnWriteString=NULL;
|
g_pengfuncsTable_Post->pfnWriteString=NULL;
|
||||||
g_pengfuncsTable_Post->pfnWriteEntity=NULL;
|
g_pengfuncsTable_Post->pfnWriteEntity=NULL;
|
||||||
g_pengfuncsTable_Post->pfnMessageEnd=NULL;
|
g_pengfuncsTable_Post->pfnMessageEnd=NULL;
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteByte_Post(int iValue)
|
void WriteByte_Post(int iValue)
|
||||||
{
|
{
|
||||||
HookedMessage->WriteByte(iValue);
|
HookedMessage->WriteByte(iValue);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteChar_Post(int iValue)
|
void WriteChar_Post(int iValue)
|
||||||
{
|
{
|
||||||
HookedMessage->WriteChar(iValue);
|
HookedMessage->WriteChar(iValue);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteShort_Post(int iValue)
|
void WriteShort_Post(int iValue)
|
||||||
{
|
{
|
||||||
HookedMessage->WriteShort(iValue);
|
HookedMessage->WriteShort(iValue);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteLong_Post(int iValue)
|
void WriteLong_Post(int iValue)
|
||||||
{
|
{
|
||||||
HookedMessage->WriteLong(iValue);
|
HookedMessage->WriteLong(iValue);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteAngle_Post(float flValue)
|
void WriteAngle_Post(float flValue)
|
||||||
{
|
{
|
||||||
HookedMessage->WriteAngle(flValue);
|
HookedMessage->WriteAngle(flValue);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteCoord_Post(float flValue)
|
void WriteCoord_Post(float flValue)
|
||||||
{
|
{
|
||||||
HookedMessage->WriteCoord(flValue);
|
HookedMessage->WriteCoord(flValue);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteString_Post(const char *sz)
|
void WriteString_Post(const char *sz)
|
||||||
{
|
{
|
||||||
HookedMessage->WriteString(sz);
|
HookedMessage->WriteString(sz);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
void WriteEntity_Post(int iValue)
|
void WriteEntity_Post(int iValue)
|
||||||
{
|
{
|
||||||
HookedMessage->WriteEntity(iValue);
|
HookedMessage->WriteEntity(iValue);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,149 +10,149 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* Class with virtual members for easy message handling
|
/* Class with virtual members for easy message handling
|
||||||
* Don't forget to add new messages to "Initialize_MessageHandler()"
|
* Don't forget to add new messages to "Initialize_MessageHandler()"
|
||||||
*/
|
*/
|
||||||
#ifndef MESSAGEHANDLER_H
|
#ifndef MESSAGEHANDLER_H
|
||||||
#define MESSAGEHANDLER_H
|
#define MESSAGEHANDLER_H
|
||||||
|
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
|
|
||||||
class MessageHandler
|
class MessageHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
unsigned int m_Count;
|
unsigned int m_Count;
|
||||||
int m_Target;
|
int m_Target;
|
||||||
float m_Origin[3];
|
float m_Origin[3];
|
||||||
edict_t *m_Entity;
|
edict_t *m_Entity;
|
||||||
int m_Msg;
|
int m_Msg;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return 1 to hook the rest of this message, 0 otherwise
|
* Return 1 to hook the rest of this message, 0 otherwise
|
||||||
*/
|
*/
|
||||||
virtual int Begin(int Target, int Msg, const float *Origin, edict_t *Entity)
|
virtual int Begin(int Target, int Msg, const float *Origin, edict_t *Entity)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void End(void)
|
virtual void End(void)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteByte(int Data)
|
virtual void WriteByte(int Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteChar(int Data)
|
virtual void WriteChar(int Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteShort(int Data)
|
virtual void WriteShort(int Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteLong(int Data)
|
virtual void WriteLong(int Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteAngle(REAL Data)
|
virtual void WriteAngle(REAL Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteCoord(REAL Data)
|
virtual void WriteCoord(REAL Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteString(const char *Data)
|
virtual void WriteString(const char *Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteEntity(int Data)
|
virtual void WriteEntity(int Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class MessageCountDown : public MessageHandler
|
class MessageCountDown : public MessageHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_CountDownTime;
|
int m_CountDownTime;
|
||||||
|
|
||||||
virtual int Begin(int Target, int Msg, const float *Origin, edict_t *Entity)
|
virtual int Begin(int Target, int Msg, const float *Origin, edict_t *Entity)
|
||||||
{
|
{
|
||||||
m_Count=0;
|
m_Count=0;
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void End(void)
|
virtual void End(void)
|
||||||
{
|
{
|
||||||
if (m_Count!=1) // invalid message?
|
if (m_Count!=1) // invalid message?
|
||||||
{
|
{
|
||||||
MF_Log("[NS] Invalid Countdown message received! Got %d args, expected 1.",m_Count);
|
MF_Log("[NS] Invalid Countdown message received! Got %d args, expected 1.",m_Count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMan.HandleCountdown(m_CountDownTime);
|
GameMan.HandleCountdown(m_CountDownTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteByte(int Data)
|
virtual void WriteByte(int Data)
|
||||||
{
|
{
|
||||||
++m_Count;
|
++m_Count;
|
||||||
m_CountDownTime=Data;
|
m_CountDownTime=Data;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageGameStatus : public MessageHandler
|
class MessageGameStatus : public MessageHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int FirstByte;
|
int FirstByte;
|
||||||
|
|
||||||
virtual int Begin(int Target, int Msg, const float *Origin, edict_t *Entity)
|
virtual int Begin(int Target, int Msg, const float *Origin, edict_t *Entity)
|
||||||
{
|
{
|
||||||
m_Count=0;
|
m_Count=0;
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void End(void)
|
virtual void End(void)
|
||||||
{
|
{
|
||||||
GameMan.HandleGameStatus(FirstByte);
|
GameMan.HandleGameStatus(FirstByte);
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void WriteByte(int iValue)
|
virtual void WriteByte(int iValue)
|
||||||
{
|
{
|
||||||
if (m_Count==0)
|
if (m_Count==0)
|
||||||
{
|
{
|
||||||
FirstByte=iValue;
|
FirstByte=iValue;
|
||||||
};
|
};
|
||||||
++m_Count;
|
++m_Count;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void Initialize_MessageHandler(void);
|
void Initialize_MessageHandler(void);
|
||||||
|
|
||||||
void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
void MessageBegin_Post(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
||||||
void MessageEnd_Post(void);
|
void MessageEnd_Post(void);
|
||||||
void WriteByte_Post(int iValue);
|
void WriteByte_Post(int iValue);
|
||||||
void WriteChar_Post(int iValue);
|
void WriteChar_Post(int iValue);
|
||||||
void WriteShort_Post(int iValue);
|
void WriteShort_Post(int iValue);
|
||||||
void WriteLong_Post(int iValue);
|
void WriteLong_Post(int iValue);
|
||||||
void WriteAngle_Post(float flValue);
|
void WriteAngle_Post(float flValue);
|
||||||
void WriteCoord_Post(float flValue);
|
void WriteCoord_Post(float flValue);
|
||||||
void WriteString_Post(const char *sz);
|
void WriteString_Post(const char *sz);
|
||||||
void WriteEntity_Post(int iValue);
|
void WriteEntity_Post(int iValue);
|
||||||
|
|
||||||
|
|
||||||
#endif // MESSAGEHANDLER_H
|
#endif // MESSAGEHANDLER_H
|
||||||
|
|
|
@ -10,71 +10,71 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* Inlined replacements for INDEXENT/ENTINDEX
|
/* Inlined replacements for INDEXENT/ENTINDEX
|
||||||
* It only really removes the overhead of the push/jump
|
* It only really removes the overhead of the push/jump
|
||||||
* but since INDEXENT/ENTINDEX are used a lot with amxx
|
* but since INDEXENT/ENTINDEX are used a lot with amxx
|
||||||
* it might be beneficial to include.
|
* it might be beneficial to include.
|
||||||
* NOTE: Bad stuff will happen if you call these before
|
* NOTE: Bad stuff will happen if you call these before
|
||||||
* NEW_Initialize()
|
* NEW_Initialize()
|
||||||
* NOTE: No bounds checking is done because natives
|
* NOTE: No bounds checking is done because natives
|
||||||
* should use their own bounds checking!
|
* should use their own bounds checking!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NEW_UTIL_H
|
#ifndef NEW_UTIL_H
|
||||||
#define NEW_UTIL_H
|
#define NEW_UTIL_H
|
||||||
|
|
||||||
|
|
||||||
extern edict_t *NEW_FirstEdict;
|
extern edict_t *NEW_FirstEdict;
|
||||||
extern bool NEW_Initialized;
|
extern bool NEW_Initialized;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called on the first Spawn() ever hooked. This would be worldspawn (index 0)
|
* This is called on the first Spawn() ever hooked. This would be worldspawn (index 0)
|
||||||
*/
|
*/
|
||||||
inline void NEW_Initialize(edict_t *Entity)
|
inline void NEW_Initialize(edict_t *Entity)
|
||||||
{
|
{
|
||||||
// call the HL Engine ENTINDEX to make sure this is index 0
|
// call the HL Engine ENTINDEX to make sure this is index 0
|
||||||
|
|
||||||
int index=ENTINDEX(Entity);
|
int index=ENTINDEX(Entity);
|
||||||
|
|
||||||
if (index==0)
|
if (index==0)
|
||||||
{
|
{
|
||||||
NEW_FirstEdict=Entity;
|
NEW_FirstEdict=Entity;
|
||||||
NEW_Initialized=true;
|
NEW_Initialized=true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is not worldspawn?
|
// This is not worldspawn?
|
||||||
// compensate
|
// compensate
|
||||||
NEW_FirstEdict=Entity - index;
|
NEW_FirstEdict=Entity - index;
|
||||||
NEW_Initialized=true;
|
NEW_Initialized=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an integer index into an edict pointer
|
* Converts an integer index into an edict pointer
|
||||||
*/
|
*/
|
||||||
inline edict_t *INDEXENT_NEW(const int Index)
|
inline edict_t *INDEXENT_NEW(const int Index)
|
||||||
{
|
{
|
||||||
return (edict_t *)(NEW_FirstEdict + Index);
|
return (edict_t *)(NEW_FirstEdict + Index);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts an edict pointer into an integer index
|
* Converts an edict pointer into an integer index
|
||||||
*/
|
*/
|
||||||
inline int ENTINDEX_NEW(const edict_t *Ent)
|
inline int ENTINDEX_NEW(const edict_t *Ent)
|
||||||
{
|
{
|
||||||
return (int)(Ent - NEW_FirstEdict);
|
return (int)(Ent - NEW_FirstEdict);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inlined replacement of MF_GetAmxAddr
|
// Inlined replacement of MF_GetAmxAddr
|
||||||
|
|
||||||
|
|
||||||
// straight from amxmodx's string.cpp; no need for this to be an api call
|
// straight from amxmodx's string.cpp; no need for this to be an api call
|
||||||
inline cell *MF_GetAmxAddr_NEW(AMX *amx, cell amx_addr)
|
inline cell *MF_GetAmxAddr_NEW(AMX *amx, cell amx_addr)
|
||||||
{
|
{
|
||||||
return (cell *)(amx->base + (int)(((AMX_HEADER *)amx->base)->dat + amx_addr));
|
return (cell *)(amx->base + (int)(((AMX_HEADER *)amx->base)->dat + amx_addr));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // NEW_UTIL_H
|
#endif // NEW_UTIL_H
|
||||||
|
|
|
@ -11,119 +11,119 @@
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "ParticleManager.h"
|
#include "ParticleManager.h"
|
||||||
|
|
||||||
void ParticleManager::ReadFile(void)
|
void ParticleManager::ReadFile(void)
|
||||||
{
|
{
|
||||||
this->Prune();
|
this->Prune();
|
||||||
if (m_iFileLoaded!=0)
|
if (m_iFileLoaded!=0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_iFileLoaded=1;
|
m_iFileLoaded=1;
|
||||||
|
|
||||||
char FileName[256];
|
char FileName[256];
|
||||||
|
|
||||||
UTIL_Format(FileName, sizeof(FileName)-1, "%s/ns.ps", MF_GetModname());
|
UTIL_Format(FileName, sizeof(FileName)-1, "%s/ns.ps", MF_GetModname());
|
||||||
FILE *fp=fopen(FileName,"r");
|
FILE *fp=fopen(FileName,"r");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
MF_Log("ParticleManager: Cannot open \"%s\" for reading!",FileName);
|
MF_Log("ParticleManager: Cannot open \"%s\" for reading!",FileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since I don't care about the actual parameters of each
|
// Since I don't care about the actual parameters of each
|
||||||
// particle system, just their order and name
|
// particle system, just their order and name
|
||||||
// I only have to scan for "start pSystemName NAME"
|
// I only have to scan for "start pSystemName NAME"
|
||||||
|
|
||||||
char Buffer[1024];
|
char Buffer[1024];
|
||||||
|
|
||||||
char *Start;
|
char *Start;
|
||||||
char *End;
|
char *End;
|
||||||
|
|
||||||
int Count=0;
|
int Count=0;
|
||||||
|
|
||||||
memset(&Buffer[0],0x0,sizeof(Buffer));
|
memset(&Buffer[0],0x0,sizeof(Buffer));
|
||||||
|
|
||||||
while (!feof(fp))
|
while (!feof(fp))
|
||||||
{
|
{
|
||||||
Buffer[0]='\0';
|
Buffer[0]='\0';
|
||||||
|
|
||||||
fgets(Buffer,1023,fp);
|
fgets(Buffer,1023,fp);
|
||||||
|
|
||||||
Start=&Buffer[0];
|
Start=&Buffer[0];
|
||||||
|
|
||||||
// strip whitespace from the front
|
// strip whitespace from the front
|
||||||
while (*Start==' ' ||
|
while (*Start==' ' ||
|
||||||
*Start=='\t')
|
*Start=='\t')
|
||||||
{
|
{
|
||||||
++Start;
|
++Start;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the first character is ' ignore it
|
// if the first character is ' ignore it
|
||||||
if (*Start=='\'')
|
if (*Start=='\'')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the first word is "start" then this is a line we want
|
// if the first word is "start" then this is a line we want
|
||||||
|
|
||||||
if (strncmp("start ",Start,6)!=0)
|
if (strncmp("start ",Start,6)!=0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move up past 2 space blocks
|
// Move up past 2 space blocks
|
||||||
|
|
||||||
while (*Start!='\0' &&
|
while (*Start!='\0' &&
|
||||||
*Start!=' ' &&
|
*Start!=' ' &&
|
||||||
*Start!='\t')
|
*Start!='\t')
|
||||||
{
|
{
|
||||||
++Start;
|
++Start;
|
||||||
}
|
}
|
||||||
while (*Start==' ' ||
|
while (*Start==' ' ||
|
||||||
*Start=='\t')
|
*Start=='\t')
|
||||||
{
|
{
|
||||||
++Start;
|
++Start;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*Start!='\0' &&
|
while (*Start!='\0' &&
|
||||||
*Start!=' ' &&
|
*Start!=' ' &&
|
||||||
*Start!='\t')
|
*Start!='\t')
|
||||||
{
|
{
|
||||||
++Start;
|
++Start;
|
||||||
}
|
}
|
||||||
while (*Start==' ' ||
|
while (*Start==' ' ||
|
||||||
*Start=='\t')
|
*Start=='\t')
|
||||||
{
|
{
|
||||||
++Start;
|
++Start;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now strip whitespace from the end
|
// now strip whitespace from the end
|
||||||
|
|
||||||
End=Start+strlen(Start)-1;
|
End=Start+strlen(Start)-1;
|
||||||
|
|
||||||
while (*End=='\n' ||
|
while (*End=='\n' ||
|
||||||
*End=='\r' ||
|
*End=='\r' ||
|
||||||
*End==' ' ||
|
*End==' ' ||
|
||||||
*End=='\t')
|
*End=='\t')
|
||||||
{
|
{
|
||||||
*End--='\0';
|
*End--='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Start" should now point to the name of this particle system
|
// "Start" should now point to the name of this particle system
|
||||||
|
|
||||||
//printf("Particle system %d = \"%s\"\n",Count,Start);
|
//printf("Particle system %d = \"%s\"\n",Count,Start);
|
||||||
|
|
||||||
|
|
||||||
this->Add(Start,1);
|
this->Add(Start,1);
|
||||||
|
|
||||||
|
|
||||||
++Count;
|
++Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,115 +10,115 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef PARTICLEMANAGER_H
|
#ifndef PARTICLEMANAGER_H
|
||||||
#define PARTICLEMANAGER_H
|
#define PARTICLEMANAGER_H
|
||||||
|
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
|
|
||||||
typedef struct psystem_s
|
typedef struct psystem_s
|
||||||
{
|
{
|
||||||
ke::AString Name;
|
ke::AString Name;
|
||||||
int id;
|
int id;
|
||||||
int IsStatic; // Set to 1 if the particle system is loaded from ns.ps
|
int IsStatic; // Set to 1 if the particle system is loaded from ns.ps
|
||||||
|
|
||||||
} ParticleSystem;
|
} ParticleSystem;
|
||||||
|
|
||||||
class ParticleManager
|
class ParticleManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ke::Vector<ParticleSystem *> Systems;
|
ke::Vector<ParticleSystem *> Systems;
|
||||||
int m_iFileLoaded;
|
int m_iFileLoaded;
|
||||||
unsigned short m_iEventID;
|
unsigned short m_iEventID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ParticleManager()
|
ParticleManager()
|
||||||
{
|
{
|
||||||
m_iFileLoaded=0;
|
m_iFileLoaded=0;
|
||||||
m_iEventID=0;
|
m_iEventID=0;
|
||||||
Systems.ensure(64);
|
Systems.ensure(64);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove all non-static particle systems
|
// Remove all non-static particle systems
|
||||||
inline void Prune()
|
inline void Prune()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < Systems.length(); ++i)
|
for (size_t i = 0; i < Systems.length(); ++i)
|
||||||
{
|
{
|
||||||
if (Systems[i]->IsStatic)
|
if (Systems[i]->IsStatic)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Systems.remove(i);
|
Systems.remove(i);
|
||||||
delete Systems.at(i);
|
delete Systems.at(i);
|
||||||
|
|
||||||
if (!Systems.length())
|
if (!Systems.length())
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void ReadFile(void);
|
void ReadFile(void);
|
||||||
|
|
||||||
inline int Add(const char *Start, int Static)
|
inline int Add(const char *Start, int Static)
|
||||||
{
|
{
|
||||||
ParticleSystem *ps=new ParticleSystem;
|
ParticleSystem *ps=new ParticleSystem;
|
||||||
|
|
||||||
ps->id=Systems.length();
|
ps->id=Systems.length();
|
||||||
ps->IsStatic=Static;
|
ps->IsStatic=Static;
|
||||||
ps->Name = Start;
|
ps->Name = Start;
|
||||||
|
|
||||||
Systems.append(ps);
|
Systems.append(ps);
|
||||||
|
|
||||||
return Systems.length()-1;
|
return Systems.length()-1;
|
||||||
};
|
};
|
||||||
inline void FireSystem(int id, float *Origin, float *Angles, int flags)
|
inline void FireSystem(int id, float *Origin, float *Angles, int flags)
|
||||||
{
|
{
|
||||||
PLAYBACK_EVENT_FULL(flags, /*flags*/
|
PLAYBACK_EVENT_FULL(flags, /*flags*/
|
||||||
NULL, /*pInvoker*/
|
NULL, /*pInvoker*/
|
||||||
m_iEventID, /*eventid*/
|
m_iEventID, /*eventid*/
|
||||||
0.0, /*delay*/
|
0.0, /*delay*/
|
||||||
Origin, /*origin*/
|
Origin, /*origin*/
|
||||||
Angles, /*angles*/
|
Angles, /*angles*/
|
||||||
0.0, /*fparam1*/
|
0.0, /*fparam1*/
|
||||||
0.0, /*fparam2*/
|
0.0, /*fparam2*/
|
||||||
id, /*iparam1 - particle system id*/
|
id, /*iparam1 - particle system id*/
|
||||||
0, /*iparam2*/
|
0, /*iparam2*/
|
||||||
0, /*bparam1*/
|
0, /*bparam1*/
|
||||||
0); /*bparam2*/
|
0); /*bparam2*/
|
||||||
};
|
};
|
||||||
inline void PrecacheEvent(const char *file)
|
inline void PrecacheEvent(const char *file)
|
||||||
{
|
{
|
||||||
if (strcmp(file,"events/Particle.sc")==0)
|
if (strcmp(file,"events/Particle.sc")==0)
|
||||||
{
|
{
|
||||||
if (META_RESULT_STATUS >= MRES_OVERRIDE)
|
if (META_RESULT_STATUS >= MRES_OVERRIDE)
|
||||||
{
|
{
|
||||||
m_iEventID=META_RESULT_OVERRIDE_RET(unsigned short);
|
m_iEventID=META_RESULT_OVERRIDE_RET(unsigned short);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_iEventID=META_RESULT_ORIG_RET(unsigned short);
|
m_iEventID=META_RESULT_ORIG_RET(unsigned short);
|
||||||
}
|
}
|
||||||
//printf("EVENT=%d\n",m_iEventID);
|
//printf("EVENT=%d\n",m_iEventID);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
inline int Find(const char *Needle)
|
inline int Find(const char *Needle)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < Systems.length(); ++i)
|
for (size_t i = 0; i < Systems.length(); ++i)
|
||||||
{
|
{
|
||||||
if (strcmp(Needle, Systems[i]->Name.chars()) == 0)
|
if (strcmp(Needle, Systems[i]->Name.chars()) == 0)
|
||||||
{
|
{
|
||||||
return Systems[i]->id;
|
return Systems[i]->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ParticleManager ParticleMan;
|
extern ParticleManager ParticleMan;
|
||||||
|
|
||||||
#endif // PARTICLEMANAGER_H
|
#endif // PARTICLEMANAGER_H
|
||||||
|
|
|
@ -10,99 +10,99 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef SPAWNMANAGER_H
|
#ifndef SPAWNMANAGER_H
|
||||||
#define SPAWNMANAGER_H
|
#define SPAWNMANAGER_H
|
||||||
|
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
|
|
||||||
typedef struct spawndata_s
|
typedef struct spawndata_s
|
||||||
{
|
{
|
||||||
REAL Location[3];
|
REAL Location[3];
|
||||||
REAL Angle[3];
|
REAL Angle[3];
|
||||||
} SpawnData;
|
} SpawnData;
|
||||||
|
|
||||||
class SpawnManager
|
class SpawnManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
ke::Vector<SpawnData> TeamSpawns[5];
|
ke::Vector<SpawnData> TeamSpawns[5];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SpawnManager()
|
SpawnManager()
|
||||||
{
|
{
|
||||||
this->Clear();
|
this->Clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Clear(void)
|
inline void Clear(void)
|
||||||
{
|
{
|
||||||
TeamSpawns[0].clear();
|
TeamSpawns[0].clear();
|
||||||
TeamSpawns[1].clear();
|
TeamSpawns[1].clear();
|
||||||
TeamSpawns[2].clear();
|
TeamSpawns[2].clear();
|
||||||
TeamSpawns[3].clear();
|
TeamSpawns[3].clear();
|
||||||
TeamSpawns[4].clear();
|
TeamSpawns[4].clear();
|
||||||
|
|
||||||
// Reserve data for a "typical" map layout
|
// Reserve data for a "typical" map layout
|
||||||
// makes data entry faster on map load
|
// makes data entry faster on map load
|
||||||
TeamSpawns[0].ensure(32);
|
TeamSpawns[0].ensure(32);
|
||||||
TeamSpawns[1].ensure(16);
|
TeamSpawns[1].ensure(16);
|
||||||
TeamSpawns[2].ensure(48);
|
TeamSpawns[2].ensure(48);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Insert(const edict_t *Entity)
|
inline void Insert(const edict_t *Entity)
|
||||||
{
|
{
|
||||||
// Bounds check team
|
// Bounds check team
|
||||||
if (Entity->v.team<0 || Entity->v.team > 4)
|
if (Entity->v.team<0 || Entity->v.team > 4)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpawnData TemporaryData;
|
SpawnData TemporaryData;
|
||||||
|
|
||||||
Entity->v.origin.CopyToArray(TemporaryData.Location);
|
Entity->v.origin.CopyToArray(TemporaryData.Location);
|
||||||
Entity->v.angles.CopyToArray(TemporaryData.Angle);
|
Entity->v.angles.CopyToArray(TemporaryData.Angle);
|
||||||
|
|
||||||
TeamSpawns[Entity->v.team].append(TemporaryData);
|
TeamSpawns[Entity->v.team].append(TemporaryData);
|
||||||
};
|
};
|
||||||
inline void InsertReadyRoom(const edict_t *Entity)
|
inline void InsertReadyRoom(const edict_t *Entity)
|
||||||
{
|
{
|
||||||
SpawnData TemporaryData;
|
SpawnData TemporaryData;
|
||||||
|
|
||||||
Entity->v.origin.CopyToArray(TemporaryData.Location);
|
Entity->v.origin.CopyToArray(TemporaryData.Location);
|
||||||
Entity->v.angles.CopyToArray(TemporaryData.Angle);
|
Entity->v.angles.CopyToArray(TemporaryData.Angle);
|
||||||
|
|
||||||
TeamSpawns[0].append(TemporaryData);
|
TeamSpawns[0].append(TemporaryData);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ns_get_spawn(team,number=0,Float:ret[3]);
|
// ns_get_spawn(team,number=0,Float:ret[3]);
|
||||||
inline cell Lookup(AMX *amx, cell *params)
|
inline cell Lookup(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (params[1] < 0 || params[1] > 4)
|
if (params[1] < 0 || params[1] > 4)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (params[2]==0)
|
if (params[2]==0)
|
||||||
{
|
{
|
||||||
return static_cast<int>(TeamSpawns[params[1]].length());
|
return static_cast<int>(TeamSpawns[params[1]].length());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[2]>=(int)TeamSpawns[params[1]].length())
|
if (params[2]>=(int)TeamSpawns[params[1]].length())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell *Return=MF_GetAmxAddr(amx,params[3]);
|
cell *Return=MF_GetAmxAddr(amx,params[3]);
|
||||||
|
|
||||||
SpawnData SpawnRet=TeamSpawns[params[1]][params[2]];
|
SpawnData SpawnRet=TeamSpawns[params[1]][params[2]];
|
||||||
|
|
||||||
Return[0]=amx_ftoc2(SpawnRet.Location[0]);
|
Return[0]=amx_ftoc2(SpawnRet.Location[0]);
|
||||||
Return[1]=amx_ftoc2(SpawnRet.Location[1]);
|
Return[1]=amx_ftoc2(SpawnRet.Location[1]);
|
||||||
Return[2]=amx_ftoc2(SpawnRet.Location[2]);
|
Return[2]=amx_ftoc2(SpawnRet.Location[2]);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SpawnManager SpawnMan;
|
extern SpawnManager SpawnMan;
|
||||||
|
|
||||||
#endif // SPAWNMANAGER_H
|
#endif // SPAWNMANAGER_H
|
||||||
|
|
|
@ -11,143 +11,143 @@
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "TitleManager.h"
|
#include "TitleManager.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
|
|
||||||
void TitleManager::LoadTitles(void)
|
void TitleManager::LoadTitles(void)
|
||||||
{
|
{
|
||||||
if (m_Loaded!=0) // already loaded?
|
if (m_Loaded!=0) // already loaded?
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Loaded=1;
|
m_Loaded=1;
|
||||||
|
|
||||||
char FileName[128];
|
char FileName[128];
|
||||||
|
|
||||||
UTIL_Format(FileName, sizeof(FileName)-1, "%s/titles.txt", MF_GetModname());
|
UTIL_Format(FileName, sizeof(FileName)-1, "%s/titles.txt", MF_GetModname());
|
||||||
|
|
||||||
FILE *fp=fopen(FileName,"r");
|
FILE *fp=fopen(FileName,"r");
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
MF_Log("Unable to load \"%s\": TitleManager will not work!",FileName);
|
MF_Log("Unable to load \"%s\": TitleManager will not work!",FileName);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
//MF_Log("TitleManager Loading titles from \"%s\"",FileName);
|
//MF_Log("TitleManager Loading titles from \"%s\"",FileName);
|
||||||
char KeyName[512]; // last known good keyname
|
char KeyName[512]; // last known good keyname
|
||||||
char Data[2048]; // data for the key
|
char Data[2048]; // data for the key
|
||||||
// does not support multi line data, but for
|
// does not support multi line data, but for
|
||||||
// location namesthat is acceptable.
|
// location namesthat is acceptable.
|
||||||
char TempBuffer[2048]; // currently read data
|
char TempBuffer[2048]; // currently read data
|
||||||
char *TempPointer;
|
char *TempPointer;
|
||||||
char *TempPointerEnd;
|
char *TempPointerEnd;
|
||||||
|
|
||||||
unsigned int Line=0;
|
unsigned int Line=0;
|
||||||
scan_for_key:
|
scan_for_key:
|
||||||
KeyName[0]='\0';
|
KeyName[0]='\0';
|
||||||
|
|
||||||
while (!feof(fp))
|
while (!feof(fp))
|
||||||
{
|
{
|
||||||
Line++;
|
Line++;
|
||||||
fgets(TempBuffer,2047,fp);
|
fgets(TempBuffer,2047,fp);
|
||||||
TempPointer=&TempBuffer[0];
|
TempPointer=&TempBuffer[0];
|
||||||
|
|
||||||
// get rid of white space at the front
|
// get rid of white space at the front
|
||||||
while (*TempPointer=='\0' || // terminator
|
while (*TempPointer=='\0' || // terminator
|
||||||
*TempPointer==' ' || // space
|
*TempPointer==' ' || // space
|
||||||
*TempPointer=='\t') // tab
|
*TempPointer=='\t') // tab
|
||||||
{
|
{
|
||||||
++TempPointer;
|
++TempPointer;
|
||||||
}
|
}
|
||||||
if (*TempPointer=='\0' || // terminator
|
if (*TempPointer=='\0' || // terminator
|
||||||
*TempPointer=='/') // comment
|
*TempPointer=='/') // comment
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get rid of \r\n at the end
|
// get rid of \r\n at the end
|
||||||
TempPointerEnd=TempPointer+strlen(TempPointer)-1;
|
TempPointerEnd=TempPointer+strlen(TempPointer)-1;
|
||||||
while (*TempPointerEnd=='\r' ||
|
while (*TempPointerEnd=='\r' ||
|
||||||
*TempPointerEnd=='\n' ||
|
*TempPointerEnd=='\n' ||
|
||||||
*TempPointerEnd=='\t' ||
|
*TempPointerEnd=='\t' ||
|
||||||
*TempPointerEnd==' ')
|
*TempPointerEnd==' ')
|
||||||
{
|
{
|
||||||
*TempPointerEnd--='\0';
|
*TempPointerEnd--='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*TempPointer=='{') // start of data
|
if (*TempPointer=='{') // start of data
|
||||||
{
|
{
|
||||||
if (KeyName[0]!='\0') // do we have a keyname
|
if (KeyName[0]!='\0') // do we have a keyname
|
||||||
{
|
{
|
||||||
goto scan_for_data;
|
goto scan_for_data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MF_Log("TitleManager: titles.txt line %u: began a data section with no key name in use!",Line);
|
MF_Log("TitleManager: titles.txt line %u: began a data section with no key name in use!",Line);
|
||||||
goto scan_for_key;
|
goto scan_for_key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// have a valid key name here
|
// have a valid key name here
|
||||||
strncpy(KeyName,TempBuffer,sizeof(KeyName)-1);
|
strncpy(KeyName,TempBuffer,sizeof(KeyName)-1);
|
||||||
|
|
||||||
// keep looping (until we hit a '{')
|
// keep looping (until we hit a '{')
|
||||||
};
|
};
|
||||||
|
|
||||||
// if we're out here then !feof() failed
|
// if we're out here then !feof() failed
|
||||||
goto end_of_file;
|
goto end_of_file;
|
||||||
scan_for_data:
|
scan_for_data:
|
||||||
Data[0]='\0';
|
Data[0]='\0';
|
||||||
|
|
||||||
while (!feof(fp))
|
while (!feof(fp))
|
||||||
{
|
{
|
||||||
Line++;
|
Line++;
|
||||||
fgets(TempBuffer,2047,fp);
|
fgets(TempBuffer,2047,fp);
|
||||||
TempPointer=&TempBuffer[0];
|
TempPointer=&TempBuffer[0];
|
||||||
|
|
||||||
// get rid of white space at the front
|
// get rid of white space at the front
|
||||||
while (*TempPointer=='\0' || // terminator
|
while (*TempPointer=='\0' || // terminator
|
||||||
*TempPointer==' ' || // space
|
*TempPointer==' ' || // space
|
||||||
*TempPointer=='\t') // tab
|
*TempPointer=='\t') // tab
|
||||||
{
|
{
|
||||||
++TempPointer;
|
++TempPointer;
|
||||||
}
|
}
|
||||||
if (*TempPointer=='\0' || // terminator
|
if (*TempPointer=='\0' || // terminator
|
||||||
*TempPointer=='/') // comment
|
*TempPointer=='/') // comment
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get rid of trailing whitespace
|
// get rid of trailing whitespace
|
||||||
TempPointerEnd=TempPointer+strlen(TempPointer)-1;
|
TempPointerEnd=TempPointer+strlen(TempPointer)-1;
|
||||||
while (*TempPointerEnd=='\r' ||
|
while (*TempPointerEnd=='\r' ||
|
||||||
*TempPointerEnd=='\n' ||
|
*TempPointerEnd=='\n' ||
|
||||||
*TempPointerEnd=='\t' ||
|
*TempPointerEnd=='\t' ||
|
||||||
*TempPointerEnd==' ')
|
*TempPointerEnd==' ')
|
||||||
{
|
{
|
||||||
*TempPointerEnd--='\0';
|
*TempPointerEnd--='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*TempPointer=='}') // end of data
|
if (*TempPointer=='}') // end of data
|
||||||
{
|
{
|
||||||
// insert KeyName & Data into the hash
|
// insert KeyName & Data into the hash
|
||||||
ke::AString key(UTIL_ToLowerCase(KeyName));
|
ke::AString key(UTIL_ToLowerCase(KeyName));
|
||||||
|
|
||||||
this->m_Hash.insert(key, new ke::AString(Data));
|
this->m_Hash.insert(key, new ke::AString(Data));
|
||||||
|
|
||||||
goto scan_for_key;
|
goto scan_for_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
// have valid data here
|
// have valid data here
|
||||||
strncpy(Data,TempBuffer,sizeof(Data)-1);
|
strncpy(Data,TempBuffer,sizeof(Data)-1);
|
||||||
};
|
};
|
||||||
end_of_file:
|
end_of_file:
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
//MF_Log("TitleManager loaded %u entries from titles.txt (%u lines parsed)",m_List.size(),Line);
|
//MF_Log("TitleManager loaded %u entries from titles.txt (%u lines parsed)",m_List.size(),Line);
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,49 +10,49 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef TITLEMANAGER_H
|
#ifndef TITLEMANAGER_H
|
||||||
#define TITLEMANAGER_H
|
#define TITLEMANAGER_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
#include "Hash.h"
|
#include "Hash.h"
|
||||||
|
|
||||||
|
|
||||||
class TitleManager
|
class TitleManager
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int m_Loaded;
|
int m_Loaded;
|
||||||
|
|
||||||
// Use a string pointer for the data type because the location manager
|
// Use a string pointer for the data type because the location manager
|
||||||
// stores a direct pointer to the c_str() of the title
|
// stores a direct pointer to the c_str() of the title
|
||||||
Hash<ke::AString, ke::AString*> m_Hash;
|
Hash<ke::AString, ke::AString*> m_Hash;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TitleManager()
|
TitleManager()
|
||||||
{
|
{
|
||||||
m_Loaded=0;
|
m_Loaded=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const char *Lookup(ke::AString &input)
|
inline const char *Lookup(ke::AString &input)
|
||||||
{
|
{
|
||||||
ke::AString** ret = m_Hash.find(input);
|
ke::AString** ret = m_Hash.find(input);
|
||||||
|
|
||||||
if (ret == NULL || *ret == NULL)
|
if (ret == NULL || *ret == NULL)
|
||||||
{
|
{
|
||||||
// was not found
|
// was not found
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*ret)->chars();
|
return (*ret)->chars();
|
||||||
};
|
};
|
||||||
void LoadTitles(void);
|
void LoadTitles(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TitleManager TitleMan;
|
extern TitleManager TitleMan;
|
||||||
|
|
||||||
#endif // TITLEMANAGER_H
|
#endif // TITLEMANAGER_H
|
||||||
|
|
|
@ -10,82 +10,82 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* Calls sent by AMX Mod X are handled here */
|
/* Calls sent by AMX Mod X are handled here */
|
||||||
|
|
||||||
#include "sdk/amxxmodule.h"
|
#include "sdk/amxxmodule.h"
|
||||||
|
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "TitleManager.h"
|
#include "TitleManager.h"
|
||||||
#include "MessageHandler.h"
|
#include "MessageHandler.h"
|
||||||
#include "ParticleManager.h"
|
#include "ParticleManager.h"
|
||||||
|
|
||||||
#include "AllocString.h"
|
#include "AllocString.h"
|
||||||
|
|
||||||
extern int gmsgHudText2;
|
extern int gmsgHudText2;
|
||||||
extern BOOL iscombat;
|
extern BOOL iscombat;
|
||||||
|
|
||||||
TitleManager TitleMan;
|
TitleManager TitleMan;
|
||||||
ParticleManager ParticleMan;
|
ParticleManager ParticleMan;
|
||||||
|
|
||||||
void MFuncs_Initialize(void);
|
void MFuncs_Initialize(void);
|
||||||
|
|
||||||
// Native register calls here
|
// Native register calls here
|
||||||
void AddNatives_MemberFunc();
|
void AddNatives_MemberFunc();
|
||||||
void AddNatives_Particles();
|
void AddNatives_Particles();
|
||||||
void AddNatives_Player();
|
void AddNatives_Player();
|
||||||
void AddNatives_PlayerMemory();
|
void AddNatives_PlayerMemory();
|
||||||
void AddNatives_Weapons();
|
void AddNatives_Weapons();
|
||||||
void AddNatives_Structure();
|
void AddNatives_Structure();
|
||||||
void AddNatives_General();
|
void AddNatives_General();
|
||||||
|
|
||||||
// All plugins have loaded (called during spawning worldspawn)
|
// All plugins have loaded (called during spawning worldspawn)
|
||||||
void OnPluginsLoaded()
|
void OnPluginsLoaded()
|
||||||
{
|
{
|
||||||
|
|
||||||
// This message is used for the ns_popup native
|
// This message is used for the ns_popup native
|
||||||
GameMan.GetMessageIDs();
|
GameMan.GetMessageIDs();
|
||||||
|
|
||||||
// Check the map name and see if it's combat or not.
|
// Check the map name and see if it's combat or not.
|
||||||
GameMan.EvaluateCombat();
|
GameMan.EvaluateCombat();
|
||||||
|
|
||||||
GameMan.RegisterForwards();
|
GameMan.RegisterForwards();
|
||||||
|
|
||||||
GameMan.CheckAllHooks();
|
GameMan.CheckAllHooks();
|
||||||
|
|
||||||
AllocStringList.Clear();
|
AllocStringList.Clear();
|
||||||
|
|
||||||
TitleMan.LoadTitles();
|
TitleMan.LoadTitles();
|
||||||
|
|
||||||
GameMan.CheckMap();
|
GameMan.CheckMap();
|
||||||
|
|
||||||
ParticleMan.ReadFile();
|
ParticleMan.ReadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int AmxxCheckGame(const char *game)
|
int AmxxCheckGame(const char *game)
|
||||||
{
|
{
|
||||||
if (strcasecmp(game, "ns") == 0 ||
|
if (strcasecmp(game, "ns") == 0 ||
|
||||||
strcasecmp(game, "nsp") == 0)
|
strcasecmp(game, "nsp") == 0)
|
||||||
{
|
{
|
||||||
return AMXX_GAME_OK;
|
return AMXX_GAME_OK;
|
||||||
}
|
}
|
||||||
return AMXX_GAME_BAD;
|
return AMXX_GAME_BAD;
|
||||||
}
|
}
|
||||||
// Module is attaching to AMXX
|
// Module is attaching to AMXX
|
||||||
void OnAmxxAttach()
|
void OnAmxxAttach()
|
||||||
{
|
{
|
||||||
AddNatives_MemberFunc();
|
AddNatives_MemberFunc();
|
||||||
AddNatives_Particles();
|
AddNatives_Particles();
|
||||||
AddNatives_Player();
|
AddNatives_Player();
|
||||||
AddNatives_PlayerMemory();
|
AddNatives_PlayerMemory();
|
||||||
AddNatives_Weapons();
|
AddNatives_Weapons();
|
||||||
AddNatives_Structure();
|
AddNatives_Structure();
|
||||||
AddNatives_General();
|
AddNatives_General();
|
||||||
|
|
||||||
MFuncs_Initialize();
|
MFuncs_Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,205 +10,205 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* Calls going from the engine to the game dll are handled here */
|
/* Calls going from the engine to the game dll are handled here */
|
||||||
|
|
||||||
#ifndef HAVE_STDINT_H
|
#ifndef HAVE_STDINT_H
|
||||||
#define HAVE_STDINT_H
|
#define HAVE_STDINT_H
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "SpawnManager.h"
|
#include "SpawnManager.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "CPlayer.h"
|
#include "CPlayer.h"
|
||||||
#include "MessageHandler.h"
|
#include "MessageHandler.h"
|
||||||
#include "LocationManager.h"
|
#include "LocationManager.h"
|
||||||
#include "ParticleManager.h"
|
#include "ParticleManager.h"
|
||||||
|
|
||||||
LocationManager LocationMan;
|
LocationManager LocationMan;
|
||||||
GameManager GameMan;
|
GameManager GameMan;
|
||||||
SpawnManager SpawnMan;
|
SpawnManager SpawnMan;
|
||||||
|
|
||||||
extern edict_t* avhgameplay;
|
extern edict_t* avhgameplay;
|
||||||
|
|
||||||
CPlayer g_player[33];
|
CPlayer g_player[33];
|
||||||
extern void *GameRules;
|
extern void *GameRules;
|
||||||
|
|
||||||
bool NEW_Initialized=false;
|
bool NEW_Initialized=false;
|
||||||
edict_t *NEW_FirstEdict=NULL;
|
edict_t *NEW_FirstEdict=NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is only called during the CountDown
|
* This is only called during the CountDown
|
||||||
* This call will unhook itself with Metamod
|
* This call will unhook itself with Metamod
|
||||||
* when it is finished.
|
* when it is finished.
|
||||||
*/
|
*/
|
||||||
void StartFrame()
|
void StartFrame()
|
||||||
{
|
{
|
||||||
GameMan.StartFrame();
|
GameMan.StartFrame();
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check spawning for:
|
* Check spawning for:
|
||||||
* - Worldspawn
|
* - Worldspawn
|
||||||
* - Initialize NEW_Utilities
|
* - Initialize NEW_Utilities
|
||||||
* - Clear CPlayer / CSpawn data
|
* - Clear CPlayer / CSpawn data
|
||||||
* - info_team_start (team spawn point)
|
* - info_team_start (team spawn point)
|
||||||
* - Save in list
|
* - Save in list
|
||||||
* - info_player_start (ready room spawn point)
|
* - info_player_start (ready room spawn point)
|
||||||
* - Save in list
|
* - Save in list
|
||||||
*/
|
*/
|
||||||
int DispatchSpawn(edict_t *pEntity)
|
int DispatchSpawn(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
if (!NEW_Initialized)
|
if (!NEW_Initialized)
|
||||||
{
|
{
|
||||||
NEW_Initialize(pEntity);
|
NEW_Initialize(pEntity);
|
||||||
}
|
}
|
||||||
if (ENTINDEX_NEW(pEntity)==0) // worldspawn
|
if (ENTINDEX_NEW(pEntity)==0) // worldspawn
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
while (i<=32)
|
while (i<=32)
|
||||||
{
|
{
|
||||||
GET_PLAYER_I(i++)->Reset();
|
GET_PLAYER_I(i++)->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationMan.Clear();
|
LocationMan.Clear();
|
||||||
|
|
||||||
SpawnMan.Clear();
|
SpawnMan.Clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (FStrEq(STRING(pEntity->v.classname),"info_player_start"))
|
else if (FStrEq(STRING(pEntity->v.classname),"info_player_start"))
|
||||||
{
|
{
|
||||||
// Mark down the ready room spawn point.
|
// Mark down the ready room spawn point.
|
||||||
SpawnMan.InsertReadyRoom(pEntity);
|
SpawnMan.InsertReadyRoom(pEntity);
|
||||||
}
|
}
|
||||||
else if (FStrEq(STRING(pEntity->v.classname),"info_team_start"))
|
else if (FStrEq(STRING(pEntity->v.classname),"info_team_start"))
|
||||||
{
|
{
|
||||||
// Mark down the team based spawn point.
|
// Mark down the team based spawn point.
|
||||||
SpawnMan.Insert(pEntity);
|
SpawnMan.Insert(pEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (FStrEq(STRING(pEntity->v.classname),"env_particles_custom"))
|
else if (FStrEq(STRING(pEntity->v.classname),"env_particles_custom"))
|
||||||
{
|
{
|
||||||
ParticleMan.Add(STRING(pEntity->v.targetname),0);
|
ParticleMan.Add(STRING(pEntity->v.targetname),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_IGNORED, 0);
|
RETURN_META_VALUE(MRES_IGNORED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DispatchKeyValue(edict_t *pEntity,KeyValueData *pkvd)
|
void DispatchKeyValue(edict_t *pEntity,KeyValueData *pkvd)
|
||||||
{
|
{
|
||||||
if (strcmp(pkvd->szKeyName,"locationname")==0)
|
if (strcmp(pkvd->szKeyName,"locationname")==0)
|
||||||
{
|
{
|
||||||
if (pkvd->szClassName && strcmp(pkvd->szClassName,"info_location")==0)
|
if (pkvd->szClassName && strcmp(pkvd->szClassName,"info_location")==0)
|
||||||
{
|
{
|
||||||
// this is a BSP model, so calling SetModel
|
// this is a BSP model, so calling SetModel
|
||||||
// will update the mins/maxs
|
// will update the mins/maxs
|
||||||
SET_MODEL(pEntity,STRING(pEntity->v.model));
|
SET_MODEL(pEntity,STRING(pEntity->v.model));
|
||||||
|
|
||||||
// Add it to our list
|
// Add it to our list
|
||||||
LocationMan.Add(pkvd->szValue,pEntity);
|
LocationMan.Add(pkvd->szValue,pEntity);
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||||
{
|
{
|
||||||
// Reset CPlayer classes (again?)
|
// Reset CPlayer classes (again?)
|
||||||
for(int i = 1; i <= gpGlobals->maxClients;i++)
|
for(int i = 1; i <= gpGlobals->maxClients;i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
CPlayer *player=GET_PLAYER_I(i);
|
CPlayer *player=GET_PLAYER_I(i);
|
||||||
|
|
||||||
player->FullReset();
|
player->FullReset();
|
||||||
|
|
||||||
player->SetEdict(pEdictList + i);
|
player->SetEdict(pEdictList + i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRules=NULL;
|
GameRules=NULL;
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax)
|
void ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax)
|
||||||
{
|
{
|
||||||
Initialize_MessageHandler();
|
Initialize_MessageHandler();
|
||||||
|
|
||||||
g_pFunctionTable_Post->pfnServerActivate=NULL;
|
g_pFunctionTable_Post->pfnServerActivate=NULL;
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlayerPreThink, PlayerPreThink_Post and PlayerPostThink_Post
|
* PlayerPreThink, PlayerPreThink_Post and PlayerPostThink_Post
|
||||||
* all disable their Metamod hook calls when they are no longer needed.
|
* all disable their Metamod hook calls when they are no longer needed.
|
||||||
* (Actually it is disabled in the native calls)
|
* (Actually it is disabled in the native calls)
|
||||||
*/
|
*/
|
||||||
void PlayerPreThink(edict_t *pEntity)
|
void PlayerPreThink(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
GET_PLAYER_E(pEntity)->PreThink();
|
GET_PLAYER_E(pEntity)->PreThink();
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
void PlayerPreThink_Post(edict_t *pEntity)
|
void PlayerPreThink_Post(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
GET_PLAYER_E(pEntity)->PreThink_Post();
|
GET_PLAYER_E(pEntity)->PreThink_Post();
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
void PlayerPostThink_Post(edict_t *pEntity)
|
void PlayerPostThink_Post(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
GET_PLAYER_E(pEntity)->PostThink_Post();
|
GET_PLAYER_E(pEntity)->PostThink_Post();
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Map is changing/server is shutting down.
|
// Map is changing/server is shutting down.
|
||||||
// We do all cleanup routines here, since, as noted in metamod's dllapi
|
// We do all cleanup routines here, since, as noted in metamod's dllapi
|
||||||
// ServerDeactivate is the very last function called before the server loads up a new map.
|
// ServerDeactivate is the very last function called before the server loads up a new map.
|
||||||
void ServerDeactivate(void)
|
void ServerDeactivate(void)
|
||||||
{
|
{
|
||||||
for (int i=1;i<=gpGlobals->maxClients;i++)
|
for (int i=1;i<=gpGlobals->maxClients;i++)
|
||||||
{
|
{
|
||||||
GET_PLAYER_I(i)->Disconnect();
|
GET_PLAYER_I(i)->Disconnect();
|
||||||
}
|
}
|
||||||
GameRules = NULL;
|
GameRules = NULL;
|
||||||
avhgameplay = NULL;
|
avhgameplay = NULL;
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset player data here..
|
// Reset player data here..
|
||||||
qboolean ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ])
|
qboolean ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ])
|
||||||
{
|
{
|
||||||
// Client's connecting. Freshen up his save data, and mark him as being connected.
|
// Client's connecting. Freshen up his save data, and mark him as being connected.
|
||||||
GET_PLAYER_E(pEntity)->Connect();
|
GET_PLAYER_E(pEntity)->Connect();
|
||||||
|
|
||||||
RETURN_META_VALUE(MRES_HANDLED,0);
|
RETURN_META_VALUE(MRES_HANDLED,0);
|
||||||
}
|
}
|
||||||
void ClientDisconnect(edict_t *pEntity)
|
void ClientDisconnect(edict_t *pEntity)
|
||||||
{
|
{
|
||||||
// Client is disconnecting, clear all his saved information.
|
// Client is disconnecting, clear all his saved information.
|
||||||
GET_PLAYER_E(pEntity)->Disconnect(1);
|
GET_PLAYER_E(pEntity)->Disconnect(1);
|
||||||
|
|
||||||
RETURN_META(MRES_HANDLED);
|
RETURN_META(MRES_HANDLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NS resets pev->fov every single frame, but this is called right before the data is sent to the client.
|
* NS resets pev->fov every single frame, but this is called right before the data is sent to the client.
|
||||||
* Reset FOV if we need to.
|
* Reset FOV if we need to.
|
||||||
* -
|
* -
|
||||||
* NOTE: This function is not called if no clients have FoV changed
|
* NOTE: This function is not called if no clients have FoV changed
|
||||||
*/
|
*/
|
||||||
void UpdateClientData( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd )
|
void UpdateClientData( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd )
|
||||||
{
|
{
|
||||||
GET_PLAYER_E(const_cast<edict_t *>(static_cast<const edict_t *>(ent)))->UpdateFOV();
|
GET_PLAYER_E(const_cast<edict_t *>(static_cast<const edict_t *>(ent)))->UpdateFOV();
|
||||||
|
|
||||||
RETURN_META(MRES_HANDLED);
|
RETURN_META(MRES_HANDLED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,283 +10,283 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
/* Calls going from the game dll to the engine are handled here */
|
/* Calls going from the game dll to the engine are handled here */
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "ParticleManager.h"
|
#include "ParticleManager.h"
|
||||||
#include "CPlayer.h"
|
#include "CPlayer.h"
|
||||||
|
|
||||||
|
|
||||||
// Parse log messages here for any desired information (structure_built, etc.)
|
// Parse log messages here for any desired information (structure_built, etc.)
|
||||||
// The following logs are needed:
|
// The following logs are needed:
|
||||||
// "sawce<1><STEAM_0:1:4560311><alien1team>" triggered "structure_built" (type "defensechamber")`
|
// "sawce<1><STEAM_0:1:4560311><alien1team>" triggered "structure_built" (type "defensechamber")`
|
||||||
void AlertMessage_Post(ALERT_TYPE atype, const char *szFmt, ...)
|
void AlertMessage_Post(ALERT_TYPE atype, const char *szFmt, ...)
|
||||||
{
|
{
|
||||||
if (atype != at_logged)
|
if (atype != at_logged)
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *MessageStart; // original pointer to start of the message
|
char *MessageStart; // original pointer to start of the message
|
||||||
char *TypePointer; // pointer to the structure type
|
char *TypePointer; // pointer to the structure type
|
||||||
char *CIDPointer; // pointer to the name text
|
char *CIDPointer; // pointer to the name text
|
||||||
|
|
||||||
int CID; // connection ID of the player
|
int CID; // connection ID of the player
|
||||||
|
|
||||||
va_list LogArgs;
|
va_list LogArgs;
|
||||||
|
|
||||||
va_start(LogArgs,szFmt);
|
va_start(LogArgs,szFmt);
|
||||||
MessageStart=va_arg(LogArgs,char *);
|
MessageStart=va_arg(LogArgs,char *);
|
||||||
va_end(LogArgs);
|
va_end(LogArgs);
|
||||||
|
|
||||||
if (MessageStart==NULL) // Somehow got a null pointer, get out of here now
|
if (MessageStart==NULL) // Somehow got a null pointer, get out of here now
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((TypePointer=strstr(MessageStart,"\"structure_built\""))==NULL) // was not found
|
if ((TypePointer=strstr(MessageStart,"\"structure_built\""))==NULL) // was not found
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(TypePointer - 2) != 'd') // If this is not from a 'triggered "structure_built"', then ignore the message
|
if (*(TypePointer - 2) != 'd') // If this is not from a 'triggered "structure_built"', then ignore the message
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we got here, then for all we can tell this message is good
|
// If we got here, then for all we can tell this message is good
|
||||||
|
|
||||||
// Move up a few spaces
|
// Move up a few spaces
|
||||||
TypePointer+=25; // strlen("\"structure_built\" (type \"")=25
|
TypePointer+=25; // strlen("\"structure_built\" (type \"")=25
|
||||||
|
|
||||||
// Now get the player's CID
|
// Now get the player's CID
|
||||||
CIDPointer=MessageStart+1; // skip over the very first quotation mark
|
CIDPointer=MessageStart+1; // skip over the very first quotation mark
|
||||||
|
|
||||||
while (*CIDPointer++ != '"') /*do nothing*/;
|
while (*CIDPointer++ != '"') /*do nothing*/;
|
||||||
|
|
||||||
--CIDPointer;
|
--CIDPointer;
|
||||||
|
|
||||||
// Move back past three <
|
// Move back past three <
|
||||||
|
|
||||||
while (*CIDPointer-- != '<') /* do nothing*/;
|
while (*CIDPointer-- != '<') /* do nothing*/;
|
||||||
while (*CIDPointer-- != '<') /* do nothing*/;
|
while (*CIDPointer-- != '<') /* do nothing*/;
|
||||||
while (*CIDPointer-- != '<') /* do nothing*/;
|
while (*CIDPointer-- != '<') /* do nothing*/;
|
||||||
|
|
||||||
++CIDPointer;
|
++CIDPointer;
|
||||||
|
|
||||||
// now skip past the <
|
// now skip past the <
|
||||||
++CIDPointer;
|
++CIDPointer;
|
||||||
|
|
||||||
// We now point to the CID string, atoi will stop at the > so just atoi it for the CID
|
// We now point to the CID string, atoi will stop at the > so just atoi it for the CID
|
||||||
CID=atoi(CIDPointer);
|
CID=atoi(CIDPointer);
|
||||||
|
|
||||||
CPlayer *Player;
|
CPlayer *Player;
|
||||||
|
|
||||||
if ((Player=UTIL_PlayerByCID(CID))==NULL)
|
if ((Player=UTIL_PlayerByCID(CID))==NULL)
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// list of what impulses represent what type of structure building
|
// list of what impulses represent what type of structure building
|
||||||
// use
|
// use
|
||||||
// 0 for unknown (shouldn't be used ever)
|
// 0 for unknown (shouldn't be used ever)
|
||||||
// 1 for marine
|
// 1 for marine
|
||||||
// 2 for alien
|
// 2 for alien
|
||||||
|
|
||||||
// I'm marking the upgrades as marine structures just incase
|
// I'm marking the upgrades as marine structures just incase
|
||||||
// they should never be used though!
|
// they should never be used though!
|
||||||
static int StructureTypes[128] =
|
static int StructureTypes[128] =
|
||||||
{
|
{
|
||||||
|
|
||||||
0, // 0 = unknown
|
0, // 0 = unknown
|
||||||
0, // 1 = next weapon
|
0, // 1 = next weapon
|
||||||
0, // 2 = reload
|
0, // 2 = reload
|
||||||
0, // 3 = drop weapon
|
0, // 3 = drop weapon
|
||||||
0, // 4 = unknown
|
0, // 4 = unknown
|
||||||
0, // 5 = unknown
|
0, // 5 = unknown
|
||||||
0, // 6 = unknown
|
0, // 6 = unknown
|
||||||
0, // 7 = radio comm
|
0, // 7 = radio comm
|
||||||
0, // 8 = radio comm
|
0, // 8 = radio comm
|
||||||
0, // 9 = radio comm
|
0, // 9 = radio comm
|
||||||
|
|
||||||
0, // 10 = radio comm
|
0, // 10 = radio comm
|
||||||
0, // 11 = radio comm
|
0, // 11 = radio comm
|
||||||
0, // 12 = radio comm
|
0, // 12 = radio comm
|
||||||
0, // 13 = radio comm
|
0, // 13 = radio comm
|
||||||
0, // 14 = radio comm
|
0, // 14 = radio comm
|
||||||
0, // 15 = radio comm
|
0, // 15 = radio comm
|
||||||
0, // 16 = unknown
|
0, // 16 = unknown
|
||||||
0, // 17 = unknown
|
0, // 17 = unknown
|
||||||
0, // 18 = unknown
|
0, // 18 = unknown
|
||||||
0, // 19 = unknown
|
0, // 19 = unknown
|
||||||
|
|
||||||
1, // 20 = armor 1
|
1, // 20 = armor 1
|
||||||
1, // 21 = armor 2
|
1, // 21 = armor 2
|
||||||
1, // 22 = armor 3
|
1, // 22 = armor 3
|
||||||
1, // 23 = weapons 1
|
1, // 23 = weapons 1
|
||||||
1, // 24 = weapons 2
|
1, // 24 = weapons 2
|
||||||
1, // 25 = weapons 3
|
1, // 25 = weapons 3
|
||||||
1, // 26 = siege upgrade
|
1, // 26 = siege upgrade
|
||||||
1, // 27 = drop catalyst
|
1, // 27 = drop catalyst
|
||||||
1, // 28 = research jp
|
1, // 28 = research jp
|
||||||
1, // 29 = research ha
|
1, // 29 = research ha
|
||||||
|
|
||||||
1, // 30 = distress beacon
|
1, // 30 = distress beacon
|
||||||
1, // 31 = resupply (combat)
|
1, // 31 = resupply (combat)
|
||||||
0, // 32 = unknown
|
0, // 32 = unknown
|
||||||
1, // 33 = motion tracking
|
1, // 33 = motion tracking
|
||||||
1, // 34 = phase gates upgrade
|
1, // 34 = phase gates upgrade
|
||||||
0, // 35 = unknown
|
0, // 35 = unknown
|
||||||
1, // 36 = electricity upgrade
|
1, // 36 = electricity upgrade
|
||||||
1, // 37 = handgrenades upgrade
|
1, // 37 = handgrenades upgrade
|
||||||
1, // 38 = drop jetpack
|
1, // 38 = drop jetpack
|
||||||
1, // 39 = drop heavy armor
|
1, // 39 = drop heavy armor
|
||||||
|
|
||||||
1, // 40 = infantry portal
|
1, // 40 = infantry portal
|
||||||
1, // 41 = marine RT
|
1, // 41 = marine RT
|
||||||
0, // 42 = unused
|
0, // 42 = unused
|
||||||
1, // 43 = turret factory
|
1, // 43 = turret factory
|
||||||
0, // 44 = unused
|
0, // 44 = unused
|
||||||
1, // 45 = arms lab
|
1, // 45 = arms lab
|
||||||
1, // 46 = proto lab
|
1, // 46 = proto lab
|
||||||
1, // 47 = upgrade
|
1, // 47 = upgrade
|
||||||
1, // 48 = armory
|
1, // 48 = armory
|
||||||
1, // 49 = advanced armory
|
1, // 49 = advanced armory
|
||||||
|
|
||||||
0, // 50 = unknown
|
0, // 50 = unknown
|
||||||
1, // 51 = observatory
|
1, // 51 = observatory
|
||||||
0, // 52 = unknown
|
0, // 52 = unknown
|
||||||
1, // 53 = scanner sweep
|
1, // 53 = scanner sweep
|
||||||
0, // 54 = unknown
|
0, // 54 = unknown
|
||||||
1, // 55 = build phase gate
|
1, // 55 = build phase gate
|
||||||
1, // 56 = build turret
|
1, // 56 = build turret
|
||||||
1, // 57 = build siege turret
|
1, // 57 = build siege turret
|
||||||
1, // 58 = build command chair
|
1, // 58 = build command chair
|
||||||
1, // 59 = drop health pack
|
1, // 59 = drop health pack
|
||||||
|
|
||||||
1, // 60 = drop ammo pack
|
1, // 60 = drop ammo pack
|
||||||
1, // 61 = drop mine pack
|
1, // 61 = drop mine pack
|
||||||
1, // 62 = drop welder
|
1, // 62 = drop welder
|
||||||
0, // 63 = unknown
|
0, // 63 = unknown
|
||||||
1, // 64 = drop shotgun
|
1, // 64 = drop shotgun
|
||||||
1, // 65 = drop heavymachinegun
|
1, // 65 = drop heavymachinegun
|
||||||
1, // 66 = drop grenadelauncher
|
1, // 66 = drop grenadelauncher
|
||||||
0, // 67 = unknown
|
0, // 67 = unknown
|
||||||
0, // 68 = unknown
|
0, // 68 = unknown
|
||||||
0, // 69 = unknown
|
0, // 69 = unknown
|
||||||
|
|
||||||
0, // 70 = unknown
|
0, // 70 = unknown
|
||||||
0, // 71 = unknown
|
0, // 71 = unknown
|
||||||
0, // 72 = unknown
|
0, // 72 = unknown
|
||||||
0, // 73 = unknown
|
0, // 73 = unknown
|
||||||
0, // 74 = unknown
|
0, // 74 = unknown
|
||||||
0, // 75 = unknown
|
0, // 75 = unknown
|
||||||
0, // 76 = unknown
|
0, // 76 = unknown
|
||||||
0, // 77 = unknown
|
0, // 77 = unknown
|
||||||
0, // 78 = unknown
|
0, // 78 = unknown
|
||||||
0, // 79 = unknown
|
0, // 79 = unknown
|
||||||
|
|
||||||
0, // 80 = radio comm
|
0, // 80 = radio comm
|
||||||
0, // 81 = radio comm
|
0, // 81 = radio comm
|
||||||
1, // 82 = commander message
|
1, // 82 = commander message
|
||||||
0, // 83 = commander message
|
0, // 83 = commander message
|
||||||
0, // 84 = commander message
|
0, // 84 = commander message
|
||||||
0, // 85 = unknown
|
0, // 85 = unknown
|
||||||
0, // 86 = unknown
|
0, // 86 = unknown
|
||||||
0, // 87 = unknown
|
0, // 87 = unknown
|
||||||
0, // 88 = unknown
|
0, // 88 = unknown
|
||||||
0, // 89 = unknown
|
0, // 89 = unknown
|
||||||
|
|
||||||
2, // 90 = alienresourcetower
|
2, // 90 = alienresourcetower
|
||||||
2, // 91 = offensechamber
|
2, // 91 = offensechamber
|
||||||
2, // 92 = defensechamber
|
2, // 92 = defensechamber
|
||||||
2, // 93 = sensorychamber
|
2, // 93 = sensorychamber
|
||||||
2, // 94 = movementchamber
|
2, // 94 = movementchamber
|
||||||
2, // 95 = team_hive
|
2, // 95 = team_hive
|
||||||
0, // 96 = unknown
|
0, // 96 = unknown
|
||||||
0, // 97 = unknown
|
0, // 97 = unknown
|
||||||
0, // 98 = unknown
|
0, // 98 = unknown
|
||||||
0, // 99 = unknown
|
0, // 99 = unknown
|
||||||
|
|
||||||
0, // 100 = unknown
|
0, // 100 = unknown
|
||||||
2, // 101 = carapace
|
2, // 101 = carapace
|
||||||
2, // 102 = regeneration
|
2, // 102 = regeneration
|
||||||
2, // 103 = redemption
|
2, // 103 = redemption
|
||||||
0, // 104 = unknown
|
0, // 104 = unknown
|
||||||
1, // 105 = select all marines
|
1, // 105 = select all marines
|
||||||
0, // 106 = unknown
|
0, // 106 = unknown
|
||||||
2, // 107 = celerity
|
2, // 107 = celerity
|
||||||
2, // 108 = adrenaline
|
2, // 108 = adrenaline
|
||||||
2, // 109 = silence
|
2, // 109 = silence
|
||||||
|
|
||||||
2, // 110 = cloaking
|
2, // 110 = cloaking
|
||||||
2, // 111 = focus
|
2, // 111 = focus
|
||||||
2, // 112 = scent of fear
|
2, // 112 = scent of fear
|
||||||
2, // 113 = skulk
|
2, // 113 = skulk
|
||||||
2, // 114 = gorge
|
2, // 114 = gorge
|
||||||
2, // 115 = lerk
|
2, // 115 = lerk
|
||||||
2, // 116 = fade
|
2, // 116 = fade
|
||||||
2, // 117 = onos
|
2, // 117 = onos
|
||||||
2, // 118 = unlock next ability (combat)
|
2, // 118 = unlock next ability (combat)
|
||||||
0, // 119 = unknown
|
0, // 119 = unknown
|
||||||
|
|
||||||
0, // 120 = unknown
|
0, // 120 = unknown
|
||||||
0, // 121 = unknown
|
0, // 121 = unknown
|
||||||
0, // 122 = unknown
|
0, // 122 = unknown
|
||||||
0, // 123 = unknown
|
0, // 123 = unknown
|
||||||
0, // 124 = unknown
|
0, // 124 = unknown
|
||||||
0, // 125 = unknown
|
0, // 125 = unknown
|
||||||
2, // 126 = unlock next ability (combat)
|
2, // 126 = unlock next ability (combat)
|
||||||
0 // 127 = unknown
|
0 // 127 = unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
int impulse=Player->GetPev()->impulse;
|
int impulse=Player->GetPev()->impulse;
|
||||||
if (impulse < 0 || impulse > 127)
|
if (impulse < 0 || impulse > 127)
|
||||||
{
|
{
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (impulse==95/*hive*/)
|
if (impulse==95/*hive*/)
|
||||||
{
|
{
|
||||||
GameMan.ExecuteClientBuilt(Player->index(), UTIL_FindBuildingHive(), StructureTypes[impulse], impulse);
|
GameMan.ExecuteClientBuilt(Player->index(), UTIL_FindBuildingHive(), StructureTypes[impulse], impulse);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GameMan.ExecuteClientBuilt(Player->index(), ENTINDEX_NEW(GameMan.GetTemporaryEdict()), StructureTypes[impulse], impulse);
|
GameMan.ExecuteClientBuilt(Player->index(), ENTINDEX_NEW(GameMan.GetTemporaryEdict()), StructureTypes[impulse], impulse);
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN_META(MRES_IGNORED);
|
RETURN_META(MRES_IGNORED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We hook newly created entities here.
|
// We hook newly created entities here.
|
||||||
// This is where we check for client_built created entities.
|
// This is where we check for client_built created entities.
|
||||||
edict_t* CreateNamedEntity_Post(int className)
|
edict_t* CreateNamedEntity_Post(int className)
|
||||||
{
|
{
|
||||||
if (GameMan.IsCombat()) // this shouldn't be called during co, just incase
|
if (GameMan.IsCombat()) // this shouldn't be called during co, just incase
|
||||||
{
|
{
|
||||||
RETURN_META_VALUE(MRES_IGNORED,0);
|
RETURN_META_VALUE(MRES_IGNORED,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incase another plugin supercedes/overrides, use their returned value here.
|
// Incase another plugin supercedes/overrides, use their returned value here.
|
||||||
// (Untested).
|
// (Untested).
|
||||||
if (gpMetaGlobals->status >= MRES_OVERRIDE)
|
if (gpMetaGlobals->status >= MRES_OVERRIDE)
|
||||||
{
|
{
|
||||||
GameMan.SetTemporaryEdict(META_RESULT_OVERRIDE_RET(edict_t *));
|
GameMan.SetTemporaryEdict(META_RESULT_OVERRIDE_RET(edict_t *));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GameMan.SetTemporaryEdict(META_RESULT_ORIG_RET(edict_t *));
|
GameMan.SetTemporaryEdict(META_RESULT_ORIG_RET(edict_t *));
|
||||||
}
|
}
|
||||||
RETURN_META_VALUE(MRES_IGNORED,0);
|
RETURN_META_VALUE(MRES_IGNORED,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short PrecacheEvent_Post(int type, const char *psz)
|
unsigned short PrecacheEvent_Post(int type, const char *psz)
|
||||||
{
|
{
|
||||||
ParticleMan.PrecacheEvent(psz);
|
ParticleMan.PrecacheEvent(psz);
|
||||||
RETURN_META_VALUE(MRES_IGNORED,0);
|
RETURN_META_VALUE(MRES_IGNORED,0);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,278 +11,278 @@
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
|
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "ns_const.h"
|
#include "ns_const.h"
|
||||||
|
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
|
|
||||||
#include "FastDelegate.h"
|
#include "FastDelegate.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
|
|
||||||
extern int IsValidBuilding[AVH_USER3_MAX + 1];
|
extern int IsValidBuilding[AVH_USER3_MAX + 1];
|
||||||
|
|
||||||
using namespace fastdelegate::detail;
|
using namespace fastdelegate::detail;
|
||||||
|
|
||||||
|
|
||||||
void *GameRules=NULL;
|
void *GameRules=NULL;
|
||||||
|
|
||||||
|
|
||||||
mBOOL dlclose_handle_invalid; // Linking errors with metamod
|
mBOOL dlclose_handle_invalid; // Linking errors with metamod
|
||||||
|
|
||||||
// void AvHBaseBuildable::StartRecycle()
|
// void AvHBaseBuildable::StartRecycle()
|
||||||
static void (GenericClass::*MFP_Recycle)();
|
static void (GenericClass::*MFP_Recycle)();
|
||||||
|
|
||||||
// void AvHWeldable::AddBuildTime(float)
|
// void AvHWeldable::AddBuildTime(float)
|
||||||
static void (GenericClass::*MFP_WeldFinished)(float);
|
static void (GenericClass::*MFP_WeldFinished)(float);
|
||||||
|
|
||||||
// AvHGameRules *GetGameRules(void)
|
// AvHGameRules *GetGameRules(void)
|
||||||
static void *(*FP_GetGameRules)();
|
static void *(*FP_GetGameRules)();
|
||||||
|
|
||||||
|
|
||||||
char *FuncBase;
|
char *FuncBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sizeof(void (detail::GenericClass::*fptr)())
|
* sizeof(void (detail::GenericClass::*fptr)())
|
||||||
* is 8 in GCC. Add an empty void * pointer at
|
* is 8 in GCC. Add an empty void * pointer at
|
||||||
* the end to compensate.
|
* the end to compensate.
|
||||||
* Layout in GCC:
|
* Layout in GCC:
|
||||||
* union {
|
* union {
|
||||||
* void *address; // When this is an address it will always be positive
|
* void *address; // When this is an address it will always be positive
|
||||||
* int vtable_index; // When it is a vtable index it will always be odd = (vindex*2)+1
|
* int vtable_index; // When it is a vtable index it will always be odd = (vindex*2)+1
|
||||||
* };
|
* };
|
||||||
* int delta;
|
* int delta;
|
||||||
* -
|
* -
|
||||||
* Delta is the adjustment to the this pointer
|
* Delta is the adjustment to the this pointer
|
||||||
* For my implementations I will only need it to 0
|
* For my implementations I will only need it to 0
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
template <typename OutType>
|
template <typename OutType>
|
||||||
inline void set_mfp(OutType &out, void *in)
|
inline void set_mfp(OutType &out, void *in)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
void *in[2];
|
void *in[2];
|
||||||
OutType out;
|
OutType out;
|
||||||
} mfpu;
|
} mfpu;
|
||||||
|
|
||||||
mfpu.in[0]=in;
|
mfpu.in[0]=in;
|
||||||
mfpu.in[1]=NULL;
|
mfpu.in[1]=NULL;
|
||||||
out=mfpu.out;
|
out=mfpu.out;
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
template <typename OutType>
|
template <typename OutType>
|
||||||
inline void set_mfp(OutType &out, void *in)
|
inline void set_mfp(OutType &out, void *in)
|
||||||
{
|
{
|
||||||
out=horrible_cast<OutType>(in);
|
out=horrible_cast<OutType>(in);
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void MFuncs_Initialize(void)
|
void MFuncs_Initialize(void)
|
||||||
{
|
{
|
||||||
char FileName[256];
|
char FileName[256];
|
||||||
DLHANDLE DLLBase;
|
DLHANDLE DLLBase;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
UTIL_Format(FileName,sizeof(FileName)-1,"%s/dlls/ns_i386.so",MF_GetModname());
|
UTIL_Format(FileName,sizeof(FileName)-1,"%s/dlls/ns_i386.so",MF_GetModname());
|
||||||
#else
|
#else
|
||||||
UTIL_Format(FileName, sizeof(FileName)-1, "%s\\dlls\\ns.dll", MF_GetModname());
|
UTIL_Format(FileName, sizeof(FileName)-1, "%s\\dlls\\ns.dll", MF_GetModname());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DLLBase=DLOPEN(FileName);
|
DLLBase=DLOPEN(FileName);
|
||||||
FuncBase=(char *)DLSYM(DLLBase, MAKE_OFFSET(BASE));
|
FuncBase=(char *)DLSYM(DLLBase, MAKE_OFFSET(BASE));
|
||||||
DLCLOSE(DLLBase);
|
DLCLOSE(DLLBase);
|
||||||
|
|
||||||
#define MFP(Offs) (((void *)(((char *)FuncBase)+MAKE_OFFSET(Offs))))
|
#define MFP(Offs) (((void *)(((char *)FuncBase)+MAKE_OFFSET(Offs))))
|
||||||
|
|
||||||
set_mfp(MFP_Recycle,MFP(MEMBER_RECYCLE));
|
set_mfp(MFP_Recycle,MFP(MEMBER_RECYCLE));
|
||||||
|
|
||||||
set_mfp(MFP_WeldFinished,MFP(MEMBER_TRIGGER_WELDABLE));
|
set_mfp(MFP_WeldFinished,MFP(MEMBER_TRIGGER_WELDABLE));
|
||||||
|
|
||||||
// This is not a member function pointer, but use MFP since it
|
// This is not a member function pointer, but use MFP since it
|
||||||
// uses the same address conversion as MFPs do
|
// uses the same address conversion as MFPs do
|
||||||
FP_GetGameRules=horrible_cast<void *(*)()>(MFP(GETGAMERULES));
|
FP_GetGameRules=horrible_cast<void *(*)()>(MFP(GETGAMERULES));
|
||||||
};
|
};
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL ns_recycle(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_recycle(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->free || Entity->pvPrivateData==NULL)
|
if (Entity->free || Entity->pvPrivateData==NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Entity->v.iuser3 <= AVH_USER3_NONE || Entity->v.iuser3 >= AVH_USER3_MAX)
|
if (Entity->v.iuser3 <= AVH_USER3_NONE || Entity->v.iuser3 >= AVH_USER3_MAX)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (IsValidBuilding[Entity->v.iuser3]!=1) // Not a marine structure?
|
if (IsValidBuilding[Entity->v.iuser3]!=1) // Not a marine structure?
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure it's a marine building, undefined stuff happens on alien structures
|
// Make sure it's a marine building, undefined stuff happens on alien structures
|
||||||
(reinterpret_cast<GenericClass *>(Entity->pvPrivateData)->*(MFP_Recycle))();
|
(reinterpret_cast<GenericClass *>(Entity->pvPrivateData)->*(MFP_Recycle))();
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
static cell AMX_NATIVE_CALL ns_finish_weldable(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_finish_weldable(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->free || Entity->pvPrivateData==NULL)
|
if (Entity->free || Entity->pvPrivateData==NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// verify the classname since this will crash if it's the wrong class!
|
// verify the classname since this will crash if it's the wrong class!
|
||||||
if (strcmp(STRING(Entity->v.classname),"avhweldable")!=0)
|
if (strcmp(STRING(Entity->v.classname),"avhweldable")!=0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First need to set the weldable to 100% complete
|
// First need to set the weldable to 100% complete
|
||||||
set_private_f(Entity,MAKE_OFFSET(WELD_DONE),get_private_f(Entity,MAKE_OFFSET(WELD_TIME)));
|
set_private_f(Entity,MAKE_OFFSET(WELD_DONE),get_private_f(Entity,MAKE_OFFSET(WELD_TIME)));
|
||||||
|
|
||||||
// Now make NS think the weldable has been welded again
|
// Now make NS think the weldable has been welded again
|
||||||
// This has to call AvHWeldable::AddBuildTime(float)
|
// This has to call AvHWeldable::AddBuildTime(float)
|
||||||
// because AvHWeldable::TriggerFinished() does not work properly
|
// because AvHWeldable::TriggerFinished() does not work properly
|
||||||
(reinterpret_cast<GenericClass *>(Entity->pvPrivateData)->*(MFP_WeldFinished))(100.0);
|
(reinterpret_cast<GenericClass *>(Entity->pvPrivateData)->*(MFP_WeldFinished))(100.0);
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL ns_get_teamres(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_teamres(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (GameMan.IsCombat())
|
if (GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (GameRules==NULL) // GameRules not initialized yet
|
if (GameRules==NULL) // GameRules not initialized yet
|
||||||
{
|
{
|
||||||
GameRules=(*(FP_GetGameRules))();
|
GameRules=(*(FP_GetGameRules))();
|
||||||
}
|
}
|
||||||
if (GameRules==NULL) // Still null? Get out of here
|
if (GameRules==NULL) // Still null? Get out of here
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch(params[1])
|
switch(params[1])
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
return amx_ftoc2(*(REAL *)((char *)GameRules+GAMERULES_TEAMA_RESOURCES));
|
return amx_ftoc2(*(REAL *)((char *)GameRules+GAMERULES_TEAMA_RESOURCES));
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
return amx_ftoc2(*(REAL *)((char *)GameRules+GAMERULES_TEAMB_RESOURCES));
|
return amx_ftoc2(*(REAL *)((char *)GameRules+GAMERULES_TEAMB_RESOURCES));
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "ns_get_teamres: Expected 1 for team a or 2 for team b, got %d", params[1]);
|
MF_LogError(amx, AMX_ERR_NATIVE, "ns_get_teamres: Expected 1 for team a or 2 for team b, got %d", params[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_teamres(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_teamres(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (GameMan.IsCombat())
|
if (GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (GameRules==NULL) // GameRules not initialized yet
|
if (GameRules==NULL) // GameRules not initialized yet
|
||||||
{
|
{
|
||||||
GameRules=(*(FP_GetGameRules))();
|
GameRules=(*(FP_GetGameRules))();
|
||||||
}
|
}
|
||||||
if (GameRules==NULL) // Still null? Get out of here
|
if (GameRules==NULL) // Still null? Get out of here
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch(params[1])
|
switch(params[1])
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
*(REAL *)((char *)GameRules+GAMERULES_TEAMA_RESOURCES)=amx_ctof2(params[2]);
|
*(REAL *)((char *)GameRules+GAMERULES_TEAMA_RESOURCES)=amx_ctof2(params[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
*(REAL *)((char *)GameRules+GAMERULES_TEAMB_RESOURCES)=amx_ctof2(params[2]);
|
*(REAL *)((char *)GameRules+GAMERULES_TEAMB_RESOURCES)=amx_ctof2(params[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "ns_set_teamres: Expected 1 for team a or 2 for team b, got %d", params[1]);
|
MF_LogError(amx, AMX_ERR_NATIVE, "ns_set_teamres: Expected 1 for team a or 2 for team b, got %d", params[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_add_teamres(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_teamres(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (GameMan.IsCombat())
|
if (GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (GameRules==NULL) // GameRules not initialized yet
|
if (GameRules==NULL) // GameRules not initialized yet
|
||||||
{
|
{
|
||||||
GameRules=(*(FP_GetGameRules))();
|
GameRules=(*(FP_GetGameRules))();
|
||||||
}
|
}
|
||||||
if (GameRules==NULL) // Still null? Get out of here
|
if (GameRules==NULL) // Still null? Get out of here
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
switch(params[1])
|
switch(params[1])
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
return amx_ftoc2(*(REAL *)((char *)GameRules+GAMERULES_TEAMA_RESOURCES)+=amx_ctof2(params[2]));
|
return amx_ftoc2(*(REAL *)((char *)GameRules+GAMERULES_TEAMA_RESOURCES)+=amx_ctof2(params[2]));
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
return amx_ftoc2(*(REAL *)((char *)GameRules+GAMERULES_TEAMB_RESOURCES)+=amx_ctof2(params[2]));
|
return amx_ftoc2(*(REAL *)((char *)GameRules+GAMERULES_TEAMB_RESOURCES)+=amx_ctof2(params[2]));
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "ns_add_teamres: Expected 1 for team a or 2 for team b, got %d", params[1]);
|
MF_LogError(amx, AMX_ERR_NATIVE, "ns_add_teamres: Expected 1 for team a or 2 for team b, got %d", params[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEVELOPER_BUILD
|
#ifdef DEVELOPER_BUILD
|
||||||
static cell AMX_NATIVE_CALL findgameinfo(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL findgameinfo(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
void *Ret=(*(FP_GetGameRules))();
|
void *Ret=(*(FP_GetGameRules))();
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
void *v;
|
void *v;
|
||||||
int i;
|
int i;
|
||||||
}vi;
|
}vi;
|
||||||
vi.v=Ret;
|
vi.v=Ret;
|
||||||
|
|
||||||
printf("GameRules=%d\n",vi.i);
|
printf("GameRules=%d\n",vi.i);
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
AMX_NATIVE_INFO memberfunc_natives[] = {
|
AMX_NATIVE_INFO memberfunc_natives[] = {
|
||||||
#ifdef DEVELOPER_BUILD
|
#ifdef DEVELOPER_BUILD
|
||||||
{ "getgameinfo", findgameinfo },
|
{ "getgameinfo", findgameinfo },
|
||||||
#endif
|
#endif
|
||||||
{ "ns_recycle", ns_recycle },
|
{ "ns_recycle", ns_recycle },
|
||||||
{ "ns_finish_weldable", ns_finish_weldable },
|
{ "ns_finish_weldable", ns_finish_weldable },
|
||||||
{ "ns_get_teamres", ns_get_teamres },
|
{ "ns_get_teamres", ns_get_teamres },
|
||||||
{ "ns_set_teamres", ns_set_teamres },
|
{ "ns_set_teamres", ns_set_teamres },
|
||||||
{ "ns_add_teamres", ns_add_teamres },
|
{ "ns_add_teamres", ns_add_teamres },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddNatives_MemberFunc()
|
void AddNatives_MemberFunc()
|
||||||
{
|
{
|
||||||
MF_AddNatives(memberfunc_natives);
|
MF_AddNatives(memberfunc_natives);
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,246 +10,246 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
|
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "NEW_Util.h"
|
#include "NEW_Util.h"
|
||||||
#include "ParticleManager.h"
|
#include "ParticleManager.h"
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
|
|
||||||
#define KVI(__KEY) PSKeyValueI(__KEY,amx,params)
|
#define KVI(__KEY) PSKeyValueI(__KEY,amx,params)
|
||||||
#define KVF(__KEY) PSKeyValueF(__KEY,amx,params)
|
#define KVF(__KEY) PSKeyValueF(__KEY,amx,params)
|
||||||
#define KVS(__KEY) PSKeyValueS(__KEY,amx,params)
|
#define KVS(__KEY) PSKeyValueS(__KEY,amx,params)
|
||||||
#define NEXT params[__pcount++]
|
#define NEXT params[__pcount++]
|
||||||
|
|
||||||
typedef enum partsystype_e
|
typedef enum partsystype_e
|
||||||
{
|
{
|
||||||
PSYS_TYPE_INT,
|
PSYS_TYPE_INT,
|
||||||
PSYS_TYPE_FLOAT,
|
PSYS_TYPE_FLOAT,
|
||||||
PSYS_TYPE_STRING
|
PSYS_TYPE_STRING
|
||||||
}partsystype;
|
}partsystype;
|
||||||
typedef struct partsyskey_s
|
typedef struct partsyskey_s
|
||||||
{
|
{
|
||||||
const char *Name;
|
const char *Name;
|
||||||
partsystype type;
|
partsystype type;
|
||||||
}partsyskey;
|
}partsyskey;
|
||||||
|
|
||||||
cell PSKeyValueI(const char *name, AMX *amx, cell *params)
|
cell PSKeyValueI(const char *name, AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (params[1]==0)
|
if (params[1]==0)
|
||||||
{
|
{
|
||||||
MF_LogError(amx,AMX_ERR_NATIVE,"Invalid particle system handle provided!");
|
MF_LogError(amx,AMX_ERR_NATIVE,"Invalid particle system handle provided!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
KeyValueData kvd;
|
KeyValueData kvd;
|
||||||
|
|
||||||
char StrData[1024];
|
char StrData[1024];
|
||||||
|
|
||||||
UTIL_Format(StrData, sizeof(StrData)-1, "%d", params[2]);
|
UTIL_Format(StrData, sizeof(StrData)-1, "%d", params[2]);
|
||||||
|
|
||||||
kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
|
kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
|
||||||
kvd.szKeyName=name;
|
kvd.szKeyName=name;
|
||||||
kvd.szValue=&StrData[0];
|
kvd.szValue=&StrData[0];
|
||||||
kvd.fHandled=0;
|
kvd.fHandled=0;
|
||||||
//printf("\"%s\" \"%s\"\n",kvd.szKeyName,kvd.szValue);
|
//printf("\"%s\" \"%s\"\n",kvd.szKeyName,kvd.szValue);
|
||||||
|
|
||||||
MDLL_KeyValue(reinterpret_cast<edict_t *>(params[1]),&kvd);
|
MDLL_KeyValue(reinterpret_cast<edict_t *>(params[1]),&kvd);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
cell PSKeyValueF(const char *name, AMX *amx, cell *params)
|
cell PSKeyValueF(const char *name, AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (params[1]==0)
|
if (params[1]==0)
|
||||||
{
|
{
|
||||||
MF_LogError(amx,AMX_ERR_NATIVE,"Invalid particle system handle provided!");
|
MF_LogError(amx,AMX_ERR_NATIVE,"Invalid particle system handle provided!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
KeyValueData kvd;
|
KeyValueData kvd;
|
||||||
|
|
||||||
char StrData[1024];
|
char StrData[1024];
|
||||||
|
|
||||||
UTIL_Format(StrData, sizeof(StrData)-1, "%f", amx_ctof2(params[2]));
|
UTIL_Format(StrData, sizeof(StrData)-1, "%f", amx_ctof2(params[2]));
|
||||||
|
|
||||||
kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
|
kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
|
||||||
kvd.szKeyName=name;
|
kvd.szKeyName=name;
|
||||||
kvd.szValue=&StrData[0];
|
kvd.szValue=&StrData[0];
|
||||||
kvd.fHandled=0;
|
kvd.fHandled=0;
|
||||||
|
|
||||||
//printf("\"%s\" \"%s\"\n",kvd.szKeyName,kvd.szValue);
|
//printf("\"%s\" \"%s\"\n",kvd.szKeyName,kvd.szValue);
|
||||||
|
|
||||||
MDLL_KeyValue(reinterpret_cast<edict_t *>(params[1]),&kvd);
|
MDLL_KeyValue(reinterpret_cast<edict_t *>(params[1]),&kvd);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
cell PSKeyValueS(const char *name, AMX *amx, cell *params)
|
cell PSKeyValueS(const char *name, AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (params[1]==0)
|
if (params[1]==0)
|
||||||
{
|
{
|
||||||
MF_LogError(amx,AMX_ERR_NATIVE,"Invalid particle system handle provided!");
|
MF_LogError(amx,AMX_ERR_NATIVE,"Invalid particle system handle provided!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
KeyValueData kvd;
|
KeyValueData kvd;
|
||||||
|
|
||||||
kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
|
kvd.szClassName=const_cast<char *>(STRING(reinterpret_cast<edict_t *>(params[1])->v.classname));
|
||||||
kvd.szKeyName=name;
|
kvd.szKeyName=name;
|
||||||
kvd.szValue=MF_GetAmxString(amx,params[2],0,NULL);
|
kvd.szValue=MF_GetAmxString(amx,params[2],0,NULL);
|
||||||
kvd.fHandled=0;
|
kvd.fHandled=0;
|
||||||
//printf("\"%s\" \"%s\"\n",kvd.szKeyName,kvd.szValue);
|
//printf("\"%s\" \"%s\"\n",kvd.szKeyName,kvd.szValue);
|
||||||
|
|
||||||
MDLL_KeyValue(reinterpret_cast<edict_t *>(params[1]),&kvd);
|
MDLL_KeyValue(reinterpret_cast<edict_t *>(params[1]),&kvd);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_name(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_name(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVS("targetname");
|
return KVS("targetname");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_sprite(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_sprite(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVS("pSprite");
|
return KVS("pSprite");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_genrate(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_genrate(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVI("pGenRate");
|
return KVI("pGenRate");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_genshape(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_genshape(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVI("pGenShape");
|
return KVI("pGenShape");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_genshape_params(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_genshape_params(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVS("pGenShapeParams");
|
return KVS("pGenShapeParams");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_spriteframes(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_spriteframes(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVI("pSpriteNumFrames");
|
return KVI("pSpriteNumFrames");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_numparticles(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_numparticles(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVI("pNumParticles");
|
return KVI("pNumParticles");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_size(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_size(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVF("pSize");
|
return KVF("pSize");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_vel_params(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_vel_params(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVS("pVelParams");
|
return KVS("pVelParams");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_vel_shape(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_vel_shape(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVI("pVelShape");
|
return KVI("pVelShape");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_sys_life(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_sys_life(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVF("pSystemLifetime");
|
return KVF("pSystemLifetime");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_particle_life(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_particle_life(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVF("pLifetime");
|
return KVF("pLifetime");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_rendermode(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_rendermode(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVI("pRenderMode");
|
return KVI("pRenderMode");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_to_gen(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_to_gen(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVS("pPSToGen");
|
return KVS("pPSToGen");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_anim_speed(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_anim_speed(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVI("pAnimationSpeed");
|
return KVI("pAnimationSpeed");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_spawn_flags(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_spawn_flags(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVI("spawnflags");
|
return KVI("spawnflags");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_base_color(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_base_color(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVS("pBaseColor");
|
return KVS("pBaseColor");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_scale(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_scale(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVF("pScale");
|
return KVF("pScale");
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_ps_max_alpha(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_ps_max_alpha(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return KVF("pMaxAlpha");
|
return KVF("pMaxAlpha");
|
||||||
}
|
}
|
||||||
// ns_create_partsys(const name[], pGenShape, const pGenShapeParams[], pGenRate, const pSprite[],
|
// ns_create_partsys(const name[], pGenShape, const pGenShapeParams[], pGenRate, const pSprite[],
|
||||||
// pSpriteFrames, pNumParticles, Float:pSize, const pVelParams[], pVelShape,
|
// pSpriteFrames, pNumParticles, Float:pSize, const pVelParams[], pVelShape,
|
||||||
// Float:pSystemLifetime, Float:pParticleLifetime, pRenderMode, const pPSToGen[], pAnimationSpeed, pSpawnFlags)
|
// Float:pSystemLifetime, Float:pParticleLifetime, pRenderMode, const pPSToGen[], pAnimationSpeed, pSpawnFlags)
|
||||||
static cell AMX_NATIVE_CALL ns_create_partsys(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_create_partsys(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return (cell)CREATE_NAMED_ENTITY(MAKE_STRING("env_particles_custom"));
|
return (cell)CREATE_NAMED_ENTITY(MAKE_STRING("env_particles_custom"));
|
||||||
};
|
};
|
||||||
static cell AMX_NATIVE_CALL ns_spawn_ps(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_spawn_ps(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (params[1]==0)
|
if (params[1]==0)
|
||||||
{
|
{
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid particle system handle");
|
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid particle system handle");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *Ent=reinterpret_cast<edict_t *>(params[1]);
|
edict_t *Ent=reinterpret_cast<edict_t *>(params[1]);
|
||||||
MDLL_Spawn(Ent);
|
MDLL_Spawn(Ent);
|
||||||
|
|
||||||
if (!Ent->free)
|
if (!Ent->free)
|
||||||
{
|
{
|
||||||
REMOVE_ENTITY(Ent);
|
REMOVE_ENTITY(Ent);
|
||||||
}
|
}
|
||||||
return ParticleMan.Add(STRING(Ent->v.targetname),0);
|
return ParticleMan.Add(STRING(Ent->v.targetname),0);
|
||||||
}
|
}
|
||||||
// ns_fire_ps(Particle:id,Float:origin[3],Float:angles[3],flags=0)
|
// ns_fire_ps(Particle:id,Float:origin[3],Float:angles[3],flags=0)
|
||||||
static cell AMX_NATIVE_CALL ns_fire_partsys(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_fire_partsys(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
float *origin=(float*)MF_GetAmxAddr(amx,params[2]);
|
float *origin=(float*)MF_GetAmxAddr(amx,params[2]);
|
||||||
float *angles=(float*)MF_GetAmxAddr(amx,params[3]);
|
float *angles=(float*)MF_GetAmxAddr(amx,params[3]);
|
||||||
|
|
||||||
ParticleMan.FireSystem(static_cast<int>(params[1]),origin,angles,static_cast<int>(params[4]));
|
ParticleMan.FireSystem(static_cast<int>(params[1]),origin,angles,static_cast<int>(params[4]));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL ns_get_partsys_id(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_partsys_id(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
return ParticleMan.Find(MF_GetAmxString(amx,params[1],0,NULL));;
|
return ParticleMan.Find(MF_GetAmxString(amx,params[1],0,NULL));;
|
||||||
};
|
};
|
||||||
|
|
||||||
AMX_NATIVE_INFO particle_natives[] = {
|
AMX_NATIVE_INFO particle_natives[] = {
|
||||||
{ "ns_create_ps", ns_create_partsys },
|
{ "ns_create_ps", ns_create_partsys },
|
||||||
{ "ns_set_ps_name", ns_set_ps_name },
|
{ "ns_set_ps_name", ns_set_ps_name },
|
||||||
{ "ns_set_ps_sprite", ns_set_ps_sprite },
|
{ "ns_set_ps_sprite", ns_set_ps_sprite },
|
||||||
{ "ns_set_ps_genrate", ns_set_ps_genrate },
|
{ "ns_set_ps_genrate", ns_set_ps_genrate },
|
||||||
{ "ns_set_ps_genshape", ns_set_ps_genshape },
|
{ "ns_set_ps_genshape", ns_set_ps_genshape },
|
||||||
{ "ns_set_ps_genshape_params", ns_set_ps_genshape_params },
|
{ "ns_set_ps_genshape_params", ns_set_ps_genshape_params },
|
||||||
{ "ns_set_ps_spriteframes", ns_set_ps_spriteframes },
|
{ "ns_set_ps_spriteframes", ns_set_ps_spriteframes },
|
||||||
{ "ns_set_ps_numparticles", ns_set_ps_numparticles },
|
{ "ns_set_ps_numparticles", ns_set_ps_numparticles },
|
||||||
{ "ns_set_ps_size", ns_set_ps_size },
|
{ "ns_set_ps_size", ns_set_ps_size },
|
||||||
{ "ns_set_ps_vel_params", ns_set_ps_vel_params },
|
{ "ns_set_ps_vel_params", ns_set_ps_vel_params },
|
||||||
{ "ns_set_ps_vel_shape", ns_set_ps_vel_shape },
|
{ "ns_set_ps_vel_shape", ns_set_ps_vel_shape },
|
||||||
{ "ns_set_ps_sys_life", ns_set_ps_sys_life },
|
{ "ns_set_ps_sys_life", ns_set_ps_sys_life },
|
||||||
{ "ns_set_ps_particle_life", ns_set_ps_particle_life },
|
{ "ns_set_ps_particle_life", ns_set_ps_particle_life },
|
||||||
{ "ns_set_ps_rendermode", ns_set_ps_rendermode },
|
{ "ns_set_ps_rendermode", ns_set_ps_rendermode },
|
||||||
{ "ns_set_ps_to_gen", ns_set_ps_to_gen },
|
{ "ns_set_ps_to_gen", ns_set_ps_to_gen },
|
||||||
{ "ns_set_ps_anim_speed", ns_set_ps_anim_speed },
|
{ "ns_set_ps_anim_speed", ns_set_ps_anim_speed },
|
||||||
{ "ns_set_ps_spawn_flags", ns_set_ps_spawn_flags },
|
{ "ns_set_ps_spawn_flags", ns_set_ps_spawn_flags },
|
||||||
{ "ns_set_ps_base_color", ns_set_ps_base_color },
|
{ "ns_set_ps_base_color", ns_set_ps_base_color },
|
||||||
{ "ns_set_ps_scale", ns_set_ps_scale },
|
{ "ns_set_ps_scale", ns_set_ps_scale },
|
||||||
{ "ns_set_ps_max_alpha", ns_set_ps_max_alpha },
|
{ "ns_set_ps_max_alpha", ns_set_ps_max_alpha },
|
||||||
{ "ns_spawn_ps", ns_spawn_ps },
|
{ "ns_spawn_ps", ns_spawn_ps },
|
||||||
|
|
||||||
{ "ns_fire_ps", ns_fire_partsys },
|
{ "ns_fire_ps", ns_fire_partsys },
|
||||||
{ "ns_get_ps_id", ns_get_partsys_id },
|
{ "ns_get_ps_id", ns_get_partsys_id },
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
void AddNatives_Particles()
|
void AddNatives_Particles()
|
||||||
{
|
{
|
||||||
MF_AddNatives(particle_natives);
|
MF_AddNatives(particle_natives);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,261 +10,261 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
|
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
|
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "NEW_Util.h"
|
#include "NEW_Util.h"
|
||||||
|
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "CPlayer.h"
|
#include "CPlayer.h"
|
||||||
|
|
||||||
#include "AllocString.h"
|
#include "AllocString.h"
|
||||||
|
|
||||||
StringManager AllocStringList;
|
StringManager AllocStringList;
|
||||||
|
|
||||||
// ns_set_player_model(id,const Model[]="")
|
// ns_set_player_model(id,const Model[]="")
|
||||||
static cell AMX_NATIVE_CALL ns_set_player_model(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_player_model(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
player->SetModel(MF_GetAmxString(amx,params[2],0,NULL));
|
player->SetModel(MF_GetAmxString(amx,params[2],0,NULL));
|
||||||
|
|
||||||
GameMan.HookPostThink_Post();
|
GameMan.HookPostThink_Post();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ns_set_player_skin(id,skin=-1)
|
// ns_set_player_skin(id,skin=-1)
|
||||||
static cell AMX_NATIVE_CALL ns_set_player_skin(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_player_skin(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
player->SetSkin(params[2]);
|
player->SetSkin(params[2]);
|
||||||
|
|
||||||
GameMan.HookPostThink_Post();
|
GameMan.HookPostThink_Post();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// ns_set_player_body(id,body=-1)
|
// ns_set_player_body(id,body=-1)
|
||||||
static cell AMX_NATIVE_CALL ns_set_player_body(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_player_body(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
player->SetBody(params[2]);
|
player->SetBody(params[2]);
|
||||||
|
|
||||||
GameMan.HookPostThink_Post();
|
GameMan.HookPostThink_Post();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// ns_get_class(id)
|
// ns_get_class(id)
|
||||||
static cell AMX_NATIVE_CALL ns_get_class(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_class(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
return player->GetClass();
|
return player->GetClass();
|
||||||
}
|
}
|
||||||
// ns_get_jpfuel(id)
|
// ns_get_jpfuel(id)
|
||||||
static cell AMX_NATIVE_CALL ns_get_jpfuel(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_jpfuel(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
REAL ret=(player->GetPev()->fuser3) / 10.0;
|
REAL ret=(player->GetPev()->fuser3) / 10.0;
|
||||||
|
|
||||||
return amx_ftoc2(ret);
|
return amx_ftoc2(ret);
|
||||||
}
|
}
|
||||||
// ns_set_jpfuel(id,Float:fuelpercent)
|
// ns_set_jpfuel(id,Float:fuelpercent)
|
||||||
static cell AMX_NATIVE_CALL ns_set_jpfuel(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_jpfuel(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
REAL fuel = amx_ctof2(params[2]);
|
REAL fuel = amx_ctof2(params[2]);
|
||||||
if (fuel > 100.0)
|
if (fuel > 100.0)
|
||||||
{
|
{
|
||||||
fuel = 100.0;
|
fuel = 100.0;
|
||||||
}
|
}
|
||||||
if (fuel < 0.0)
|
if (fuel < 0.0)
|
||||||
{
|
{
|
||||||
fuel = 0.0;
|
fuel = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
player->GetPev()->fuser3 = fuel * 10.0;
|
player->GetPev()->fuser3 = fuel * 10.0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_add_jpfuel(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_jpfuel(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
REAL fuel = clamp(amx_ctof2(params[2]),0.0,100.0);
|
REAL fuel = clamp(amx_ctof2(params[2]),0.0,100.0);
|
||||||
|
|
||||||
return amx_ftoc2(player->GetPev()->fuser3 = clamp(static_cast<float>(player->GetPev()->fuser3 + (fuel * 10.0)),static_cast<float>(0.0)));
|
return amx_ftoc2(player->GetPev()->fuser3 = clamp(static_cast<float>(player->GetPev()->fuser3 + (fuel * 10.0)),static_cast<float>(0.0)));
|
||||||
};
|
};
|
||||||
// ns_get_speedchange(index)
|
// ns_get_speedchange(index)
|
||||||
static cell AMX_NATIVE_CALL ns_get_speedchange(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_speedchange(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
return player->GetSpeedChange();
|
return player->GetSpeedChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ns_set_speedchange(index,speedchange=0)
|
// ns_set_speedchange(index,speedchange=0)
|
||||||
static cell AMX_NATIVE_CALL ns_set_speedchange(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_speedchange(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
player->SetSpeedChange(params[2]);
|
player->SetSpeedChange(params[2]);
|
||||||
|
|
||||||
// Update PreThink_Post if we need to
|
// Update PreThink_Post if we need to
|
||||||
GameMan.HookPreThink_Post();
|
GameMan.HookPreThink_Post();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ns_get_maxspeed(index) (returns the max speed of the player BEFORE speed change is factored in.)
|
// ns_get_maxspeed(index) (returns the max speed of the player BEFORE speed change is factored in.)
|
||||||
static cell AMX_NATIVE_CALL ns_get_maxspeed(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_maxspeed(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
return player->GetMaxSpeed();
|
return player->GetMaxSpeed();
|
||||||
}
|
}
|
||||||
// ns_set_fov(id,Float:fov);
|
// ns_set_fov(id,Float:fov);
|
||||||
static cell AMX_NATIVE_CALL ns_set_fov(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_fov(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
return player->SetFOV(amx_ctof3(¶ms[2]));
|
return player->SetFOV(amx_ctof3(¶ms[2]));
|
||||||
}
|
}
|
||||||
// ns_giveiteM(id,"item");
|
// ns_giveiteM(id,"item");
|
||||||
static cell AMX_NATIVE_CALL ns_giveitem(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_giveitem(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
char *classname = MF_GetAmxString(amx,params[2],0,NULL);
|
char *classname = MF_GetAmxString(amx,params[2],0,NULL);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (player->GetPev()->deadflag > 0)
|
if (player->GetPev()->deadflag > 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *object=CREATE_NAMED_ENTITY(ALLOC_STRING2(classname));
|
edict_t *object=CREATE_NAMED_ENTITY(ALLOC_STRING2(classname));
|
||||||
|
|
||||||
if (!object)
|
if (!object)
|
||||||
{
|
{
|
||||||
MF_LogError(amx, AMX_ERR_NATIVE, "Error creating entity \"%s\"", classname);
|
MF_LogError(amx, AMX_ERR_NATIVE, "Error creating entity \"%s\"", classname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SET_ORIGIN(object,player->GetPev()->origin); // move to player
|
SET_ORIGIN(object,player->GetPev()->origin); // move to player
|
||||||
gpGamedllFuncs->dllapi_table->pfnSpawn(object); // emulate spawn
|
gpGamedllFuncs->dllapi_table->pfnSpawn(object); // emulate spawn
|
||||||
object->v.flags |= FL_ONGROUND; // make it think it's touched the ground
|
object->v.flags |= FL_ONGROUND; // make it think it's touched the ground
|
||||||
gpGamedllFuncs->dllapi_table->pfnThink(object); //
|
gpGamedllFuncs->dllapi_table->pfnThink(object); //
|
||||||
gpGamedllFuncs->dllapi_table->pfnTouch(object,player->GetEdict()); // give it to the player
|
gpGamedllFuncs->dllapi_table->pfnTouch(object,player->GetEdict()); // give it to the player
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL ns_get_user_team(AMX* amx, cell* params)
|
static cell AMX_NATIVE_CALL ns_get_user_team(AMX* amx, cell* params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int team = player->GetPev()->team;
|
int team = player->GetPev()->team;
|
||||||
|
|
||||||
if (team > 4 || team < 0)
|
if (team > 4 || team < 0)
|
||||||
{
|
{
|
||||||
MF_SetAmxString(amx, params[2], "undefinedteam", params[3]);
|
MF_SetAmxString(amx, params[2], "undefinedteam", params[3]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (team)
|
switch (team)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// iuser1 means readyroom (I think!)
|
// iuser1 means readyroom (I think!)
|
||||||
if (player->GetPev()->iuser1 == 0)
|
if (player->GetPev()->iuser1 == 0)
|
||||||
{
|
{
|
||||||
MF_SetAmxString(amx, params[2], "undefinedteam", params[3]);
|
MF_SetAmxString(amx, params[2], "undefinedteam", params[3]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MF_SetAmxString(amx, params[2], "spectatorteam", params[3]);
|
MF_SetAmxString(amx, params[2], "spectatorteam", params[3]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
MF_SetAmxString(amx, params[2], "marine1team", params[3]);
|
MF_SetAmxString(amx, params[2], "marine1team", params[3]);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
MF_SetAmxString(amx, params[2], "alien1team", params[3]);
|
MF_SetAmxString(amx, params[2], "alien1team", params[3]);
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
MF_SetAmxString(amx, params[2], "marine2team", params[3]);
|
MF_SetAmxString(amx, params[2], "marine2team", params[3]);
|
||||||
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
MF_SetAmxString(amx, params[2], "alien2team", params[3]);
|
MF_SetAmxString(amx, params[2], "alien2team", params[3]);
|
||||||
|
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MF_SetAmxString(amx, params[2], "spectatorteam", params[3]);
|
MF_SetAmxString(amx, params[2], "spectatorteam", params[3]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AMX_NATIVE_INFO player_natives[] = {
|
AMX_NATIVE_INFO player_natives[] = {
|
||||||
|
|
||||||
{ "ns_set_player_model", ns_set_player_model },
|
{ "ns_set_player_model", ns_set_player_model },
|
||||||
{ "ns_set_player_skin", ns_set_player_skin },
|
{ "ns_set_player_skin", ns_set_player_skin },
|
||||||
{ "ns_set_player_body", ns_set_player_body },
|
{ "ns_set_player_body", ns_set_player_body },
|
||||||
|
|
||||||
{ "ns_get_class", ns_get_class },
|
{ "ns_get_class", ns_get_class },
|
||||||
|
|
||||||
{ "ns_get_jpfuel", ns_get_jpfuel },
|
{ "ns_get_jpfuel", ns_get_jpfuel },
|
||||||
{ "ns_set_jpfuel", ns_set_jpfuel },
|
{ "ns_set_jpfuel", ns_set_jpfuel },
|
||||||
{ "ns_add_jpfuel", ns_add_jpfuel },
|
{ "ns_add_jpfuel", ns_add_jpfuel },
|
||||||
|
|
||||||
{ "ns_get_energy", ns_get_jpfuel }, // They do the same thing...
|
{ "ns_get_energy", ns_get_jpfuel }, // They do the same thing...
|
||||||
{ "ns_set_energy", ns_set_jpfuel }, //
|
{ "ns_set_energy", ns_set_jpfuel }, //
|
||||||
{ "ns_add_energy", ns_add_jpfuel },
|
{ "ns_add_energy", ns_add_jpfuel },
|
||||||
|
|
||||||
{ "ns_get_speedchange", ns_get_speedchange },
|
{ "ns_get_speedchange", ns_get_speedchange },
|
||||||
{ "ns_set_speedchange", ns_set_speedchange },
|
{ "ns_set_speedchange", ns_set_speedchange },
|
||||||
{ "ns_get_maxspeed", ns_get_maxspeed },
|
{ "ns_get_maxspeed", ns_get_maxspeed },
|
||||||
|
|
||||||
{ "ns_set_fov", ns_set_fov },
|
{ "ns_set_fov", ns_set_fov },
|
||||||
|
|
||||||
{ "ns_give_item", ns_giveitem },
|
{ "ns_give_item", ns_giveitem },
|
||||||
|
|
||||||
{ "ns_get_user_team", ns_get_user_team },
|
{ "ns_get_user_team", ns_get_user_team },
|
||||||
|
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
void AddNatives_Player()
|
void AddNatives_Player()
|
||||||
{
|
{
|
||||||
MF_AddNatives(player_natives);
|
MF_AddNatives(player_natives);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,418 +10,418 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
|
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
|
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "NEW_Util.h"
|
#include "NEW_Util.h"
|
||||||
|
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "CPlayer.h"
|
#include "CPlayer.h"
|
||||||
|
|
||||||
// Float:ns_get_res(Player)
|
// Float:ns_get_res(Player)
|
||||||
static cell AMX_NATIVE_CALL ns_get_res(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_res(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (GameMan.IsCombat())
|
if (GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(get_private_f(player->GetEdict(),MAKE_OFFSET(RESOURCES)));
|
return amx_ftoc2(get_private_f(player->GetEdict(),MAKE_OFFSET(RESOURCES)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ns_set_res(Player,Float:res)
|
// ns_set_res(Player,Float:res)
|
||||||
static cell AMX_NATIVE_CALL ns_set_res(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_res(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (GameMan.IsCombat())
|
if (GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private_f(player->GetEdict(),MAKE_OFFSET(RESOURCES),amx_ctof2(params[2]));
|
set_private_f(player->GetEdict(),MAKE_OFFSET(RESOURCES),amx_ctof2(params[2]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// Float:ns_add_res(Player,Float:res)
|
// Float:ns_add_res(Player,Float:res)
|
||||||
static cell AMX_NATIVE_CALL ns_add_res(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_res(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (GameMan.IsCombat())
|
if (GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(inc_private_f(player->GetEdict(),MAKE_OFFSET(RESOURCES),amx_ctof2(params[2]),0.0,100.0));
|
return amx_ftoc2(inc_private_f(player->GetEdict(),MAKE_OFFSET(RESOURCES),amx_ctof2(params[2]),0.0,100.0));
|
||||||
}
|
}
|
||||||
// Float:ns_get_exp(Player)
|
// Float:ns_get_exp(Player)
|
||||||
static cell AMX_NATIVE_CALL ns_get_exp(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_exp(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (!GameMan.IsCombat())
|
if (!GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(get_private_f(player->GetEdict(),MAKE_OFFSET(EXP)));
|
return amx_ftoc2(get_private_f(player->GetEdict(),MAKE_OFFSET(EXP)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ns_set_exp(Player,Float:exp)
|
// ns_set_exp(Player,Float:exp)
|
||||||
static cell AMX_NATIVE_CALL ns_set_exp(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_exp(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (!GameMan.IsCombat())
|
if (!GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private_f(player->GetEdict(),MAKE_OFFSET(EXP),amx_ctof2(params[2]));
|
set_private_f(player->GetEdict(),MAKE_OFFSET(EXP),amx_ctof2(params[2]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// Float:ns_add_exp(Player,Float:exp)
|
// Float:ns_add_exp(Player,Float:exp)
|
||||||
static cell AMX_NATIVE_CALL ns_add_exp(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_exp(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (!GameMan.IsCombat())
|
if (!GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(inc_private_f(player->GetEdict(),MAKE_OFFSET(EXP),amx_ctof2(params[2]),0.0));
|
return amx_ftoc2(inc_private_f(player->GetEdict(),MAKE_OFFSET(EXP),amx_ctof2(params[2]),0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ns_get_points(Player)
|
// ns_get_points(Player)
|
||||||
static cell AMX_NATIVE_CALL ns_get_points(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_points(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (!GameMan.IsCombat())
|
if (!GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(POINTS));
|
return get_private(player->GetEdict(),MAKE_OFFSET(POINTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ns_set_points(Player,points)
|
// ns_set_points(Player,points)
|
||||||
static cell AMX_NATIVE_CALL ns_set_points(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_points(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (!GameMan.IsCombat())
|
if (!GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx, params[1]);
|
CreatePlayerPointer(amx, params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(POINTS),static_cast<int>(params[2]));
|
set_private(player->GetEdict(),MAKE_OFFSET(POINTS),static_cast<int>(params[2]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// ns_add_points(Player,points)
|
// ns_add_points(Player,points)
|
||||||
static cell AMX_NATIVE_CALL ns_add_points(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_points(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
if (!GameMan.IsCombat())
|
if (!GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePlayerPointer(amx, params[1]);
|
CreatePlayerPointer(amx, params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(POINTS),static_cast<int>(params[2]),0,9);
|
return inc_private(player->GetEdict(),MAKE_OFFSET(POINTS),static_cast<int>(params[2]),0,9);
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_get_score(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_score(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(SCORE));
|
return get_private(player->GetEdict(),MAKE_OFFSET(SCORE));
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_score(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_score(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(SCORE),static_cast<int>(params[2]));
|
set_private(player->GetEdict(),MAKE_OFFSET(SCORE),static_cast<int>(params[2]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_add_score(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_score(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(SCORE),static_cast<int>(params[2]));
|
return inc_private(player->GetEdict(),MAKE_OFFSET(SCORE),static_cast<int>(params[2]));
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_get_deaths(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_deaths(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(DEATHS));
|
return get_private(player->GetEdict(),MAKE_OFFSET(DEATHS));
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_deaths(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_deaths(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(DEATHS),static_cast<int>(params[2]));
|
set_private(player->GetEdict(),MAKE_OFFSET(DEATHS),static_cast<int>(params[2]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_add_deaths(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_deaths(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(DEATHS),static_cast<int>(params[2]));
|
return inc_private(player->GetEdict(),MAKE_OFFSET(DEATHS),static_cast<int>(params[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL ns_get_hive_ability(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_hive_ability(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
int result = get_private(player->GetEdict(), MAKE_OFFSET(HIVEABILITY));
|
int result = get_private(player->GetEdict(), MAKE_OFFSET(HIVEABILITY));
|
||||||
|
|
||||||
return (params[2] > 0) ? (result >= params[2] - 1) : result;
|
return (params[2] > 0) ? (result >= params[2] - 1) : result;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_remove_upgrade(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_remove_upgrade(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx, params[1]);
|
CreatePlayerPointer(amx, params[1]);
|
||||||
|
|
||||||
if (!GameMan.IsCombat())
|
if (!GameMan.IsCombat())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upgrades are stored in a std::vector<int> in the player's private data
|
// Upgrades are stored in a std::vector<int> in the player's private data
|
||||||
// The integer value represents the impulse for the offset
|
// The integer value represents the impulse for the offset
|
||||||
// std::vector's memory layout is:
|
// std::vector's memory layout is:
|
||||||
// void *start
|
// void *start
|
||||||
// void *lastobject
|
// void *lastobject
|
||||||
// void *lastreserved
|
// void *lastreserved
|
||||||
struct upgradevector
|
struct upgradevector
|
||||||
{
|
{
|
||||||
int *start;
|
int *start;
|
||||||
int *end;
|
int *end;
|
||||||
int *allocated;
|
int *allocated;
|
||||||
|
|
||||||
inline int size() { return static_cast<int>((reinterpret_cast<unsigned int>(end) - reinterpret_cast<unsigned int>(start)) / sizeof(int)); }
|
inline int size() { return static_cast<int>((reinterpret_cast<unsigned int>(end) - reinterpret_cast<unsigned int>(start)) / sizeof(int)); }
|
||||||
inline int at(int which) { return start[which]; }
|
inline int at(int which) { return start[which]; }
|
||||||
inline void set(int which, int val) { start[which] = val; }
|
inline void set(int which, int val) { start[which] = val; }
|
||||||
inline bool remove(int val)
|
inline bool remove(int val)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int i = 0; i < this->size(); i++)
|
for (int i = 0; i < this->size(); i++)
|
||||||
{
|
{
|
||||||
if (this->at(i) == val)
|
if (this->at(i) == val)
|
||||||
{
|
{
|
||||||
|
|
||||||
int last = this->size() - 1;
|
int last = this->size() - 1;
|
||||||
while (i < last)
|
while (i < last)
|
||||||
{
|
{
|
||||||
this->set(i, this->at(i + 1));
|
this->set(i, this->at(i + 1));
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->end--;
|
this->end--;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inline void print()
|
inline void print()
|
||||||
{
|
{
|
||||||
printf("size: %d values: ", this->size());
|
printf("size: %d values: ", this->size());
|
||||||
for (int i = 0; i < this->size(); i++)
|
for (int i = 0; i < this->size(); i++)
|
||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
printf(", ");
|
printf(", ");
|
||||||
|
|
||||||
printf("%d", this->at(i));
|
printf("%d", this->at(i));
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
upgradevector *bought = reinterpret_cast<upgradevector *>(reinterpret_cast<char *>(player->GetEdict()->pvPrivateData) + MAKE_OFFSET(UPGRADES_BOUGHT));
|
upgradevector *bought = reinterpret_cast<upgradevector *>(reinterpret_cast<char *>(player->GetEdict()->pvPrivateData) + MAKE_OFFSET(UPGRADES_BOUGHT));
|
||||||
upgradevector *active = reinterpret_cast<upgradevector *>(reinterpret_cast<char *>(player->GetEdict()->pvPrivateData) + MAKE_OFFSET(UPGRADES_ACTIVE));
|
upgradevector *active = reinterpret_cast<upgradevector *>(reinterpret_cast<char *>(player->GetEdict()->pvPrivateData) + MAKE_OFFSET(UPGRADES_ACTIVE));
|
||||||
|
|
||||||
|
|
||||||
//bought->print();
|
//bought->print();
|
||||||
//active->print();
|
//active->print();
|
||||||
|
|
||||||
bool bfound = bought->remove(params[2]);
|
bool bfound = bought->remove(params[2]);
|
||||||
bool afound = active->remove(params[2]);
|
bool afound = active->remove(params[2]);
|
||||||
|
|
||||||
if (bfound)
|
if (bfound)
|
||||||
{
|
{
|
||||||
if (afound)
|
if (afound)
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (afound)
|
if (afound)
|
||||||
{
|
{
|
||||||
// shouldn't happen, but just incase
|
// shouldn't happen, but just incase
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO player_memory_natives[] = {
|
AMX_NATIVE_INFO player_memory_natives[] = {
|
||||||
|
|
||||||
{ "ns_get_res", ns_get_res },
|
{ "ns_get_res", ns_get_res },
|
||||||
{ "ns_set_res", ns_set_res },
|
{ "ns_set_res", ns_set_res },
|
||||||
{ "ns_add_res", ns_add_res },
|
{ "ns_add_res", ns_add_res },
|
||||||
|
|
||||||
{ "ns_get_exp", ns_get_exp },
|
{ "ns_get_exp", ns_get_exp },
|
||||||
{ "ns_set_exp", ns_set_exp },
|
{ "ns_set_exp", ns_set_exp },
|
||||||
{ "ns_add_exp", ns_add_exp },
|
{ "ns_add_exp", ns_add_exp },
|
||||||
|
|
||||||
{ "ns_get_points", ns_get_points },
|
{ "ns_get_points", ns_get_points },
|
||||||
{ "ns_set_points", ns_set_points },
|
{ "ns_set_points", ns_set_points },
|
||||||
{ "ns_add_points", ns_add_points },
|
{ "ns_add_points", ns_add_points },
|
||||||
|
|
||||||
{ "ns_set_score", ns_set_score },
|
{ "ns_set_score", ns_set_score },
|
||||||
{ "ns_get_score", ns_get_score },
|
{ "ns_get_score", ns_get_score },
|
||||||
{ "ns_add_score", ns_add_score },
|
{ "ns_add_score", ns_add_score },
|
||||||
|
|
||||||
{ "ns_get_deaths", ns_get_deaths },
|
{ "ns_get_deaths", ns_get_deaths },
|
||||||
{ "ns_set_deaths", ns_set_deaths },
|
{ "ns_set_deaths", ns_set_deaths },
|
||||||
{ "ns_add_deaths", ns_add_deaths },
|
{ "ns_add_deaths", ns_add_deaths },
|
||||||
|
|
||||||
{ "ns_get_hive_ability", ns_get_hive_ability },
|
{ "ns_get_hive_ability", ns_get_hive_ability },
|
||||||
|
|
||||||
{ "ns_remove_upgrade", ns_remove_upgrade },
|
{ "ns_remove_upgrade", ns_remove_upgrade },
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
void AddNatives_PlayerMemory()
|
void AddNatives_PlayerMemory()
|
||||||
{
|
{
|
||||||
MF_AddNatives(player_memory_natives);
|
MF_AddNatives(player_memory_natives);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,376 +10,376 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
|
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
|
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "NEW_Util.h"
|
#include "NEW_Util.h"
|
||||||
|
|
||||||
int IsValidBuilding[AVH_USER3_MAX + 1] = {
|
int IsValidBuilding[AVH_USER3_MAX + 1] = {
|
||||||
0, // AVH_USER3_NONE = 0,
|
0, // AVH_USER3_NONE = 0,
|
||||||
0, // AVH_USER3_MARINE_PLAYER,
|
0, // AVH_USER3_MARINE_PLAYER,
|
||||||
0, // AVH_USER3_COMMANDER_PLAYER,
|
0, // AVH_USER3_COMMANDER_PLAYER,
|
||||||
0, // AVH_USER3_ALIEN_PLAYER1,
|
0, // AVH_USER3_ALIEN_PLAYER1,
|
||||||
0, // AVH_USER3_ALIEN_PLAYER2,
|
0, // AVH_USER3_ALIEN_PLAYER2,
|
||||||
0, // AVH_USER3_ALIEN_PLAYER3,
|
0, // AVH_USER3_ALIEN_PLAYER3,
|
||||||
0, // AVH_USER3_ALIEN_PLAYER4,
|
0, // AVH_USER3_ALIEN_PLAYER4,
|
||||||
0, // AVH_USER3_ALIEN_PLAYER5,
|
0, // AVH_USER3_ALIEN_PLAYER5,
|
||||||
0, // AVH_USER3_ALIEN_EMBRYO,
|
0, // AVH_USER3_ALIEN_EMBRYO,
|
||||||
0, // AVH_USER3_SPAWN_TEAMONE,
|
0, // AVH_USER3_SPAWN_TEAMONE,
|
||||||
0, // AVH_USER3_SPAWN_TEAMTWO,
|
0, // AVH_USER3_SPAWN_TEAMTWO,
|
||||||
0, // AVH_USER3_PARTICLE_ON, // only valid for AvHParticleEntity: entindex as int in fuser1, template index stored in fuser2
|
0, // AVH_USER3_PARTICLE_ON, // only valid for AvHParticleEntity: entindex as int in fuser1, template index stored in fuser2
|
||||||
0, // AVH_USER3_PARTICLE_OFF, // only valid for AvHParticleEntity: particle system handle in fuser1
|
0, // AVH_USER3_PARTICLE_OFF, // only valid for AvHParticleEntity: particle system handle in fuser1
|
||||||
0, // AVH_USER3_WELD, // float progress (0 - 100) stored in fuser1
|
0, // AVH_USER3_WELD, // float progress (0 - 100) stored in fuser1
|
||||||
0, // AVH_USER3_ALPHA, // fuser1 indicates how much alpha this entity toggles to in commander mode, fuser2 for players
|
0, // AVH_USER3_ALPHA, // fuser1 indicates how much alpha this entity toggles to in commander mode, fuser2 for players
|
||||||
0, // AVH_USER3_MARINEITEM, // Something a friendly marine can pick up
|
0, // AVH_USER3_MARINEITEM, // Something a friendly marine can pick up
|
||||||
0, // AVH_USER3_WAYPOINT,
|
0, // AVH_USER3_WAYPOINT,
|
||||||
2, // AVH_USER3_HIVE,
|
2, // AVH_USER3_HIVE,
|
||||||
0, // AVH_USER3_NOBUILD,
|
0, // AVH_USER3_NOBUILD,
|
||||||
0, // AVH_USER3_USEABLE,
|
0, // AVH_USER3_USEABLE,
|
||||||
0, // AVH_USER3_AUDIO_ON,
|
0, // AVH_USER3_AUDIO_ON,
|
||||||
0, // AVH_USER3_AUDIO_OFF,
|
0, // AVH_USER3_AUDIO_OFF,
|
||||||
0, // AVH_USER3_FUNC_RESOURCE,
|
0, // AVH_USER3_FUNC_RESOURCE,
|
||||||
1, // AVH_USER3_COMMANDER_STATION,
|
1, // AVH_USER3_COMMANDER_STATION,
|
||||||
1, // AVH_USER3_TURRET_FACTORY,
|
1, // AVH_USER3_TURRET_FACTORY,
|
||||||
1, // AVH_USER3_ARMORY,
|
1, // AVH_USER3_ARMORY,
|
||||||
1, // AVH_USER3_ADVANCED_ARMORY,
|
1, // AVH_USER3_ADVANCED_ARMORY,
|
||||||
1, // AVH_USER3_ARMSLAB,
|
1, // AVH_USER3_ARMSLAB,
|
||||||
1, // AVH_USER3_PROTOTYPE_LAB,
|
1, // AVH_USER3_PROTOTYPE_LAB,
|
||||||
1, // AVH_USER3_OBSERVATORY,
|
1, // AVH_USER3_OBSERVATORY,
|
||||||
0, // AVH_USER3_CHEMLAB,
|
0, // AVH_USER3_CHEMLAB,
|
||||||
0, // AVH_USER3_MEDLAB,
|
0, // AVH_USER3_MEDLAB,
|
||||||
0, // AVH_USER3_NUKEPLANT,
|
0, // AVH_USER3_NUKEPLANT,
|
||||||
1, // AVH_USER3_TURRET,
|
1, // AVH_USER3_TURRET,
|
||||||
1, // AVH_USER3_SIEGETURRET,
|
1, // AVH_USER3_SIEGETURRET,
|
||||||
1, // AVH_USER3_RESTOWER,
|
1, // AVH_USER3_RESTOWER,
|
||||||
0, // AVH_USER3_PLACEHOLDER,
|
0, // AVH_USER3_PLACEHOLDER,
|
||||||
1, // AVH_USER3_INFANTRYPORTAL,
|
1, // AVH_USER3_INFANTRYPORTAL,
|
||||||
0, // AVH_USER3_NUKE,
|
0, // AVH_USER3_NUKE,
|
||||||
0, // AVH_USER3_BREAKABLE,
|
0, // AVH_USER3_BREAKABLE,
|
||||||
0, // AVH_USER3_UMBRA,
|
0, // AVH_USER3_UMBRA,
|
||||||
1, // AVH_USER3_PHASEGATE,
|
1, // AVH_USER3_PHASEGATE,
|
||||||
2, // AVH_USER3_DEFENSE_CHAMBER,
|
2, // AVH_USER3_DEFENSE_CHAMBER,
|
||||||
2, // AVH_USER3_MOVEMENT_CHAMBER,
|
2, // AVH_USER3_MOVEMENT_CHAMBER,
|
||||||
2, // AVH_USER3_OFFENSE_CHAMBER,
|
2, // AVH_USER3_OFFENSE_CHAMBER,
|
||||||
2, // AVH_USER3_SENSORY_CHAMBER,
|
2, // AVH_USER3_SENSORY_CHAMBER,
|
||||||
2, // AVH_USER3_ALIENRESTOWER,
|
2, // AVH_USER3_ALIENRESTOWER,
|
||||||
0, // AVH_USER3_HEAVY,
|
0, // AVH_USER3_HEAVY,
|
||||||
0, // AVH_USER3_JETPACK,
|
0, // AVH_USER3_JETPACK,
|
||||||
1, // AVH_USER3_ADVANCED_TURRET_FACTORY,
|
1, // AVH_USER3_ADVANCED_TURRET_FACTORY,
|
||||||
0, // AVH_USER3_SPAWN_READYROOM,
|
0, // AVH_USER3_SPAWN_READYROOM,
|
||||||
0, // AVH_USER3_CLIENT_COMMAND,
|
0, // AVH_USER3_CLIENT_COMMAND,
|
||||||
0, // AVH_USER3_FUNC_ILLUSIONARY,
|
0, // AVH_USER3_FUNC_ILLUSIONARY,
|
||||||
0, // AVH_USER3_MENU_BUILD,
|
0, // AVH_USER3_MENU_BUILD,
|
||||||
0, // AVH_USER3_MENU_BUILD_ADVANCED,
|
0, // AVH_USER3_MENU_BUILD_ADVANCED,
|
||||||
0, // AVH_USER3_MENU_ASSIST,
|
0, // AVH_USER3_MENU_ASSIST,
|
||||||
0, // AVH_USER3_MENU_EQUIP,
|
0, // AVH_USER3_MENU_EQUIP,
|
||||||
0, // AVH_USER3_MINE,
|
0, // AVH_USER3_MINE,
|
||||||
0 // AVH_USER3_MAX
|
0 // AVH_USER3_MAX
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ns_build_structure(idStructure);
|
// ns_build_structure(idStructure);
|
||||||
static cell AMX_NATIVE_CALL ns_build_structure(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_build_structure(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
// Trick NS into thinking that this structure is being spawned from the map
|
// Trick NS into thinking that this structure is being spawned from the map
|
||||||
// set the "startbuilt" setting to 1, then remove it.
|
// set the "startbuilt" setting to 1, then remove it.
|
||||||
// "startbuilt" is set as "spawnflag" "1" in the ns.fgd
|
// "startbuilt" is set as "spawnflag" "1" in the ns.fgd
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->free)
|
if (Entity->free)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Entity->v.iuser3 <= AVH_USER3_NONE || Entity->v.iuser3 >= AVH_USER3_MAX)
|
if (Entity->v.iuser3 <= AVH_USER3_NONE || Entity->v.iuser3 >= AVH_USER3_MAX)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int StructureType=IsValidBuilding[Entity->v.iuser3];
|
int StructureType=IsValidBuilding[Entity->v.iuser3];
|
||||||
if (StructureType==0)
|
if (StructureType==0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Entity->v.iuser3==AVH_USER3_HIVE)
|
if (Entity->v.iuser3==AVH_USER3_HIVE)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Already set?
|
// Already set?
|
||||||
if (Entity->v.spawnflags & 1)
|
if (Entity->v.spawnflags & 1)
|
||||||
{
|
{
|
||||||
MDLL_Spawn(Entity);
|
MDLL_Spawn(Entity);
|
||||||
|
|
||||||
goto undo_ghost;
|
goto undo_ghost;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity->v.spawnflags |= 1;
|
Entity->v.spawnflags |= 1;
|
||||||
|
|
||||||
MDLL_Spawn(Entity);
|
MDLL_Spawn(Entity);
|
||||||
|
|
||||||
Entity->v.spawnflags &= ~1;
|
Entity->v.spawnflags &= ~1;
|
||||||
|
|
||||||
undo_ghost:
|
undo_ghost:
|
||||||
if (StructureType==1) // marine, remove "ghost" appearance
|
if (StructureType==1) // marine, remove "ghost" appearance
|
||||||
{
|
{
|
||||||
if (get_private(Entity,MAKE_OFFSET(GHOST_STRUCTURE))!=0)
|
if (get_private(Entity,MAKE_OFFSET(GHOST_STRUCTURE))!=0)
|
||||||
{
|
{
|
||||||
set_private(Entity,MAKE_OFFSET(GHOST_STRUCTURE),0);
|
set_private(Entity,MAKE_OFFSET(GHOST_STRUCTURE),0);
|
||||||
|
|
||||||
Entity->v.rendermode=kRenderNormal;
|
Entity->v.rendermode=kRenderNormal;
|
||||||
Entity->v.renderamt=100.0;
|
Entity->v.renderamt=100.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MASK_ELECTRICITY 8192
|
#define MASK_ELECTRICITY 8192
|
||||||
static cell AMX_NATIVE_CALL ns_get_build(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_build(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
int iLength;
|
int iLength;
|
||||||
char *buildtype = MF_GetAmxString(amx,params[1],0,&iLength);
|
char *buildtype = MF_GetAmxString(amx,params[1],0,&iLength);
|
||||||
int iBuiltOnly = params[2];
|
int iBuiltOnly = params[2];
|
||||||
int iNumber = params[3];
|
int iNumber = params[3];
|
||||||
edict_t* pBuild = NULL;
|
edict_t* pBuild = NULL;
|
||||||
int iCount=0;
|
int iCount=0;
|
||||||
|
|
||||||
while ((pBuild = UTIL_FindEntityByString(pBuild,"classname",buildtype)) != NULL)
|
while ((pBuild = UTIL_FindEntityByString(pBuild,"classname",buildtype)) != NULL)
|
||||||
{
|
{
|
||||||
if (iBuiltOnly > 0)
|
if (iBuiltOnly > 0)
|
||||||
{
|
{
|
||||||
if (FStrEq("team_advarmory",buildtype) || FStrEq("team_advturretfactory",buildtype))
|
if (FStrEq("team_advarmory",buildtype) || FStrEq("team_advturretfactory",buildtype))
|
||||||
{
|
{
|
||||||
iCount++;
|
iCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pBuild->v.fuser1 >= 1000 || pBuild->v.iuser4 & MASK_ELECTRICITY)
|
if (pBuild->v.fuser1 >= 1000 || pBuild->v.iuser4 & MASK_ELECTRICITY)
|
||||||
{
|
{
|
||||||
iCount++;
|
iCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iCount++;
|
iCount++;
|
||||||
}
|
}
|
||||||
if (iNumber > 0 && iCount == iNumber)
|
if (iNumber > 0 && iCount == iNumber)
|
||||||
return ENTINDEX_NEW(pBuild);
|
return ENTINDEX_NEW(pBuild);
|
||||||
}
|
}
|
||||||
return iCount++;
|
return iCount++;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_hive_trait(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_hive_trait(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private(Entity,MAKE_OFFSET(HIVE_TRAIT),static_cast<int>(params[2]));
|
set_private(Entity,MAKE_OFFSET(HIVE_TRAIT),static_cast<int>(params[2]));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_get_hive_trait(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_hive_trait(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_private(Entity,MAKE_OFFSET(HIVE_TRAIT));
|
return get_private(Entity,MAKE_OFFSET(HIVE_TRAIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell AMX_NATIVE_CALL ns_get_struct_owner(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_struct_owner(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_private(Entity,MAKE_OFFSET(STRUCTOWNER));
|
return get_private(Entity,MAKE_OFFSET(STRUCTOWNER));
|
||||||
}
|
}
|
||||||
// ns_set_struct_owner(idStructure,idPlayer) - -1 means no owner
|
// ns_set_struct_owner(idStructure,idPlayer) - -1 means no owner
|
||||||
static cell AMX_NATIVE_CALL ns_set_struct_owner(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_struct_owner(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
|
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (params[2] > gpGlobals->maxClients || params[2] < -1)
|
if (params[2] > gpGlobals->maxClients || params[2] < -1)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
set_private(Entity,MAKE_OFFSET(STRUCTOWNER),params[2]);
|
set_private(Entity,MAKE_OFFSET(STRUCTOWNER),params[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// Float:ns_get_obs_energy(id);
|
// Float:ns_get_obs_energy(id);
|
||||||
static cell AMX_NATIVE_CALL ns_get_obs_energy(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_obs_energy(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(get_private(Entity,MAKE_OFFSET(OBS_ENERGY)));
|
return amx_ftoc2(get_private(Entity,MAKE_OFFSET(OBS_ENERGY)));
|
||||||
};
|
};
|
||||||
// Float:ns_set_obs_energy(id,Float:energy);
|
// Float:ns_set_obs_energy(id,Float:energy);
|
||||||
static cell AMX_NATIVE_CALL ns_set_obs_energy(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_obs_energy(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private_f(Entity,MAKE_OFFSET(OBS_ENERGY),amx_ctof2(params[2]));
|
set_private_f(Entity,MAKE_OFFSET(OBS_ENERGY),amx_ctof2(params[2]));
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Float:ns_add_obs_energy(id,Float:energy);
|
// Float:ns_add_obs_energy(id,Float:energy);
|
||||||
static cell AMX_NATIVE_CALL ns_add_obs_energy(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_obs_energy(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(inc_private_f(Entity,MAKE_OFFSET(OBS_ENERGY),amx_ctof2(params[2]),0.0,100.0));
|
return amx_ftoc2(inc_private_f(Entity,MAKE_OFFSET(OBS_ENERGY),amx_ctof2(params[2]),0.0,100.0));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Float:ns_get_weld_time(idWeldable);
|
// Float:ns_get_weld_time(idWeldable);
|
||||||
static cell AMX_NATIVE_CALL ns_get_weld_time(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_weld_time(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(get_private_f(Entity,MAKE_OFFSET(WELD_TIME)));
|
return amx_ftoc2(get_private_f(Entity,MAKE_OFFSET(WELD_TIME)));
|
||||||
};
|
};
|
||||||
// ns_set_weld_time(idWeldable,Float:value);
|
// ns_set_weld_time(idWeldable,Float:value);
|
||||||
static cell AMX_NATIVE_CALL ns_set_weld_time(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_weld_time(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private_f(Entity,MAKE_OFFSET(WELD_TIME),amx_ctof2(params[2]));
|
set_private_f(Entity,MAKE_OFFSET(WELD_TIME),amx_ctof2(params[2]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
// Float:ns_add_weld_time(idWeldable,Float:value);
|
// Float:ns_add_weld_time(idWeldable,Float:value);
|
||||||
static cell AMX_NATIVE_CALL ns_add_weld_time(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_weld_time(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(inc_private_f(Entity,MAKE_OFFSET(WELD_TIME),amx_ctof2(params[2]),0.0));
|
return amx_ftoc2(inc_private_f(Entity,MAKE_OFFSET(WELD_TIME),amx_ctof2(params[2]),0.0));
|
||||||
};
|
};
|
||||||
// Float:ns_get_weld_done(idWeldable);
|
// Float:ns_get_weld_done(idWeldable);
|
||||||
static cell AMX_NATIVE_CALL ns_get_weld_done(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_weld_done(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(get_private_f(Entity,MAKE_OFFSET(WELD_DONE)));
|
return amx_ftoc2(get_private_f(Entity,MAKE_OFFSET(WELD_DONE)));
|
||||||
};
|
};
|
||||||
// ns_set_weld_done(idWeldable,Float:value);
|
// ns_set_weld_done(idWeldable,Float:value);
|
||||||
static cell AMX_NATIVE_CALL ns_set_weld_done(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_weld_done(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private_f(Entity,MAKE_OFFSET(WELD_DONE),amx_ctof2(params[2]));
|
set_private_f(Entity,MAKE_OFFSET(WELD_DONE),amx_ctof2(params[2]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
// Float:ns_add_weld_done(idWeldable,Float:value);
|
// Float:ns_add_weld_done(idWeldable,Float:value);
|
||||||
static cell AMX_NATIVE_CALL ns_add_weld_done(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_weld_done(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL)
|
if (Entity->pvPrivateData == NULL)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return amx_ftoc2(inc_private_f(Entity,MAKE_OFFSET(WELD_DONE),amx_ctof2(params[2]),0.0));
|
return amx_ftoc2(inc_private_f(Entity,MAKE_OFFSET(WELD_DONE),amx_ctof2(params[2]),0.0));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO structure_natives[] = {
|
AMX_NATIVE_INFO structure_natives[] = {
|
||||||
{ "ns_build_structure", ns_build_structure },
|
{ "ns_build_structure", ns_build_structure },
|
||||||
|
|
||||||
{ "ns_get_build", ns_get_build },
|
{ "ns_get_build", ns_get_build },
|
||||||
|
|
||||||
{ "ns_get_hive_trait", ns_get_hive_trait },
|
{ "ns_get_hive_trait", ns_get_hive_trait },
|
||||||
{ "ns_set_hive_trait", ns_set_hive_trait },
|
{ "ns_set_hive_trait", ns_set_hive_trait },
|
||||||
|
|
||||||
{ "ns_get_struct_owner", ns_get_struct_owner },
|
{ "ns_get_struct_owner", ns_get_struct_owner },
|
||||||
{ "ns_set_struct_owner", ns_set_struct_owner },
|
{ "ns_set_struct_owner", ns_set_struct_owner },
|
||||||
|
|
||||||
{ "ns_get_obs_energy", ns_get_obs_energy },
|
{ "ns_get_obs_energy", ns_get_obs_energy },
|
||||||
{ "ns_set_obs_energy", ns_set_obs_energy },
|
{ "ns_set_obs_energy", ns_set_obs_energy },
|
||||||
{ "ns_add_obs_energy", ns_add_obs_energy },
|
{ "ns_add_obs_energy", ns_add_obs_energy },
|
||||||
|
|
||||||
{ "ns_get_weld_time", ns_get_weld_time },
|
{ "ns_get_weld_time", ns_get_weld_time },
|
||||||
{ "ns_set_weld_time", ns_set_weld_time },
|
{ "ns_set_weld_time", ns_set_weld_time },
|
||||||
{ "ns_add_weld_time", ns_add_weld_time },
|
{ "ns_add_weld_time", ns_add_weld_time },
|
||||||
|
|
||||||
{ "ns_get_weld_done", ns_get_weld_done },
|
{ "ns_get_weld_done", ns_get_weld_done },
|
||||||
{ "ns_set_weld_done", ns_set_weld_done },
|
{ "ns_set_weld_done", ns_set_weld_done },
|
||||||
{ "ns_add_weld_done", ns_add_weld_done },
|
{ "ns_add_weld_done", ns_add_weld_done },
|
||||||
|
|
||||||
/* prototypes for natives i have planned */
|
/* prototypes for natives i have planned */
|
||||||
//{ "ns_get_phase_target", ns_get_phase_target },
|
//{ "ns_get_phase_target", ns_get_phase_target },
|
||||||
//{ "ns_set_phase_target", ns_set_phase_target },
|
//{ "ns_set_phase_target", ns_set_phase_target },
|
||||||
|
|
||||||
//{ "ns_set_phase_nextuse", ns_set_phase_nextuse },
|
//{ "ns_set_phase_nextuse", ns_set_phase_nextuse },
|
||||||
//{ "ns_get_phase_nextuse", ns_get_phase_nextuse },
|
//{ "ns_get_phase_nextuse", ns_get_phase_nextuse },
|
||||||
//{ "ns_add_phase_nextuse", ns_add_phase_nextuse },
|
//{ "ns_add_phase_nextuse", ns_add_phase_nextuse },
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
void AddNatives_Structure()
|
void AddNatives_Structure()
|
||||||
{
|
{
|
||||||
MF_AddNatives(structure_natives);
|
MF_AddNatives(structure_natives);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,450 +10,450 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
|
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
|
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "NEW_Util.h"
|
#include "NEW_Util.h"
|
||||||
|
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "CPlayer.h"
|
#include "CPlayer.h"
|
||||||
|
|
||||||
// ns_has_weapon(idPlayer,NsWeapon,set=0)
|
// ns_has_weapon(idPlayer,NsWeapon,set=0)
|
||||||
static cell AMX_NATIVE_CALL ns_has_weapon(AMX *amx,cell *params)
|
static cell AMX_NATIVE_CALL ns_has_weapon(AMX *amx,cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[3] == -1)
|
if (params[3] == -1)
|
||||||
{
|
{
|
||||||
if ((player->GetPev()->weapons & (1<<params[2])) > 0)
|
if ((player->GetPev()->weapons & (1<<params[2])) > 0)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((player->GetPev()->weapons & (1<<params[2])) > 0)
|
if ((player->GetPev()->weapons & (1<<params[2])) > 0)
|
||||||
{
|
{
|
||||||
if (params[3] == 0)
|
if (params[3] == 0)
|
||||||
{
|
{
|
||||||
player->GetPev()->weapons &= ~(1<<params[2]);
|
player->GetPev()->weapons &= ~(1<<params[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (params[3] == 1)
|
if (params[3] == 1)
|
||||||
{
|
{
|
||||||
player->GetPev()->weapons |= (1<<params[2]);
|
player->GetPev()->weapons |= (1<<params[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// ns_set_weap_dmg(WeaponID,Float:damage)
|
// ns_set_weap_dmg(WeaponID,Float:damage)
|
||||||
static cell AMX_NATIVE_CALL ns_set_weapon_dmg(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_weapon_dmg(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
|
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL || Entity->free)
|
if (Entity->pvPrivateData == NULL || Entity->free)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private_f(Entity,MAKE_OFFSET(WEAPDMG),amx_ctof2(params[2]));
|
set_private_f(Entity,MAKE_OFFSET(WEAPDMG),amx_ctof2(params[2]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Float:ns_get_weap_dmg(WeaponID)
|
// Float:ns_get_weap_dmg(WeaponID)
|
||||||
static cell AMX_NATIVE_CALL ns_get_weapon_dmg(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_weapon_dmg(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
|
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL || Entity->free)
|
if (Entity->pvPrivateData == NULL || Entity->free)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
REAL ret=get_private_f(Entity,MAKE_OFFSET(WEAPDMG));
|
REAL ret=get_private_f(Entity,MAKE_OFFSET(WEAPDMG));
|
||||||
return amx_ftoc2(ret);
|
return amx_ftoc2(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ns_set_weap_range(WeaponID,Float:range)
|
// ns_set_weap_range(WeaponID,Float:range)
|
||||||
static cell AMX_NATIVE_CALL ns_set_weapon_range(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_weapon_range(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
|
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL || Entity->free)
|
if (Entity->pvPrivateData == NULL || Entity->free)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private_f(Entity,MAKE_OFFSET(WEAPRANGE),amx_ctof2(params[2]));
|
set_private_f(Entity,MAKE_OFFSET(WEAPRANGE),amx_ctof2(params[2]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// Float:ns_get_weap_range(WeaponID)
|
// Float:ns_get_weap_range(WeaponID)
|
||||||
static cell AMX_NATIVE_CALL ns_get_weapon_range(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_weapon_range(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
|
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL || Entity->free)
|
if (Entity->pvPrivateData == NULL || Entity->free)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
REAL ret=get_private_f(Entity,MAKE_OFFSET(WEAPRANGE));
|
REAL ret=get_private_f(Entity,MAKE_OFFSET(WEAPRANGE));
|
||||||
return amx_ftoc2(ret);
|
return amx_ftoc2(ret);
|
||||||
}
|
}
|
||||||
// ns_get_weap_ammo(WeaponID)
|
// ns_get_weap_ammo(WeaponID)
|
||||||
static cell AMX_NATIVE_CALL ns_get_weapon_clip(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_weapon_clip(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL || Entity->free)
|
if (Entity->pvPrivateData == NULL || Entity->free)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_private(Entity,MAKE_OFFSET(WEAPCLIP));
|
return get_private(Entity,MAKE_OFFSET(WEAPCLIP));
|
||||||
}
|
}
|
||||||
// ns_set_weap_ammo(WeaponID,ammo)
|
// ns_set_weap_ammo(WeaponID,ammo)
|
||||||
static cell AMX_NATIVE_CALL ns_set_weapon_clip(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_weapon_clip(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL || Entity->free)
|
if (Entity->pvPrivateData == NULL || Entity->free)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_private(Entity,MAKE_OFFSET(WEAPCLIP),params[2]);
|
set_private(Entity,MAKE_OFFSET(WEAPCLIP),params[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_add_weapon_clip(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_weapon_clip(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
|
|
||||||
CreateNonPlayerEdict(amx,params[1]);
|
CreateNonPlayerEdict(amx,params[1]);
|
||||||
|
|
||||||
if (Entity->pvPrivateData == NULL || Entity->free)
|
if (Entity->pvPrivateData == NULL || Entity->free)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return inc_private(Entity,MAKE_OFFSET(WEAPCLIP),static_cast<int>(params[2]),0);
|
return inc_private(Entity,MAKE_OFFSET(WEAPCLIP),static_cast<int>(params[2]),0);
|
||||||
}
|
}
|
||||||
// ns_get_weap_reserve(PlayerID,WeaponType)
|
// ns_get_weap_reserve(PlayerID,WeaponType)
|
||||||
static cell AMX_NATIVE_CALL ns_get_weap_reserve(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_weap_reserve(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (params[2])
|
switch (params[2])
|
||||||
{
|
{
|
||||||
case WEAPON_PISTOL:
|
case WEAPON_PISTOL:
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_PISTOL));
|
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_PISTOL));
|
||||||
case WEAPON_LMG:
|
case WEAPON_LMG:
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_LMG));
|
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_LMG));
|
||||||
case WEAPON_SHOTGUN:
|
case WEAPON_SHOTGUN:
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_SHOTGUN));
|
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_SHOTGUN));
|
||||||
case WEAPON_HMG:
|
case WEAPON_HMG:
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_HMG));
|
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_HMG));
|
||||||
case WEAPON_GRENADE_GUN:
|
case WEAPON_GRENADE_GUN:
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_GL));
|
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_GL));
|
||||||
case WEAPON_GRENADE:
|
case WEAPON_GRENADE:
|
||||||
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_HG));
|
return get_private(player->GetEdict(),MAKE_OFFSET(AMMO_HG));
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_set_weap_reserve(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_set_weap_reserve(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (params[2])
|
switch (params[2])
|
||||||
{
|
{
|
||||||
case WEAPON_PISTOL:
|
case WEAPON_PISTOL:
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_PISTOL),params[3]);
|
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_PISTOL),params[3]);
|
||||||
return 1;
|
return 1;
|
||||||
case WEAPON_LMG:
|
case WEAPON_LMG:
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_LMG),(int)params[3]);
|
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_LMG),(int)params[3]);
|
||||||
return 1;
|
return 1;
|
||||||
case WEAPON_SHOTGUN:
|
case WEAPON_SHOTGUN:
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_SHOTGUN),(int)params[3]);
|
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_SHOTGUN),(int)params[3]);
|
||||||
return 1;
|
return 1;
|
||||||
case WEAPON_HMG:
|
case WEAPON_HMG:
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_HMG),(int)params[3]);
|
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_HMG),(int)params[3]);
|
||||||
return 1;
|
return 1;
|
||||||
case WEAPON_GRENADE_GUN:
|
case WEAPON_GRENADE_GUN:
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_GL),(int)params[3]);
|
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_GL),(int)params[3]);
|
||||||
return 1;
|
return 1;
|
||||||
case WEAPON_GRENADE:
|
case WEAPON_GRENADE:
|
||||||
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_HG),(int)params[3]);
|
set_private(player->GetEdict(),MAKE_OFFSET(AMMO_HG),(int)params[3]);
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static cell AMX_NATIVE_CALL ns_add_weap_reserve(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_add_weap_reserve(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected() || !player->HasPrivateData())
|
if (!player->IsConnected() || !player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (params[2])
|
switch (params[2])
|
||||||
{
|
{
|
||||||
case WEAPON_PISTOL:
|
case WEAPON_PISTOL:
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_PISTOL),params[3],0);
|
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_PISTOL),params[3],0);
|
||||||
case WEAPON_LMG:
|
case WEAPON_LMG:
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_LMG),(int)params[3],0);
|
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_LMG),(int)params[3],0);
|
||||||
case WEAPON_SHOTGUN:
|
case WEAPON_SHOTGUN:
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_SHOTGUN),(int)params[3],0);
|
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_SHOTGUN),(int)params[3],0);
|
||||||
case WEAPON_HMG:
|
case WEAPON_HMG:
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_HMG),(int)params[3],0);
|
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_HMG),(int)params[3],0);
|
||||||
case WEAPON_GRENADE_GUN:
|
case WEAPON_GRENADE_GUN:
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_GL),(int)params[3],0);
|
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_GL),(int)params[3],0);
|
||||||
case WEAPON_GRENADE:
|
case WEAPON_GRENADE:
|
||||||
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_HG),(int)params[3],0);
|
return inc_private(player->GetEdict(),MAKE_OFFSET(AMMO_HG),(int)params[3],0);
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// ns_get_weapon(idPlayer,weaponid,&weapontype=0)
|
// ns_get_weapon(idPlayer,weaponid,&weapontype=0)
|
||||||
static cell AMX_NATIVE_CALL ns_get_weapon(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_get_weapon(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
// Peachy did it like this:
|
// Peachy did it like this:
|
||||||
// if weapontype is 0, return the primary weapon index of the player
|
// if weapontype is 0, return the primary weapon index of the player
|
||||||
// if weapontype is < 0, return the last inventory weapon index of the player
|
// if weapontype is < 0, return the last inventory weapon index of the player
|
||||||
// otherwise, scan the player's inventory and look for a weapon of the given type
|
// otherwise, scan the player's inventory and look for a weapon of the given type
|
||||||
// such as WEAPON_KNIFE, etc, etc
|
// such as WEAPON_KNIFE, etc, etc
|
||||||
// I added the last parameter, which will byref the weapontype of the weapon found
|
// I added the last parameter, which will byref the weapontype of the weapon found
|
||||||
// returns 0 on failure
|
// returns 0 on failure
|
||||||
// last param default value added to not conflict with his version
|
// last param default value added to not conflict with his version
|
||||||
|
|
||||||
CreatePlayerPointer(amx,params[1]);
|
CreatePlayerPointer(amx,params[1]);
|
||||||
|
|
||||||
if (!player->IsConnected())
|
if (!player->IsConnected())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player->HasPrivateData())
|
if (!player->HasPrivateData())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[2]<0) // find lastinv weapon
|
if (params[2]<0) // find lastinv weapon
|
||||||
{
|
{
|
||||||
edict_t *Weapon=private_to_edict(get_private_p<void *>(player->GetEdict(),MAKE_OFFSET(LAST_WEAPON)));
|
edict_t *Weapon=private_to_edict(get_private_p<void *>(player->GetEdict(),MAKE_OFFSET(LAST_WEAPON)));
|
||||||
|
|
||||||
if (Weapon==NULL) // no weapon
|
if (Weapon==NULL) // no weapon
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((params[0] / sizeof(cell))>2) // If this plugin was compiled with peachy's .inc then don't byref
|
if ((params[0] / sizeof(cell))>2) // If this plugin was compiled with peachy's .inc then don't byref
|
||||||
{
|
{
|
||||||
*MF_GetAmxAddr_NEW(amx,params[3])=get_private(Weapon,MAKE_OFFSET(WEAPID));
|
*MF_GetAmxAddr_NEW(amx,params[3])=get_private(Weapon,MAKE_OFFSET(WEAPID));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENTINDEX_NEW(Weapon);
|
return ENTINDEX_NEW(Weapon);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (params[2]==0) // find current weapon
|
if (params[2]==0) // find current weapon
|
||||||
{
|
{
|
||||||
edict_t *Weapon=private_to_edict(get_private_p<void *>(player->GetEdict(),MAKE_OFFSET(CURRENT_WEAPON)));
|
edict_t *Weapon=private_to_edict(get_private_p<void *>(player->GetEdict(),MAKE_OFFSET(CURRENT_WEAPON)));
|
||||||
|
|
||||||
if (Weapon==NULL) // no weapon
|
if (Weapon==NULL) // no weapon
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((params[0] / sizeof(cell))>2) // If this plugin was compiled with peachy's .inc then don't byref
|
if ((params[0] / sizeof(cell))>2) // If this plugin was compiled with peachy's .inc then don't byref
|
||||||
{
|
{
|
||||||
*MF_GetAmxAddr_NEW(amx,params[3])=get_private(Weapon,MAKE_OFFSET(WEAPID));
|
*MF_GetAmxAddr_NEW(amx,params[3])=get_private(Weapon,MAKE_OFFSET(WEAPID));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ENTINDEX_NEW(Weapon);
|
return ENTINDEX_NEW(Weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finding weapon by ID
|
// Finding weapon by ID
|
||||||
|
|
||||||
char **pPlayerItems = reinterpret_cast<char**>(static_cast<char*>(player->GetEdict()->pvPrivateData) + MAKE_OFFSET(PLAYER_ITEMS));
|
char **pPlayerItems = reinterpret_cast<char**>(static_cast<char*>(player->GetEdict()->pvPrivateData) + MAKE_OFFSET(PLAYER_ITEMS));
|
||||||
char *pItem;
|
char *pItem;
|
||||||
int weapon=params[2];
|
int weapon=params[2];
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
pItem = pPlayerItems[i];
|
pItem = pPlayerItems[i];
|
||||||
while (pItem)
|
while (pItem)
|
||||||
{
|
{
|
||||||
if (*(int *)(pItem + MAKE_OFFSET(WEAPID)) == weapon)
|
if (*(int *)(pItem + MAKE_OFFSET(WEAPID)) == weapon)
|
||||||
{
|
{
|
||||||
return ENTINDEX_NEW(private_to_edict(pItem));
|
return ENTINDEX_NEW(private_to_edict(pItem));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pItem = *(char **)(pItem + MAKE_OFFSET(WEAP_NEXT));
|
pItem = *(char **)(pItem + MAKE_OFFSET(WEAP_NEXT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef DEVELOPER_BUILD
|
#ifdef DEVELOPER_BUILD
|
||||||
// ns_find_weapon_offset(idPlayer,"primweapon","lastinvweapon")
|
// ns_find_weapon_offset(idPlayer,"primweapon","lastinvweapon")
|
||||||
static cell AMX_NATIVE_CALL ns_find_weapon_offset(AMX *amx, cell *params)
|
static cell AMX_NATIVE_CALL ns_find_weapon_offset(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
char *SPrimWeapon=MF_GetAmxString(amx,params[2],0,NULL);
|
char *SPrimWeapon=MF_GetAmxString(amx,params[2],0,NULL);
|
||||||
char *SLastInv=MF_GetAmxString(amx,params[3],1,NULL);
|
char *SLastInv=MF_GetAmxString(amx,params[3],1,NULL);
|
||||||
edict_t *ePlayer=INDEXENT_NEW(params[1]);
|
edict_t *ePlayer=INDEXENT_NEW(params[1]);
|
||||||
|
|
||||||
// Locate entities by name
|
// Locate entities by name
|
||||||
edict_t *PrimWeapon=NULL;
|
edict_t *PrimWeapon=NULL;
|
||||||
edict_t *LastInv=NULL;
|
edict_t *LastInv=NULL;
|
||||||
|
|
||||||
edict_t *Temp=NULL;
|
edict_t *Temp=NULL;
|
||||||
|
|
||||||
while ((Temp=UTIL_FindEntityByString(Temp,"classname",SPrimWeapon))!=NULL)
|
while ((Temp=UTIL_FindEntityByString(Temp,"classname",SPrimWeapon))!=NULL)
|
||||||
{
|
{
|
||||||
if (Temp->v.owner==ePlayer)
|
if (Temp->v.owner==ePlayer)
|
||||||
{
|
{
|
||||||
PrimWeapon=Temp;
|
PrimWeapon=Temp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Temp=NULL;
|
Temp=NULL;
|
||||||
while ((Temp=UTIL_FindEntityByString(Temp,"classname",SLastInv))!=NULL)
|
while ((Temp=UTIL_FindEntityByString(Temp,"classname",SLastInv))!=NULL)
|
||||||
{
|
{
|
||||||
if (Temp->v.owner==ePlayer)
|
if (Temp->v.owner==ePlayer)
|
||||||
{
|
{
|
||||||
LastInv=Temp;
|
LastInv=Temp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LastInv == NULL || PrimWeapon == NULL)
|
if (LastInv == NULL || PrimWeapon == NULL)
|
||||||
{
|
{
|
||||||
if (LastInv==NULL)
|
if (LastInv==NULL)
|
||||||
{
|
{
|
||||||
MF_Log("LastInv==NULL");
|
MF_Log("LastInv==NULL");
|
||||||
}
|
}
|
||||||
if (PrimWeapon==NULL)
|
if (PrimWeapon==NULL)
|
||||||
{
|
{
|
||||||
MF_Log("PrimWeapon=NULL");
|
MF_Log("PrimWeapon=NULL");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// now iterate through the client's private data until we find the pointer to PrimWeapon/LastInv's offset
|
// now iterate through the client's private data until we find the pointer to PrimWeapon/LastInv's offset
|
||||||
unsigned int *Ptr=(unsigned int*)ePlayer->pvPrivateData;
|
unsigned int *Ptr=(unsigned int*)ePlayer->pvPrivateData;
|
||||||
|
|
||||||
int FoundLastInv=0;
|
int FoundLastInv=0;
|
||||||
int FoundPrim=0;
|
int FoundPrim=0;
|
||||||
size_t count=0;
|
size_t count=0;
|
||||||
unsigned int iPrim;
|
unsigned int iPrim;
|
||||||
unsigned int iLast;
|
unsigned int iLast;
|
||||||
|
|
||||||
// so nasty D: this is basically horrible_cast
|
// so nasty D: this is basically horrible_cast
|
||||||
union bleh
|
union bleh
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
unsigned int ival;
|
unsigned int ival;
|
||||||
}blah;
|
}blah;
|
||||||
|
|
||||||
blah.ptr=PrimWeapon->pvPrivateData;
|
blah.ptr=PrimWeapon->pvPrivateData;
|
||||||
iPrim=blah.ival;
|
iPrim=blah.ival;
|
||||||
|
|
||||||
blah.ptr=LastInv->pvPrivateData;
|
blah.ptr=LastInv->pvPrivateData;
|
||||||
iLast=blah.ival;
|
iLast=blah.ival;
|
||||||
|
|
||||||
while (count<4000)
|
while (count<4000)
|
||||||
{
|
{
|
||||||
if (*Ptr==iLast)
|
if (*Ptr==iLast)
|
||||||
{
|
{
|
||||||
MF_Log("Found LastInv: %d",count);
|
MF_Log("Found LastInv: %d",count);
|
||||||
FoundLastInv=1;
|
FoundLastInv=1;
|
||||||
}
|
}
|
||||||
if (*Ptr==iPrim)
|
if (*Ptr==iPrim)
|
||||||
{
|
{
|
||||||
MF_Log("Found Primary: %d",count);
|
MF_Log("Found Primary: %d",count);
|
||||||
FoundPrim=1;
|
FoundPrim=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FoundLastInv && FoundPrim)
|
if (FoundLastInv && FoundPrim)
|
||||||
{
|
{
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
count+=4;
|
count+=4;
|
||||||
Ptr++;
|
Ptr++;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
AMX_NATIVE_INFO weapon_natives[] = {
|
AMX_NATIVE_INFO weapon_natives[] = {
|
||||||
|
|
||||||
{ "ns_has_weapon", ns_has_weapon },
|
{ "ns_has_weapon", ns_has_weapon },
|
||||||
|
|
||||||
{ "ns_set_weap_dmg", ns_set_weapon_dmg },
|
{ "ns_set_weap_dmg", ns_set_weapon_dmg },
|
||||||
{ "ns_get_weap_dmg", ns_get_weapon_dmg },
|
{ "ns_get_weap_dmg", ns_get_weapon_dmg },
|
||||||
|
|
||||||
{ "ns_set_weap_range", ns_set_weapon_range },
|
{ "ns_set_weap_range", ns_set_weapon_range },
|
||||||
{ "ns_get_weap_range", ns_get_weapon_range },
|
{ "ns_get_weap_range", ns_get_weapon_range },
|
||||||
|
|
||||||
{ "ns_set_weap_clip", ns_set_weapon_clip },
|
{ "ns_set_weap_clip", ns_set_weapon_clip },
|
||||||
{ "ns_get_weap_clip", ns_get_weapon_clip },
|
{ "ns_get_weap_clip", ns_get_weapon_clip },
|
||||||
{ "ns_add_weap_clip", ns_add_weapon_clip },
|
{ "ns_add_weap_clip", ns_add_weapon_clip },
|
||||||
|
|
||||||
{ "ns_set_weap_reserve", ns_set_weap_reserve },
|
{ "ns_set_weap_reserve", ns_set_weap_reserve },
|
||||||
{ "ns_get_weap_reserve", ns_get_weap_reserve },
|
{ "ns_get_weap_reserve", ns_get_weap_reserve },
|
||||||
{ "ns_add_weap_reserve", ns_add_weap_reserve },
|
{ "ns_add_weap_reserve", ns_add_weap_reserve },
|
||||||
|
|
||||||
{ "ns_get_weapon", ns_get_weapon},
|
{ "ns_get_weapon", ns_get_weapon},
|
||||||
|
|
||||||
#ifdef DEVELOPER_BUILD
|
#ifdef DEVELOPER_BUILD
|
||||||
{ "ns_find_weapon_offset", ns_find_weapon_offset},
|
{ "ns_find_weapon_offset", ns_find_weapon_offset},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
void AddNatives_Weapons()
|
void AddNatives_Weapons()
|
||||||
{
|
{
|
||||||
MF_AddNatives(weapon_natives);
|
MF_AddNatives(weapon_natives);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,174 +10,174 @@
|
||||||
//
|
//
|
||||||
// Natural Selection Module
|
// Natural Selection Module
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "amxxmodule.h"
|
#include "amxxmodule.h"
|
||||||
#include "ns.h"
|
#include "ns.h"
|
||||||
#include "utilfunctions.h"
|
#include "utilfunctions.h"
|
||||||
#include "CPlayer.h"
|
#include "CPlayer.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scans through all hives and finds the one currently building
|
* Scans through all hives and finds the one currently building
|
||||||
*/
|
*/
|
||||||
int UTIL_FindBuildingHive(void)
|
int UTIL_FindBuildingHive(void)
|
||||||
{
|
{
|
||||||
edict_t *Entity=NULL;
|
edict_t *Entity=NULL;
|
||||||
|
|
||||||
while ((Entity = UTIL_FindEntityByString(Entity,"classname","team_hive")))
|
while ((Entity = UTIL_FindEntityByString(Entity,"classname","team_hive")))
|
||||||
{
|
{
|
||||||
// is alive active not fully built
|
// is alive active not fully built
|
||||||
if (Entity->v.health > 0 && Entity->v.solid > 0 && Entity->v.fuser1 < 1000)
|
if (Entity->v.health > 0 && Entity->v.solid > 0 && Entity->v.fuser1 < 1000)
|
||||||
{
|
{
|
||||||
return ENTINDEX_NEW(Entity);
|
return ENTINDEX_NEW(Entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *UTIL_FindEntityByString(edict_t *Start, const char *Keyword, const char *Value)
|
edict_t *UTIL_FindEntityByString(edict_t *Start, const char *Keyword, const char *Value)
|
||||||
{
|
{
|
||||||
edict_t *Entity;
|
edict_t *Entity;
|
||||||
|
|
||||||
Entity=FIND_ENTITY_BY_STRING(Start, Keyword, Value);
|
Entity=FIND_ENTITY_BY_STRING(Start, Keyword, Value);
|
||||||
|
|
||||||
if(!FNullEnt(Entity))
|
if(!FNullEnt(Entity))
|
||||||
{
|
{
|
||||||
return Entity;
|
return Entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns TRUE if the provided native is used in a loaded plugin
|
* Returns TRUE if the provided native is used in a loaded plugin
|
||||||
* FALSE otherwise.
|
* FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
BOOL UTIL_CheckForNative(const char *NativeName)
|
BOOL UTIL_CheckForNative(const char *NativeName)
|
||||||
{
|
{
|
||||||
AMX *amx;
|
AMX *amx;
|
||||||
char blah[64];
|
char blah[64];
|
||||||
int FunctionIndex;
|
int FunctionIndex;
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
strncpy(blah,NativeName,63);
|
strncpy(blah,NativeName,63);
|
||||||
|
|
||||||
// Loop through all running scripts
|
// Loop through all running scripts
|
||||||
while((amx=MF_GetScriptAmx(i++))!=NULL)
|
while((amx=MF_GetScriptAmx(i++))!=NULL)
|
||||||
{
|
{
|
||||||
// Scan for native
|
// Scan for native
|
||||||
if (MF_AmxFindNative(amx, blah, &FunctionIndex) == AMX_ERR_NONE)
|
if (MF_AmxFindNative(amx, blah, &FunctionIndex) == AMX_ERR_NONE)
|
||||||
{
|
{
|
||||||
// Native was found.
|
// Native was found.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE; // no native found in any loaded script
|
return FALSE; // no native found in any loaded script
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Scans an amxx plugin for a public
|
* Scans an amxx plugin for a public
|
||||||
* returns whether or not that public exists
|
* returns whether or not that public exists
|
||||||
*/
|
*/
|
||||||
BOOL UTIL_CheckForPublic(const char *publicname)
|
BOOL UTIL_CheckForPublic(const char *publicname)
|
||||||
{
|
{
|
||||||
AMX *amx;
|
AMX *amx;
|
||||||
char blah[64];
|
char blah[64];
|
||||||
int FunctionIndex;
|
int FunctionIndex;
|
||||||
int i=0;
|
int i=0;
|
||||||
|
|
||||||
strncpy(blah,publicname,63);
|
strncpy(blah,publicname,63);
|
||||||
|
|
||||||
// Loop through all running scripts
|
// Loop through all running scripts
|
||||||
while((amx=MF_GetScriptAmx(i++))!=NULL)
|
while((amx=MF_GetScriptAmx(i++))!=NULL)
|
||||||
{
|
{
|
||||||
// Scan for public
|
// Scan for public
|
||||||
if (MF_AmxFindPublic(amx, blah, &FunctionIndex) == AMX_ERR_NONE)
|
if (MF_AmxFindPublic(amx, blah, &FunctionIndex) == AMX_ERR_NONE)
|
||||||
{
|
{
|
||||||
// Public was found.
|
// Public was found.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE; // no public found in any loaded script
|
return FALSE; // no public found in any loaded script
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlayer *UTIL_PlayerByCID(int CID)
|
CPlayer *UTIL_PlayerByCID(int CID)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
while (i++<gpGlobals->maxClients)
|
while (i++<gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
if (GETPLAYERUSERID(g_player[i].GetEdict())==CID)
|
if (GETPLAYERUSERID(g_player[i].GetEdict())==CID)
|
||||||
{
|
{
|
||||||
return &g_player[i];
|
return &g_player[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a log string (eg: "sawce<1><STEAM_0:1:4560311><marine1team>")
|
* Converts a log string (eg: "sawce<1><STEAM_0:1:4560311><marine1team>")
|
||||||
* into a player index
|
* into a player index
|
||||||
*/
|
*/
|
||||||
int UTIL_LogToIndex(const char *LogLine)
|
int UTIL_LogToIndex(const char *LogLine)
|
||||||
{
|
{
|
||||||
char NameBuffer[33] ; // Temporary buffer to store the CID String
|
char NameBuffer[33] ; // Temporary buffer to store the CID String
|
||||||
char *StrLocation; // Location in the LogLine pointer
|
char *StrLocation; // Location in the LogLine pointer
|
||||||
unsigned int Count=0; // Count for how many <'s we've passed
|
unsigned int Count=0; // Count for how many <'s we've passed
|
||||||
size_t Length; // Length of LogLine
|
size_t Length; // Length of LogLine
|
||||||
|
|
||||||
Length=strlen(LogLine);
|
Length=strlen(LogLine);
|
||||||
StrLocation=const_cast<char *>(LogLine) + Length; // Should now point to the last >
|
StrLocation=const_cast<char *>(LogLine) + Length; // Should now point to the last >
|
||||||
|
|
||||||
while (Length--)
|
while (Length--)
|
||||||
{
|
{
|
||||||
if (*StrLocation--=='<')
|
if (*StrLocation--=='<')
|
||||||
{
|
{
|
||||||
if (++Count==3) // 3rd match is end of CID
|
if (++Count==3) // 3rd match is end of CID
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Count!=3) // Invalid name somehow??
|
if (Count!=3) // Invalid name somehow??
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Length > 32) // The name is too long somehow? stop here...
|
if (Length > 32) // The name is too long somehow? stop here...
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
strncpy(NameBuffer,LogLine,Length);
|
strncpy(NameBuffer,LogLine,Length);
|
||||||
|
|
||||||
Count=0;
|
Count=0;
|
||||||
|
|
||||||
while ((int)Count++<gpGlobals->maxClients)
|
while ((int)Count++<gpGlobals->maxClients)
|
||||||
{
|
{
|
||||||
if (strcmp(NameBuffer,STRING(INDEXENT_NEW(Count)->v.netname))==0)
|
if (strcmp(NameBuffer,STRING(INDEXENT_NEW(Count)->v.netname))==0)
|
||||||
{
|
{
|
||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *UTIL_ToLowerCase(const char *str)
|
char *UTIL_ToLowerCase(const char *str)
|
||||||
{
|
{
|
||||||
size_t len = strlen(str);
|
size_t len = strlen(str);
|
||||||
char *buffer = new char[len + 1];
|
char *buffer = new char[len + 1];
|
||||||
for (size_t i = 0; i < len; i++)
|
for (size_t i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
if (str[i] >= 'A' && str[i] <= 'Z')
|
if (str[i] >= 'A' && str[i] <= 'Z')
|
||||||
buffer[i] = tolower(str[i]);
|
buffer[i] = tolower(str[i]);
|
||||||
else
|
else
|
||||||
buffer[i] = str[i];
|
buffer[i] = str[i];
|
||||||
}
|
}
|
||||||
buffer[len] = '\0';
|
buffer[len] = '\0';
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,118 +10,118 @@
|
||||||
//
|
//
|
||||||
// Message Stocks
|
// Message Stocks
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined _message_stocks_included
|
#if defined _message_stocks_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _message_stocks_included
|
#define _message_stocks_included
|
||||||
|
|
||||||
/* Creates a death message. */
|
/* Creates a death message. */
|
||||||
stock dod_make_deathmsg(killer, victim, weaponNUM)
|
stock dod_make_deathmsg(killer, victim, weaponNUM)
|
||||||
{
|
{
|
||||||
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
|
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
|
||||||
write_byte(killer);
|
write_byte(killer);
|
||||||
write_byte(victim);
|
write_byte(victim);
|
||||||
write_byte(weaponNUM);
|
write_byte(weaponNUM);
|
||||||
message_end();
|
message_end();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Kills a user without a message. */
|
/* Kills a user without a message. */
|
||||||
stock user_silentkill(index)
|
stock user_silentkill(index)
|
||||||
{
|
{
|
||||||
static msgid = 0;
|
static msgid = 0;
|
||||||
new msgblock;
|
new msgblock;
|
||||||
if (!msgid)
|
if (!msgid)
|
||||||
{
|
{
|
||||||
msgid = get_user_msgid("DeathMsg");
|
msgid = get_user_msgid("DeathMsg");
|
||||||
}
|
}
|
||||||
msgblock = get_msg_block(msgid);
|
msgblock = get_msg_block(msgid);
|
||||||
set_msg_block(msgid, BLOCK_ONCE);
|
set_msg_block(msgid, BLOCK_ONCE);
|
||||||
user_kill(index, 1);
|
user_kill(index, 1);
|
||||||
set_msg_block(msgid, msgblock);
|
set_msg_block(msgid, msgblock);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creates a death message. */
|
/* Creates a death message. */
|
||||||
stock make_deathmsg(killer, victim, headshot, const weapon[])
|
stock make_deathmsg(killer, victim, headshot, const weapon[])
|
||||||
{
|
{
|
||||||
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
|
message_begin(MSG_ALL, get_user_msgid("DeathMsg"), {0,0,0}, 0);
|
||||||
write_byte(killer);
|
write_byte(killer);
|
||||||
write_byte(victim);
|
write_byte(victim);
|
||||||
|
|
||||||
new mod_name[32];
|
new mod_name[32];
|
||||||
get_modname(mod_name, 31);
|
get_modname(mod_name, 31);
|
||||||
if (equal(mod_name, "cstrike") || equal(mod_name, "czero") || equal(mod_name, "csv15") || equal(mod_name, "cs13"))
|
if (equal(mod_name, "cstrike") || equal(mod_name, "czero") || equal(mod_name, "csv15") || equal(mod_name, "cs13"))
|
||||||
write_byte(headshot);
|
write_byte(headshot);
|
||||||
write_string(weapon);
|
write_string(weapon);
|
||||||
message_end();
|
message_end();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a predefined text message to player.
|
* Sends a predefined text message to player.
|
||||||
* Predefined texts are default game messages which will be translated
|
* Predefined texts are default game messages which will be translated
|
||||||
* to player's game language, e.g. #Game_join_ct.
|
* to player's game language, e.g. #Game_join_ct.
|
||||||
*
|
*
|
||||||
* @note Set index to 0 to send text globally.
|
* @note Set index to 0 to send text globally.
|
||||||
*
|
*
|
||||||
* @note There does not necessarily have to be a total of 6 arguments.
|
* @note There does not necessarily have to be a total of 6 arguments.
|
||||||
* It will depend if message takes arguments, e.g.:
|
* It will depend if message takes arguments, e.g.:
|
||||||
* client_printex(id, print_chat, "#Game_join_ct", "Pimp Daddy")
|
* client_printex(id, print_chat, "#Game_join_ct", "Pimp Daddy")
|
||||||
* client_printex(id, print_chat, "1", "#Game_radio", "Pimp Daddy", "Hello world!")
|
* client_printex(id, print_chat, "1", "#Game_radio", "Pimp Daddy", "Hello world!")
|
||||||
*
|
*
|
||||||
* @param index Index of the player, use 0 to send to all players.
|
* @param index Index of the player, use 0 to send to all players.
|
||||||
* @param type The message destination. See print_* constants.
|
* @param type The message destination. See print_* constants.
|
||||||
* @param msg_name The custom or predefined message to send.
|
* @param msg_name The custom or predefined message to send.
|
||||||
* @param msg_param1 Optional message argument.
|
* @param msg_param1 Optional message argument.
|
||||||
* @param msg_param2 Optional message argument.
|
* @param msg_param2 Optional message argument.
|
||||||
* @param msg_param3 Optional message argument.
|
* @param msg_param3 Optional message argument.
|
||||||
* @param msg_param4 Optional message argument.
|
* @param msg_param4 Optional message argument.
|
||||||
*
|
*
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
stock client_printex(index, type, const msg_name[], const msg_param1[] = "", const msg_param2[] = "", const msg_param3[] = "", const msg_param4[] = "")
|
stock client_printex(index, type, const msg_name[], const msg_param1[] = "", const msg_param2[] = "", const msg_param3[] = "", const msg_param4[] = "")
|
||||||
{
|
{
|
||||||
new ch = msg_name[0];
|
new ch = msg_name[0];
|
||||||
|
|
||||||
// If not a predefined message, we don't care about it and forward directly to client_print.
|
// If not a predefined message, we don't care about it and forward directly to client_print.
|
||||||
// Special case for radio message. msg_name is an index, msg_param1 #Game_radio*, etc. Checking index should be enough.
|
// Special case for radio message. msg_name is an index, msg_param1 #Game_radio*, etc. Checking index should be enough.
|
||||||
if (ch != '#' && (type != print_radio || !strtol(msg_name)))
|
if (ch != '#' && (type != print_radio || !strtol(msg_name)))
|
||||||
{
|
{
|
||||||
return client_print(index, type, msg_name, msg_param1, msg_param2, msg_param3, msg_param4);
|
return client_print(index, type, msg_name, msg_param1, msg_param2, msg_param3, msg_param4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Even if message starts with '#', we should check its length for safety.
|
// Even if message starts with '#', we should check its length for safety.
|
||||||
new length = strlen(msg_name);
|
new length = strlen(msg_name);
|
||||||
|
|
||||||
// If string is larger than expected, we forward to client_print which will cut message properly.
|
// If string is larger than expected, we forward to client_print which will cut message properly.
|
||||||
// This means also this can't be a predefined game message.
|
// This means also this can't be a predefined game message.
|
||||||
// Max console length: 128 = \n (126) + \0 (127)
|
// Max console length: 128 = \n (126) + \0 (127)
|
||||||
// Max SayText length: 192 = \n (190) + \0 (191)
|
// Max SayText length: 192 = \n (190) + \0 (191)
|
||||||
if ((length > 126 && (print_notify <= type <= print_console))
|
if ((length > 126 && (print_notify <= type <= print_console))
|
||||||
|| ( length > 190 && (print_chat <= type <= print_radio)))
|
|| ( length > 190 && (print_chat <= type <= print_radio)))
|
||||||
{
|
{
|
||||||
return client_print(index, type, msg_name, msg_param1, msg_param2, msg_param3, msg_param4);
|
return client_print(index, type, msg_name, msg_param1, msg_param2, msg_param3, msg_param4);
|
||||||
}
|
}
|
||||||
|
|
||||||
static msgTextMsg;
|
static msgTextMsg;
|
||||||
if (!msgTextMsg)
|
if (!msgTextMsg)
|
||||||
{
|
{
|
||||||
msgTextMsg = get_user_msgid("TextMsg");
|
msgTextMsg = get_user_msgid("TextMsg");
|
||||||
}
|
}
|
||||||
|
|
||||||
message_begin(index > 0 ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgTextMsg, .player = index);
|
message_begin(index > 0 ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgTextMsg, .player = index);
|
||||||
write_byte(type);
|
write_byte(type);
|
||||||
write_string(msg_name);
|
write_string(msg_name);
|
||||||
if (msg_param1[0]) { write_string(msg_param1); }
|
if (msg_param1[0]) { write_string(msg_param1); }
|
||||||
if (msg_param2[0]) { write_string(msg_param2); }
|
if (msg_param2[0]) { write_string(msg_param2); }
|
||||||
if (msg_param3[0]) { write_string(msg_param3); }
|
if (msg_param3[0]) { write_string(msg_param3); }
|
||||||
if (msg_param4[0]) { write_string(msg_param4); }
|
if (msg_param4[0]) { write_string(msg_param4); }
|
||||||
message_end();
|
message_end();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,311 +6,311 @@
|
||||||
// This software is licensed under the GNU General Public License, version 3 or higher.
|
// This software is licensed under the GNU General Public License, version 3 or higher.
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#if defined _newmenus_included
|
#if defined _newmenus_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _newmenus_included
|
#define _newmenus_included
|
||||||
|
|
||||||
#define MEXIT_ALL 1 /* Menu will have an exit option (default)*/
|
#define MEXIT_ALL 1 /* Menu will have an exit option (default)*/
|
||||||
#define MEXIT_FORCE 2 /* Menu will have an exit option, even when pagination is disabled.
|
#define MEXIT_FORCE 2 /* Menu will have an exit option, even when pagination is disabled.
|
||||||
* There have to be less than 10 items in the menu or it won't appear. The exit
|
* There have to be less than 10 items in the menu or it won't appear. The exit
|
||||||
* option will be appended to the last item with no extra slot padding. If you
|
* option will be appended to the last item with no extra slot padding. If you
|
||||||
* want it in the 10th slot you have to pad it manually with menu_addblank2 */
|
* want it in the 10th slot you have to pad it manually with menu_addblank2 */
|
||||||
#define MEXIT_NEVER -1 /* Menu will not have an exit option */
|
#define MEXIT_NEVER -1 /* Menu will not have an exit option */
|
||||||
|
|
||||||
#define MPROP_PERPAGE 1 /* Number of items per page (param1 = number, 0=no paginating, 7=default) */
|
#define MPROP_PERPAGE 1 /* Number of items per page (param1 = number, 0=no paginating, 7=default) */
|
||||||
#define MPROP_BACKNAME 2 /* Name of the back button (param1 = string) */
|
#define MPROP_BACKNAME 2 /* Name of the back button (param1 = string) */
|
||||||
#define MPROP_NEXTNAME 3 /* Name of the next button (param1 = string) */
|
#define MPROP_NEXTNAME 3 /* Name of the next button (param1 = string) */
|
||||||
#define MPROP_EXITNAME 4 /* Name of the exit button (param1 = string) */
|
#define MPROP_EXITNAME 4 /* Name of the exit button (param1 = string) */
|
||||||
#define MPROP_TITLE 5 /* Menu title text (param1 = string) */
|
#define MPROP_TITLE 5 /* Menu title text (param1 = string) */
|
||||||
#define MPROP_EXIT 6 /* Exit functionality (param1 = number, see MEXIT constants) */
|
#define MPROP_EXIT 6 /* Exit functionality (param1 = number, see MEXIT constants) */
|
||||||
#define MPROP_NOCOLORS 8 /* Sets whether colors are not auto (param1 = number, 0=default) */
|
#define MPROP_NOCOLORS 8 /* Sets whether colors are not auto (param1 = number, 0=default) */
|
||||||
#define MPROP_NUMBER_COLOR 10 /* Color indicator to use for numbers (param1 = string, "\r"=default) */
|
#define MPROP_NUMBER_COLOR 10 /* Color indicator to use for numbers (param1 = string, "\r"=default) */
|
||||||
|
|
||||||
#define MEXIT_NORMAL 0 /* DEPRECATED, do not use (has no effect) */
|
#define MEXIT_NORMAL 0 /* DEPRECATED, do not use (has no effect) */
|
||||||
#define MENUPAD_NONE 0 /* DEPRECATED, do not use (has no effect) */
|
#define MENUPAD_NONE 0 /* DEPRECATED, do not use (has no effect) */
|
||||||
#define MENUPAD_PAGE 1 /* DEPRECATED, do not use (has no effect) */
|
#define MENUPAD_PAGE 1 /* DEPRECATED, do not use (has no effect) */
|
||||||
#define MPROP_ORDER 7 /* DEPRECATED, do not use (has no effect) */
|
#define MPROP_ORDER 7 /* DEPRECATED, do not use (has no effect) */
|
||||||
#define MPROP_PADMENU 9 /* DEPRECATED, do not use (has no effect) */
|
#define MPROP_PADMENU 9 /* DEPRECATED, do not use (has no effect) */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a new menu object.
|
* @brief Creates a new menu object.
|
||||||
*
|
*
|
||||||
* The handler function should be prototyped as:
|
* The handler function should be prototyped as:
|
||||||
*
|
*
|
||||||
* public <function>(id, menu, item)
|
* public <function>(id, menu, item)
|
||||||
* id - Client the menu is being acted upon.
|
* id - Client the menu is being acted upon.
|
||||||
* menu - Menu resource identifier.
|
* menu - Menu resource identifier.
|
||||||
* item - Item the client selected. If less than 0, the menu was
|
* item - Item the client selected. If less than 0, the menu was
|
||||||
* cancelled and the item is a status code. menu_display
|
* cancelled and the item is a status code. menu_display
|
||||||
* should never be called immediately if the item is a status
|
* should never be called immediately if the item is a status
|
||||||
* code, for re-entrancy reasons.
|
* code, for re-entrancy reasons.
|
||||||
*
|
*
|
||||||
* The handler function should always return PLUGIN_HANDLED to block
|
* The handler function should always return PLUGIN_HANDLED to block
|
||||||
* any old menu handlers from potentially feeding on the menu, unless
|
* any old menu handlers from potentially feeding on the menu, unless
|
||||||
* that is the desired functionality.
|
* that is the desired functionality.
|
||||||
*
|
*
|
||||||
* @param title Title the menu should use.
|
* @param title Title the menu should use.
|
||||||
* @param handler Name of the handler function. The function will be invoked
|
* @param handler Name of the handler function. The function will be invoked
|
||||||
* once and only once to every menu_display() call.
|
* once and only once to every menu_display() call.
|
||||||
* @param ml Unused (should be 0).
|
* @param ml Unused (should be 0).
|
||||||
* @return Menu resource identifier which must be destroyed via
|
* @return Menu resource identifier which must be destroyed via
|
||||||
* menu_destroy(). All menus are destroyed when the plugin
|
* menu_destroy(). All menus are destroyed when the plugin
|
||||||
* unloads.
|
* unloads.
|
||||||
* @error Function name not found.
|
* @error Function name not found.
|
||||||
*/
|
*/
|
||||||
native menu_create(const title[], const handler[], ml=0);
|
native menu_create(const title[], const handler[], ml=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a menu item callback handler.
|
* Creates a menu item callback handler.
|
||||||
*
|
*
|
||||||
* The handler function should be prototyped as:
|
* The handler function should be prototyped as:
|
||||||
*
|
*
|
||||||
* public <function>(id, menu, item)
|
* public <function>(id, menu, item)
|
||||||
* id - Client index being displayed to.
|
* id - Client index being displayed to.
|
||||||
* menu - Menu resource identifier.
|
* menu - Menu resource identifier.
|
||||||
* item - Item being drawn.
|
* item - Item being drawn.
|
||||||
* <return> - ITEM_IGNORE to use the default functionality. ITEM_ENABLED to
|
* <return> - ITEM_IGNORE to use the default functionality. ITEM_ENABLED to
|
||||||
* explicitly enable or ITEM_DISABLED to explicitly disable.
|
* explicitly enable or ITEM_DISABLED to explicitly disable.
|
||||||
*
|
*
|
||||||
* @param function Function name.
|
* @param function Function name.
|
||||||
* @return Menu callback ID.
|
* @return Menu callback ID.
|
||||||
*/
|
*/
|
||||||
native menu_makecallback(const function[]);
|
native menu_makecallback(const function[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds an menu to a menu.
|
* Adds an menu to a menu.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param name Item text to display.
|
* @param name Item text to display.
|
||||||
* @param info Item info string for internal information.
|
* @param info Item info string for internal information.
|
||||||
* @param paccess Access required by the player viewing the menu.
|
* @param paccess Access required by the player viewing the menu.
|
||||||
* @param callback If set to a valid ID from menu_makecallback(), the
|
* @param callback If set to a valid ID from menu_makecallback(), the
|
||||||
* callback will be invoked before drawing the item.
|
* callback will be invoked before drawing the item.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_additem(menu, const name[], const info[]="", paccess=0, callback=-1);
|
native menu_additem(menu, const name[], const info[]="", paccess=0, callback=-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of pages in a menu.
|
* Returns the number of pages in a menu.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @return Number of pages in the menu.
|
* @return Number of pages in the menu.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_pages(menu);
|
native menu_pages(menu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of items in a menu.
|
* Returns the number of items in a menu.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @return Number of items in the menu.
|
* @return Number of items in the menu.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_items(menu);
|
native menu_items(menu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a menu to one client. This should never be called from a handler
|
* Displays a menu to one client. This should never be called from a handler
|
||||||
* when the item is less than 0 (i.e. calling this from a cancelled menu will
|
* when the item is less than 0 (i.e. calling this from a cancelled menu will
|
||||||
* result in an error).
|
* result in an error).
|
||||||
*
|
*
|
||||||
* Starting with 1.8.3 this allows to specify a menu timeout similar to the
|
* Starting with 1.8.3 this allows to specify a menu timeout similar to the
|
||||||
* show_menu native. If the menu exists on the client past the timeout *any*
|
* show_menu native. If the menu exists on the client past the timeout *any*
|
||||||
* further action will send the MENU_TIMEOUT status code to the menu handler.
|
* further action will send the MENU_TIMEOUT status code to the menu handler.
|
||||||
* That includes actions which would otherwise send MENU_EXIT, such as the
|
* That includes actions which would otherwise send MENU_EXIT, such as the
|
||||||
* client selecting an item or disconnecting and calling menu_cancel or
|
* client selecting an item or disconnecting and calling menu_cancel or
|
||||||
* menu_destroy on a live menu.
|
* menu_destroy on a live menu.
|
||||||
*
|
*
|
||||||
* @param id Client index.
|
* @param id Client index.
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param page Page to start from (starting from 0).
|
* @param page Page to start from (starting from 0).
|
||||||
* @param time If >=0 menu will timeout after this many seconds
|
* @param time If >=0 menu will timeout after this many seconds
|
||||||
* @noreturn
|
* @noreturn
|
||||||
* @error Invalid menu resource or client index.
|
* @error Invalid menu resource or client index.
|
||||||
*/
|
*/
|
||||||
native menu_display(id, menu, page=0, time=-1);
|
native menu_display(id, menu, page=0, time=-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a page on a menu and a keypress on that page, returns the item id selected.
|
* Given a page on a menu and a keypress on that page, returns the item id selected.
|
||||||
* If the item is less than 0, a special option was chosen (such as MENU_EXIT).
|
* If the item is less than 0, a special option was chosen (such as MENU_EXIT).
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param page Page on the menu.
|
* @param page Page on the menu.
|
||||||
* @param key Key pressed (from 1 to 10).
|
* @param key Key pressed (from 1 to 10).
|
||||||
* @return Item identifier, or <0 for a special selection code.
|
* @return Item identifier, or <0 for a special selection code.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_find_id(menu, page, key);
|
native menu_find_id(menu, page, key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves info about a menu item.
|
* Retrieves info about a menu item.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param item Item identifier.
|
* @param item Item identifier.
|
||||||
* @param access Variable to store access value.
|
* @param access Variable to store access value.
|
||||||
* @param info Buffer to store item info.
|
* @param info Buffer to store item info.
|
||||||
* @param infolen Item info buffer length.
|
* @param infolen Item info buffer length.
|
||||||
* @param name Buffer to store item display text.
|
* @param name Buffer to store item display text.
|
||||||
* @param namelen Item name buffer length.
|
* @param namelen Item name buffer length.
|
||||||
* @param callback Callback ID.
|
* @param callback Callback ID.
|
||||||
* @return 1 on success, 0 on failure.
|
* @return 1 on success, 0 on failure.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_item_getinfo(menu, item, &access, info[], infolen, name[]="", namelen=0, &callback);
|
native menu_item_getinfo(menu, item, &access, info[], infolen, name[]="", namelen=0, &callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an item's display text.
|
* Sets an item's display text.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param item Item identifier.
|
* @param item Item identifier.
|
||||||
* @param name New item display text.
|
* @param name New item display text.
|
||||||
* @return 1 on success, 0 on failure.
|
* @return 1 on success, 0 on failure.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_item_setname(menu, item, const name[]);
|
native menu_item_setname(menu, item, const name[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an item's info string.
|
* Sets an item's info string.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param item Item identifier.
|
* @param item Item identifier.
|
||||||
* @param info New item info string.
|
* @param info New item info string.
|
||||||
* @return 1 on success, 0 on failure.
|
* @return 1 on success, 0 on failure.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_item_setcmd(menu, item, const info[]);
|
native menu_item_setcmd(menu, item, const info[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an item's callback.
|
* Sets an item's callback.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param item Item identifier.
|
* @param item Item identifier.
|
||||||
* @param callback New callback from menu_makecallback(), or -1 to clear.
|
* @param callback New callback from menu_makecallback(), or -1 to clear.
|
||||||
* @return 1 on success, 0 on failure.
|
* @return 1 on success, 0 on failure.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_item_setcall(menu, item, callback=-1);
|
native menu_item_setcall(menu, item, callback=-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys a menu. Player menus will be cancelled (although may still linger
|
* Destroys a menu. Player menus will be cancelled (although may still linger
|
||||||
* on the HUD), and future attempts to access the menu resource will result in
|
* on the HUD), and future attempts to access the menu resource will result in
|
||||||
* an error.
|
* an error.
|
||||||
*
|
*
|
||||||
* This must be called if you create menus dynamically, otherwise you will
|
* This must be called if you create menus dynamically, otherwise you will
|
||||||
* leak memory. For normal dynamic menus, you will destroy the menu in the
|
* leak memory. For normal dynamic menus, you will destroy the menu in the
|
||||||
* handler function (remembering to handle the case of a menu being cancelled,
|
* handler function (remembering to handle the case of a menu being cancelled,
|
||||||
* it must still be destroyed).
|
* it must still be destroyed).
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_destroy(menu);
|
native menu_destroy(menu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns information about a menu (if any) the client is currently viewing.
|
* Returns information about a menu (if any) the client is currently viewing.
|
||||||
*
|
*
|
||||||
* If newmenu is valid, then the menu will refer to the menuid associated with
|
* If newmenu is valid, then the menu will refer to the menuid associated with
|
||||||
* the title. If newmenu is not valid, and the menu is valid, then the player
|
* the title. If newmenu is not valid, and the menu is valid, then the player
|
||||||
* is viewing a menu displayed with show_menu().
|
* is viewing a menu displayed with show_menu().
|
||||||
*
|
*
|
||||||
* Both may be invalid if the player is not viewing a menu.
|
* Both may be invalid if the player is not viewing a menu.
|
||||||
*
|
*
|
||||||
* @param id Client index.
|
* @param id Client index.
|
||||||
* @param menu Variable to store old menu id. If none, then <1 will be
|
* @param menu Variable to store old menu id. If none, then <1 will be
|
||||||
* stored.
|
* stored.
|
||||||
* @param newmenu Variable to store new menu id. If none, then -1 will be
|
* @param newmenu Variable to store new menu id. If none, then -1 will be
|
||||||
* stored.
|
* stored.
|
||||||
* @param menupage Variable to store current page of the new menu, if any.
|
* @param menupage Variable to store current page of the new menu, if any.
|
||||||
* @return 1 if the player is viewing a menu, 0 otherwise.
|
* @return 1 if the player is viewing a menu, 0 otherwise.
|
||||||
* @error Invalid client.
|
* @error Invalid client.
|
||||||
*/
|
*/
|
||||||
native player_menu_info(id, &menu, &newmenu, &menupage=0);
|
native player_menu_info(id, &menu, &newmenu, &menupage=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a blank line to a menu.
|
* Adds a blank line to a menu.
|
||||||
*
|
*
|
||||||
* When using slot=1 this might break your menu. To achieve this functionality
|
* When using slot=1 this might break your menu. To achieve this functionality
|
||||||
* menu_addblank2 should be used.
|
* menu_addblank2 should be used.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param slot 1 (default) if the line should shift the numbering down.
|
* @param slot 1 (default) if the line should shift the numbering down.
|
||||||
* 0 if the line should be a visual shift only.
|
* 0 if the line should be a visual shift only.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_addblank(menu, slot=1);
|
native menu_addblank(menu, slot=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a text line to a menu. Only available in amxmodx 1.8.1 and above.
|
* Adds a text line to a menu. Only available in amxmodx 1.8.1 and above.
|
||||||
*
|
*
|
||||||
* When using slot=1 this might break your menu. To achieve this functionality
|
* When using slot=1 this might break your menu. To achieve this functionality
|
||||||
* menu_addtext2 should be used.
|
* menu_addtext2 should be used.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param text Text to add.
|
* @param text Text to add.
|
||||||
* @param slot 1 (default) if the line should shift the numbering down.
|
* @param slot 1 (default) if the line should shift the numbering down.
|
||||||
* 0 if the line should be a visual shift only.
|
* 0 if the line should be a visual shift only.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
*/
|
*/
|
||||||
native menu_addtext(menu, const text[], slot=1);
|
native menu_addtext(menu, const text[], slot=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a blank line to a menu, always shifting the numbering down.
|
* Adds a blank line to a menu, always shifting the numbering down.
|
||||||
*
|
*
|
||||||
* This will add a special item to create a blank line. It will affect the menu
|
* This will add a special item to create a blank line. It will affect the menu
|
||||||
* item count and pagination. These items can be modified later but will ignore
|
* item count and pagination. These items can be modified later but will ignore
|
||||||
* access and item callback results.
|
* access and item callback results.
|
||||||
*
|
*
|
||||||
* Only available in 1.8.3 and above.
|
* Only available in 1.8.3 and above.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
*
|
*
|
||||||
* @return 1 on success, 0 on failure.
|
* @return 1 on success, 0 on failure.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
* Too many items on non-paginated menu (max is 10)
|
* Too many items on non-paginated menu (max is 10)
|
||||||
*/
|
*/
|
||||||
native menu_addblank2( menu );
|
native menu_addblank2( menu );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a text line to a menu, always shifting the numbering down.
|
* Adds a text line to a menu, always shifting the numbering down.
|
||||||
*
|
*
|
||||||
* This will add a special item to create a blank line. It will affect the menu
|
* This will add a special item to create a blank line. It will affect the menu
|
||||||
* item count and pagination. These items can be modified later but will ignore
|
* item count and pagination. These items can be modified later but will ignore
|
||||||
* access and item callback results.
|
* access and item callback results.
|
||||||
*
|
*
|
||||||
* Only available in 1.8.3 and above.
|
* Only available in 1.8.3 and above.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param text Text to add.
|
* @param text Text to add.
|
||||||
*
|
*
|
||||||
* @return 1 on success, 0 on failure.
|
* @return 1 on success, 0 on failure.
|
||||||
* @error Invalid menu resource.
|
* @error Invalid menu resource.
|
||||||
* Too many items on non-paginated menu (max is 10)
|
* Too many items on non-paginated menu (max is 10)
|
||||||
*/
|
*/
|
||||||
native menu_addtext2( menu, const text[] );
|
native menu_addtext2( menu, const text[] );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a menu property.
|
* Sets a menu property.
|
||||||
*
|
*
|
||||||
* @param menu Menu resource identifier.
|
* @param menu Menu resource identifier.
|
||||||
* @param prop MPROP_ constant.
|
* @param prop MPROP_ constant.
|
||||||
* @param ... Property parameters.
|
* @param ... Property parameters.
|
||||||
* @return 1 on success, 0 on failure.
|
* @return 1 on success, 0 on failure.
|
||||||
* @error Invalid menu resource or property.
|
* @error Invalid menu resource or property.
|
||||||
*/
|
*/
|
||||||
native menu_setprop(menu, prop, ...);
|
native menu_setprop(menu, prop, ...);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels a player's menu, effectively forcing the player to select MENU_EXIT.
|
* Cancels a player's menu, effectively forcing the player to select MENU_EXIT.
|
||||||
* The menu will still exist on their screen but any results are invalidated,
|
* The menu will still exist on their screen but any results are invalidated,
|
||||||
* and the callback is invoked.
|
* and the callback is invoked.
|
||||||
*
|
*
|
||||||
* @param player Client index.
|
* @param player Client index.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
* @error Invalid client index.
|
* @error Invalid client index.
|
||||||
*/
|
*/
|
||||||
native menu_cancel(player);
|
native menu_cancel(player);
|
||||||
|
|
|
@ -16,92 +16,92 @@
|
||||||
// C standard library, which uses the Quick Sort algorithm.
|
// C standard library, which uses the Quick Sort algorithm.
|
||||||
// For more info, see: http://linux.wku.edu/~lamonml/algor/sort/sort.html
|
// For more info, see: http://linux.wku.edu/~lamonml/algor/sort/sort.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined _sorting_included
|
#if defined _sorting_included
|
||||||
#endinput
|
#endinput
|
||||||
#endif
|
#endif
|
||||||
#define _sorting_included
|
#define _sorting_included
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains sorting orders.
|
* Contains sorting orders.
|
||||||
*/
|
*/
|
||||||
enum SortMethod
|
enum SortMethod
|
||||||
{
|
{
|
||||||
Sort_Ascending = 0,
|
Sort_Ascending = 0,
|
||||||
Sort_Descending,
|
Sort_Descending,
|
||||||
Sort_Random,
|
Sort_Random,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data types for ADT Array Sorts
|
* Data types for ADT Array Sorts
|
||||||
*/
|
*/
|
||||||
enum SortType
|
enum SortType
|
||||||
{
|
{
|
||||||
Sort_Integer = 0,
|
Sort_Integer = 0,
|
||||||
Sort_Float,
|
Sort_Float,
|
||||||
Sort_String,
|
Sort_String,
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Basic sorting functions below.
|
* Basic sorting functions below.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
native SortIntegers(array[], array_size, SortMethod:order = Sort_Ascending);
|
native SortIntegers(array[], array_size, SortMethod:order = Sort_Ascending);
|
||||||
|
|
||||||
native SortFloats(Float:array[], array_size, SortMethod:order = Sort_Ascending);
|
native SortFloats(Float:array[], array_size, SortMethod:order = Sort_Ascending);
|
||||||
|
|
||||||
native SortStrings(array[][], num_strings, SortMethod:order = Sort_Ascending);
|
native SortStrings(array[][], num_strings, SortMethod:order = Sort_Ascending);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom sorting functions below.
|
* Custom sorting functions below.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts a custom 1D array. You must pass in a comparison function.
|
* Sorts a custom 1D array. You must pass in a comparison function.
|
||||||
* The sorting algorithm then uses your comparison function to sort the data.
|
* The sorting algorithm then uses your comparison function to sort the data.
|
||||||
* The function is called in the following manner:
|
* The function is called in the following manner:
|
||||||
*
|
*
|
||||||
* public MySortFunc(elem1, elem2, const array[], const data[], data_size)
|
* public MySortFunc(elem1, elem2, const array[], const data[], data_size)
|
||||||
*
|
*
|
||||||
* elem1, elem2 - Current element pair being compared
|
* elem1, elem2 - Current element pair being compared
|
||||||
* array[] - Array in its current mid-sorted state.
|
* array[] - Array in its current mid-sorted state.
|
||||||
* data[] - Extra data array you passed to the sort func.
|
* data[] - Extra data array you passed to the sort func.
|
||||||
* data_size - Size of extra data you passed to the sort func.
|
* data_size - Size of extra data you passed to the sort func.
|
||||||
*
|
*
|
||||||
* Your function should return:
|
* Your function should return:
|
||||||
* -1 if elem1 should go before elem2
|
* -1 if elem1 should go before elem2
|
||||||
* 0 if elem1 and elem2 are equal
|
* 0 if elem1 and elem2 are equal
|
||||||
* 1 if elem1 should go after elem2
|
* 1 if elem1 should go after elem2
|
||||||
* Note that the parameters after elem2 are all optional and you do not need to specify them.
|
* Note that the parameters after elem2 are all optional and you do not need to specify them.
|
||||||
*/
|
*/
|
||||||
native SortCustom1D(array[], array_size, const comparefunc[], data[]="", data_size=0);
|
native SortCustom1D(array[], array_size, const comparefunc[], data[]="", data_size=0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts a custom 2D array.
|
* Sorts a custom 2D array.
|
||||||
* The sorting algorithm then uses your comparison function to sort the data.
|
* The sorting algorithm then uses your comparison function to sort the data.
|
||||||
* The function is called in the following manner:
|
* The function is called in the following manner:
|
||||||
*
|
*
|
||||||
* public MySortFunc(const elem1[], const elem2[], const array[], data[], data_size)
|
* public MySortFunc(const elem1[], const elem2[], const array[], data[], data_size)
|
||||||
*
|
*
|
||||||
* elem1[], elem2[] - Current element array pairs being compared
|
* elem1[], elem2[] - Current element array pairs being compared
|
||||||
* array[][] - Array in its currently being sorted state.
|
* array[][] - Array in its currently being sorted state.
|
||||||
* data[] - Extra data array you passed to the sort func.
|
* data[] - Extra data array you passed to the sort func.
|
||||||
* data_size - Size of extra data you passed to the sort func.
|
* data_size - Size of extra data you passed to the sort func.
|
||||||
*
|
*
|
||||||
* Your function should return:
|
* Your function should return:
|
||||||
* -1 if elem1[] should go before elem2[]
|
* -1 if elem1[] should go before elem2[]
|
||||||
* 0 if elem1[] and elem2 are equal[]
|
* 0 if elem1[] and elem2 are equal[]
|
||||||
* 1 if elem1[] should go after elem2[]
|
* 1 if elem1[] should go after elem2[]
|
||||||
* Note that the parameters after elem2[] are all optional and you do not need to specify them.
|
* Note that the parameters after elem2[] are all optional and you do not need to specify them.
|
||||||
*/
|
*/
|
||||||
native SortCustom2D(array[][], array_size, const comparefunc[], data[]="", data_size=0);
|
native SortCustom2D(array[][], array_size, const comparefunc[], data[]="", data_size=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort an ADT Array. Specify the type as Integer, Float, or String.
|
* Sort an ADT Array. Specify the type as Integer, Float, or String.
|
||||||
*
|
*
|
||||||
* @param array Array Handle to sort
|
* @param array Array Handle to sort
|
||||||
* @param order Sort order to use, same as other sorts.
|
* @param order Sort order to use, same as other sorts.
|
||||||
* @param type Data type stored in the ADT Array
|
* @param type Data type stored in the ADT Array
|
||||||
* @noreturn
|
* @noreturn
|
||||||
*/
|
*/
|
||||||
native SortADTArray(Array:array, SortMethod:order, SortType:type);
|
native SortADTArray(Array:array, SortMethod:order, SortType:type);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,126 +7,126 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
|
|
||||||
new __testnumber;
|
new __testnumber;
|
||||||
new errcount;
|
new errcount;
|
||||||
|
|
||||||
enum TestType
|
enum TestType
|
||||||
{
|
{
|
||||||
TT_Equal = 0,
|
TT_Equal = 0,
|
||||||
TT_LessThan,
|
TT_LessThan,
|
||||||
TT_GreaterThan,
|
TT_GreaterThan,
|
||||||
TT_LessThanEqual,
|
TT_LessThanEqual,
|
||||||
TT_GreaterThanEqual,
|
TT_GreaterThanEqual,
|
||||||
TT_NotEqual
|
TT_NotEqual
|
||||||
};
|
};
|
||||||
|
|
||||||
new TestWords[6][] = {
|
new TestWords[6][] = {
|
||||||
"==",
|
"==",
|
||||||
"<",
|
"<",
|
||||||
">",
|
">",
|
||||||
"<=",
|
"<=",
|
||||||
">=",
|
">=",
|
||||||
"!="
|
"!="
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stock test(A,B=0,TestType:Type=TT_Equal)
|
stock test(A,B=0,TestType:Type=TT_Equal)
|
||||||
{
|
{
|
||||||
++__testnumber;
|
++__testnumber;
|
||||||
|
|
||||||
new passed=0;
|
new passed=0;
|
||||||
|
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case TT_Equal: if (A==B) passed=1;
|
case TT_Equal: if (A==B) passed=1;
|
||||||
case TT_LessThan: if (A<B) passed=1;
|
case TT_LessThan: if (A<B) passed=1;
|
||||||
case TT_GreaterThan: if (A>B) passed=1;
|
case TT_GreaterThan: if (A>B) passed=1;
|
||||||
case TT_LessThanEqual: if (A<=B) passed=1;
|
case TT_LessThanEqual: if (A<=B) passed=1;
|
||||||
case TT_GreaterThanEqual: if (A>=B) passed=1;
|
case TT_GreaterThanEqual: if (A>=B) passed=1;
|
||||||
case TT_NotEqual: if (A!=B) passed=1;
|
case TT_NotEqual: if (A!=B) passed=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!passed)
|
if (!passed)
|
||||||
{
|
{
|
||||||
log_amx("Failed test #%d (%d %s %d)",__testnumber,A,TestWords[_:Type],B);
|
log_amx("Failed test #%d (%d %s %d)",__testnumber,A,TestWords[_:Type],B);
|
||||||
errcount++;
|
errcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_srvcmd("testadmins","testadmins");
|
register_srvcmd("testadmins","testadmins");
|
||||||
}
|
}
|
||||||
public testadmins()
|
public testadmins()
|
||||||
{
|
{
|
||||||
|
|
||||||
new AuthData[44];
|
new AuthData[44];
|
||||||
new Password[32];
|
new Password[32];
|
||||||
new Access;
|
new Access;
|
||||||
new Flags;
|
new Flags;
|
||||||
new id;
|
new id;
|
||||||
|
|
||||||
__testnumber=0;
|
__testnumber=0;
|
||||||
errcount=0;
|
errcount=0;
|
||||||
|
|
||||||
|
|
||||||
test(admins_num(),0);
|
test(admins_num(),0);
|
||||||
|
|
||||||
admins_push("STEAM_0:1:23456","",read_flags("abcdefghijklmnopqrstu"),read_flags("ce"));
|
admins_push("STEAM_0:1:23456","",read_flags("abcdefghijklmnopqrstu"),read_flags("ce"));
|
||||||
|
|
||||||
test(admins_num(),1);
|
test(admins_num(),1);
|
||||||
|
|
||||||
admins_push("ABCDEFGHIJKLMNOP","abcdefghijklmnop",read_flags("z"),read_flags("a"));
|
admins_push("ABCDEFGHIJKLMNOP","abcdefghijklmnop",read_flags("z"),read_flags("a"));
|
||||||
|
|
||||||
test(admins_num(),2);
|
test(admins_num(),2);
|
||||||
|
|
||||||
admins_push("ZYXWVUTSRQPONMLKJIHGFEDCBA","plop",read_flags("a"),read_flags("b"));
|
admins_push("ZYXWVUTSRQPONMLKJIHGFEDCBA","plop",read_flags("a"),read_flags("b"));
|
||||||
|
|
||||||
test(admins_num(),3);
|
test(admins_num(),3);
|
||||||
|
|
||||||
id=0;
|
id=0;
|
||||||
|
|
||||||
admins_lookup(id,AdminProp_Auth,AuthData,sizeof(AuthData)-1);
|
admins_lookup(id,AdminProp_Auth,AuthData,sizeof(AuthData)-1);
|
||||||
admins_lookup(id,AdminProp_Password,Password,sizeof(Password)-1);
|
admins_lookup(id,AdminProp_Password,Password,sizeof(Password)-1);
|
||||||
Access=admins_lookup(id,AdminProp_Access);
|
Access=admins_lookup(id,AdminProp_Access);
|
||||||
Flags=admins_lookup(id,AdminProp_Flags);
|
Flags=admins_lookup(id,AdminProp_Flags);
|
||||||
|
|
||||||
test(strcmp(AuthData,"STEAM_0:1:23456"),0);
|
test(strcmp(AuthData,"STEAM_0:1:23456"),0);
|
||||||
test(strcmp(Password,""),0);
|
test(strcmp(Password,""),0);
|
||||||
test(Access,read_flags("abcdefghijklmnopqrstu"));
|
test(Access,read_flags("abcdefghijklmnopqrstu"));
|
||||||
test(Flags,read_flags("ce"));
|
test(Flags,read_flags("ce"));
|
||||||
|
|
||||||
id++;
|
id++;
|
||||||
|
|
||||||
admins_lookup(id,AdminProp_Auth,AuthData,sizeof(AuthData)-1);
|
admins_lookup(id,AdminProp_Auth,AuthData,sizeof(AuthData)-1);
|
||||||
admins_lookup(id,AdminProp_Password,Password,sizeof(Password)-1);
|
admins_lookup(id,AdminProp_Password,Password,sizeof(Password)-1);
|
||||||
Access=admins_lookup(id,AdminProp_Access);
|
Access=admins_lookup(id,AdminProp_Access);
|
||||||
Flags=admins_lookup(id,AdminProp_Flags);
|
Flags=admins_lookup(id,AdminProp_Flags);
|
||||||
|
|
||||||
test(strcmp(AuthData,"ABCDEFGHIJKLMNOP"),0);
|
test(strcmp(AuthData,"ABCDEFGHIJKLMNOP"),0);
|
||||||
test(strcmp(Password,"abcdefghijklmnop"),0);
|
test(strcmp(Password,"abcdefghijklmnop"),0);
|
||||||
test(Access,read_flags("z"));
|
test(Access,read_flags("z"));
|
||||||
test(Flags,read_flags("a"));
|
test(Flags,read_flags("a"));
|
||||||
|
|
||||||
id++;
|
id++;
|
||||||
|
|
||||||
admins_lookup(id,AdminProp_Auth,AuthData,sizeof(AuthData)-1);
|
admins_lookup(id,AdminProp_Auth,AuthData,sizeof(AuthData)-1);
|
||||||
admins_lookup(id,AdminProp_Password,Password,sizeof(Password)-1);
|
admins_lookup(id,AdminProp_Password,Password,sizeof(Password)-1);
|
||||||
Access=admins_lookup(id,AdminProp_Access);
|
Access=admins_lookup(id,AdminProp_Access);
|
||||||
Flags=admins_lookup(id,AdminProp_Flags);
|
Flags=admins_lookup(id,AdminProp_Flags);
|
||||||
|
|
||||||
test(strcmp(AuthData,"ZYXWVUTSRQPONMLKJIHGFEDCBA"),0);
|
test(strcmp(AuthData,"ZYXWVUTSRQPONMLKJIHGFEDCBA"),0);
|
||||||
test(strcmp(Password,"plop"),0);
|
test(strcmp(Password,"plop"),0);
|
||||||
test(Access,read_flags("a"));
|
test(Access,read_flags("a"));
|
||||||
test(Flags,read_flags("b"));
|
test(Flags,read_flags("b"));
|
||||||
|
|
||||||
admins_flush();
|
admins_flush();
|
||||||
|
|
||||||
test(admins_num(),0);
|
test(admins_num(),0);
|
||||||
|
|
||||||
server_print("test complete, %d errors",errcount);
|
server_print("test complete, %d errors",errcount);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,63 +7,63 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_plugin("callfunc test", "1.0", "BAILOPAN")
|
register_plugin("callfunc test", "1.0", "BAILOPAN")
|
||||||
|
|
||||||
register_srvcmd("test_callfunc", "Command_Callfunc")
|
register_srvcmd("test_callfunc", "Command_Callfunc")
|
||||||
}
|
}
|
||||||
|
|
||||||
public OnCallfuncReceived(num, str[], &val, array[], array2[], size, hello2[1])
|
public OnCallfuncReceived(num, str[], &val, array[], array2[], size, hello2[1])
|
||||||
{
|
{
|
||||||
server_print("num = %d (expected: %d)", num, 5)
|
server_print("num = %d (expected: %d)", num, 5)
|
||||||
server_print("str[] = ^"%s^" (expected: %s)", str, "Gaben")
|
server_print("str[] = ^"%s^" (expected: %s)", str, "Gaben")
|
||||||
|
|
||||||
server_print("val = %d (expected %d, setting to %d)", val, 62, 15)
|
server_print("val = %d (expected %d, setting to %d)", val, 62, 15)
|
||||||
val = 15
|
val = 15
|
||||||
server_print("printing %d elements of array[] (expected: %d)", size, 6)
|
server_print("printing %d elements of array[] (expected: %d)", size, 6)
|
||||||
for (new i=0; i<size; i++)
|
for (new i=0; i<size; i++)
|
||||||
{
|
{
|
||||||
server_print("array[%d] = %d (expected: %d)", i, array[i], i)
|
server_print("array[%d] = %d (expected: %d)", i, array[i], i)
|
||||||
}
|
}
|
||||||
for (new i=0; i<size; i++)
|
for (new i=0; i<size; i++)
|
||||||
{
|
{
|
||||||
server_print("array2[%d] = %d (expected: %d)", i, array[i], i)
|
server_print("array2[%d] = %d (expected: %d)", i, array[i], i)
|
||||||
}
|
}
|
||||||
array[0] = 5
|
array[0] = 5
|
||||||
array2[1] = 6
|
array2[1] = 6
|
||||||
hello2[0] = 25
|
hello2[0] = 25
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_Callfunc()
|
public Command_Callfunc()
|
||||||
{
|
{
|
||||||
new a = 62
|
new a = 62
|
||||||
new hello[] = {0,1,2,3,4,5}
|
new hello[] = {0,1,2,3,4,5}
|
||||||
new hello2[] = {9}
|
new hello2[] = {9}
|
||||||
new pm = 6
|
new pm = 6
|
||||||
new err
|
new err
|
||||||
|
|
||||||
if ((err=callfunc_begin("OnCallfuncReceived")) < 1)
|
if ((err=callfunc_begin("OnCallfuncReceived")) < 1)
|
||||||
{
|
{
|
||||||
server_print("Failed to call callfunc_begin()! Error: %d", err)
|
server_print("Failed to call callfunc_begin()! Error: %d", err)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
callfunc_push_int(5)
|
callfunc_push_int(5)
|
||||||
callfunc_push_str("Gaben")
|
callfunc_push_str("Gaben")
|
||||||
callfunc_push_intrf(a)
|
callfunc_push_intrf(a)
|
||||||
callfunc_push_array(hello, pm)
|
callfunc_push_array(hello, pm)
|
||||||
callfunc_push_array(hello, pm)
|
callfunc_push_array(hello, pm)
|
||||||
callfunc_push_int(pm)
|
callfunc_push_int(pm)
|
||||||
callfunc_push_array(hello2, 1, false)
|
callfunc_push_array(hello2, 1, false)
|
||||||
callfunc_end()
|
callfunc_end()
|
||||||
|
|
||||||
server_print("a = %d (expected: %d)", a, 15)
|
server_print("a = %d (expected: %d)", a, 15)
|
||||||
server_print("hello[0] = %d (expected: %d)", hello[0], 5)
|
server_print("hello[0] = %d (expected: %d)", hello[0], 5)
|
||||||
server_print("hello[1] = %d (expected: %d)", hello[1], 6)
|
server_print("hello[1] = %d (expected: %d)", hello[1], 6)
|
||||||
server_print("hello2[0] = %d (expected: %d)", hello2[0], 9)
|
server_print("hello2[0] = %d (expected: %d)", hello2[0], 9)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,21 +7,21 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
#include <fakemeta>
|
#include <fakemeta>
|
||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_plugin("Fakemeta Tests", "1.0", "BAILOPAN")
|
register_plugin("Fakemeta Tests", "1.0", "BAILOPAN")
|
||||||
register_forward(FM_ServerDeactivate, "Hook_ServerDeactivate")
|
register_forward(FM_ServerDeactivate, "Hook_ServerDeactivate")
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hook_ServerDeactivate()
|
public Hook_ServerDeactivate()
|
||||||
{
|
{
|
||||||
server_print("[FAKEMETA TEST] ServerDeactivate() at %f", get_gametime())
|
server_print("[FAKEMETA TEST] ServerDeactivate() at %f", get_gametime())
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_end()
|
public plugin_end()
|
||||||
{
|
{
|
||||||
server_print("[FAKEMETA TEST] plugin_end() at %f", get_gametime())
|
server_print("[FAKEMETA TEST] plugin_end() at %f", get_gametime())
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,61 +7,61 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_plugin("Format Test", "1.0", "BAILOPAN")
|
register_plugin("Format Test", "1.0", "BAILOPAN")
|
||||||
|
|
||||||
register_srvcmd("test_format", "Command_TestFormat")
|
register_srvcmd("test_format", "Command_TestFormat")
|
||||||
register_srvcmd("test_replace", "Command_TestReplace")
|
register_srvcmd("test_replace", "Command_TestReplace")
|
||||||
}
|
}
|
||||||
|
|
||||||
public gabprint(const fmt[], ...)
|
public gabprint(const fmt[], ...)
|
||||||
{
|
{
|
||||||
static buffer[2048]
|
static buffer[2048]
|
||||||
vformat(buffer, 2047, fmt, 2)
|
vformat(buffer, 2047, fmt, 2)
|
||||||
|
|
||||||
server_print("%s", buffer)
|
server_print("%s", buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestFormat()
|
public Command_TestFormat()
|
||||||
{
|
{
|
||||||
server_print("Printing -1 with d: %d", -1)
|
server_print("Printing -1 with d: %d", -1)
|
||||||
server_print("Printing -1 with u: %u", -1)
|
server_print("Printing -1 with u: %u", -1)
|
||||||
server_print("Printing (1<<31) with d: %d", (1<<31))
|
server_print("Printing (1<<31) with d: %d", (1<<31))
|
||||||
server_print("Printing (1<<31) with u: %u", (1<<31))
|
server_print("Printing (1<<31) with u: %u", (1<<31))
|
||||||
server_print("Printing 1 with d: %d", 1)
|
server_print("Printing 1 with d: %d", 1)
|
||||||
server_print("Printing 1 with u: %u", 1)
|
server_print("Printing 1 with u: %u", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestReplace()
|
public Command_TestReplace()
|
||||||
{
|
{
|
||||||
new message[192] = "^"@test^""
|
new message[192] = "^"@test^""
|
||||||
|
|
||||||
replace_all(message, 191, "^"", "")
|
replace_all(message, 191, "^"", "")
|
||||||
server_print("Got: %s (expected: %s)", message, "@test")
|
server_print("Got: %s (expected: %s)", message, "@test")
|
||||||
|
|
||||||
copy(message, 191, "test")
|
copy(message, 191, "test")
|
||||||
replace_all(message, 191, "t", "tt")
|
replace_all(message, 191, "t", "tt")
|
||||||
server_print("Got: %s (expected: %s)", message, "ttestt")
|
server_print("Got: %s (expected: %s)", message, "ttestt")
|
||||||
|
|
||||||
replace_all(message, 191, "tt", "")
|
replace_all(message, 191, "tt", "")
|
||||||
server_print("Got: %s (expected: %s)", message, "es")
|
server_print("Got: %s (expected: %s)", message, "es")
|
||||||
|
|
||||||
copy(message, 191, "good boys do fine always")
|
copy(message, 191, "good boys do fine always")
|
||||||
replace_all(message, 191, " ", "-----")
|
replace_all(message, 191, " ", "-----")
|
||||||
server_print("Got %s (expected: %s)", message, "good-----boys-----do-----fine-----always")
|
server_print("Got %s (expected: %s)", message, "good-----boys-----do-----fine-----always")
|
||||||
|
|
||||||
copy(message, 191, "-----")
|
copy(message, 191, "-----")
|
||||||
replace_all(message, 191, "-", "")
|
replace_all(message, 191, "-", "")
|
||||||
server_print("Got ^"%s%^" (expected: ^"%s%^")", message, "")
|
server_print("Got ^"%s%^" (expected: ^"%s%^")", message, "")
|
||||||
|
|
||||||
copy(message, 191, "-----")
|
copy(message, 191, "-----")
|
||||||
replace_all(message, 191, "--", "")
|
replace_all(message, 191, "--", "")
|
||||||
server_print("Got ^"%s%^" (expected: ^"%s%^")", message, "-")
|
server_print("Got ^"%s%^" (expected: ^"%s%^")", message, "-")
|
||||||
|
|
||||||
copy(message, 191, "aaaa")
|
copy(message, 191, "aaaa")
|
||||||
replace_all(message, 191, "a", "Aaa")
|
replace_all(message, 191, "a", "Aaa")
|
||||||
server_print("Got %s (expected: %s)", message, "AaaAaaAaaAaa")
|
server_print("Got %s (expected: %s)", message, "AaaAaaAaaAaa")
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,48 +7,48 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
|
|
||||||
new g_BlockLog
|
new g_BlockLog
|
||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_plugin("Log Tester", "1.0", "BAILOPAN")
|
register_plugin("Log Tester", "1.0", "BAILOPAN")
|
||||||
register_srvcmd("log_addlogevent", "Command_AddLogEvent")
|
register_srvcmd("log_addlogevent", "Command_AddLogEvent")
|
||||||
register_srvcmd("log_setblock", "Command_LogSetBlock")
|
register_srvcmd("log_setblock", "Command_LogSetBlock")
|
||||||
}
|
}
|
||||||
|
|
||||||
public event_round_start()
|
public event_round_start()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_LogSetBlock()
|
public Command_LogSetBlock()
|
||||||
{
|
{
|
||||||
if (read_argc() < 2)
|
if (read_argc() < 2)
|
||||||
{
|
{
|
||||||
server_print("Specify 1 or 0.")
|
server_print("Specify 1 or 0.")
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
new temp[12]
|
new temp[12]
|
||||||
read_argv(1, temp, 11)
|
read_argv(1, temp, 11)
|
||||||
|
|
||||||
g_BlockLog = str_to_num(temp) ? true : false
|
g_BlockLog = str_to_num(temp) ? true : false
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_log()
|
public plugin_log()
|
||||||
{
|
{
|
||||||
server_print("Got log event! Blocking: %d", g_BlockLog)
|
server_print("Got log event! Blocking: %d", g_BlockLog)
|
||||||
|
|
||||||
return g_BlockLog ? PLUGIN_HANDLED : PLUGIN_CONTINUE
|
return g_BlockLog ? PLUGIN_HANDLED : PLUGIN_CONTINUE
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_AddLogEvent(id)
|
public Command_AddLogEvent(id)
|
||||||
{
|
{
|
||||||
register_logevent("event_round_start", 2, "0=World triggered", "1=Round_Start")
|
register_logevent("event_round_start", 2, "0=World triggered", "1=Round_Start")
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,34 +7,34 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
|
|
||||||
native Factorial(num)
|
native Factorial(num)
|
||||||
|
|
||||||
public __Factorial(id, num)
|
public __Factorial(id, num)
|
||||||
{
|
{
|
||||||
new num = get_param(1)
|
new num = get_param(1)
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
{
|
{
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
return num * Factorial(num - 1)
|
return num * Factorial(num - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_natives()
|
public plugin_natives()
|
||||||
{
|
{
|
||||||
register_native("Factorial", "__Factorial")
|
register_native("Factorial", "__Factorial")
|
||||||
}
|
}
|
||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_plugin("Native Test", "1.0", "BAILOPAN")
|
register_plugin("Native Test", "1.0", "BAILOPAN")
|
||||||
register_srvcmd("test_native1", "Command_TestNative1")
|
register_srvcmd("test_native1", "Command_TestNative1")
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestNative1()
|
public Command_TestNative1()
|
||||||
{
|
{
|
||||||
new num = Factorial(6)
|
new num = Factorial(6)
|
||||||
server_print("Factorial of 6 is: %d", num)
|
server_print("Factorial of 6 is: %d", num)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,23 +7,23 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
#include <nvault>
|
#include <nvault>
|
||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_plugin("nVault Test", "1.0", "BAILOPAN")
|
register_plugin("nVault Test", "1.0", "BAILOPAN")
|
||||||
|
|
||||||
register_srvcmd("test_nvault", "Command_TestNvault")
|
register_srvcmd("test_nvault", "Command_TestNvault")
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestNvault()
|
public Command_TestNvault()
|
||||||
{
|
{
|
||||||
new v = nvault_open("://:/1/R!?#@41345$%:$")
|
new v = nvault_open("://:/1/R!?#@41345$%:$")
|
||||||
server_print("Vault value: %d (expected: %d)", v, -1)
|
server_print("Vault value: %d (expected: %d)", v, -1)
|
||||||
|
|
||||||
if (v != -1)
|
if (v != -1)
|
||||||
{
|
{
|
||||||
nvault_close(v)
|
nvault_close(v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,294 +7,294 @@
|
||||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||||
// https://alliedmods.net/amxmodx-license
|
// https://alliedmods.net/amxmodx-license
|
||||||
|
|
||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
|
|
||||||
public plugin_init()
|
public plugin_init()
|
||||||
{
|
{
|
||||||
register_plugin("Sort Test", "1.0", "BAILOPAN")
|
register_plugin("Sort Test", "1.0", "BAILOPAN")
|
||||||
|
|
||||||
register_srvcmd("test_sort_ints", "Command_TestSortInts")
|
register_srvcmd("test_sort_ints", "Command_TestSortInts")
|
||||||
register_srvcmd("test_sort_floats", "Command_TestSortFloats")
|
register_srvcmd("test_sort_floats", "Command_TestSortFloats")
|
||||||
register_srvcmd("test_sort_strings", "Command_TestSortStrings")
|
register_srvcmd("test_sort_strings", "Command_TestSortStrings")
|
||||||
register_srvcmd("test_sort_1d", "Command_TestSort1D")
|
register_srvcmd("test_sort_1d", "Command_TestSort1D")
|
||||||
register_srvcmd("test_sort_2d", "Command_TestSort2D")
|
register_srvcmd("test_sort_2d", "Command_TestSort2D")
|
||||||
register_srvcmd("test_adtsort_ints", "Command_TestSortADTInts")
|
register_srvcmd("test_adtsort_ints", "Command_TestSortADTInts")
|
||||||
register_srvcmd("test_adtsort_floats", "Command_TestSortADTFloats")
|
register_srvcmd("test_adtsort_floats", "Command_TestSortADTFloats")
|
||||||
register_srvcmd("test_adtsort_strings", "Command_TestSortADTStrings")
|
register_srvcmd("test_adtsort_strings", "Command_TestSortADTStrings")
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************
|
/*****************
|
||||||
* INTEGER TESTS *
|
* INTEGER TESTS *
|
||||||
*****************/
|
*****************/
|
||||||
// Note that integer comparison is just int1-int2 (or a variation therein)
|
// Note that integer comparison is just int1-int2 (or a variation therein)
|
||||||
|
|
||||||
PrintIntegers(const array[], size)
|
PrintIntegers(const array[], size)
|
||||||
{
|
{
|
||||||
for (new i=0; i<size; i++)
|
for (new i=0; i<size; i++)
|
||||||
{
|
{
|
||||||
server_print("array[%d] = %d", i, array[i])
|
server_print("array[%d] = %d", i, array[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestSortInts()
|
public Command_TestSortInts()
|
||||||
{
|
{
|
||||||
new array[10] = {6, 7, 3, 2, 8, 5, 0, 1, 4, 9}
|
new array[10] = {6, 7, 3, 2, 8, 5, 0, 1, 4, 9}
|
||||||
|
|
||||||
server_print("Testing ascending sort:")
|
server_print("Testing ascending sort:")
|
||||||
SortIntegers(array, 10, Sort_Ascending)
|
SortIntegers(array, 10, Sort_Ascending)
|
||||||
PrintIntegers(array, 10)
|
PrintIntegers(array, 10)
|
||||||
|
|
||||||
server_print("Testing descending sort:")
|
server_print("Testing descending sort:")
|
||||||
SortIntegers(array, 10, Sort_Descending)
|
SortIntegers(array, 10, Sort_Descending)
|
||||||
PrintIntegers(array, 10)
|
PrintIntegers(array, 10)
|
||||||
|
|
||||||
server_print("Testing random sort:")
|
server_print("Testing random sort:")
|
||||||
SortIntegers(array, 10, Sort_Random)
|
SortIntegers(array, 10, Sort_Random)
|
||||||
PrintIntegers(array, 10)
|
PrintIntegers(array, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
* Float comparison tests *
|
* Float comparison tests *
|
||||||
**************************/
|
**************************/
|
||||||
|
|
||||||
PrintFloats(const Float:array[], size)
|
PrintFloats(const Float:array[], size)
|
||||||
{
|
{
|
||||||
for (new i=0; i<size; i++)
|
for (new i=0; i<size; i++)
|
||||||
{
|
{
|
||||||
server_print("array[%d] = %f", i, array[i])
|
server_print("array[%d] = %f", i, array[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestSortFloats()
|
public Command_TestSortFloats()
|
||||||
{
|
{
|
||||||
new Float:array[10] = {6.3, 7.6, 3.2, 2.1, 8.5, 5.2, 0.4, 1.7, 4.8, 8.2}
|
new Float:array[10] = {6.3, 7.6, 3.2, 2.1, 8.5, 5.2, 0.4, 1.7, 4.8, 8.2}
|
||||||
|
|
||||||
server_print("Testing ascending sort:")
|
server_print("Testing ascending sort:")
|
||||||
SortFloats(array, 10, Sort_Ascending)
|
SortFloats(array, 10, Sort_Ascending)
|
||||||
PrintFloats(array, 10)
|
PrintFloats(array, 10)
|
||||||
|
|
||||||
server_print("Testing descending sort:")
|
server_print("Testing descending sort:")
|
||||||
SortFloats(array, 10, Sort_Descending)
|
SortFloats(array, 10, Sort_Descending)
|
||||||
PrintFloats(array, 10)
|
PrintFloats(array, 10)
|
||||||
|
|
||||||
server_print("Testing random sort:")
|
server_print("Testing random sort:")
|
||||||
SortFloats(array, 10, Sort_Random)
|
SortFloats(array, 10, Sort_Random)
|
||||||
PrintFloats(array, 10)
|
PrintFloats(array, 10)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public Custom1DSort(Float:elem1, Float:elem2)
|
public Custom1DSort(Float:elem1, Float:elem2)
|
||||||
{
|
{
|
||||||
if (elem1 > elem2)
|
if (elem1 > elem2)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
} else if (elem1 < elem2) {
|
} else if (elem1 < elem2) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestSort1D()
|
public Command_TestSort1D()
|
||||||
{
|
{
|
||||||
new Float:array[10] = {6.3, 7.6, 3.2, 2.1, 8.5, 5.2, 0.4, 1.7, 4.8, 8.2}
|
new Float:array[10] = {6.3, 7.6, 3.2, 2.1, 8.5, 5.2, 0.4, 1.7, 4.8, 8.2}
|
||||||
|
|
||||||
SortCustom1D(_:array, 10, "Custom1DSort")
|
SortCustom1D(_:array, 10, "Custom1DSort")
|
||||||
PrintFloats(array, 10)
|
PrintFloats(array, 10)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************
|
/***************************
|
||||||
* String comparison tests *
|
* String comparison tests *
|
||||||
***************************/
|
***************************/
|
||||||
|
|
||||||
PrintStrings(const array[][], size)
|
PrintStrings(const array[][], size)
|
||||||
{
|
{
|
||||||
for (new i=0; i<size; i++)
|
for (new i=0; i<size; i++)
|
||||||
{
|
{
|
||||||
server_print("array[%d] = %s", i, array[i])
|
server_print("array[%d] = %s", i, array[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestSortStrings()
|
public Command_TestSortStrings()
|
||||||
{
|
{
|
||||||
new array[][] =
|
new array[][] =
|
||||||
{
|
{
|
||||||
"faluco",
|
"faluco",
|
||||||
"bailopan",
|
"bailopan",
|
||||||
"pm onoto",
|
"pm onoto",
|
||||||
"damaged soul",
|
"damaged soul",
|
||||||
"sniperbeamer",
|
"sniperbeamer",
|
||||||
"sidluke",
|
"sidluke",
|
||||||
"johnny got his gun",
|
"johnny got his gun",
|
||||||
"gabe newell",
|
"gabe newell",
|
||||||
"hello",
|
"hello",
|
||||||
"WHAT?!"
|
"WHAT?!"
|
||||||
}
|
}
|
||||||
|
|
||||||
server_print("Testing ascending sort:")
|
server_print("Testing ascending sort:")
|
||||||
SortStrings(array, 10, Sort_Ascending)
|
SortStrings(array, 10, Sort_Ascending)
|
||||||
PrintStrings(array, 10)
|
PrintStrings(array, 10)
|
||||||
|
|
||||||
server_print("Testing descending sort:")
|
server_print("Testing descending sort:")
|
||||||
SortStrings(array, 10, Sort_Descending)
|
SortStrings(array, 10, Sort_Descending)
|
||||||
PrintStrings(array, 10)
|
PrintStrings(array, 10)
|
||||||
|
|
||||||
server_print("Testing random sort:")
|
server_print("Testing random sort:")
|
||||||
SortStrings(array, 10, Sort_Random)
|
SortStrings(array, 10, Sort_Random)
|
||||||
PrintStrings(array, 10)
|
PrintStrings(array, 10)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
public Custom2DSort(const elem1[], const elem2[])
|
public Custom2DSort(const elem1[], const elem2[])
|
||||||
{
|
{
|
||||||
return strcmp(elem1, elem2)
|
return strcmp(elem1, elem2)
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestSort2D()
|
public Command_TestSort2D()
|
||||||
{
|
{
|
||||||
new array[][] =
|
new array[][] =
|
||||||
{
|
{
|
||||||
"faluco",
|
"faluco",
|
||||||
"bailopan",
|
"bailopan",
|
||||||
"pm onoto",
|
"pm onoto",
|
||||||
"damaged soul",
|
"damaged soul",
|
||||||
"sniperbeamer",
|
"sniperbeamer",
|
||||||
"sidluke",
|
"sidluke",
|
||||||
"johnny got his gun",
|
"johnny got his gun",
|
||||||
"gabe newell",
|
"gabe newell",
|
||||||
"hello",
|
"hello",
|
||||||
"WHAT?!"
|
"WHAT?!"
|
||||||
}
|
}
|
||||||
|
|
||||||
SortCustom2D(array, 10, "Custom2DSort")
|
SortCustom2D(array, 10, "Custom2DSort")
|
||||||
PrintStrings(array, 10)
|
PrintStrings(array, 10)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
* ADT ARRAY TESTS *
|
* ADT ARRAY TESTS *
|
||||||
*******************/
|
*******************/
|
||||||
// Int and floats work the same as normal comparisions. Strings are direct
|
// Int and floats work the same as normal comparisions. Strings are direct
|
||||||
// comparisions with no hacky memory stuff like Pawn arrays.
|
// comparisions with no hacky memory stuff like Pawn arrays.
|
||||||
|
|
||||||
PrintADTArrayIntegers(Array:array)
|
PrintADTArrayIntegers(Array:array)
|
||||||
{
|
{
|
||||||
new size = ArraySize(array);
|
new size = ArraySize(array);
|
||||||
for (new i=0; i<size;i++)
|
for (new i=0; i<size;i++)
|
||||||
{
|
{
|
||||||
server_print("array[%d] = %d", i, ArrayGetCell(array, i));
|
server_print("array[%d] = %d", i, ArrayGetCell(array, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestSortADTInts()
|
public Command_TestSortADTInts()
|
||||||
{
|
{
|
||||||
new Array:array = ArrayCreate();
|
new Array:array = ArrayCreate();
|
||||||
ArrayPushCell(array, 6);
|
ArrayPushCell(array, 6);
|
||||||
ArrayPushCell(array, 7);
|
ArrayPushCell(array, 7);
|
||||||
ArrayPushCell(array, 3);
|
ArrayPushCell(array, 3);
|
||||||
ArrayPushCell(array, 2);
|
ArrayPushCell(array, 2);
|
||||||
ArrayPushCell(array, 8);
|
ArrayPushCell(array, 8);
|
||||||
ArrayPushCell(array, 5);
|
ArrayPushCell(array, 5);
|
||||||
ArrayPushCell(array, 0);
|
ArrayPushCell(array, 0);
|
||||||
ArrayPushCell(array, 1);
|
ArrayPushCell(array, 1);
|
||||||
ArrayPushCell(array, 4);
|
ArrayPushCell(array, 4);
|
||||||
ArrayPushCell(array, 9);
|
ArrayPushCell(array, 9);
|
||||||
|
|
||||||
server_print("Testing ascending sort:")
|
server_print("Testing ascending sort:")
|
||||||
SortADTArray(array, Sort_Ascending, Sort_Integer)
|
SortADTArray(array, Sort_Ascending, Sort_Integer)
|
||||||
PrintADTArrayIntegers(array)
|
PrintADTArrayIntegers(array)
|
||||||
|
|
||||||
server_print("Testing descending sort:")
|
server_print("Testing descending sort:")
|
||||||
SortADTArray(array, Sort_Descending, Sort_Integer)
|
SortADTArray(array, Sort_Descending, Sort_Integer)
|
||||||
PrintADTArrayIntegers(array)
|
PrintADTArrayIntegers(array)
|
||||||
|
|
||||||
server_print("Testing random sort:")
|
server_print("Testing random sort:")
|
||||||
SortADTArray(array, Sort_Random, Sort_Integer)
|
SortADTArray(array, Sort_Random, Sort_Integer)
|
||||||
PrintADTArrayIntegers(array)
|
PrintADTArrayIntegers(array)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintADTArrayFloats(Array:array)
|
PrintADTArrayFloats(Array:array)
|
||||||
{
|
{
|
||||||
new size = ArraySize(array);
|
new size = ArraySize(array);
|
||||||
for (new i=0; i<size;i++)
|
for (new i=0; i<size;i++)
|
||||||
{
|
{
|
||||||
server_print("array[%d] = %f", i, Float:ArrayGetCell(array, i));
|
server_print("array[%d] = %f", i, Float:ArrayGetCell(array, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestSortADTFloats()
|
public Command_TestSortADTFloats()
|
||||||
{
|
{
|
||||||
new Array:array = ArrayCreate();
|
new Array:array = ArrayCreate();
|
||||||
ArrayPushCell(array, 6.0);
|
ArrayPushCell(array, 6.0);
|
||||||
ArrayPushCell(array, 7.0);
|
ArrayPushCell(array, 7.0);
|
||||||
ArrayPushCell(array, 3.0);
|
ArrayPushCell(array, 3.0);
|
||||||
ArrayPushCell(array, 2.0);
|
ArrayPushCell(array, 2.0);
|
||||||
ArrayPushCell(array, 8.0);
|
ArrayPushCell(array, 8.0);
|
||||||
ArrayPushCell(array, 5.0);
|
ArrayPushCell(array, 5.0);
|
||||||
ArrayPushCell(array, 0.0);
|
ArrayPushCell(array, 0.0);
|
||||||
ArrayPushCell(array, 1.0);
|
ArrayPushCell(array, 1.0);
|
||||||
ArrayPushCell(array, 4.0);
|
ArrayPushCell(array, 4.0);
|
||||||
ArrayPushCell(array, 9.0);
|
ArrayPushCell(array, 9.0);
|
||||||
|
|
||||||
server_print("Testing ascending sort:")
|
server_print("Testing ascending sort:")
|
||||||
SortADTArray(array, Sort_Ascending, Sort_Float)
|
SortADTArray(array, Sort_Ascending, Sort_Float)
|
||||||
PrintADTArrayFloats(array)
|
PrintADTArrayFloats(array)
|
||||||
|
|
||||||
server_print("Testing descending sort:")
|
server_print("Testing descending sort:")
|
||||||
SortADTArray(array, Sort_Descending, Sort_Float)
|
SortADTArray(array, Sort_Descending, Sort_Float)
|
||||||
PrintADTArrayFloats(array)
|
PrintADTArrayFloats(array)
|
||||||
|
|
||||||
server_print("Testing random sort:")
|
server_print("Testing random sort:")
|
||||||
SortADTArray(array, Sort_Random, Sort_Float)
|
SortADTArray(array, Sort_Random, Sort_Float)
|
||||||
PrintADTArrayFloats(array)
|
PrintADTArrayFloats(array)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintADTArrayStrings(Array:array)
|
PrintADTArrayStrings(Array:array)
|
||||||
{
|
{
|
||||||
new size = ArraySize(array);
|
new size = ArraySize(array);
|
||||||
new buffer[64];
|
new buffer[64];
|
||||||
for (new i=0; i<size;i++)
|
for (new i=0; i<size;i++)
|
||||||
{
|
{
|
||||||
ArrayGetString(array, i, buffer, sizeof(buffer));
|
ArrayGetString(array, i, buffer, sizeof(buffer));
|
||||||
server_print("array[%d] = %s", i, buffer);
|
server_print("array[%d] = %s", i, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command_TestSortADTStrings()
|
public Command_TestSortADTStrings()
|
||||||
{
|
{
|
||||||
new Array:array = ArrayCreate(64);
|
new Array:array = ArrayCreate(64);
|
||||||
ArrayPushString(array, "faluco");
|
ArrayPushString(array, "faluco");
|
||||||
ArrayPushString(array, "bailopan");
|
ArrayPushString(array, "bailopan");
|
||||||
ArrayPushString(array, "pm onoto");
|
ArrayPushString(array, "pm onoto");
|
||||||
ArrayPushString(array, "damaged soul");
|
ArrayPushString(array, "damaged soul");
|
||||||
ArrayPushString(array, "sniperbeamer");
|
ArrayPushString(array, "sniperbeamer");
|
||||||
ArrayPushString(array, "sidluke");
|
ArrayPushString(array, "sidluke");
|
||||||
ArrayPushString(array, "johnny got his gun");
|
ArrayPushString(array, "johnny got his gun");
|
||||||
ArrayPushString(array, "gabe newell");
|
ArrayPushString(array, "gabe newell");
|
||||||
ArrayPushString(array, "Hello pRED*");
|
ArrayPushString(array, "Hello pRED*");
|
||||||
ArrayPushString(array, "WHAT?!");
|
ArrayPushString(array, "WHAT?!");
|
||||||
|
|
||||||
server_print("Testing ascending sort:")
|
server_print("Testing ascending sort:")
|
||||||
SortADTArray(array, Sort_Ascending, Sort_String)
|
SortADTArray(array, Sort_Ascending, Sort_String)
|
||||||
PrintADTArrayStrings(array)
|
PrintADTArrayStrings(array)
|
||||||
|
|
||||||
server_print("Testing descending sort:")
|
server_print("Testing descending sort:")
|
||||||
SortADTArray(array, Sort_Descending, Sort_String)
|
SortADTArray(array, Sort_Descending, Sort_String)
|
||||||
PrintADTArrayStrings(array)
|
PrintADTArrayStrings(array)
|
||||||
|
|
||||||
server_print("Testing random sort:")
|
server_print("Testing random sort:")
|
||||||
SortADTArray(array, Sort_Random, Sort_String)
|
SortADTArray(array, Sort_Random, Sort_String)
|
||||||
PrintADTArrayStrings(array)
|
PrintADTArrayStrings(array)
|
||||||
|
|
||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user