# GM:OnPlayerChat

- **Ortam:** İstemci
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/GM:OnPlayerChat
- **Çeviri tarihi:** 2025-09-08

```lua
boolean GM:OnPlayerChat( Player ply, string text, boolean teamChat, boolean isDead )
```

## Açıklama

Bir oyuncu sohbet mesajı gönderdiğinde çağrılır. Sunucu taraflı karşılığı için [GM:PlayerSay](https://gmod.tr/wiki/GM:PlayerSay) sayfasına bakın.

> **NOT:** Bu hook'un girdisi (veya engellenmesi) [GM:PlayerSay](https://gmod.tr/wiki/GM:PlayerSay)'den gelen çıktıya dayanır. Sunucu tarafında engellenen sohbet olayları bu hook'u çağırmaz.

## Argümanlar

1. [Player](https://gmod.tr/wiki/Player) **ply**: Oyuncu
2. [string](https://gmod.tr/wiki/string) **text**: Mesajın metni
3. [boolean](https://gmod.tr/wiki/boolean) **teamChat**: Oyuncu takım sohbetine mi yazıyor?
4. [boolean](https://gmod.tr/wiki/boolean) **isDead**: Oyuncu ölü mü?

## Döndürülen Değerler

1. [boolean](https://gmod.tr/wiki/boolean): Mesaj engellenmeli mi?

### Örnek

Yalnızca istemci tarafında çalışan bir sohbet komutunu nasıl oluşturabileceğinize dair bir örnek.

```lua
hook.Add( "OnPlayerChat", "HelloCommand", function( ply, strText, bTeam, bDead )
    if ( ply != LocalPlayer() ) then return end

	strText = string.lower( strText ) -- metni küçük harfe çevirir

	if ( strText == "/hello" ) then -- eğer oyuncu /hello yazdıysa
		print( "Hello world!" ) -- konsola Hello world! yazdırır
		return true -- bu, mesajın gösterilmesini engeller
	end
end )
```

**Çıktı:** Sohbete `/hello` yazdığınızda konsola `Hello world!` yazdırır.

- [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/GM:OnPlayerChat
