🔥 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

@ -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
#include <amxmodx>
#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
// Use AMXX's logging system
log_amx("%s%s%s", addLogTypeName ? xs__logtypenames[logtype] : "",
addLogTypeName ? ": " : "", buffer);
}
// 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
return 1.0 / floatsqroot(x);
}
// 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
return floatsqroot(x);
}
// These functions generate errors if you use the macros with wrong parameter count.
@ -373,47 +313,14 @@
#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)
#define xs_acos(%1,%2) floatacos(%1, %2)
#define xs_cos(%1,%2) floatcos(%1, %2)
#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
#define xs_fabs(%1) floatabs(%1)
#define xs_asin(%1,%2) floatasin(%1, %2)
#define xs_sin(%1,%2) floatsin(%1, %2)
#define xs_acos(%1,%2) floatacos(%1, %2)
#define xs_cos(%1,%2) floatcos(%1, %2)
#define xs_atan(%1,%2) floatatan(%1, %2)
#define xs_atan2(%1,%2) floatatan2(%1, %2)
#define xs_tan(%1,%2) floattan(%1, %2)
/****** 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