[INC] CHR Engine v1.1b

For scripting examples for learning how to use AMXX.
User avatar
Archive-Poster
Posts: 1267
Gender:
United States of America

[INC] CHR Engine v1.1b

Post by Archive-Poster »

  • This is a compilation of stocks that required greater than average math skills to create.
  • They have many functionalities.
  • Stocks require the fakemeta module.

Code: Select all

get_speed_vector(const Float:origin1[3],const Float:origin2[3], Float:speed, Float:new_velocity[3])
/*
*
*  Determines velocity (new_velocity) that
*  you would set an entity to in order for
*  it to go at "speed" from "origin1" to
*  "origin2".
*
*/

Code: Select all

get_speed_vector2(ent1, ent2, Float:speed, Float:new_velocity[3])
/*
*
*  Determines velocity (new_velocity) that
*  you would set "ent1" to in order for it
*  to go at "speed" from "ent1"'s origin
*  to "ent2"'s origin.
*
*/

Code: Select all

get_offset_origin(ent,const Float:offset[3],Float:origin[3])
/*
*
*  Determines location ("origin") of an entity
*  with supplied offset to its original angles.
*
*  Example: You want the location of 30 units
*  to the left of a model but the model is
*  turned at an angle so you cannot simply add
*  the offset to the origin. Then you would use
*  this.
*
*/

Code: Select all

get_offset_origin_body(ent,const Float:offset[3],Float:origin[3])
/*
*
*  Determines location ("origin") of a monster
*  or player entity with supplied offset to its
*  original angles.
*
*  Example: You want the location of 30 units
*  to the left of a model but the model is
*  turned at an angle so you cannot simply add
*  the offset to the origin. Then you would use
*  this.
*
*  Works same as above but only for players and
*  monsters.
*
*/

Code: Select all

is_user_crouching(ent,ignoreplayer=0)
/*
*
*  Determines if a player is crouching or not.
*  Return 1 if crouching and 0 if not.
*
*  Set ignoreplayer to 1 if you are using on
*  a HL monster that can crouch.
*
*/

Code: Select all

get_players_distance(const Float:origin[3],players[32], &num,flags[]="",index=0,team[]="")
/*
*
*  Returns indexes of players in order according
*  to how close they are to "origin". Indexes are
*  stored in "players[32]" and the number of
*  indexes returned is stored in num. team[] is
*  used only if flag 'e' is passed.
*
*  Flags:
*  "a" - Don't return dead players
*  "b" - Don't return alive players
*  "c" - Skip bots
*  "d" - Skip real players
*  "e" - Match with passed team
*  "h" - Skip HLTV
*  "i" - Is in Viewcone
*  "j" - Is Visible
*
*  If flag 'i' is passed, you must specify into
*  variable "index" who's viewcone to check if
*  the returned players are in.
*
*/

Code: Select all

entity_set_aim(ent,const Float:origin2[3],bone=0)
/*
*
*  Forces "ent" to aim at "origin"
*
*  Set bone to a positive value to
*  detect a specific bone the function
*  should aim from.
*
*/

Code: Select all

get_hudmessage_locs(ent,const Float:origin[3],Float:hudpos[2])
/*
*
*  If "origin" is in ent's viewcone, the location
*  of it using the hudmessage grid will be placed
*  into hudpos[2].
*
*  Returns 0 if "origin" is not on ent's hud.
*
*  ent must be a player (index 1-32).
*
*/

Code: Select all

set_speed(ent,Float:speed,mode=0,const Float:origin[3]={0.0,0.0,0.0})
/*
*
*  Sets ent's speed in the direction specified
*  by the mode variable
*
*  Modes:
*   0 = In direction ent is currently moving
*        but not including the z axis
*   1 = In direction ent is currently moving
*   2 = In direction ent is currently looking
*   3 = In direction ent is currently looking
*        but not including the z axis
*   4 = In direction of origin[3]
*
*
*  Use a negative speed to go in the opposite
*  direction of the specified mode.
*
*/

Code: Select all

is_within_difference(Float:number1,Float:number2,Float:difference)
/*
*
*  Determines if 2 floats are within "difference"
*  between eachother.
*
*  Example: 2.0 is within 5.0 "difference" of 7.0
*
*/

Code: Select all

#define MAX_SIDES   20
is_inside(const Float:point[2],const Float:polygon[MAX_SIDES][2],numsides)
/*
*
*  Determines if point[2] is inside of polygon[20][2].
*  Returns 1 if it is and 0 if it isn't.
*
*  Any polygon of any shape can be put into the polygon
*  array. MAX_SIDES define has to be changed for more
*  than 20 sides.
*
*  numsides if the number of sides put into polygon[20][2].
*
*  Example Usage:
*
*  new Float:square[MAX_SIDES][2], Float:point[2]
*  point[0] = 0.0
*  point[1] = 0.0
*
*  //4 sides are made up between the 4 points.
*  //The sides make up a square if you connect
*  //the points.
*  square[0][0] = 10.0
*  square[0][1] = 10.0
*  square[1][0] = 10.0
*  square[1][1] = -10.0
*  square[2][0] = -10.0
*  square[2][1] = -10.0
*  square[3][0] = -10.0
*  square[3][1] = 10.0
*
*  //will return 1 because (0,0) is
*  //inside the polygon made by the array.
*  is_inside(point,square,4)
*
*/

Code: Select all

stock Float:distance_from_line(Float:start[3],Float:end[3],Float:origin[3],&is_visible)
/*
*
*  Returns the distance origin[3] is at its closest
*  location to the line drawn from start[3] to end[3]
*
*  &is_visible is filled with 1 if origin[3] is visible
*  by the line at its nearest point, 0 if it is not
*
*/
CHR_Engine Approved Plugins:
Sparta Mod (300) - DA
GHW Aim Targets - GHW_Chronic
Headcrab Spawner - GHW_Chronic
Monster AI - Headcrab - GHW_Chronic
GHW Pet Followers - GHW_Chronic
Prometheus (Enhanced Hostages) - XxAvalanchexX
Long Jump - GHW_Chronic
"Hacks" Plugin - GHW_Chronic
Attachments
chr_engine.zip
(4.17 KiB) Downloaded 16 times

Who is online

Users browsing this forum: No registered users and 1 guest