# player\_disconnect

- **Ortam:** İstemci, Sunucu, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/gameevent/player_disconnect
- **Çeviri tarihi:** 2025-11-07

## Açıklama

Bir oyuncu sunucudan ayrıldığında çağrılır.

> **NOT:** Bu olay, bir oyuncu sunucuya bağlanmayı iptal ettiğinde de çağrılır.
> Yerel oyuncu için istemci tarafında veya tek oyunculu modda çağrılmaz.
> Bu oyun olayı (gameevent) istemci tarafında çağrıldığında, oyuncu NULL olacaktır! Bu yüzden `Player(data.userid)` kullanamazsınız!

## Üyeler

- [number](https://gmod.tr/wiki/number) **bot**

  Eğer oyuncu bir bot değilse 0, bot ise 1'dir.

- [string](https://gmod.tr/wiki/string) **networkid**

  Oyuncunun sahip olduğu SteamID. Botlar için `BOT`, tek oyunculu modda ise `STEAM_0:0:0` olur.

- [string](https://gmod.tr/wiki/string) **name**

  Oyuncunun sahip olduğu [isim](https://gmod.tr/wiki/Player.Nick).

- [number](https://gmod.tr/wiki/number) **userid**

  Oyuncunun sahip olduğu [UserID](https://gmod.tr/wiki/Player:UserID).

- [string](https://gmod.tr/wiki/string) **reason**

  Ayrılma sebebi.

## Örnekler

### Örnek

Bu, hangi değerlere erişilebileceğini kolayca anlaşılır kılmak amacıyla tüm argümanları / tablo değişkenlerini içeren temel bir şablondur.

```lua
gameevent.Listen( "player_disconnect" )
hook.Add( "player_disconnect", "player_disconnect_example", function( data )
	local name = data.name			// Player:Nick() ile aynı
	local steamid = data.networkid	// Player:SteamID() ile aynı
	local id = data.userid			// Player:UserID() ile aynı
	local bot = data.bot			// Player:IsBot() ile aynı, oyuncular için 0, botlar için 1 tamsayı değerini döndürür
	local reason = data.reason		// "Kicked by console!", "Timed out!" gibi metin formatındaki ayrılma sebebi...

	// Oyuncu ayrıldı - bu, PlayerDisconnect'ten daha güvenilirdir

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/gameevent/player_disconnect
