# Player:SetActiveWeapon

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

```lua
Player:SetActiveWeapon( Weapon weapon )
```

## Açıklama

Oyuncunun aktif silahını ayarlar. Çoğu durumda bunun yerine [CUserCmd:SelectWeapon](https://gmod.tr/wiki/CUserCmd:SelectWeapon) veya [Player:SelectWeapon](https://gmod.tr/wiki/Player:SelectWeapon) kullanmalısınız.

Bu fonksiyon, silah değiştirme olaylarını veya ilişkili kuşanma animasyonlarını tetiklemez. [GM:PlayerSwitchWeapon](https://gmod.tr/wiki/GM:PlayerSwitchWeapon) kancasını ve o anki aktif silahın [WEAPON:Holster](https://gmod.tr/wiki/WEAPON:Holster) geri dönüş değerini atlar.

## Argümanlar

1. [Weapon](https://gmod.tr/wiki/Weapon) **weapon**: Kuşanılacak silah.

### Örnek

Bir oyuncunun silahını kınına koyar (gizler) ve 20 saniye sonra geri verir.

```lua
local ply = Entity( 1 )
local prevWeapon = ply:GetActiveWeapon()
local prevWeaponClass = prevWeapon:GetClass()

ply:SetActiveWeapon( NULL ) -- Silahı kınına koyar

timer.Simple(20, function()
	if ( !prevWeapon:IsValid() ) then
		prevWeapon = ply:Give( prevWeaponClass )
	end

	ply:SelectWeapon( prevWeapon )
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:SetActiveWeapon
