# CFX::DOES_PLAYER_EXIST

- **Hash:** `0x12038599`
- **Namespace:** CFX
- **Runtime name (Lua/JS):** `DoesPlayerExist`
- **Side:** server (Cfx runtime native)
- **Name status:** official
- **Documentation:** described with examples
- **URL:** https://natives.borderlinerp.com/natives/CFX/DOES_PLAYER_EXIST

## Signature

```c
BOOL DOES_PLAYER_EXIST(char* playerSrc);
```

## Parameters

- `playerSrc` (`char*`)

## Returns

`BOOL` — True if the player exists, false otherwise

## Description

*Source: Cfx.re native reference*

Returns whether or not the player exists

## Usage

### Lua

```lua
local retval = DoesPlayerExist(playerSrc)

-- always available, by hash
local retval = Citizen.InvokeNative(0x12038599, playerSrc, Citizen.ReturnResultAnyway())
```

### JavaScript

```js
const retval = DoesPlayerExist(playerSrc);

// by hash
const retval = Citizen.invokeNative('0x12038599', playerSrc, Citizen.returnResultAnyway());
```

### C#

```csharp
bool retval = Function.Call<bool>((Hash)0x12038599, playerSrc);
```

## Examples

*Source: Cfx.re native reference*

```lua
local deferralMessages = { "Isn't this just magical!", "We can defer all day!", "You'll get in eventually", "You're totally not going to sit here forever", "The Fruit Tree is a lie" }
AddEventHandler("playerConnecting", function(name, setKickReason, deferrals)
    local source = source
    deferrals.defer()

    Wait(0)

    local messageIndex = 0

    repeat
        Wait(2000)
        if messageIndex >= #deferralMessages then
            deferrals.done()
        else
            messageIndex = messageIndex + 1
        end
        deferrals.update(deferralMessages[messageIndex])
    until not DoesPlayerExist(source)
end)
```

*Sources: Cfx.re native reference.*
