[Half-Life AMXX] / include / amxmod_compat / xtrafun.inc Repository:
ViewVC logotype

Diff of /include/amxmod_compat/xtrafun.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16, Fri Nov 16 15:12:40 2007 UTC revision 17, Fri Nov 16 15:29:57 2007 UTC
# Line 15  Line 15 
15    
16  /* Gets the velocity of an entity */  /* Gets the velocity of an entity */
17  stock get_entity_velocity(index, velocity[3]) {  stock get_entity_velocity(index, velocity[3]) {
18          new Float:vector[3]          new Float:vector[3];
19          entity_get_vector(index, EV_VEC_velocity, vector)          entity_get_vector(index, EV_VEC_velocity, vector);
20          FVecIVec(vector, velocity)          FVecIVec(vector, velocity);
21  }  }
22    
23  /* Sets the velocity of an entity */  /* Sets the velocity of an entity */
24  stock set_entity_velocity(index, velocity[3]) {  stock set_entity_velocity(index, velocity[3]) {
25          new Float:vector[3]          new Float:vector[3];
26          IVecFVec(velocity, vector)          IVecFVec(velocity, vector);
27          entity_set_vector(index, EV_VEC_velocity, vector)          entity_set_vector(index, EV_VEC_velocity, vector);
28  }  }
29    
30  /* Gets the origin of an entity */  /* Gets the origin of an entity */
31  stock get_entity_origin(index, origin[3]) {  stock get_entity_origin(index, origin[3]) {
32          new Float:vector[3]          new Float:vector[3];
33          entity_get_vector(index, EV_VEC_origin, vector)          entity_get_vector(index, EV_VEC_origin, vector);
34          FVecIVec(vector, origin)          FVecIVec(vector, origin);
35  }  }
36    
37  /* Sets the origin of an entity */  /* Sets the origin of an entity */
38  stock set_entity_origin(index, origin[3]) {  stock set_entity_origin(index, origin[3]) {
39          new Float:vector[3]          new Float:vector[3];
40          IVecFVec(origin, vector)          IVecFVec(origin, vector);
41          entity_set_vector(index, EV_VEC_origin, vector)          entity_set_vector(index, EV_VEC_origin, vector);
42  }  }
43    
44  /* Get the index of the grenade belonging to index.  /* Get the index of the grenade belonging to index.
# Line 51  Line 51 
51   * FLASHBANG = "models/w_flashbang.mdl"   * FLASHBANG = "models/w_flashbang.mdl"
52   * SMOKEGRENADE = "models/w_smokegrenade.mdl" */   * SMOKEGRENADE = "models/w_smokegrenade.mdl" */
53  stock get_grenade_index(index, model[], len, grenadeindex = 0) {  stock get_grenade_index(index, model[], len, grenadeindex = 0) {
54          new entfind = grenadeindex          new entfind = grenadeindex;
55          new entowner = index          new entowner = index;
56    
57          for (;;) {          for (;;) {
58                  entfind = find_ent_by_class(entfind, "grenade")                  entfind = find_ent_by_class(entfind, "grenade");
59    
60                  if (entfind && is_valid_ent(entfind)) {                  if (entfind && is_valid_ent(entfind)) {
61                          if (entity_get_edict(entFind, EV_ENT_owner) == entowner) {                          if (entity_get_edict(entFind, EV_ENT_owner) == entowner) {
62                                  entity_get_string(entfind, EV_SZ_model, model)                                  entity_get_string(entfind, EV_SZ_model, model);
63                                  return entfind                                  return entfind;
64                          }                          }
65                  }                  }
66                  else {                  else {
# Line 79  Line 79 
79     classname = 0,     classname = 0,
80     target,     target,
81     targetname     targetname
82  }  };
83    
84  #if !defined _vexd_bcompat_included  #if !defined _vexd_bcompat_included
85  /* Find an entity ID from start_from_ent id (use 0 to start from  /* Find an entity ID from start_from_ent id (use 0 to start from
# Line 87  Line 87 
87   * "targetname", value is the name you are searching for */   * "targetname", value is the name you are searching for */
88  stock find_entity(start_from_ent, category, value[]) {  stock find_entity(start_from_ent, category, value[]) {
89          switch (category) {          switch (category) {
90                  case target: return find_ent_by_target(start_from_ent, value)                  case target: return find_ent_by_target(start_from_ent, value);
91                  case targetname: return find_ent_by_tname(start_from_ent, value)                  case targetname: return find_ent_by_tname(start_from_ent, value);
92          }          }
93          return find_ent_by_class(start_from_ent, value)          return find_ent_by_class(start_from_ent, value);
94  }  }
95  #endif  #endif
96    

Legend:
Removed from v.16  
changed lines
  Added in v.17

Contact
ViewVC Help
Powered by ViewVC 1.0.4