merged bcompat changed into trunk

removed amxmod compat files for now
This commit is contained in:
David Anderson
2006-09-01 03:29:27 +00:00
parent 95537e4840
commit 78956f3d89
32 changed files with 979 additions and 267 deletions

View File

@ -1,104 +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>
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

@ -11,6 +11,14 @@
#endif
#define _amxmisc_included
#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)
{
return ( get_user_flags(id)>0 && !(get_user_flags(id)&ADMIN_USER) )
@ -30,13 +38,21 @@ stock cmd_access(id,level,cid,num) {
}
if ( has_access==0 ) {
#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
}
if (read_argc() < num) {
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
}
return 1
@ -58,21 +74,33 @@ stock cmd_target(id,const arg[],flags = 1) {
new player = find_player("bl",arg)
if (player) {
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
}
}
else if ( ( player = find_player("c",arg) )==0 && arg[0]=='#' && arg[1] )
player = find_player("k",str_to_num(arg[1]))
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 & 1) {
if ((get_user_flags(player)&ADMIN_IMMUNITY) && ((flags&2)?(id!=player):true) ) {
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
}
}
@ -80,7 +108,11 @@ stock cmd_target(id,const arg[],flags = 1) {
if (!is_user_alive(player)) {
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
}
}
@ -88,7 +120,11 @@ stock cmd_target(id,const arg[],flags = 1) {
if (is_user_bot(player)) {
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
}
}
@ -98,11 +134,20 @@ stock cmd_target(id,const arg[],flags = 1) {
stock show_activity( id, const name[], {Float,_}: ... ) {
new buffer[128]
format_args( buffer , 127 , 2 )
switch(get_cvar_num("amx_show_activity")) {
case 2: client_print(0,print_chat,"%L %s: %s",
id, is_user_admin(id) ? "ADMIN" : "PLAYER" , name , buffer )
case 1: client_print(0,print_chat,"%L: %s",
id, is_user_admin(id) ? "ADMIN" : "PLAYER", buffer )
switch(get_cvar_num("amx_show_activity"))
{
case 2:
#if defined AMXMOD_BCOMPAT
client_print(0, print_chat, "%s %s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), name, buffer)
#else
client_print(0, print_chat, "%L %s: %s", id, is_user_admin(id) ? "ADMIN" : "PLAYER" , name , buffer )
#endif
case 1:
#if defined AMXMOD_BCOMPAT
client_print(0, print_chat, "%s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), buffer)
#else
client_print(0, print_chat, "%L: %s", id, is_user_admin(id) ? "ADMIN" : "PLAYER", buffer )
#endif
}
}

View File

@ -1,42 +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
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fun>
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,_}:... )
{
new basedir[32]
get_localinfo("amxx_basedir",basedir,31)
format_args(path,len,2)
return replace(path,len,"$basedir",basedir)
}

View File

@ -121,7 +121,9 @@ 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, szKey[], value[], maxLength);
@ -131,14 +133,18 @@ 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(Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier);
#endif
/* Will return the contents of a point (inside map? in sky? outside map? etc.). */
native point_contents(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, Float:fStart[3], Float:fEnd[3], Float:vReturn[3]);
#endif
/* Traces a hull. */
native trace_hull(Float:origin[3],hull,ignoredent=0,ignoremonsters=0);

View File

@ -66,14 +66,22 @@ native Float:floatpower(Float:value, Float:exponent);
native Float:floatlog(Float:value, Float:base=10.0);
/* Return the sine, cosine or tangent.
* The input angle may be in radian, degrees or grades. */
* The input angle may be in radians, degrees or grades. */
native Float:floatsin(Float:value, anglemode:mode=radian);
native Float:floatcos(Float:value, anglemode:mode=radian);
native Float:floattan(Float:value, anglemode:mode=radian);
/* Return the hyperbolic sine, cosine or tangent.
* The input angle may be in radians, degrees or grades. */
native Float:floatsinh(Float:angle, anglemode:mode=radian);
native Float:floatcosh(Float:angle, anglemode:mode=radian);
native Float:floattanh(Float:angle, anglemode:mode=radian);
/* Return the absolute value */
native Float:floatabs(Float:value);
/* Return the angle of a sine, cosine or tangent.
* The output angle may be in radians, degrees, or grades. */
native Float:floatatan(Float:angle, radix);
native Float:floatacos(Float:angle, radix);
native Float:floatasin(Float:angle, radix);

View File

@ -159,6 +159,12 @@
#define DMG_MORTAR (1<<23) // Hit by air raid (done to distinguish grenade from mortar)
#define DMG_TIMEBASED (~(0x3fff)) // Mask for time-based damage
// The fNoMonsters parameter of EngFunc_TraceLine, EngFunc_TraceMonsterHull, EngFunc_TraceHull, and EngFunc_TraceSphere
#define DONT_IGNORE_MONSTERS 0
#define IGNORE_MONSTERS 1
#define IGNORE_MISSILE 2
#define IGNORE_GLASS 0x100
// The hullnumber paramater of EngFunc_TraceHull, EngFunc_TraceModel and DLLFunc_GetHullBounds
#define HULL_POINT 0
#define HULL_HUMAN 1

View File

@ -1,95 +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
}
/* 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 // _xtrafun_included