# entity

## Getting entity:

### Get local player

```javascript
entity.getLocalPlayer();
```

Returns the local player as pointer.

### Get DwEntityList

```javascript
entity.getDwEntityList();
```

Returns the entity list as a pointer.

### Get crosshair entity

```javascript
entity.getCrosshairHandle(IntPtr: playerPawn)
```

Returns the aimed at player as a handle.

### Handle to entity (Crosshair Entity)

```javascript
entity.getEntityFromHandle(IntPtr: entityList, IntPtr: handle)
```

This will return any handle as en entity.

## About entity:

### Is Left Handed?

```javascript
entity.isLeftHanded(IntPtr: entity);
```

Returns a boolean

### Get Health

```javascript
entity.getHealth(IntPtr: entity);
```

Returns the entity's health as an integer.

### Is Dead?

```javascript
entity.isDead(IntPtr: entity);
```

Returns a boolean for any entity.

### Can Be Damaged?

```javascript
entity.canBeDamaged(IntPtr: entity);
```

Returns a boolean.

### Get Armor

```javascript
entity.getArmorValue(IntPtr: entity);
```

Returns an integer.

### Has Helmet?

```javascript
entity.hasHelmet(IntPtr: entity);
```

### Get Team

```javascript
entity.getTeam(IntPtr: entity);
```

Returns the entity's team number as an integer.

### Get Speed

```javascript
entity.getSpeed(IntPtr: entity);
```

Returns the entity's speed as a nice integer by doing Math.Sqrt on the speed vector.\
NOTE:\
This does an internal "isDead" check on the entity, if the entity is dead the speed is returned as -1

### Is Standing?

```javascript
entity.isStanding(IntPtr: entity);
```

Returns a boolean.

### Is Running?

```javascript
entity.isRunning(IntPtr: entity);
```

Returns a boolean \[counts as running/walking]

### Is Jumping?

```javascript
entity.isJumping(IntPtr: entity);
```

Returns a boolean \[counts as jumping/falling]

### Is Landing?

```javascript
entity.isLanding(IntPtr: entity);
```

Returns a boolean.

### Is Crouching?

```javascript
entity.isCrouching(IntPtr: entity);
```

Returns a boolean.

### Is Scoped?

```javascript
entity.isScoped(IntPtr: entity);
```

Returns a boolean.

### Will Resume Scope?

```javascript
entity.resumeScope(IntPtr: entity);
```

Returns a boolean

### Is Flashed?

```javascript
entity.isFlashed(IntPtr: entity);
```

Returns a boolean.

### Is Reloading?

```javascript
entity.isReloading(IntPtr: entity);
```

Returns a boolean.

### Get Weapon index

```javascript
entity.getWeaponIndex(IntPtr: entity);
```

Returns the entity's weapon index as a short.

### Has Defuser?

```javascript
entity.hasDefuser(IntPtr: entity);
```

Returns a boolean.

### Get Shots Fired

```javascript
entity.getShotsFired(IntPtr: entity);
```

Returns the current amount of shots fired while shooting as an integer.

### Get Punch Angle

```javascript
entity.getPunchAngle(IntPtr: entity);
```

Returns a vector for the view recoil.

### Get Flinch

```javascript
entity.getFlinch(IntPtr: entity);
```

Returns a vector for Flinch Stack.

### Wait For Attack?

```javascript
entity.waitForNoAttack(IntPtr: entity);
```

Returns a boolean.

### Eye Angles

```javascript
entity.getPunchAngle(IntPtr: entity);
```

Returns a vector.

### Get Scene Node

```javascript
entity.getSceneNode(IntPtr: entity);
```

Return the Scene Node for any entity as a pointer.

### Get Camera Services

```javascript
entity.getCamera(IntrPtr: entity);
```

Returns a pointer to the players Camera Service.

### Get Position

```javascript
entity.getPosition(IntPtr: sceneNode);
```

Returns the X,Y,Z of the entities position, this vector is already unpacked by default and does not require [#unpack](https://abuse.gitbook.io/lua-documentation/reference/vector#unpack "mention")

Example:

```javascript
var player = entity.getLocalPlayer();
var node = entity.getSceneNode(player);
var pos = entity.getPosition(node);
client.print(`X: ${pos.X} Y: ${pos.Y}, Z: ${pos.Z}`);
```

### Get Distance Between

```javascript
entity.getDistanceBetween(IntPtr: firstEntitySceneNode, IntPtr: secondEntitySceneNode);
```

Returns an integer .

### Get Closest Enemy

```javascript
entity.getClosestEnemy(IntPtr: playerPawn);
```

Returns the closest entity as a pointer.

### Is Buy Menu Open?

```javascript
entity.isBuyMenuOpen(IntPtr: entity);
```

Returns a boolean.

### Is In Buy Zone?

```javascript
entity.inBuyZone(IntPtr: entity);
```

Returns a boolean.

### Is Muted?

```javascript
entity.isMuted(IntPtr: entity);
```

Returns a boolean for communcation ban.

### Get Ping

```javascript
entity.getPing(IntPtr: entity)
```

### Get Kills

```javascript
entity.getKills(IntPtr: entity);
```

Returns an integer.

### Get Score

```javascript
entity.getScore(IntPtr: entity);
```

Returns an integer.

### Get MVPS

```javascript
entity.getMvps(IntPtr: entity);
```

Returns an integer.

### Cant Be Kicked?

```javascript
entity.cantBeKicked(IntPtr: entity);
```

Returns a boolean.

### Get Competitve Type

```javascript
entity.getCompetitiveType(IntPtr: entity);
```

Returns an integer for either Competitive or Premiere.

### Get Competitive Ranking

```javascript
entity.getCompetitiveRanking(IntPtr: entity);
```

Returns an integer.

### Get Competitive Wins

```javascript
entity.getCompetitiveWins(IntPtr: entity);
```

Returns an integer.

### Abandon Allows Surrender?

```javascript
entity.abandonAllowsSurrender(IntPtr: entity);
```

Returns a boolean.

### Abandon Allows Instant Surrender?

```javascript
entity.abandonAllowsInstantSurrender(IntPtr: entity);
```

Returns a boolean.

### Get Predicted Competitive Win Amount&#x20;

```javascript
entity.getPredictedCompetitiveWinAmount(IntPtr: entity);
```

Returns an integer.

### Get Predicted Competitive Loss Amount&#x20;

```javascript
entity.getPredictedCompetitiveLossAmount(IntPtr: entity);
```

Returns an integer.

### Get Predicted Competitive Tie Amount&#x20;

```javascript
entity.getPredictedCompetitiveTieAmount(IntPtr: entity);
```

Returns an integer.

### Get Entities

```javascript
entity.getEntities();
```

Return a list of all current entities and some of their data

Example:

```javascript
var entities = entity.getEntities(); // get entities from c# List<T> that appears in js as an object
entities = Array.from(entities); // collect all values
entities.forEach(ent => 
{
  client.print(`Name: ${ent.name} Health: ${ent.health} Team: ${ent.team} Round starting money: ${ent.startAccount} Money spent this round: ${ent.moneySpent} Total money spent: ${ent.totalMoneySpent}`);
});
```
