🔥 Remove amxmod compatability

This doesn't remove anything from the engine
This commit is contained in:
xPaw 2014-06-05 13:48:56 +03:00
parent 08378eed4b
commit ae9315ad48
26 changed files with 16 additions and 2736 deletions

View File

@ -40,7 +40,5 @@ statsx.amxx ; stats on death or round end (CSX Module required!)
;miscstats.amxx ; bunch of events announcement for Counter-Strike
;stats_logging.amxx ; weapons stats logging (CSX Module required!)
; Enable to use AMX Mod plugins
;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
; Custom - Add 3rd party plugins here

View File

@ -39,7 +39,5 @@ statscfg.amxx ; allows to manage stats plugins via menu and commands
;statssounds.amxx ; precache plugin for stats plugins
;stats_logging.amxx ; weapons stats logging (DoD Module required!)
; Enable to use AMX Mod plugins
;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
; Custom - Add 3rd party plugins here

View File

@ -34,8 +34,6 @@ timeleft.amxx ; displays time left on map
pausecfg.amxx ; allows to pause and unpause some plugins
statscfg.amxx ; allows to manage stats plugins via menu and commands
; Enable to use AMX Mod plugins
;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
; Custom - Add 3rd party plugins here
EvolutionX.Core.amxx ; Adds extra plugin functions for Earth's Special Forces

View File

@ -38,7 +38,5 @@ idlekicker.amxx ; kicks idle players
nscommands.amxx ; extra commands for Natural-Selection
;unstuck.amxx ; Free stuck players (engine & ns modules required!)
; Enable to use AMX Mod plugins
;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
; Custom - Add 3rd party plugins here

View File

@ -34,8 +34,5 @@ timeleft.amxx ; displays time left on map
pausecfg.amxx ; allows to pause and unpause some plugins
statscfg.amxx ; allows to manage stats plugins via menu and commands
; Enable to use AMX Mod plugins
;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
; Custom - Add 3rd party plugins here

View File

@ -39,7 +39,5 @@ statscfg.amxx ; allows to manage stats plugins via menu and commands
;statssounds.amxx ; precache plugin for stats plugins
;stats_logging.amxx ; weapons stats logging (TFC Module required!)
; Enable to use AMX Mod plugins
;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
; Custom - Add 3rd party plugins here

View File

@ -39,7 +39,5 @@ statscfg.amxx ; allows to manage stats plugins via menu and commands
;statssounds.amxx ; precache plugin for stats plugins
;stats_logging.amxx ; weapons stats logging (TS Module required!)
; Enable to use AMX Mod plugins
;amxmod_compat.amxx ; AMX Mod backwards compatibility layer
; Custom - Add 3rd party plugins here

View File

@ -193,7 +193,6 @@ Section "MainSection" SEC01
File "installer\files\base\addons\amxmodx\plugins\adminslots.amxx"
File "installer\files\base\addons\amxmodx\plugins\adminvote.amxx"
File "installer\files\base\addons\amxmodx\plugins\admin_sql.amxx"
File "installer\files\base\addons\amxmodx\plugins\amxmod_compat.amxx"
File "installer\files\base\addons\amxmodx\plugins\antiflood.amxx"
File "installer\files\base\addons\amxmodx\plugins\cmdmenu.amxx"
File "installer\files\base\addons\amxmodx\plugins\imessage.amxx"
@ -285,16 +284,6 @@ Section "MainSection" SEC01
File "installer\files\base\addons\amxmodx\scripting\include\vault.inc"
File "installer\files\base\addons\amxmodx\scripting\include\vector.inc"
File "installer\files\base\addons\amxmodx\scripting\include\xs.inc"
SetOutPath "$INSTDIR\files\base\scripting\include\amxmod_compat"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\amxmod.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\maths.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\mysql.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\translator.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\Vexd_Utilities.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\VexdUM.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\VexdUM_const.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\VexdUM_stock.inc"
File "installer\files\base\addons\amxmodx\scripting\include\amxmod_compat\xtrafun.inc"
SetOutPath "$INSTDIR\files\base\scripting"
File "installer\files\base\addons\amxmodx\scripting\mapchooser.sma"
File "installer\files\base\addons\amxmodx\scripting\mapsmenu.sma"
@ -308,11 +297,6 @@ Section "MainSection" SEC01
File "installer\files\base\addons\amxmodx\scripting\statscfg.sma"
File "installer\files\base\addons\amxmodx\scripting\telemenu.sma"
File "installer\files\base\addons\amxmodx\scripting\timeleft.sma"
SetOutPath "$INSTDIR\files\base\scripting\amxmod_compat"
File "installer\files\base\addons\amxmodx\scripting\amxmod_compat\amxmod_compat.sma"
File "installer\files\base\addons\amxmodx\scripting\amxmod_compat\core.sma"
File "installer\files\base\addons\amxmodx\scripting\amxmod_compat\mysql.sma"
File "installer\files\base\addons\amxmodx\scripting\amxmod_compat\vexdum.sma"
SetOutPath "$INSTDIR\files\base\scripting\testsuite"
File "installer\files\base\addons\amxmodx\scripting\testsuite\admins_test.sma"
File "installer\files\base\addons\amxmodx\scripting\testsuite\arraytest.sma"
@ -637,15 +621,6 @@ Section Uninstall
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\testsuite\callfunc_test.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\testsuite\arraytest.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\testsuite\admins_test.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\xtrafun.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\VexdUM_stock.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\VexdUM_const.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\VexdUM.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\Vexd_Utilities.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\translator.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\mysql.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\maths.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat\amxmod.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\xtrafun.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\xs.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\Vexd_Utilities.inc"
@ -705,10 +680,6 @@ Section Uninstall
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmisc.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxconst.inc"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxmod_compat\amxmod_compat.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxmod_compat\core.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxmod_compat\mysql.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\amxmod_compat\vexdum.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\timeleft.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\telemenu.sma"
Delete "$INSTDIR\files\base\addons\amxmodx\scripting\statscfg.sma"
@ -909,9 +880,7 @@ Section Uninstall
RMDir "$INSTDIR\files\cstrike\modules"
RMDir "$INSTDIR\files\cstrike\data"
RMDir "$INSTDIR\files\cstrike\configs"
RMDir "$INSTDIR\files\base\addons\amxmodx\scripting\include\amxmod_compat"
RMDir "$INSTDIR\files\base\addons\amxmodx\scripting\include"
RMDir "$INSTDIR\files\base\addons\amxmodx\scripting\amxmod_compat"
RMDir "$INSTDIR\files\base\scripting"
RMDir "$INSTDIR\files\base\plugins"
RMDir "$INSTDIR\files\base\modules"

View File

@ -106,9 +106,3 @@ build_plugin(
amxx_file = 'admin_sql.amxx',
extra_argv = ['USING_SQL=1']
)
# amxmod_compat is multi-file.
build_plugin(
script_path = os.path.join(builder.currentSourcePath, 'amxmod_compat', 'amxmod_compat.sma'),
amxx_file = 'amxmod_compat.amxx'
)

View File

