2004-02-21 20:30:04 +00:00
|
|
|
/* Engine functions
|
2004-02-15 02:29:51 +00:00
|
|
|
*
|
2004-02-21 20:30:04 +00:00
|
|
|
* by the AMX Mod X Development Team
|
2004-05-26 07:59:33 +00:00
|
|
|
* thanks to Vexd and mahnsawce
|
2004-02-15 02:29:51 +00:00
|
|
|
*
|
|
|
|
* This file is provided as is (no warranties).
|
|
|
|
*/
|
|
|
|
|
2004-02-21 20:30:04 +00:00
|
|
|
#if defined _engine_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _engine_included
|
|
|
|
|
2004-02-15 02:29:51 +00:00
|
|
|
#include <engine_const>
|
|
|
|
|
2006-05-10 10:42:49 +00:00
|
|
|
#if AMXX_VERSION_NUM >= 175
|
|
|
|
#pragma reqlib engine
|
|
|
|
#if !defined AMXMODX_NOAUTOLOAD
|
|
|
|
#pragma loadlib engine
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#pragma library engine
|
|
|
|
#endif
|
2005-07-15 19:05:31 +00:00
|
|
|
|
2007-04-24 16:38:36 +00:00
|
|
|
native traceresult(type,any:...);
|
2004-06-26 04:48:32 +00:00
|
|
|
|
2004-06-25 22:50:43 +00:00
|
|
|
/* Registers a client impulse to a function. Function is passed the ID of the user. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native register_impulse(impulse, const function[]);
|
2004-06-25 22:50:43 +00:00
|
|
|
|
|
|
|
/* Registers a touch action to a function by classnames. Use * to specify any classname. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native register_touch(const Touched[], const Toucher[], const function[]);
|
2004-06-25 22:50:43 +00:00
|
|
|
|
|
|
|
/* Registers a think action to a function by classname. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native register_think(const Classname[], const function[]);
|
2004-06-25 22:50:43 +00:00
|
|
|
|
2004-05-26 07:59:33 +00:00
|
|
|
/* NOTE: In old engine versions, this was not the case. Values are now WINDOWS values.
|
|
|
|
* You must pass with the windows offset (e.g. if 230 on windows, pass 230 no matter what)
|
|
|
|
* The module will automatically add +5 for Linux.
|
|
|
|
*/
|
2004-02-15 02:29:51 +00:00
|
|
|
|
2004-03-14 08:23:42 +00:00
|
|
|
/* Precaches an event. */
|
2007-04-24 16:38:36 +00:00
|
|
|
native precache_event(type, const Name[], any:...);
|
2004-03-14 08:23:42 +00:00
|
|
|
|
2004-07-30 14:17:28 +00:00
|
|
|
/* set/get a user's speak flags */
|
2007-03-05 19:30:40 +00:00
|
|
|
native set_speak(iIndex, iSpeakFlags);
|
|
|
|
native get_speak(iIndex);
|
2004-03-21 09:17:55 +00:00
|
|
|
|
2004-07-30 14:17:28 +00:00
|
|
|
/* Drops an entity to the floor (work?) */
|
2007-03-05 19:30:40 +00:00
|
|
|
native drop_to_floor(entity);
|
2004-03-14 08:23:42 +00:00
|
|
|
|
|
|
|
/* Get whole buffer containing keys and their data. */
|
|
|
|
native get_info_keybuffer(id, buffer[], length);
|
|
|
|
|
2006-05-05 08:30:16 +00:00
|
|
|
/* Use an entity with another entity. "entUsed" could be a hostage, "entUser" a player. */
|
|
|
|
native force_use(entUsed, entUser);
|
2004-03-14 08:23:42 +00:00
|
|
|
|
|
|
|
/* Get globals from server. */
|
|
|
|
native Float:get_global_float(variable);
|
|
|
|
native get_global_int(variable);
|
|
|
|
native get_global_string(variable, string[], maxlen);
|
|
|
|
native get_global_vector(variable, Float:vector[3]);
|
|
|
|
native get_global_edict(variable);
|
|
|
|
|
|
|
|
/* Set entity bounds. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native entity_set_size(index, const Float:mins[3], const Float:maxs[3]);
|
2004-03-14 08:23:42 +00:00
|
|
|
|
|
|
|
/* Get decal index */
|
|
|
|
native get_decal_index(const szDecalName[]);
|
|
|
|
|
2004-05-26 07:59:33 +00:00
|
|
|
/* Returns the distance between two entities. */
|
|
|
|
native Float:entity_range(ida,idb);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
|
|
|
/* Sets/gets things in an entities Entvars Struct. */
|
|
|
|
native entity_get_int(iIndex, iKey);
|
|
|
|
native entity_set_int(iIndex, iKey, iVal);
|
|
|
|
native Float:entity_get_float(iIndex, iKey);
|
|
|
|
native entity_set_float(iIndex, iKey, Float:iVal);
|
|
|
|
native entity_get_vector(iIndex, iKey, Float:vRetVector[3]);
|
2007-01-26 05:56:10 +00:00
|
|
|
native entity_set_vector(iIndex, iKey, const Float:vNewVector[3]);
|
2004-02-15 02:29:51 +00:00
|
|
|
native entity_get_edict(iIndex, iKey);
|
|
|
|
native entity_set_edict(iIndex, iKey, iNewIndex);
|
|
|
|
native entity_get_string(iIndex, iKey, szReturn[], iRetLen);
|
2004-03-24 08:53:40 +00:00
|
|
|
native entity_set_string(iIndex, iKey, const szNewVal[]);
|
2004-02-15 02:29:51 +00:00
|
|
|
native entity_get_byte(iIndex, iKey);
|
|
|
|
native entity_set_byte(iIndex, iKey, iVal);
|
|
|
|
|
|
|
|
/* Creates an entity, will return the index of the created entity. ClassName must be valid. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native create_entity(const szClassname[]);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
2004-03-08 09:28:30 +00:00
|
|
|
/* Finds an entity in the world, will return 0 if nothing is found */
|
2007-01-26 05:56:10 +00:00
|
|
|
native find_ent_by_class(iIndex, const szClass[]);
|
2004-03-24 05:01:33 +00:00
|
|
|
//optionally you can set a jghg2 type
|
|
|
|
// 1: target, 2:targetname, 0:classname (default)
|
2007-01-26 05:56:10 +00:00
|
|
|
native find_ent_by_owner(iIndex, const szClass[], iOwner, iJghgType=0);
|
|
|
|
native find_ent_by_target(iIndex, const szClass[]);
|
|
|
|
native find_ent_by_tname(iIndex, const szClass[]);
|
|
|
|
native find_ent_by_model(iIndex, const szClass[], const szModel[]);
|
|
|
|
native find_ent_in_sphere(start_from_ent, const Float:origin[3], Float:radius);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
2004-03-04 08:27:51 +00:00
|
|
|
//this will CBaseEntity::Think() or something from the entity
|
2007-03-05 19:30:40 +00:00
|
|
|
native call_think(entity);
|
2004-03-04 08:27:51 +00:00
|
|
|
|
2004-02-15 02:29:51 +00:00
|
|
|
/* Is entity valid? */
|
|
|
|
native is_valid_ent(iIndex);
|
|
|
|
|
|
|
|
/* Proper origin setting, keeps updated with Half-Life engine. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native entity_set_origin(iIndex, const Float:fNewOrigin[3]);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
|
|
|
/* Sets the model of an Entity. */
|
2004-03-25 11:42:34 +00:00
|
|
|
native entity_set_model(iIndex, const szModel[]);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
|
|
|
/* Remove an entity from the world. */
|
|
|
|
native remove_entity(iIndex);
|
|
|
|
|
|
|
|
/* Return current number of entities in the map */
|
|
|
|
native entity_count();
|
|
|
|
|
2006-05-04 22:12:16 +00:00
|
|
|
/* Simulate two entities colliding/touching. */
|
|
|
|
native fake_touch(entTouched, entToucher);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
2004-06-25 22:50:43 +00:00
|
|
|
/* 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. */
|
2006-09-01 03:29:27 +00:00
|
|
|
#if !defined AMXMOD_BCOMPAT
|
2004-06-25 22:50:43 +00:00
|
|
|
native DispatchKeyValue(...);
|
2006-09-01 03:29:27 +00:00
|
|
|
#endif
|
2004-06-25 22:50:43 +00:00
|
|
|
|
2007-01-26 05:56:10 +00:00
|
|
|
native get_keyvalue(entity, const szKey[], value[], maxLength);
|
2004-06-25 22:50:43 +00:00
|
|
|
|
|
|
|
native copy_keyvalue(szClassName[],sizea,szKeyName[],sizeb,szValue[],sizec);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
|
|
|
/* Runs the GameDLL's DispatchSpawn for an entity, I think it's used with DispatchKeyValue. */
|
|
|
|
native DispatchSpawn(iIndex);
|
|
|
|
|
|
|
|
/* Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage. */
|
2006-09-01 03:29:27 +00:00
|
|
|
#if !defined AMXMOD_BCOMPAT
|
2007-01-26 05:56:10 +00:00
|
|
|
native radius_damage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier);
|
2006-09-01 03:29:27 +00:00
|
|
|
#endif
|
2004-02-15 02:29:51 +00:00
|
|
|
|
|
|
|
/* Will return the contents of a point (inside map? in sky? outside map? etc.). */
|
2007-01-26 05:56:10 +00:00
|
|
|
native point_contents(const Float:fCheckAt[3]);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
|
|
|
/* 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. */
|
2006-09-01 03:29:27 +00:00
|
|
|
#if !defined AMXMOD_BCOMPAT
|
2007-01-26 05:56:10 +00:00
|
|
|
native trace_line(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
|
2006-09-01 03:29:27 +00:00
|
|
|
#endif
|
2004-02-15 02:29:51 +00:00
|
|
|
|
2004-05-26 07:59:33 +00:00
|
|
|
/* Traces a hull. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native trace_hull(const Float:origin[3],hull,ignoredent=0,ignoremonsters=0);
|
2004-05-26 07:59:33 +00:00
|
|
|
|
2004-02-15 02:29:51 +00:00
|
|
|
/* Traces a line, and returns the normal to the plane hit in vReturn.
|
|
|
|
* Returns 0 if theres no normal. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native trace_normal(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
|
|
|
/* Gets the ID of a grenade. */
|
|
|
|
native get_grenade_id(id, model[], len, grenadeid = 0);
|
|
|
|
|
|
|
|
/* Gets gpGlobals->time from Half-Life */
|
|
|
|
native Float:halflife_time();
|
|
|
|
|
|
|
|
/* Sets map lighting, #OFF to disable. */
|
|
|
|
native set_lights(const Lighting[]);
|
|
|
|
|
|
|
|
/* Sets Player's View to entity iTargetIndex. */
|
|
|
|
native attach_view(iIndex, iTargetIndex);
|
|
|
|
|
2010-12-13 02:24:30 +00:00
|
|
|
/* Sets Player's View Mode.
|
|
|
|
* rpgrocket.mdl must be precached in order for this function to work */
|
2004-02-15 02:29:51 +00:00
|
|
|
native set_view(iIndex, ViewType);
|
|
|
|
|
2004-05-26 07:59:33 +00:00
|
|
|
/* Direct copy of PLAYBACK_EVENT_FULL from Metamod/HLSDK. If you don't know how that works, you probably shouldn't be using it. */
|
2007-01-26 05:56:10 +00:00
|
|
|
native playback_event(flags,invoker,eventindex,Float:delay,const Float:origin[3],const Float:angles[3],Float:fparam1,Float:fparam2,iparam1,iparam2,bparam1,bparam2);
|
2004-05-26 07:59:33 +00:00
|
|
|
|
|
|
|
/* Gets parameters sent from CmdStart.
|
|
|
|
Note that you will receive modified values if any other plugin have
|
|
|
|
changed them. */
|
2007-04-24 16:38:36 +00:00
|
|
|
native get_usercmd(type,any:...);
|
2004-05-26 07:59:33 +00:00
|
|
|
|
|
|
|
/* Sets the parameters sent from CmdStart.
|
|
|
|
Note that your changes will be seen by any other plugin doing get_usercmd() */
|
2007-04-24 16:38:36 +00:00
|
|
|
native set_usercmd(type,any:...);
|
2004-05-26 07:59:33 +00:00
|
|
|
|
2004-09-16 11:02:51 +00:00
|
|
|
/* Converts a string offset into a real string. Some of the forwards in fakemeta
|
|
|
|
uses string offsets. (FM_CreateNamedEntity) */
|
2005-08-01 05:14:55 +00:00
|
|
|
native eng_get_string(_string, _returnString[], _len);
|
2004-09-16 11:02:51 +00:00
|
|
|
|
2004-05-26 07:59:33 +00:00
|
|
|
/* FORWARDS
|
|
|
|
**********/
|
|
|
|
|
2006-05-04 22:10:23 +00:00
|
|
|
/* Called when 2 entities touch.
|
|
|
|
* ptr - touched entity
|
|
|
|
* ptd - toucher entity
|
|
|
|
*/
|
|
|
|
forward pfn_touch(ptr, ptd);
|
2004-02-15 02:29:51 +00:00
|
|
|
|
|
|
|
/* Called once every server frame. May cause lag. */
|
|
|
|
forward server_frame();
|
|
|
|
|
|
|
|
/* Called when a client types kill in console. */
|
|
|
|
forward client_kill(id);
|
|
|
|
|
|
|
|
/* Forward for PreThink()/PostThink() on a player. */
|
|
|
|
forward client_PreThink(id);
|
2004-03-04 20:25:27 +00:00
|
|
|
forward client_PostThink(id);
|
|
|
|
|
2004-04-16 04:57:38 +00:00
|
|
|
/* Forward for impulses. */
|
|
|
|
forward client_impulse(id, impulse);
|
2004-05-26 07:59:33 +00:00
|
|
|
|
2013-07-02 23:00:52 +00:00
|
|
|
/* Forward for CmdStart() on a player. */
|
|
|
|
forward client_cmdStart(id);
|
|
|
|
|
2004-05-26 07:59:33 +00:00
|
|
|
/* Called when an entity "thinks" (DispatchThink) */
|
|
|
|
forward pfn_think(entid);
|
|
|
|
|
|
|
|
/* Called when an event is played */
|
2006-02-13 20:03:39 +00:00
|
|
|
forward pfn_playbackevent(flags, entid, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2);
|
2004-09-28 07:29:48 +00:00
|
|
|
|
|
|
|
/* Called when an entity gets a keyvalue set on it from the engine (ie: map load) Use copy_keyvalue to get the keyvalue information */
|
|
|
|
forward pfn_keyvalue(entid);
|
2004-05-26 07:59:33 +00:00
|
|
|
|
|
|
|
/* Called when an entity is spawned */
|
|
|
|
forward pfn_spawn(entid);
|
|
|
|
|
2004-03-24 05:01:33 +00:00
|
|
|
//from jghg2
|
2004-05-26 07:59:33 +00:00
|
|
|
/* As above, but returns number of ents stored in entlist. Use to find a specific type of entity classname (specify in _lookforclassname) around a
|
2004-03-24 05:01:33 +00:00
|
|
|
* certain entity specified in aroundent. All matching ents are stored in entlist. Specify max amount of entities to find in maxents.
|
|
|
|
* If aroundent is 0 its origin is not used, but origin in 6th parameter. Ie, do not specify 6th parameter (origin) if you specified an entity
|
|
|
|
* in aroundent.
|
|
|
|
*/
|
2007-01-26 05:56:10 +00:00
|
|
|
native find_sphere_class(aroundent, const _lookforclassname[], Float:radius, entlist[], maxents, const Float:origin[3] = {0.0, 0.0, 0.0});
|
2004-03-24 05:01:33 +00:00
|
|
|
|
2006-10-01 06:08:39 +00:00
|
|
|
/* SDK function - checks if an origin is in an entity's view cone
|
|
|
|
* Set use3d to 1 to do the calculation in 3D. Otherwise it will be in 2D.
|
|
|
|
*/
|
2007-01-26 05:56:10 +00:00
|
|
|
native is_in_viewcone(entity, const Float:origin[3], use3d = 0);
|
2005-07-15 20:29:59 +00:00
|
|
|
|
2005-08-01 18:56:03 +00:00
|
|
|
//SDK function - checks if an entity is visible to an entity
|
|
|
|
native is_visible(entity, target);
|
2005-07-15 20:29:59 +00:00
|
|
|
|
2005-07-29 19:37:07 +00:00
|
|
|
//Added at twistedeuphoria's request, see funcwiki for details
|
2007-01-26 05:56:10 +00:00
|
|
|
native trace_forward(const Float:start[3], const Float:angle[3], Float:give, ignoreEnt, &Float:hitX, &Float:hitY, &Float:shortestDistance, &Float:shortestDistLow, &Float:shortestDistHigh);
|
2005-07-29 19:37:07 +00:00
|
|
|
|
2013-08-10 12:16:26 +00:00
|
|
|
/**
|
|
|
|
* Sets rendering of an entity, including player entities.
|
|
|
|
* This is basically the same as set_rendering() stock.
|
|
|
|
*
|
|
|
|
* @param index The entity index to apply the render.
|
|
|
|
* @param fx The render effect. See kRenderFx* constants.
|
|
|
|
* @param r The amount of red.
|
|
|
|
* @param g The amount of green.
|
|
|
|
* @param b The amount of blue.
|
|
|
|
* @param render The render mode. See kRender* constants.
|
|
|
|
* @param amount The render thickness generally. It can have others meaning depending effect/mode.
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
native set_ent_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0);
|
|
|
|
|
2005-07-29 19:37:07 +00:00
|
|
|
#include <engine_stocks>
|