# 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.getCrosshairEntity(IntPtr: localPlayer)
```

Returns the aimed at player as an entity

## About entity:

### 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.

### Get Team

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

Returns the entity's team number as an integer.

### Is Dormant?

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

Returns a boolean for any entity.

### Is Scoped?

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

Returns a boolean for any entity.

### Is Reloading?

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

Returns a boolean for any entity.

### Is Flashed?

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

Returns a boolean for any entity.

### Is Jumping?

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

Returns a boolean for any entity

### Is Defusing?

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

Returns a boolean for any entity

### Get Name

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

Returns a string (128 length) for any entity

### Set name

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

Sets the entity's name but should be the local player

### Speed

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

Returns the entity's speed as a nice integer by doing Math.Sqrt on the speed vector.

### Get Weapon Index

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

Returns the entity's weapon index as an integer

### Get Weapon Type

```javascript
entity.getWeaponType(short: index);
```

Returns the entity's weapon type as a lowercase string.

### 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 Position

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

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/counter-strike-2/vector#unpack "mention")

Example:

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

## Functions:

### Remove Flash

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

Used to remove the flash for local player typically
