# isPedInWater (Shared)

> Tells whether a ped or player is in the water.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Peds
- **URL**: https://wiki.mymp.gg/en/isPedInWater

## Syntax

```lua
bool isPedInWater(element ped)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `element` | The ped or player. Any other element returns `false`. |

## Returns

`true` if it is in the water. `false` if not or if the element is not a ped.

On the client, a ped on foot is in the water when it is swimming, and a ped in a vehicle when the vehicle is in the water. On the server, the last state the client synced is used: the ped is swimming.

## Example

```lua
setTimer(function()
    for _, player in ipairs(getElementsByType("player")) do
        if isPedInWater(player) then
            outputDebugString(getPlayerName(player) .. " is swimming")
        end
    end
end, 1000, 0)
```

## See also

- [isPedOnGround (Shared)](https://wiki.mymp.gg/en/isPedOnGround.md): Tells whether a ped or player is on the ground.
- [isPedDucked (Shared)](https://wiki.mymp.gg/en/isPedDucked.md): Tells whether a ped or player is crouching.
- [getPedMoveState (Client)](https://wiki.mymp.gg/en/getPedMoveState.md): Tells how a ped on foot is moving.
