Es getindexprop

From EventScripts Community Encyclopedia


Overview

Syntax: es_getindexprop <variable> <index> "<property>"

Note: Command parameters are described inside the < and > characters. Optional parameters are contained within [ and ] characters.

Variation of this command that doesn't expand variables: es_xgetindexprop

Description

Get the value of a class property from the entity defined by index and stores it in variable.

Parameters

  • variable - Variable to assign the entity property to.
  • index - Index of the entity to get the property from.
  • property - Direct name of the variable from source, i.e. CBaseEntity.vecOrigin (location of the entity in the map)


Examples

// Populate a database called 'awplist' with information
// about all awps on the map or in player's hands
es_xcreateentitylist awplist weapon_awp
 
// For each awp in the database, get it's origin:
es_foreachkey awpindex in awplist "es_xdoblock script/display_origin"
 
block display_origin
{
  es_xset awp_loc 0
  es_getindexprop awp_loc server_var(awpindex) "CBaseEntity.vecOrigin"
  es_msg An awp was found at: server_var(awp_loc)
}


Notes

  • Class which contains the source variable name may not always be CBaseEntity, although this is the superclass of all other source entity classes. Other subclasses may have their own variables, such as CBaseCombatWeapon, which contains information such as m_hOwner, which says which player is holding the weapon (-1 if it's on the ground).


See also

blog comments powered by Disqus