# GM:PlayerSay

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

```lua
string GM:PlayerSay( Player sender, string text, boolean teamChat )
```

## Açıklama

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

> **NOT:** Eklentiler sohbet mesajlarını değiştirmek için genellikle bu hook'ta değerler döndürdüğünden, sunucu tarafında mesajları okumak için [gameevent/player_say](https://gmod.tr/wiki/gameevent/player_say) kullanmak daha güvenilir olabilir.

## Argümanlar

1. [Player](https://gmod.tr/wiki/Player) **sender**: Mesajı gönderen oyuncu.
2. [string](https://gmod.tr/wiki/string) **text**: Mesajın içeriği.
3. [boolean](https://gmod.tr/wiki/boolean) **teamChat**: Mesaj herkese yönelikse false, göndericinin takımına yönelikse true döndürür.

## Döndürülenler

1. [string](https://gmod.tr/wiki/string): Orijinal metin yerine ne gösterileceği. Mesajın görüntülenmesini engellemek için `""` olarak ayarlayın.

### Örnek

Sohbete yazı tura komutu ekler. Oyuncu `/flip` yazmalıdır (büyük/küçük harfe duyarsız).

```lua
hook.Add( "PlayerSay", "CoinFlip", function( ply, text )
	if ( string.lower( text ) == "/flip" ) then
		PrintMessage( HUD_PRINTTALK, ply:Nick() .. " flipped the coin and got " .. ( math.random( 2 ) == 1 and "heads" or "tails" ) )
		return ""
	end
end )
```

**Çıktı:**

```lua
Player1 flipped the coin and got heads
```

### Örnek

Sohbete bir sembol sayacı komutu ekler. Oyuncu `/len *metin*` yazmalıdır (büyük/küçük harfe duyarsız).

```lua
hook.Add( "PlayerSay", "CharCount", function( ply, text )
	if ( string.StartWith( string.lower( text ), "/len " ) ) then
		ply:ChatPrint( "Your message has " .. utf8.len( string.sub( text, 6 ) ) .. " symbol(s)." ) -- string.sub içinde 6 kullanıyoruz çünkü bu, "/len " metninin uzunluğu + 1'dir
		return ""
	end
end )
```

**Çıktı:**

```lua
Your message has 5 symbol(s). [Birisi şunu yazdığında: "/len Hello"]
```

- [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:PlayerSay