@ -1,75 +0,0 @@
/**
* AMX Mod Compatibility engine
* by the AMX Mod X Development Team
*/
#include <amxmodx>
#include <fun> //we want fun running for extra compatibility
#include <engine> //we want engine running for extra compatibility
#include <fakemeta>
#include <translator>
#define AMXMODX_NOAUTOLOAD
#include <cstrike>
#include <sqlx>
#define MOD_NORMAL 0
#define MOD_CSTRIKE 1
new g_ModType = MOD_NORMAL
new g_MaxPlayers
#include "core.sma"
#include "vexdum.sma"
#include "mysql.sma"
public plugin_init()
{
register_plugin("AMX Mod Compat Engine", "1.76.rc4", "AMXX Dev Team")
g_MaxPlayers = get_maxplayers()
VexdUM_Register()
}
public plugin_natives()
{
set_module_filter("Plugin_ModuleFilter")
set_native_filter("Plugin_NativeFilter")
new modname[32]
get_modname(modname, 31)
if (equali(modname, "cstrike") || equali(modname, "czero"))
{
g_ModType = MOD_CSTRIKE
}
Core_Natives()
VexdUM_Natives()
MySQL_Natives()
}
public Plugin_ModuleFilter(const module[])
{
if (equali(module, "sqlx") || equali(module, "cstrike"))
{
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public Plugin_NativeFilter(const name[], index, trap)
{
if (!trap)
{
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public client_connect(id)
{
VexdUM_ClientConnect(id)
}

View File

@ -1,301 +0,0 @@
/**
* AMX Mod Compatibility engine
* by the AMX Mod X Development Team
*/
Core_Natives()
{
/* implicit compatibility */
register_native("VelocityByAim", "__VelocityByAim")
register_native("load_translations", "__load_translations")
register_native("is_user_authorized", "__is_user_authorized")
register_native("get_user_money", "__get_user_money")
register_native("set_user_money", "__set_user_money")
register_native("angle_to_vector", "__angle_to_vector")
register_native("fabs", "__fabs")
register_native("asin", "__asin")
register_native("sin", "__sin")
register_native("sinh", "__sinh")
register_native("acos", "__acos")
register_native("cos", "__cos")
register_native("cosh", "__cosh")
register_native("atan", "__atan")
register_native("atan2", "__atan2")
register_native("tan", "__tan")
register_native("tanh", "__tanh")
register_native("fsqroot", "__fsqroot")
register_native("fpower", "__fpower")
register_native("flog", "__flog")
register_native("get_cmdaccess", "__get_cmdaccess")
register_native("is_translated", "__is_translated")
register_native("get_plugincmdsnum", "__get_plugincmdsnum")
register_native("get_plugincmd", "__get_plugincmd")
register_native("get_plugincvarsnum", "__get_plugincvarsnum")
register_native("get_plugincvar", "__get_plugincvar")
register_native("is_module_running", "__is_module_running")
register_native("is_plugin_running", "__is_plugin_running")
}
public __VelocityByAim(plid, num)
{
new iIndex
new iVelocity
new Float:vRetValue[3]
iIndex = get_param(1)
iVelocity = get_param(2)
new ret = velocity_by_aim(iIndex, iVelocity, vRetValue)
set_array_f(3, vRetValue, 3)
return ret
}
public __load_translations(plid, num)
{
static file[255]
get_string(1, file, 254)
return load_translations(file)
}
public __is_user_authorized(plid, num)
{
return is_user_authorized(get_param(1))
}
public __get_user_money(plid, num)
{
return get_user_money(get_param(1))
}
public __set_user_money(plid, num)
{
return set_user_money(get_param(1), get_param(2), get_param(3))
}
public __angle_to_vector(plid, num)
{
new Float:angle[3]
new Float:vRetValue[3]
get_array_f(1, angle, 3)
new ret = angle_vector(angle, get_param(2), vRetValue)
set_array_f(3, vRetValue, 3)
return ret
}
public Float:__fabs(plid, num)
{
new Float:value = get_param_f(1)
return floatabs(value)
}
public Float:__asin(plid, num)
{
new Float:value = get_param_f(1)
return floatasin(value, radian)
}
public Float:__sin(plid, num)
{
new Float:value = get_param_f(1)
return floatsin(value, radian)
}
public Float:__sinh(plid, num)
{
new Float:value = get_param_f(1)
return floatsinh(value, radian)
}
public Float:__acos(plid, num)
{
new Float:value = get_param_f(1)
return floatacos(value, radian)
}
public Float:__cos(plid, num)
{
new Float:value = get_param_f(1)
return floatcos(value, radian)
}
public Float:__cosh(plid, num)
{
new Float:value = get_param_f(1)
return floatcosh(value, radian)
}
public Float:__atan(plid, num)
{
new Float:value = get_param_f(1)
return floatatan(value, radian)
}
public Float:__atan2(plid, num)
{
new Float:value1 = get_param_f(1)
new Float:value2 = get_param_f(2)
return floatatan2(value1, value2, radian)
}
public Float:__tan(plid, num)
{
new Float:value = get_param_f(1)
return floattan(value, radian)
}
public Float:__tanh(plid, num)
{
new Float:value = get_param_f(1)
return floattanh(value, radian)
}
public Float:__fsqroot(plid, num)
{
new Float:value = get_param_f(1)
return floatsqroot(value)
}
public Float:__fpower(plid, num)
{
new Float:value = get_param_f(1)
new Float:exponent = get_param_f(2)
return floatpower(value, exponent)
}
public Float:__flog(plid, num)
{
new Float:value = get_param_f(1)
new Float:base = get_param_f(2)
return floatlog(value, base)
}
//get_cmdaccess(cmd[], accessflags[], len)
public __get_cmdaccess(plid, num)
{
static command[32], accessflags[32]
new ret
get_string(1, command, 31)
if ((ret=get_cmdaccess(command, accessflags, 31)))
{
set_string(2, accessflags, get_param(3))
}
return ret
}
public __is_translated(plid, num)
{
static string[512]
get_string(1, string, 511)
return is_translated(string)
}
public __get_plugincmdsnum(plid, num)
{
static plugin[64]
get_string(1, plugin, 63)
return get_plugincmdsnum(plugin, get_param(2))
}
public __get_plugincmd(plid, num)
{
static plugin[64]
static command[32]
static accessflags[32]
static info[512]
get_string(1, plugin, 63)
if (get_plugincmd(plugin,
get_param(2),
command,
31,
accessflags,
31,
info,
511,
get_param(9),
get_param(10)))
{
set_string(3, command, get_param(4))
set_string(5, accessflags, get_param(6))
set_string(7, info, get_param(8))
return 1
}
return 0
}
public __get_plugincvarsnum(plid, num)
{
static plugin[64]
get_string(1, plugin, 63)
return get_plugincvarsnum(plugin, get_param(2))
}
//stock get_plugincvar(plugin[], index, cvar[], len1, value[], len2, flags=0)
public __get_plugincvar(plid, num)
{
static plugin[64]
static cvar[32]
static value[512]
get_string(1, plugin, 63)
if (get_plugincvar(plugin, get_param(2), cvar, 31, value, 511, get_param(7)))
{
set_string(3, cvar, get_param(4))
set_string(5, value, get_param(6))
return 1
}
return 0
}
public __is_module_running(plid, num)
{
static module[64]
get_string(1, module, 63)
return is_module_running(module)
}
public __is_plugin_running(plid, num)
{
static plugin[64]
get_string(1, plugin, 63)
return is_plugin_running(plugin)
}

View File

@ -1,415 +0,0 @@
/**
* AMX Mod Compatibility engine
* by the AMX Mod X Development Team
*/
#define MAX_CONNECTIONS 64
new Connections[MAX_CONNECTIONS+1] = {0}
new ConnectionTracker[MAX_CONNECTIONS+1] = {0}
new ConnectionErrors[MAX_CONNECTIONS+1][255]
new ConnectionQueries[MAX_CONNECTIONS+1] = {0}
new QueryPositions[MAX_CONNECTIONS+1]
MySQL_Natives()
{
register_native("mysql_connect", "__mysql_connect")
register_native("mysql_query", "__mysql_query")
register_native("mysql_error", "__mysql_error")
register_native("mysql_close", "__mysql_close")
register_native("mysql_nextrow", "__mysql_nextrow")
register_native("mysql_getfield", "__mysql_getfield")
register_native("mysql_getresult", "__mysql_getresult")
register_native("mysql_affected_rows", "__mysql_affected_rows")
register_native("mysql_num_fields", "__mysql_num_fields")
register_native("mysql_num_rows", "__mysql_num_rows")
register_native("mysql_field_name", "__mysql_field_name")
register_native("mysql_insert_id", "__mysql_insert_id")
}
MakeConnectionIndex(Handle:cn)
{
if (ConnectionTracker[0])
{
new idx = ConnectionTracker[ConnectionTracker[0]]
ConnectionTracker[0]--
Connections[idx] = _:cn
return idx
} else {
Connections[0]++
if (Connections[0] > MAX_CONNECTIONS)
{
return 0
}
Connections[Connections[0]] = _:cn
return Connections[0]
}
return 0
}
Handle:GetConnectionIndex(idx)
{
if (idx < 1 || idx > MAX_CONNECTIONS || !Connections[idx])
{
return Empty_Handle
}
return Handle:Connections[idx]
}
FreeConnectionIndex(idx)
{
Connections[idx] = 0
ConnectionTracker[0]++
ConnectionTracker[ConnectionTracker[0]] = idx
ConnectionErrors[idx][0] = 0
ConnectionQueries[idx] = 0
QueryPositions[idx] = 0
}
/*
* Unlike the previous this does not check for a matching connection.
* Unless a plugin breaks I'm not going to take that step.
*/
public __mysql_connect(plid, num)
{
static host[255], user[128], pass[128], dbname[128], error[512]
new errcode
get_string(1, host, 254)
get_string(2, user, 127)
get_string(3, pass, 127)
get_string(4, dbname, 127)
new Handle:info = SQL_MakeDbTuple(host, user, pass, dbname)
new Handle:cn = SQL_Connect(info, errcode, error, 511)
if (cn == Empty_Handle)
{
set_string(5, error, get_param(6))
return 0
}
SQL_FreeHandle(info)
new idx = MakeConnectionIndex(cn)
if (idx == 0)
{
set_string(5, "Reached max unclosed connections", get_param(6))
return 0
}
ConnectionQueries[idx] = 0
return idx
}
public __mysql_query(plid, num)
{
static queryString[4096]
new cn_idx = get_param(1)
new Handle:cn
if ((cn=GetConnectionIndex(cn_idx)) == Empty_Handle)
{
return 0
}
vdformat(queryString, 4095, 2, 3)
new Handle:query = SQL_PrepareQuery(cn, "%s", queryString)
if (!SQL_Execute(query))
{
SQL_QueryError(query, ConnectionErrors[cn_idx], 254)
SQL_FreeHandle(query)
return 0
}
if (ConnectionQueries[cn_idx])
{
SQL_FreeHandle(Handle:ConnectionQueries[cn_idx])
}
ConnectionQueries[cn_idx] = _:query
QueryPositions[cn_idx] = 0
return 1
}
public __mysql_error(plid, num)
{
new cn_idx = get_param(1)
if (Connections[cn_idx] < 1)
{
static error[255]
format(error, 254, "Invalid connection index: %d", cn_idx)
set_string(2, error, get_param(3))
return 1
}
set_string(2, ConnectionErrors[cn_idx], get_param(3))
return 1
}
public __mysql_close(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query != Empty_Handle)
{
SQL_FreeHandle(query)
}
SQL_FreeHandle(cn)
FreeConnectionIndex(cn_idx)
return 1
}
public __mysql_nextrow(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query == Empty_Handle)
{
return 0
}
if (QueryPositions[cn_idx] != 0)
{
SQL_NextRow(query)
}
if (SQL_MoreResults(query))
{
return ++QueryPositions[cn_idx]
}
return 0
}
public __mysql_getresult(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query == Empty_Handle)
{
return 0
}
if (!SQL_MoreResults(query))
{
return 0
}
static name[64]
get_string(2, name, 63)
new column = SQL_FieldNameToNum(query, name)
if (column == -1)
{
log_error(AMX_ERR_NATIVE, "Invalid column name: %s", name)
return 0
}
switch (num)
{
case 2:
{
return SQL_ReadResult(query, column)
}
case 3:
{
new Float:fma
SQL_ReadResult(query, column, fma)
set_param_byref(3, _:fma)
}
case 4:
{
static str[2048]
SQL_ReadResult(query, column, str, 2047)
set_string(3, str, get_param_byref(4))
}
}
return 1
}
public __mysql_getfield(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query == Empty_Handle)
{
return 0
}
if (!SQL_MoreResults(query))
{
return 0
}
switch (num)
{
case 2:
{
return SQL_ReadResult(query, get_param(2)-1)
}
case 3:
{
new Float:fma
SQL_ReadResult(query, get_param(2)-1, fma)
set_param_byref(3, _:fma)
}
case 4:
{
static str[2048]
SQL_ReadResult(query, get_param(2)-1, str, 2047)
set_string(3, str, get_param_byref(4))
}
}
return 1
}
public __mysql_affected_rows(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query == Empty_Handle)
{
return 0
}
return SQL_AffectedRows(query)
}
public __mysql_num_fields(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query == Empty_Handle)
{
return 0
}
return SQL_NumColumns(query)
}
public __mysql_insert_id(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query == Empty_Handle)
{
return 0
}
return SQL_GetInsertId(query)
}
public __mysql_num_rows(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query == Empty_Handle)
{
return 0
}
return SQL_NumResults(query)
}
public __mysql_field_name(plid, num)
{
new cn_idx = get_param(1)
new Handle:cn = GetConnectionIndex(cn_idx)
if (cn == Empty_Handle)
{
return 0
}
new Handle:query = Handle:ConnectionQueries[cn_idx]
if (query == Empty_Handle)
{
return 0
}
new column = get_param(2) - 1
if (column < 0 || column >= SQL_NumColumns(query))
{
return 0
}
new field[64]
SQL_FieldNumToName(query, column, field, 63)
set_string(3, field, get_param(4))
return 1
}

