# player.GetCount

- **Ortam:** İstemci, Sunucu
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/player.GetCount
- **Çeviri tarihi:** 2025-09-08

```lua
number player.GetCount()
```

## Açıklama

Aktif oyuncu sayısını döndürür.

> **NOT:** **#**[player.GetAll](https://gmod.tr/wiki/player.GetAll)() fonksiyonuna benzer, ancak oyuncu tablosunun oluşturulması gerekmediği için daha iyi performansa sahiptir. Eğer [player.GetAll](https://gmod.tr/wiki/player.GetAll) zaten bir döngü için çağrılıyorsa, tablo üzerinde **#** operatörünü kullanmak, JIT derlendiği için bu fonksiyonu çağırmaktan daha hızlı olacaktır.

> **NOT:** Sunucuya o an bağlanmakta olan oyuncular sayılmaz. İlgili fonksiyon: [player.GetCountConnecting](https://gmod.tr/wiki/player.GetCountConnecting)

## Döndürdüğü Değer

1. [number](https://gmod.tr/wiki/number): Oyuncu sayısı

### Örnek

Her 300 saniyede bir sohbete mesaj gönderme.

```lua
timer.Create("CountAdvert", 300, 0, function()
    local playerCount = player.GetCount() -- Sunucudaki oyuncu sayısını alıyoruz
    local message = "Sunucuda şu anda " .. playerCount .. " kişi oynuyor." -- Mesajımız

    -- Herkes için sohbete gönder
    for _, ply in player.Iterator() do
        ply:ChatPrint(message)
    end
end)
```

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/player.GetCount
