# Player:KeyPressed

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

```lua
boolean Player:KeyPressed( number key )
```

## Açıklama

Bir tuşa bu tick içinde yeni basılıp basılmadığını kontrol eder.

## Argümanlar

1. [number](https://gmod.tr/wiki/number) **key**: Bir [IN enum](https://gmod.tr/wiki/Enums/IN)'una karşılık gelir. Burada [bit.bor](https://gmod.tr/wiki/bit.bor) kullanabilirsiniz (bkz. örnek 2)

## Dönen Değer

1. [boolean](https://gmod.tr/wiki/boolean): Tuşa basılıp basılmadığı

### Örnek

Birinci oyuncu +forward tuşuna (w QWERTY klavyelerde) basmaya başladığında konsola yazı yazdırır.

```lua
hook.Add( "Tick", "CheckPlayer1Forward", function()
	if Entity( 1 ):KeyPressed( IN_FORWARD ) then
		print( "Player1 just started moving forward!" )
	end
end )
```

### Örnek

Oyuncuyu +attack, +attack2 veya +jump tuşlarından birine bastığında yeniden doğurur (varsayılan olarak sırasıyla lmb, rmb ve space)

```lua
local respawnKeys = bit.bor( IN_ATTACK, IN_ATTACK2, IN_JUMP )
hook.Add( "PlayerDeathThink", "DoRespawn", function( ply )
	if ply:KeyPressed( respawnKeys ) then
		ply:Spawn()
	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:KeyPressed