View File

@ -1,730 +0,0 @@
/**
* AMX Mod Compatibility engine
* by the AMX Mod X Development Team
*/
#include <VexdUM_const>
#include <VexdUM_stock>
/* Forwards */
new g_FwdTouch
new g_FwdThink
new g_FwdSpawn
new g_FwdClientPreThink
new g_FwdClientPostThink
new g_FwdEmitSound
new g_FwdEmitAmbientSound
new g_FwdSetModel
new g_FwdTraceLine
new g_FwdSetCliKeyValue
new g_FwdKeyValue
new g_PlayerModels[33][64]
new g_PlayerModeled[33]
/* User Messages */
new g_msgDamage
new g_msgDeathMsg
new g_msgScoreInfo
new g_LastTrace = 0
VexdUM_Register()
{
/* Fakemeta Hooks */
register_forward(FM_EmitSound, "Hook_FM_EmitSound")
register_forward(FM_EmitAmbientSound, "Hook_FM_EmitAmbientSound")
register_forward(FM_SetModel, "Hook_FM_SetModel")
register_forward(FM_SetClientKeyValue, "Hook_FM_SetClientKeyValue")
register_forward(FM_KeyValue, "Hook_FM_KeyValue")
register_forward(FM_Touch, "Hook_FM_Touch")
register_forward(FM_Think, "Hook_FM_Think")
register_forward(FM_Spawn, "Hook_FM_Spawn")
register_forward(FM_PlayerPreThink, "Hook_FM_PlayerPreThink")
register_forward(FM_PlayerPostThink, "Hook_FM_PlayerPostThink")
register_forward(FM_ClientUserInfoChanged, "Hook_ClientUserInfoChanged")
// Only register the traceline forward if there actually is a plugin
// that needs it. Otherwise this will mess with set_user_hitzones
new pluginnum = get_pluginsnum();
for (new i = 0; i < pluginnum; i++)
{
if (plugin_flags(0, i) & AMX_FLAG_OLDFILE && // plugin is an AMX plugin being emulated
get_func_id("traceline", i) != -1) // plugin needs traceline
{
register_forward(FM_TraceLine, "Hook_FM_TraceLine")
break;
}
}
/* Global Forwards */
g_FwdTouch = CreateMultiForwardEx("entity_touch", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_CELL)
g_FwdThink = CreateMultiForwardEx("entity_think", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
g_FwdSpawn = CreateMultiForwardEx("entity_spawn", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
g_FwdClientPreThink = CreateMultiForwardEx("client_prethink", ET_IGNORE, FORWARD_ONLY_OLD, FP_CELL)
g_FwdClientPostThink = CreateMultiForwardEx("client_postthink", ET_IGNORE, FORWARD_ONLY_OLD, FP_CELL)
g_FwdEmitSound = CreateMultiForwardEx("emitsound", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
g_FwdEmitAmbientSound = CreateMultiForwardEx("emitambientsound", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
g_FwdSetModel = CreateMultiForwardEx("set_model", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
g_FwdTraceLine = CreateMultiForwardEx("traceline", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
g_FwdSetCliKeyValue = CreateMultiForwardEx("setclientkeyvalue", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING, FP_STRING)
g_FwdKeyValue = CreateMultiForwardEx("keyvalue", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
/* User Messages */
g_msgDamage = get_user_msgid("Damage")
g_msgDeathMsg = get_user_msgid("DeathMsg")
g_msgScoreInfo = get_user_msgid("ScoreInfo")
}
VexdUM_Natives()
{
/* implicit compatibility */
register_native("is_entity", "__is_entity")
register_native("find_entity", "__find_entity")
register_native("find_entity_sphere", "__find_entity_sphere")
register_native("in_view_cone", "__in_view_cone")
register_native("get_offset_int", "__get_offset_int")
register_native("set_offset_int", "__set_offset_int")
register_native("trace_line", "__trace_line")
register_native("traceline_get_int", "__traceline_get_int")
register_native("traceline_set_int", "__traceline_set_int")
register_native("traceline_get_edict", "__traceline_get_edict")
register_native("traceline_set_edict", "__traceline_set_edict")
register_native("traceline_set_float", "__traceline_set_float")
register_native("can_see", "__can_see")
register_native("user_spawn", "__user_spawn")
register_native("get_maxentities", "__get_maxentities")
register_native("PointContents", "__PointContents")
register_native("DispatchKeyValue", "__DispatchKeyValue")
register_native("entity_use","__entity_use")
register_native("get_num_ents","__get_num_ents")
register_native("take_damage","__take_damage")
if (g_ModType == MOD_CSTRIKE)
{
register_native("set_user_model", "__cs_set_user_model")
} else {
register_native("set_user_model", "__set_user_model")
}
}
VexdUM_ClientConnect(id)
{
g_PlayerModels[id][0] = 0
g_PlayerModeled[id] =0
}
SetClientKeyValue(id, const key[], const value[])
{
new buffer = engfunc(EngFunc_GetInfoKeyBuffer, id)
return engfunc(EngFunc_SetClientKeyValue, id, buffer, key, value)
}
GetClientKeyValue(id, const key[], value[], maxlen)
{
new buffer = engfunc(EngFunc_GetInfoKeyBuffer, id)
engfunc(EngFunc_InfoKeyValue, buffer, key, value, maxlen)
}
Death(victim, killer, weapon[64], hs)
{
if(pev(victim,pev_takedamage) > DAMAGE_NO)
{
new inflictor = pev(killer,pev_owner)
if(pev(killer,pev_flags) & (FL_CLIENT | FL_FAKECLIENT))
{
if(equal(weapon,""))
{
pev(killer,pev_viewmodel2,weapon,63)
replace(weapon,63,"models/v_","")
weapon[strlen(weapon) - 4] = '^0'
}
}
else if(inflictor > 0 && inflictor < get_maxplayers())
{
if(equal(weapon,""))
{
pev(killer,pev_viewmodel2,weapon,63)
replace(weapon,63,"weapon_","")
replace(weapon,63,"monster_","")
replace(weapon,63,"func_","")
}
if(inflictor == victim)
{
killer = victim
} else {
killer = inflictor
}
}
message_begin(MSG_ALL,g_msgDeathMsg)
write_byte(killer)
write_byte(victim)
write_byte(hs)
write_string(weapon)
message_end()
new vname[32],vauthid[32],vteam[32]
get_user_name(victim,vname,31)
get_user_authid(victim,vauthid,31)
get_user_team(victim,vteam,31)
if(victim == killer)
{
log_message("^"%s<%i><%s><%s>^" killed self with ^"%s^"^n",vname,get_user_userid(victim),
vauthid,vteam,weapon)
}
else if(pev(killer,pev_flags) & (FL_CLIENT | FL_FAKECLIENT))
{
new kname[32],kauthid[32],kteam[32],team
get_user_name(killer,kname,31)
get_user_authid(killer,kauthid,31)
team = get_user_team(killer,kteam,31)
log_message("^"%s<%i><%s><%s>^" killed ^"%s<%i><%s><%s>^" with ^"%s^"^n",kname,get_user_userid(killer),
kauthid,kteam,vname,get_user_userid(victim),vauthid,vteam,weapon)
new Float:frags
pev(killer,pev_frags,frags)
set_pev(killer,pev_frags,frags+1.0)
message_begin(MSG_ALL,g_msgScoreInfo)
write_byte(killer)
write_short(floatround(frags))
write_short(get_user_deaths(killer))
write_short(0)
write_short(team)
message_end()
pev(victim,pev_frags,frags)
set_pev(victim,pev_frags,frags+1.0)
} else {
log_message("^"%s<%i><%s><%s>^" killed by ^"%s^"^n",vname,get_user_userid(victim),vauthid,vteam,weapon)
}
set_msg_block(g_msgDeathMsg,BLOCK_ONCE)
dllfunc(DLLFunc_ClientKill,victim)
}
}
public __is_entity(plid, num)
{
new ent = get_param(1)
return is_entity(ent)
}
public __find_entity(plid, num)
{
static entstr[256]
new startEnt, type
startEnt = get_param(1)
get_string(2, entstr, 255)
type = get_param(3)
return find_entity(startEnt, entstr, type)
}
public __find_entity_sphere(plid, num)
{
new ent
new Float:orig[3]
new Float:radius
ent = get_param(1)
get_array_f(2, orig, 3)
radius = get_param_f(3)
return find_entity_sphere(ent, orig, radius)
}
public __in_view_cone(plid, num)
{
new ent
new Float:orig[3]
ent = get_param(1)
get_array_f(2, orig, 3)
return in_view_cone(ent, orig)
}
public __get_offset_int(plid, num)
{
new ent = get_param(1)
new offs = get_param(2)
new linux = get_param(3)
return get_pdata_int(ent, offs, linux)
}
public __set_offset_int(plid, num)
{
return set_offset_int(get_param(1), get_param(2), get_param(3), get_param(4))
}
public __trace_line(plid, num)
{
new ent = get_param(1)
new Float:vStart[3], Float:vEnd[3], Float:vReturn[3]
get_array_f(2, vStart, 3)
get_array_f(3, vEnd, 3)
if (ent == FM_NULLENT)
engfunc(EngFunc_TraceLine, vStart, vEnd, IGNORE_MONSTERS, 0, 0)
else
engfunc(EngFunc_TraceLine, vStart, vEnd, DONT_IGNORE_MONSTERS, ent, 0)
get_tr2(0, TraceResult:TR_vecEndPos, vReturn)
set_array_f(4, vReturn, 3)
new traceHit = get_tr2(0, TraceResult:TR_pHit)
if (!pev_valid(traceHit))
return FM_NULLENT
return traceHit
}
public __traceline_get_int(plid, num)
{
new iSet = get_param(1)
new iValue = 0
switch (iSet)
{
case TR_INT_fAllSolid:
iValue = get_tr2(g_LastTrace, TraceResult:TR_AllSolid)
case TR_INT_fStartSolid:
iValue = get_tr2(g_LastTrace, TraceResult:TR_StartSolid)
case TR_INT_fInOpen:
iValue = get_tr2(g_LastTrace, TraceResult:TR_InOpen)
case TR_INT_fInWater:
iValue = get_tr2(g_LastTrace, TraceResult:TR_InWater)
case TR_INT_iHitgroup:
iValue = get_tr2(g_LastTrace, TraceResult:TR_iHitgroup)
default:
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
}
return iValue
}
public __traceline_set_int(plid, num)
{
new iSet = get_param(1)
new iValue = get_param(2)
switch (iSet)
{
case TR_INT_fAllSolid:
set_tr2(g_LastTrace, TraceResult:TR_AllSolid, iValue)
case TR_INT_fStartSolid:
set_tr2(g_LastTrace, TraceResult:TR_StartSolid, iValue)
case TR_INT_fInOpen:
set_tr2(g_LastTrace, TraceResult:TR_InOpen, iValue)
case TR_INT_fInWater:
set_tr2(g_LastTrace, TraceResult:TR_InWater, iValue)
case TR_INT_iHitgroup:
set_tr2(g_LastTrace, TraceResult:TR_iHitgroup, iValue)
default:
{
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
return 0
}
}
return 1
}
public __traceline_get_edict(plid, num)
{
new iSet = get_param(1)
new iValue = 0
switch (iSet)
{
case TR_ENT_pHit:
iValue = get_tr2(g_LastTrace, TraceResult:TR_pHit)
default:
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
}
return iValue
}
public __traceline_set_edict(plid, num)
{
new iSet = get_param(1)
new iValue = get_param(2)
switch (iSet)
{
case TR_ENT_pHit:
set_tr2(g_LastTrace, TraceResult:TR_pHit, iValue)
default:
{
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
return 0
}
}
return 1
}
public Float:__traceline_get_float(plid, num)
{
new iSet = get_param(1)
new Float:fValue = 0.0
switch (iSet)
{
case TR_FL_flFraction:
get_tr2(g_LastTrace, TraceResult:TR_flFraction, fValue)
case TR_FL_flPlaneDist:
get_tr2(g_LastTrace, TraceResult:TR_flPlaneDist, fValue)
default:
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
}
return fValue
}
public __traceline_set_float(plid, num)
{
new iSet = get_param(1)
new Float:fValue = get_param_f(2)
switch (iSet)
{
case TR_FL_flFraction:
set_tr2(g_LastTrace, TraceResult:TR_flFraction, fValue)
case TR_FL_flPlaneDist:
set_tr2(g_LastTrace, TraceResult:TR_flPlaneDist, fValue)
default:
{
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
return 0
}
}
return 1
}
public __traceline_get_vector(plid, num)
{
new iSet = get_param(1)
new Float:vValue[3]
switch (iSet)
{
case TR_VEC_vecEndPos:
get_tr2(g_LastTrace, TraceResult:TR_vecEndPos, vValue)
case TR_VEC_vecPlaneNormal:
get_tr2(g_LastTrace, TraceResult:TR_vecPlaneNormal, vValue)
default:
{
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
return 0
}
}
set_array_f(2, vValue, 3)
return 1
}
public __traceline_set_vector(plid, num)
{
new iSet = get_param(1)
new Float:vValue[3]
get_array_f(2, vValue, 3)
switch (iSet)
{
case TR_VEC_vecEndPos:
set_tr2(g_LastTrace, TraceResult:TR_vecEndPos, vValue)
case TR_VEC_vecPlaneNormal:
set_tr2(g_LastTrace, TraceResult:TR_vecPlaneNormal, vValue)
default:
{
log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
return 0
}
}
return 1
}
public __can_see(plid, num)
{
return can_see(get_param(1), get_param(2))
}
public __user_spawn(plid, num)
{
return dllfunc(DLLFunc_Spawn, get_param(1))
}
public __set_user_model(plid, num)
{
new id = get_param(1)
if (id < 1 || id > g_MaxPlayers)
{
return 0
}
new model[64]
get_string(2, model, 63)
if (model[0] == 0)
{
if (!g_PlayerModeled[id])
{
return 0
}
g_PlayerModeled[id] = 0
g_PlayerModels[id][0] = 0
dllfunc(DLLFunc_ClientUserInfoChanged, id)
} else {
copy(g_PlayerModels[id], 63, model)
g_PlayerModeled[id] = 1
SetClientKeyValue(id, "model", model)
}
return 1
}
public __cs_set_user_model(plid, num)
{
new id = get_param(1)
new model[64]
get_string(2, model, 63)
return cs_set_user_model(id, model)
}
public __get_maxentities(plid, num)
{
return get_maxentities()
}
public __PointContents(plid, num)
{
new Float:vCheckAt[3]
get_array_f(1, vCheckAt, 3)
return point_contents(vCheckAt)
}
public __DispatchKeyValue(plid, num)
{
new ent = get_param(1)
new szClassname[32], szKey[32], szValue[32]
if (pev_valid(ent))
{
get_string(2, szKey, 31)
get_string(3, szValue, 31)
pev(ent, pev_classname, szClassname, 31)
set_kvd(0, KV_ClassName, szClassname)
set_kvd(0, KV_KeyName, szKey)
set_kvd(0, KV_Value, szValue)
set_kvd(0, KV_fHandled, 0)
dllfunc(DLLFunc_KeyValue, ent, 0)
}
return 1
}
public __entity_use(plid, num)
{
new entUsed = get_param(1)
new entOther = get_param(2)
return dllfunc(DLLFunc_Use,entUsed,entOther)
}
public __get_num_ents(plid, num)
{
return engfunc(EngFunc_NumberOfEntities)
}
public __take_damage(plid, num)
{
new victim = get_param(1)
new attacker = get_param(2)
new Float:orig[3]
get_array_f(3,orig,3)
new Float:dmg = get_param_f(4)
new bit = get_param(5)
new wpnName[64]
get_string(6,wpnName,63)
new hs = get_param(7)
if(pev(victim,pev_takedamage) > DAMAGE_NO)
{
set_pev(victim,pev_dmg_inflictor,attacker)
new Float:olddmg
pev(victim,pev_dmg_take,olddmg)
set_pev(victim,pev_dmg_take,olddmg+dmg)
message_begin(MSG_ONE, g_msgDamage, {0,0,0} , victim)
write_byte(0)
write_byte(floatround(olddmg+dmg))
write_long(bit)
write_coord(floatround(orig[0]))
write_coord(floatround(orig[1]))
write_coord(floatround(orig[2]))
message_end()
new Float:health
pev(victim,pev_health,health)
if((dmg >= health) && (health > 0.0))
{
Death(victim,attacker,wpnName,hs)
} else {
set_pev(victim,pev_health,health-dmg)
}
}
}
/*********************************
***** HOOKS *********************
*********************************/
public Hook_ClientUserInfoChanged(id, buffer)
{
if (g_PlayerModeled[id] && (pev(id, pev_deadflag) == DEAD_NO))
{
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public Hook_FM_EmitSound(entid, channel, const sample[]) //we don't care about the rest
{
new ret
ExecuteForward(g_FwdEmitSound, ret, entid, sample)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_EmitAmbientSound(entid, Float:pos[3], const sample[]) //we don't care about the rest
{
new ret
ExecuteForward(g_FwdEmitAmbientSound, ret, entid, sample)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_SetModel(entid, const model[])
{
new ret
ExecuteForward(g_FwdSetModel, ret, entid, model)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_TraceLine(Float:v1[3], Float:v2[3], noMonsters, skip_ent, ptr)
{
g_LastTrace = ptr
engfunc(EngFunc_TraceLine, v1, v2, noMonsters, skip_ent, ptr)
new ret
ExecuteForward(g_FwdTraceLine, ret, skip_ent)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_SetClientKeyValue(id, const infobuffer[], const key[], const value[])
{
new ret
ExecuteForward(g_FwdSetCliKeyValue, ret, id, key, value)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_KeyValue(ent, kvd)
{
new ret
ExecuteForward(g_FwdKeyValue, ret, ent)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_Touch(ent1, ent2)
{
new ret
ExecuteForward(g_FwdTouch, ret, ent1, ent2)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_Think(entid)
{
new ret
ExecuteForward(g_FwdThink, ret, entid)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_Spawn(entid)
{
new ret
ExecuteForward(g_FwdSpawn, ret, entid)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_PlayerPreThink(id)
{
new ret
ExecuteForward(g_FwdClientPreThink, ret, id)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}
public Hook_FM_PlayerPostThink(id)
{
new ret
if (g_PlayerModeled[id])
{
new model[64]
GetClientKeyValue(id, "model", model, 63)
if (!equal(g_PlayerModels[id], model))
{
SetClientKeyValue(id, "model", g_PlayerModels[id])
}
}
ExecuteForward(g_FwdClientPostThink, ret, id)
return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
}

View File

@ -12,19 +12,7 @@
#define _amxmisc_included
#if !defined _amxmodx_included
#if defined AMXMOD_BCOMPAT
#include <amxmod>
#else
#include <amxmodx>
#endif
#endif
#if defined AMXMOD_BCOMPAT
#if defined _translator_included
#define SIMPLE_T(%1) _T(%1)
#else
#define SIMPLE_T(%1) %1
#endif
#endif
stock is_user_admin(id)
@ -60,11 +48,7 @@ stock cmd_access(id, level, cid, num, bool:accesssilent = false)
{
if (!accesssilent)
{
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("You have no access to that command."));
#else
console_print(id,"%L",id,"NO_ACC_COM");
#endif
}
return 0;
}
@ -72,11 +56,7 @@ stock cmd_access(id, level, cid, num, bool:accesssilent = false)
{
new hcmd[32], hinfo[128], hflag;
get_concmd(cid,hcmd,31,hflag,hinfo,127,level);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("Usage: %s %s"), hcmd, SIMPLE_T(hinfo));
#else
console_print(id,"%L: %s %s",id,"USAGE",hcmd,hinfo);
#endif
return 0;
}
@ -113,11 +93,7 @@ stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
{
if ( player != find_player("blj",arg) )
{
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("There are more clients matching to your argument"));
#else
console_print(id,"%L",id,"MORE_CL_MATCHT");
#endif
return 0;
}
}
@ -127,11 +103,7 @@ stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
}
if (!player)
{
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("Client with that name or userid not found"));
#else
console_print(id,"%L",id,"CL_NOT_FOUND");
#endif
return 0;
}
if (flags & CMDTARGET_OBEY_IMMUNITY)
@ -141,11 +113,7 @@ stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
{
new imname[32];
get_user_name(player,imname,31);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("Client ^"%s^" has immunity"), imname);
#else
console_print(id,"%L",id,"CLIENT_IMM",imname);
#endif
return 0;
}
}
@ -155,11 +123,7 @@ stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
{
new imname[32];
get_user_name(player,imname,31);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("That action can't be performed on dead client ^"%s^""), imname);
#else
console_print(id,"%L",id,"CANT_PERF_DEAD",imname);
#endif
return 0;
}
}
@ -169,11 +133,7 @@ stock cmd_target(id,const arg[],flags = CMDTARGET_OBEY_IMMUNITY)
{
new imname[32];
get_user_name(player,imname,31);
#if defined AMXMOD_BCOMPAT
console_print(id, SIMPLE_T("That action can't be performed on bot ^"%s^""), imname);
#else
console_print(id,"%L",id,"CANT_PERF_BOT",imname);
#endif
return 0;
}
}
@ -201,10 +161,7 @@ stock show_activity( id, const name[], const fmt[], any:... )
__amx_show_activity = register_cvar("amx_show_activity", "2");
}
}
#if defined AMXMOD_BCOMPAT
new buffer[128];
format_args( buffer , 127 , 2 );
#else
new prefix[10];
if (is_user_admin(id))
{
@ -216,19 +173,9 @@ stock show_activity( id, const name[], const fmt[], any:... )
}
new buffer[512];
vformat(buffer, charsmax(buffer), fmt, 4);
#endif
switch(get_pcvar_num(__amx_show_activity))
{
#if defined AMXMOD_BCOMPAT
case 2: // show name to all
{
client_print(0, print_chat, "%s %s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), name, buffer);
}
case 1: // hide name to all
{
client_print(0, print_chat, "%s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), buffer);
}
#else
case 5: // hide name only to admins, show nothing to normal users
{
new __maxclients=get_maxplayers();
@ -287,7 +234,6 @@ stock show_activity( id, const name[], const fmt[], any:... )
{
client_print(0, print_chat, "%L: %s", LANG_PLAYER, prefix, buffer );
}
#endif
}
}

View File

@ -1,89 +0,0 @@
/* VexdUM backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if !defined _fakemeta_included
#include <fakemeta>
#endif
#if !defined _engine_included
#include <engine>
#endif
#if defined _vexd_bcompat_included
#endinput
#endif
#define _vexd_bcompat_included
#include <VexdUM_const>
native radius_damage(inflictor, Float:dmg, Float:orig[3], Float:rad, bit = DMG_BULLET, wpnName[]="", hs = 0);
native take_damage(victim, attacker, Float:orig[3], Float:dmg, bit = DMG_BULLET, wpnName[]="", hs = 0);
native set_user_model(id, const Model[]="");
native entity_use(eUsed, eOther);
native get_num_ents();
native DispatchKeyValue(ent, szKey[], szValue[]);
// Trace a line from Start(X, Y, Z) to End(X, Y, Z), will return the point hit in vReturn[3]
// Will return an entindex if an entity is hit.
native trace_line(ent, Float:vStart[3], Float:vEnd[3], Float:vReturn[3]);
native traceline_get_int(iVar);
native traceline_set_int(iVar, iVal);
native Float:traceline_get_float(iVar);
native traceline_set_float(iVar, Float:fVal);
native traceline_get_vector(iVar, Float:vVal[3]);
native traceline_set_vector(iVar, Float:vVal[3]);
native traceline_get_edict(iVar);
native traceline_set_edict(iVar, iEnt);
/* Wrapper around pfn_touch */
forward entity_touch(entity1, entity2);
/* Wrapper around pfn_think */
forward entity_think(entity);
/* Wrapper around pfn_spawn */
forward entity_spawn(entity);
/* Wrapper around client_PreThink */
forward client_prethink(id);
/* Wrapper around client_PostThink */
forward client_postthink(id);
//From AMX Mod:
// Called when an Emitting Sound is played Server-Side
forward emitsound(entity, const sample[]);
//From AMX Mod:
// Called when an Emitting Ambient Sound is played Server-Side
forward emitambientsound(entity, const sample[]);
//From AMX Mod:
// Called when a model spawns
forward set_model(entity, const model[]);
//From AMX Mod:
// Called whatever an entity looks at
forward traceline(entity);
//:TODO: ?
// Called when a monster is hurt by VexdUM damage natives
// forward monster_hurt(monster, attacker, damage);
//From AMX Mod:
// Called when a keyvalue is set on a player
forward setclientkeyvalue(id, key[], value[]);
//From AMX Mod:
// Called when an entity gets a keyvalue set on it from the engine.
// Use copy_keyvalue to get the keyvalue information
forward keyvalue(entity);
#include <VexdUM_stock>

View File

@ -1,30 +0,0 @@
#if defined _vexdum_const_included
#endinput
#endif
#define _vexdum_const_included
// TraceLine Integer
enum {
TR_INT_fAllSolid, // if true, plane is not valid
TR_INT_fStartSolid, // if true, the initial point was in a solid area
TR_INT_fInOpen,
TR_INT_fInWater,
TR_INT_iHitgroup, // 0 == generic, non zero is specific body part
};
// TraceLine Float
enum {
TR_FL_flFraction, // time completed, 1.0 = didn't hit anything
TR_FL_flPlaneDist,
};
// TraceLine Vector
enum {
TR_VEC_vecEndPos, // final position
TR_VEC_vecPlaneNormal, // surface normal at impact
};
// TraceLine Edict
enum {
TR_ENT_pHit, // entity the surface is on
};

View File

@ -1,135 +0,0 @@
/* VexdUM stocks backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _vexd_bcompat_stocks_included
#endinput
#endif
#define _vexd_bcompat_stocks_included
#if !defined _engine_included
#include <engine>
#endif
stock is_entity(ent)
{
return pev_valid(ent);
}
stock get_offset_int(ent, offset, linos = 5)
{
return get_pdata_int(ent, offset, linos);
}
stock set_offset_int(ent, offset, value, linos = 5)
{
return set_pdata_int(ent, offset, value, linos);
}
stock in_view_cone(ent, Float:Orig[3])
{
return is_in_viewcone(ent, Orig);
}
stock get_maxentities()
{
return global_get(glb_maxEntities);
}
stock can_see(ent1, ent2)
{
if (is_entity(ent1) && is_entity(ent2))
{
new flags = pev(ent1, pev_flags);
if (flags & EF_NODRAW || flags & FL_NOTARGET)
{
return 0;
}
new Float:lookerOrig[3];
new Float:targetOrig[3];
new Float:temp[3];
pev(ent1, pev_origin, lookerOrig);
pev(ent1, pev_view_ofs, temp);
lookerOrig[0] += temp[0];
lookerOrig[1] += temp[1];
lookerOrig[2] += temp[2];
pev(ent2, pev_origin, targetOrig);
pev(ent2, pev_view_ofs, temp);
targetOrig[0] += temp[0];
targetOrig[1] += temp[1];
targetOrig[2] += temp[2];
engfunc(EngFunc_TraceLine, lookerOrig, targetOrig, 0, ent1, 0);
if (get_tr2(0, TraceResult:TR_InOpen) && get_tr2(0, TraceResult:TR_InWater))
{
return 0;
} else {
new Float:flFraction;
get_tr2(0, TraceResult:TR_flFraction, flFraction);
if (flFraction == 1.0 || (get_tr2(0, TraceResult:TR_pHit) == ent2))
{
return 1;
}
}
}
return 0;
}
//From AMX Mod:
// Find an entity in the world, will return -1 if nothing is found
// type = 0: "classname"
// type = 1: "globalname"
// type = 2: "model"
// type = 3: "target"
// type = 4: "targetname"
// type = 5: "netname"
// type = 6: "message"
// type = 7: "noise"
// type = 8: "noise1"
// type = 9: "noise2"
// type = 10: "noise3"
// type = 11: "viewmodel"
// type = 12: "weaponmodel"
stock vexd_find_entity(ent, szValue[], type=0)
{
static _g_FindEntTypes[13][] =
{
"classname",
"globalname",
"model",
"target",
"targetname",
"netname",
"messages",
"noise",
"noise1",
"noise2",
"noise3",
"viewmodel",
"weaponmodel"
};
if (type < 0 || type >= 13)
{
type = 0;
}
return engfunc(EngFunc_FindEntityByString, ent, _g_FindEntTypes[type], szValue);
}
#define find_entity vexd_find_entity
//From AMX Mod:
// Find an entity within a given origin and radius
stock find_entity_sphere(ent, Float:Orig[3], Float:Rad)
{
return engfunc(EngFunc_FindEntityInSphere, ent, Orig, Rad);
}

View File

@ -1,109 +0,0 @@
/* Vexd Utility backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _Vexd_Utilities_included
#endinput
#endif
#define _Vexd_Utilities_included
#include <engine>
#if defined AMXMOD_BCOMPAT
#if !defined _vexd_bcompat_included
#include <VexdUM>
#endif
#endif
stock Entvars_Get_Int(iIndex, iVariable)
return entity_get_int(iIndex, iVariable);
stock Entvars_Set_Int(iIndex, iVariable, iNewValue)
return entity_set_int(iIndex, iVariable, iNewValue);
stock Float:Entvars_Get_Float(iIndex, iVariable)
return entity_get_float(iIndex, iVariable);
stock Entvars_Set_Float(iIndex, iVariable, Float:fNewValue)
return entity_set_float(iIndex, iVariable, fNewValue);
stock Entvars_Get_Vector(iIndex, iVariable, Float:vRetVector[3])
return entity_get_vector(iIndex, iVariable, vRetVector);
stock Entvars_Set_Vector(iIndex, iVariable, Float:vNewVector[3])
return entity_set_vector(iIndex, iVariable, vNewVector);
stock Entvars_Get_Edict(iIndex, iVariable)
return entity_get_edict(iIndex, iVariable);
stock Entvars_Set_Edict(iIndex, iVariable, iNewIndex)
return entity_set_edict(iIndex, iVariable, iNewIndex);
stock Entvars_Get_String(iIndex, iVariable, szReturnValue[], iReturnLen)
return entity_get_string(iIndex, iVariable, szReturnValue, iReturnLen);
stock Entvars_Set_String(iIndex, iVariable, szNewValue[])
return entity_set_string(iIndex, iVariable, szNewValue);
stock Entvars_Get_Byte(iIndex, iVariable)
return entity_get_byte(iIndex, iVariable);
stock Entvars_Set_Byte(iIndex, iVariable, iNewValue)
return entity_set_byte(iIndex, iVariable, iNewValue);
stock CreateEntity(szClassname[])
return create_entity(szClassname);
stock ENT_SetModel(iIndex, szModel[])
return entity_set_model(iIndex, szModel);
stock ENT_SetOrigin(iIndex, Float:fNewOrigin[3])
return entity_set_origin(iIndex, fNewOrigin);
stock FindEntity(iIndex, szValue[])
return find_ent_by_class(iIndex, szValue);
stock RemoveEntity(iIndex)
return remove_entity(iIndex);
stock TraceLn(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3])
return trace_line(iIgnoreEnt, fStart, fEnd, vReturn);
stock TraceNormal(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3])
return trace_normal(iIgnoreEnt, fStart, fEnd, vReturn);
stock VecToAngles(Float:fVector[3], Float:vReturn[3])
return vector_to_angle(fVector, vReturn);
stock Float:VecLength(Float:vVector[3])
return vector_length(vVector);
stock Float:VecDist(Float:vVector[3], Float:vVector2[3])
return vector_distance(vVector, vVector2);
stock MessageBlock(iMessage, iMessageFlags)
return set_msg_block(iMessage, iMessageFlags);
stock GetMessageBlock(iMessage)
return get_msg_block(iMessage);
stock Float:HLTime()
return halflife_time();
stock FakeTouch(iToucher, iTouched)
return fake_touch(iToucher, iTouched);
stock AttachView(iIndex, iTargetIndex)
return attach_view(iIndex, iTargetIndex);
stock SetView(iIndex, ViewType)
return set_view(iIndex, ViewType);
stock SetSpeak(iIndex, iSpeakFlags)
return set_speak(iIndex, iSpeakFlags);
forward vexd_pfntouch(pToucher, pTouched);
forward ServerFrame();

View File

@ -1,318 +0,0 @@
/* AMX Mod X Backwards Compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _amxmod_included
#endinput
#endif
#define _amxmod_included
#if !defined AMXMOD_BCOMPAT
#define AMXMOD_BCOMPAT
#endif
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
#include <maths>
stock AMX_VERSION[] = "1.76-BC";
#define ADMIN_PERMBAN ADMIN_BAN //AMX Mod admin flag for permanent ban
#define ADMIN_UNBAN ADMIN_BAN //AMX Mod admin flag for unbanning
#define ADMIN_SUPREME ADMIN_IMMUNITY //AMX Mod admin flag for "super admin" (can kick, slap, ban, slay admins with Immunity)
/* Core will identify us as an "old plugin" this way. */
public __b_old_plugin = 1;
public __b_ident_vers()
{
return __b_old_plugin;
}
stock user_spawn(index)
return spawn(index);
stock get_logfile( name[], len )
return get_time("admin%m%d.log",name,len);
stock get_user_money(index)
return cs_get_user_money(index);
stock set_user_money(index,money,flash=1)
return cs_set_user_money(index,money,flash);
stock numtostr(num,string[],len)
return num_to_str(num,string,len);
stock strtonum(const string[])
return str_to_num(string);
stock build_path(path[], len, {Float,_}:... )
{
format_args(path, len, 2);
new pathlen = strlen(path);
new basedir[32];
if (containi(path, "$basedir") != -1)
{
get_localinfo("amxx_basedir", basedir, 31);
if (!basedir[0])
{
copy(basedir, 31, "addons/amxmodx");
}
if ((pathlen+strlen(basedir)-strlen("$basedir")) < len)
{
replace(path, len, "$basedir", basedir);
}
}
new dir[64], subdir[63];
if (containi(path, "$configdir") != -1)
{
get_localinfo("amxx_configsdir", dir, 63);
if (!dir[0])
{
format(dir, 63, "%s/configs", basedir);
}
if ((pathlen+strlen(basedir)-strlen("$configdir")) < len)
{
replace(path, len, "$configdir", dir);
}
dir[0] = '^0';
}
if (containi(path, "$langdir") != -1)
{
get_localinfo("amxx_datadir", subdir, 63);
if (!subdir[0])
{
format(subdir, 63, "%s/data", basedir);
}
format(dir, 63, "%s/amxmod-lang", subdir);
if ((pathlen+strlen(basedir)-strlen("$langdir")) < len)
{
replace(path, len, "$langdir", dir);
}
dir[0] = '^0';
}
if (containi(path, "$modulesdir") != -1)
{
get_localinfo("amxx_modules", dir, 63);
if (!dir[0])
{
format(dir, 63, "%s/modules", basedir);
}
if ((pathlen+strlen(basedir)-strlen("$modulesdir")) < len)
{
replace(path, len, "$modulesdir", dir);
}
dir[0] = '^0';
}
if (containi(path, "$pluginsdir") != -1)
{
get_localinfo("amx_pluginsdir", dir, 63);
if( !dir[0])
{
format(dir, 63, "%s/plugins", basedir);
}
if ((pathlen+strlen(basedir)-strlen("$pluginsdir")) < len)
{
replace(path, len, "$pluginsdir", dir);
}
dir[0] = '^0';
}
if (containi(path, "$logdir") != -1)
{
get_localinfo("amx_logs", dir, 63);
if (!dir[0])
{
format(dir, 63, "%s/logs", basedir);
}
if ((pathlen+strlen(basedir)-strlen("$logdir")) < len)
{
replace(path, len, "$logdir", dir);
}
}
return 1;
}
stock is_user_authorized(id)
{
static auth[32];
get_user_authid(id, auth, 31);
if (auth[0] == 0 || equali(auth, "STEAM_ID_PENDING"))
{
return 0;
}
return 1;
}
/* Vector AMX Mod compatibility */
#define ANGLEVECTORS_FORWARD 1
#define ANGLEVECTORS_RIGHT 2
#define ANGLEVECTORS_UP 3
stock angle_to_vector(Float:vector[3], FRU, Float:ret[3])
{
return angle_vector(vector, FRU, ret);
}
stock get_cmdaccess(cmd[], accessflags[], len)
{
new num = get_concmdsnum(-1);
new command[32], info[3];
new flags;
for (new i=0; i<num; i++)
{
get_concmd(i, command, 31, flags, info, 2, -1);
if (equal(command, cmd))
{
get_flags(flags, accessflags, len);
return 1;
}
}
return 0;
}
stock is_translated(const sentence[])
{
return (GetLangTransKey(sentence) != TransKey_Bad);
}
stock get_plugincmdsnum(plugin[], type=7)
{
new plid = find_plugin_byfile(plugin);
new our_type;
/**
* Whoever wrote this was a bit confused about the type stuff...
*/
if (type == 1) {
our_type = 1;
} else if (type == 4) {
our_type = 0;
} else {
our_type = -1;
}
new found = 0;
new total = get_concmdsnum(-1, our_type);
for (new i=0; i<total; i++)
{
if (plid == get_concmd_plid(i, -1, our_type))
{
found++;
}
}
return found;
}
stock get_plugincmd(plugin[], index, cmd[], len1, accessflags[], len2, info[], len3, destid=-1, type=7)
{
new plid = find_plugin_byfile(plugin);
new our_type;
/**
* Whoever wrote this was a bit confused about the type stuff...
*/
if (type == 1) {
our_type = 1;
} else if (type == 4) {
our_type = 0;
} else {
our_type = -1;
}
new found_iter = 0;
new total = get_concmdsnum(-1, our_type);
for (new i=0; i<total; i++)
{
if (plid == get_concmd_plid(i, -1, our_type))
{
if (found_iter == index)
{
new flags, result;
result = get_concmd(i, cmd, len1, flags, info, len3, -1, our_type);
get_flags(flags, accessflags, len2);
return result;
}
found_iter++;
}
}
/* get rid of a compiler warning */
destid = -1;
return (++destid);
}
stock get_plugincvar(plugin[], index, cvar[], len1, value[], len2, flags=0)
{
new plid = find_plugin_byfile(plugin);
new total = get_plugins_cvarsnum();
new cvar_flags, plugin_id, pcvar_handle;
new iter_id = 0;
for (new i=0; i<total; i++)
{
get_plugins_cvar(i, cvar, len1, cvar_flags, plugin_id, pcvar_handle);
if ((plugin_id == plid)
&& (!flags || (cvar_flags & flags)))
{
if (iter_id == index)
{
get_pcvar_string(pcvar_handle, value, len2);
return 1;
}
iter_id++;
}
}
return 0;
}
stock get_plugincvarsnum(plugin[], flags=0)
{
new plid = find_plugin_byfile(plugin);
new total = get_plugins_cvarsnum();
new cvar_flags, plugin_id;
new cvars_total = 0;
for (new i=0; i<total; i++)
{
get_plugins_cvar(i, "", 0, cvar_flags, plugin_id);
if ((plugin_id == plid)
&& (!flags || (cvar_flags & flags)))
{
cvars_total++;
}
}
return cvars_total;
}
stock is_module_running(const module[])
{
if (strcmp(module, "MySQL Access") == 0)
return LibraryExists("sqlx", LibType_Class);
return is_module_loaded(module) == -1 ? 0 : 1;
}
stock is_plugin_running(const plugin[])
{
new status[8];
new id, filename[1], name[1], version[1], author[1];
id = is_plugin_loaded(plugin);
get_plugin(id, filename, 0, name, 0, version, 0, author, 0, status, 7);
return strcmp(status, "running") == 0 ? id + 1 : 0;
}

View File

@ -1,85 +0,0 @@
/* AMX Mod math functions backwards compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _maths_bcompat_included
#endinput
#endif
#define _maths_bcompat_included
#if !defined _float_included
#include <float>
#endif
stock Float:fabs(Float:value)
{
return floatabs(value);
}
stock Float:asin(Float:value)
{
return floatasin(value, radian);
}
stock Float:sin(Float:value)
{
return floatsin(value, radian);
}
stock Float:sinh(Float:value)
{
return floatsinh(value, radian);
}
stock Float:acos(Float:value)
{
return floatacos(value, radian);
}
stock Float:cos(Float:value)
{
return floatcos(value, radian);
}
stock Float:cosh(Float:value)
{
return floatcosh(value, radian);
}
stock Float:atan(Float:value)
{
return floatatan(value, radian);
}
stock Float:atan2(Float:value1, Float:value2)
{
return floatatan2(value1, value2, radian);
}
stock Float:tan(Float:value)
{
return floattan(value, radian);
}
stock Float:tanh(Float:value)
{
return floattanh(value, radian);
}
stock Float:fsqroot(Float:value)
{
return floatsqroot(value);
}
stock Float:fpower(Float:value, Float:exponent)
{
return floatpower(value, exponent);
}
stock Float:flog(Float:value, Float:base=10.0)
{
return floatlog(value, base);
}

View File

@ -1,20 +0,0 @@
#if defined _mysql_included
#endinput
#endif
#define _mysql_included
#include <sqlx>
native mysql_connect(host[], user[], pass[], dbname[], error[], maxlength);
native mysql_query(sql, query[], {Float,_}:... );
native mysql_error(sql, dest[], maxlength);
native mysql_close(sql);
native mysql_nextrow(sql);
native mysql_getfield(sql, fieldnum, {Float,_}:... );
native mysql_getresult(sql, field[], {Float,_}:... );
native mysql_affected_rows(sql);
native mysql_num_fields(sql);
native mysql_num_rows(sql);
native mysql_field_name(sql, field, name[], length);
native mysql_insert_id(sql);

View File

@ -1,86 +0,0 @@
/* AMX Mod X Backwards Compatibility
*
* by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#if defined _amxmod_translator_included
#endinput
#endif
#define _amxmod_translator_included
#define _translator_included
#include <amxmodx>
#include <amxmod>
#include <amxmisc>
//From AMX Mod. This is implemented in Core due to the nature of the
// translation engine and what AMX Mod did.
/* Translation backend, used by _T (since natives can't return arrays). */
native translate(const string[], destid=-1, forcelang=-1);
stock _T(const string[], destid=-1, forcelang=-1)
{
new TranslationResult[2] = {0, 0};
TranslationResult[0] = translate(string, destid, forcelang);
return TranslationResult;
}
stock load_translations(const file[])
{
static dir[255], path[255];
get_datadir(dir, 254);
format(path, 254, "%s/amxmod-lang/%s.txt", dir, file);
new fp
if (!(fp=fopen(path, "r")))
{
abort(AMX_ERR_NATIVE, "Could not find file: %s", path);
return 0;
}
static buffer[1024];
new lang[3];
new TransKey:bad_key = TransKey:-1;
new TransKey:cur_key = bad_key;
new len;
while (!feof(fp))
{
buffer[0] = 0;
fgets(fp, buffer, 1023);
len = strlen(buffer);
if (len == 0)
{
continue;
}
if (isspace(buffer[len-1]))
{
buffer[--len] = 0;
}
if (buffer[0] == '"')
{
remove_quotes(buffer);
cur_key = CreateLangKey(buffer);
AddTranslation("en", cur_key, buffer);
continue;
}
if (isspace(buffer[0]))
{
continue;
}
if ((cur_key != bad_key) && (buffer[2] == ':' && buffer[3] == '"'))
{
lang[0] = buffer[0];
lang[1] = buffer[1];
lang[2] = 0;
remove_quotes(buffer[3]);
AddTranslation(lang, cur_key, buffer[3]);
}
}
fclose(fp);
return 1;
}

View File

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

View File

@ -121,9 +121,7 @@ native fake_touch(entTouched, entToucher);
/* 2 formats.
Format: DispatchKeyValue("KeyName","Value") - sets keyvalues for the entity specified in the keyvalue() forward.
Format: DispatchKeyValue(index,"KeyName","Value") - Sets keyvalue for entity not specified in keyvalue() forward. */
#if !defined AMXMOD_BCOMPAT
native DispatchKeyValue(...);
#endif
native get_keyvalue(entity, const szKey[], value[], maxLength);
@ -133,18 +131,14 @@ native copy_keyvalue(szClassName[],sizea,szKeyName[],sizeb,szValue[],sizec);
native DispatchSpawn(iIndex);
/* Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage. */
#if !defined AMXMOD_BCOMPAT
native radius_damage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier);
#endif
/* Will return the contents of a point (inside map? in sky? outside map? etc.). */
native point_contents(const Float:fCheckAt[3]);
/* Trace a line from Start(X, Y, Z) to End(X, Y, Z), will return the point hit in vReturn[3]
* and an entity index if an entity is hit. */
#if !defined AMXMOD_BCOMPAT
native trace_line(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
#endif
/* Traces a hull. */
native trace_hull(const Float:origin[3],hull,ignoredent=0,ignoremonsters=0);

View File

@ -101,25 +101,6 @@
#define XS_REPLACEBUF_SIZE 3072
#endif
// **** Detect platform
#define XS_AMX 0
#define XS_AMXX 1
#if defined _amxmodx_included
#define XS_PLATFORM XS_AMXX
#endif
#if defined _amxmod_included && !defined _amxmodx_included
#define XS_PLATFORM XS_AMX
#endif
#if !defined XS_PLATFORM
// Could not detect platform.
// Make sure you include amxmodx.inc or amxmod.inc before including xs.inc
#assert 0
#endinput
#endif
// Turn on for release
#define XS__LIBRELEASE 1
@ -167,19 +148,9 @@
format_args(buffer, XS_LOGBUFFER_SIZE, 1 /* go from SECOND argument*/);
new bool:addLogTypeName = strlen(xs__logtypenames[logtype]) ? true : false;
#if XS_PLATFORM == XS_AMX
new plugname[32];
new dummy[1];
get_plugin(-1, plugname, 31, dummy, 0, dummy, 0, dummy, 0, dummy, 0, dummy[0]);
// log into HL Logs
log_message("[AMX][%s]: %s%s%s", plugname, addLogTypeName ? xs__logtypenames[logtype] : "",
addLogTypeName ? ": " : "", buffer);
#else // assume AMXX
// Use AMXX's logging system
log_amx("%s%s%s", addLogTypeName ? xs__logtypenames[logtype] : "",
addLogTypeName ? ": " : "", buffer);
#endif
}
// Assertion
@ -214,15 +185,6 @@
/****** BASIC STUFF ******/
#if XS_PLATFORM == XS_AMX
enum anglemode
{
radian = 0,
degrees,
grades
}
#endif
// Returns -1 if num is negative, 0 if num is 0, 1 if num is positive
// tested
XS_LIBFUNC_ATTRIB xs_sign(num)
@ -284,36 +246,14 @@
// tested
XS_LIBFUNC_ATTRIB Float:xs_rsqrt(Float:x)
{
#if XS_PLATFORM == XS_AMX
// store half
new Float:xhalf = x * 0.5;
// compute initial guess
new i = _:x;
i = 0x5f375a84 - (i >> 1);
x = Float:i;
// refine 3 times
x = x * (1.5 - xhalf * x * x);
x = x * (1.5 - xhalf * x * x);
x = x * (1.5 - xhalf * x * x);
return x;
#else
return 1.0 / floatsqroot(x);
#endif
}
// sqrt
// tested
XS_LIBFUNC_ATTRIB Float:xs_sqrt(Float:x)
{
#if XS_PLATFORM == XS_AMX
// 1.0 / rsqrt should still be faster than loop-using-approximation-methods
return 1.0 / xs_rsqrt(x);
#else
return floatsqroot(x);
#endif
}
// These functions generate errors if you use the macros with wrong parameter count.
@ -373,38 +313,6 @@
#pragma unused rawr
}
#if XS_PLATFORM == XS_AMX
#pragma semicolon 0
#include <VexdUM>
#pragma semicolon 1
// We need stocks to provide radian / degrees / grades functionality
XS_LIBFUNC_ATTRIB Float:xs__2rad(Float:x, anglemode:mod)
{
switch (mod)
{
case radian:
return x;
case degrees:
return xs_deg2rad(x);
case grades:
return xs_gra2rad(x);
default:
xs_assert(0, "xs_asin, xs_sin, xs_acos, xs_cos, xs_atan, xs_atan2 or xs_tan called with invalid mod param");
}
return 0.0; // compiler warning
}
#define xs_fabs(%1) fabs(%1)
#define xs_asin(%1,%2) asin(xs__2rad(%1, %2))
#define xs_sin(%1,%2) sin(xs__2rad(%1, %2))
#define xs_acos(%1,%2) acos(xs__2rad(%1, %2))
#define xs_cos(%1,%2) cos(xs__2rad(%1, %2))
#define xs_atan(%1,%2) atan(xs__2rad(%1, %2))
#define xs_atan2(%1,%2) atan2(xs__2rad(%1, %2))
#define xs_tan(%1,%2) tan(xs__2rad(%1, %2))
#else
#define xs_fabs(%1) floatabs(%1)
#define xs_asin(%1,%2) floatasin(%1, %2)
#define xs_sin(%1,%2) floatsin(%1, %2)
@ -413,7 +321,6 @@
#define xs_atan(%1,%2) floatatan(%1, %2)
#define xs_atan2(%1,%2) floatatan2(%1, %2)
#define xs_tan(%1,%2) floattan(%1, %2)
#endif
/****** RANDOM NUMBERS ******/
// This routine comes from the book "Inner Loops" by Rick Booth, Addison-Wesley
@ -961,16 +868,6 @@
return xs_replace(text, len, arr[0], arr[2]);
}
#if XS_PLATFORM == XS_AMX
// message_begin checking for AMX
xs__hook_message_begin(dest, msg_type, origin[3]={0,0,0}, player = 0)
{
xs_assert(xs_is_msg_valid(msg_type), "message_begin called with bogus message type");
return message_begin(dest, msg_type, origin, player);
}
#define message_begin xs__hook_message_begin
#endif
/****** MISC FUNCS *******/
// sets namestr to name of the command identified by cid
// half-tested

View File

@ -22,9 +22,7 @@ folder_list = [
'base/addons/amxmodx/modules',
'base/addons/amxmodx/plugins',
'base/addons/amxmodx/scripting',
'base/addons/amxmodx/scripting/amxmod_compat',
'base/addons/amxmodx/scripting/include',
'base/addons/amxmodx/scripting/include/amxmod_compat',
'base/addons/amxmodx/scripting/testsuite',
'cstrike/addons/amxmodx/configs',
'cstrike/addons/amxmodx/data',
@ -215,10 +213,6 @@ scripting_files = [
'telemenu.sma',
'timeleft.sma',
'pluginmenu.sma',
'amxmod_compat/amxmod_compat.sma',
'amxmod_compat/core.sma',
'amxmod_compat/mysql.sma',
'amxmod_compat/vexdum.sma',
'testsuite/admins_test.sma',
'testsuite/arraytest.sma',
'testsuite/callfunc_test.sma',
@ -295,15 +289,6 @@ scripting_files = [
'include/svn_version.inc',
'include/time.inc',
'include/vector.inc',
'include/amxmod_compat/VexdUM.inc',
'include/amxmod_compat/VexdUM_const.inc',
'include/amxmod_compat/VexdUM_stock.inc',
'include/amxmod_compat/Vexd_Utilities.inc',
'include/amxmod_compat/amxmod.inc',
'include/amxmod_compat/maths.inc',
'include/amxmod_compat/mysql.inc',
'include/amxmod_compat/translator.inc',
'include/amxmod_compat/xtrafun.inc',
]
for filename in scripting_files:
output_folder = 'base/addons/amxmodx/scripting'