Skip to main content

Entity::getSpeed

Syntax

```js entity.getSpeed(); ```

Required Arguments

  • Entity: <font color='red'>vehicle</font>

Return value

  • MP/s (Meters per second)

Speed Calculations

  • KM/H (Kilometers per hour): `speed*3.6`
  • MP/H (Miles per hour): `speed*2.236936`

Example

```js function getspeed() &#123;

let vehicle = mp.players.local.vehicle let speed = vehicle.getSpeed();

speed = speed * 3.6; // Transform the speed into KM/H // If you want a realistic calculation for the vehicle speed use: speed = Math.ceil(speed * (speed / 20) * 2); &lt;- this will raise up to 300 km/h for a T20, but you can still easily cruise around with 60 km/h

return speed; // returns the speed in KM/H &#125; ```

See also