Engine
Содержание
- 1 engine.inc
- 1.1 register_impulse
- 1.2 register_touch
- 1.3 register_think
- 1.4 precache_event
- 1.5 set_speak
- 1.6 get_speak
- 1.7 drop_to_floor
- 1.8 get_info_keybuffer
- 1.9 force_use
- 1.10 get_global_float
- 1.11 get_global_int
- 1.12 get_global_string
- 1.13 get_global_vector
- 1.14 get_global_edict
- 1.15 entity_set_size
- 1.16 get_decal_index
- 1.17 entity_range
- 1.18 entity_get_int
- 1.19 entity_set_int
- 1.20 entity_get_float
- 1.21 entity_set_float
- 1.22 entity_get_vector
- 1.23 entity_set_vector
- 1.24 entity_get_edict
- 1.25 entity_set_edict
- 1.26 entity_get_string
- 1.27 entity_set_string
- 1.28 entity_get_byte
- 1.29 entity_set_byte
- 1.30 create_entity
- 1.31 find_ent_by_class
- 1.32 find_ent_by_owner
- 1.33 find_ent_by_target
- 1.34 find_ent_by_tname
- 1.35 find_ent_by_model
- 1.36 find_ent_in_sphere
- 1.37 call_think
- 1.38 message_fbegin
- 1.39 emessage_fbegin
- 1.40 ewrite_fcoord
- 1.41 write_fcoord
- 1.42 write_fangle
- 1.43 ewrite_fangle
- 1.44 is_valid_ent
- 1.45 entity_set_origin
- 1.46 entity_set_model
- 1.47 remove_entity
- 1.48 entity_count
- 1.49 fake_touch
- 1.50 get_keyvalue
- 1.51 copy_keyvalue
- 1.52 DispatchSpawn
- 1.53 radius_damage
- 1.54 point_contents
- 1.55 trace_line
- 1.56 trace_hull
- 1.57 trace_normal
- 1.58 get_grenade_id
- 1.59 halflife_time
- 1.60 set_lights
- 1.61 attach_view
- 1.62 set_view
- 1.63 playback_event
- 1.64 get_usercmd
- 1.65 set_usercmd
- 1.66 eng_get_string
- 1.67 pfn_touch
- 1.68 server_frame
- 1.69 client_kill
- 1.70 client_PreThink
- 1.71 client_PostThink
- 1.72 client_impulse
- 1.73 pfn_think
- 1.74 pfn_playbackevent
- 1.75 pfn_keyvalue
- 1.76 pfn_spawn
- 1.77 find_sphere_class
- 1.78 is_in_viewcone
- 1.79 is_visible
- 1.80 is_borderplane_visible
- 1.81 is_visible_origin
- 1.82 in_front
- 1.83 trace_texture
- 1.84 trace_forward
- 2 engine_stock.inc
engine.inc
register_impulse
Registers a client impulse to a function. Function is passed the ID of the user.
native register_impulse(impulse, const function[]);
register_touch
Registers a touch action to a function by classnames. Use * to specify any classname.
native register_touch(const Touched[], const Toucher[], const function[]);
register_think
Registers a think action to a function by classname.
native register_think(const Classname[], const function[]);
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.
precache_event
Precaches an event.
native precache_event(type, const Name[], any:...);
set_speak
Set a user's speak
native set_speak(iIndex, iSpeakFlags);
get_speak
Get a user's speak
native get_speak(iIndex);
drop_to_floor
Drops an entity to the floor (work?)
native drop_to_floor(entity);
get_info_keybuffer
Get whole buffer containing keys and their data.
native get_info_keybuffer(id, buffer[], length);
force_use
Use an entity with another entity. "entUsed" could be a hostage, "entUser" a player.
native force_use(entUsed, entUser);
get_global_float
native Float:get_global_float(variable);
get_global_int
native get_global_int(variable);
get_global_string
native get_global_string(variable, string[], maxlen);
get_global_vector
native get_global_vector(variable, Float:vector[3]);
get_global_edict
native get_global_edict(variable);
entity_set_size
Set entity bounds.
native entity_set_size(index, const Float:mins[3], const Float:maxs[3]);
get_decal_index
Get decal index
native get_decal_index(const szDecalName[]);
entity_range
Returns the distance between two entities.
native Float:entity_range(ida,idb);
entity_get_int
Get things in an entities Entvars Struct.
native entity_get_int(iIndex, iKey);
entity_set_int
Set things in an entities Entvars Struct. native entity_set_int(iIndex, iKey, iVal);
entity_get_float
Get things in an entities Entvars Struct.
native Float:entity_get_float(iIndex, iKey);
entity_set_float
native entity_set_float(iIndex, iKey, Float:iVal);
entity_get_vector
Set things in an entities Entvars Struct.
native entity_get_vector(iIndex, iKey, Float:vRetVector[3]);
entity_set_vector
Set things in an entities Entvars Struct.
native entity_set_vector(iIndex, iKey, const Float:vNewVector[3]);
entity_get_edict
Get things in an entities Entvars Struct.
native entity_get_edict(iIndex, iKey);
entity_set_edict
Get things in an entities Entvars Struct.
native entity_set_edict(iIndex, iKey, iNewIndex);
entity_get_string
Get things in an entities Entvars Struct.
native entity_get_string(iIndex, iKey, szReturn[], iRetLen);
entity_set_string
Set things in an entities Entvars Struct.
native entity_set_string(iIndex, iKey, const szNewVal[]);
entity_get_byte
Get things in an entities Entvars Struct.
native entity_get_byte(iIndex, iKey);
entity_set_byte
Set things in an entities Entvars Struct.
native entity_set_byte(iIndex, iKey, iVal);
create_entity
Creates an entity, will return the index of the created entity. ClassName must be valid.
native create_entity(const szClassname[]);
find_ent_by_class
Finds an entity in the world, will return 0 if nothing is found
native find_ent_by_class(iIndex, const szClass[]);
find_ent_by_owner
native find_ent_by_owner(iIndex, const szClass[], iOwner, iJghgType=0);
find_ent_by_target
native find_ent_by_target(iIndex, const szClass[]);
find_ent_by_tname
native find_ent_by_tname(iIndex, const szClass[]);
find_ent_by_model
native find_ent_by_model(iIndex, const szClass[], const szModel[]);
find_ent_in_sphere
native find_ent_in_sphere(start_from_ent, const Float:origin[3], Float:radius);
call_think
this will CBaseEntity::Think() or something from the entity
native call_think(entity);
message_fbegin
Message functions, read message.inc (the same but more faster than fakemeta)
native message_fbegin(dest, msg_type, Float:origin[3]={0.0,0.0,0.0},player=0);
emessage_fbegin
native emessage_fbegin(dest, msg_type, Float:origin[3]={0.0,0.0,0.0}, player=0);
ewrite_fcoord
Message functions, read message.inc (the same but more faster than fakemeta)
native ewrite_fcoord(Float:coord);
write_fcoord
native write_fcoord(Float:coord);
write_fangle
native write_fangle(Float:angle);
ewrite_fangle
native ewrite_fangle(Float:angle);
is_valid_ent
Is entity valid?
native is_valid_ent(iIndex);
entity_set_origin
Proper origin setting, keeps updated with Half-Life engine.
native entity_set_origin(iIndex, const Float:fNewOrigin[3]);
entity_set_model
Sets the model of an Entity.
native entity_set_model(iIndex, const szModel[]);
remove_entity
Remove an entity from the world.
native remove_entity(iIndex);
entity_count
Return current number of entities in the map
native entity_count();
fake_touch
Simulate two entities colliding/touching.
native fake_touch(entTouched, entToucher);
get_keyvalue
native get_keyvalue(entity, const szKey[], value[], maxLength);
copy_keyvalue
native copy_keyvalue(szClassName[],sizea,szKeyName[],sizeb,szValue[],sizec);
DispatchSpawn
Runs the GameDLL's DispatchSpawn for an entity, I think it's used with DispatchKeyValue.
native DispatchSpawn(iIndex);
radius_damage
Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage.
native radius_damage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier);
point_contents
Will return the contents of a point (inside map? in sky? outside map? etc.).
native point_contents(const Float:fCheckAt[3]);
trace_line
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.
native trace_line(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
trace_hull
Traces a hull.
native trace_hull(const Float:origin[3],hull,ignoredent=0,ignoremonsters=0);
trace_normal
Traces a line, and returns the normal to the plane hit in vReturn. Returns 0 if theres no normal.
native trace_normal(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]);
get_grenade_id
Gets the ID of a grenade.
native get_grenade_id(id, model[], len, grenadeid = 0);
halflife_time
Gets gpGlobals->time from Half-Life
native Float:halflife_time();
set_lights
Sets map lighting, #OFF to disable.
native set_lights(const Lighting[]);
attach_view
Sets Player's View to entity iTargetIndex.
native attach_view(iIndex, iTargetIndex);
set_view
Sets Player's View Mode.
native set_view(iIndex, ViewType);
playback_event
Direct copy of PLAYBACK_EVENT_FULL from Metamod/HLSDK. If you don't know how that works, you probably shouldn't be using it.
native playback_event(flags,invoker,eventindex,Float:delay,const Float:origin[3],const Float:angles[3],Float:fparam1,Float:fparam2,iparam1,iparam2,bparam1,bparam2);
get_usercmd
Gets parameters sent from CmdStart. Note that you will receive modified values if any other plugin have changed them.
native get_usercmd(type,any:...);
set_usercmd
Sets the parameters sent from CmdStart. Note that your changes will be seen by any other plugin doing get_usercmd()
native set_usercmd(type,any:...);
eng_get_string
Converts a string offset into a real string. Some of the forwards in fakemeta uses string offsets. (FM_CreateNamedEntity)
native eng_get_string(_string, _returnString[], _len);
pfn_touch
Called when 2 entities touch. ptr - touched entity, ptd - toucher entity.
forward pfn_touch(ptr, ptd);
server_frame
Called once every server frame. May cause lag.
forward server_frame();
client_kill
Called when a client types kill in console.
forward client_kill(id);
client_PreThink
Forward for PreThink() on a player.
forward client_PreThink(id);
client_PostThink
Forward for PostThink() on a player.
forward client_PostThink(id);
client_impulse
Forward for impulses.
forward client_impulse(id, impulse);
pfn_think
Called when an entity "thinks" (DispatchThink)
forward pfn_think(entid);
pfn_playbackevent
Called when an event is played
forward pfn_playbackevent(flags, entid, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2);
pfn_keyvalue
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);
pfn_spawn
Called when an entity is spawned
forward pfn_spawn(entid);
find_sphere_class
As above, but returns number of ents stored in entlist. Use to find a specific type of entity classname (specify in _lookforclassname) around a 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.
native find_sphere_class(aroundent, const _lookforclassname[], Float:radius, entlist[], maxents, const Float:origin[3] = {0.0, 0.0, 0.0});
is_in_viewcone
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.
native is_in_viewcone(entity, const Float:origin[3], use3d = 0);
is_visible
SDK function - checks if an entity is visible to an entity
native is_visible(entity, target);
is_borderplane_visible
Function checks 4 points on a plane made on an entity based on its bounding box (it is like 4 trace lines made to 4 different points calculated by the bounding box!). Returns 1 if one point from the borderplane is visible.
native is_borderplane_visible(Float:startorigin[3], Float:endorigin[3], Float:mins[3], Float:maxs[3], ignore = DONT_IGNORE_MONSTERS, ignore_ent = 0, Float:mulconst = 1.0);
startorigin | Start point (this is the point where the trace starts!) |
endorigin | End origin, from this origin the plane will be created in right,left,up and down |
mins and maxs | Are the bounding box of the target entity, use customs if you like |
ignore | Ignore property (see trace line tutorial) |
ignore_ent | Ignore entity |
mulconst | This is a multiplication constant, normally the plane has the size of the cube that surronds the entity. If this constant for example 0.5 then the plane is 1/2 times smaller |
is_visible_origin
The same as is_visible but checks origin not an entity
native is_visible_origin(entity, Float:origin[3]);
in_front
Returns 1 if origin is in front of the entity, 0 if not
native in_front(entity, const Float:origin[3]);
trace_texture
The same as fakemeta trace texture but works better, it is more efficient, and it also does not crash the server. Return 1 when we have a valid texture, 0 when not.
native trace_texture(entity, Float:v1[3], Float:v2[3], texture[], len);
trace_forward
Added at twistedeuphoria's request, see funcwiki for details.
native trace_forward(const Float:start[3], const Float:angle[3], Float:give, ignoreEnt, &Float:hitX, &Float:hitY, &Float:shortestDistance, &Float:shortestDistLow, &Float:shortestDistHigh);