# SANDBOX:PlayerSpawnSWEP

- **Ortam:** Sunucu
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/SANDBOX:PlayerSpawnSWEP
- **Çeviri tarihi:** 2025-10-10

```lua
boolean SANDBOX:PlayerSpawnSWEP( Player ply, string weapon, table swep )
```

## Açıklama

Bir oyuncu, bir silah simgesine orta fare tuşuyla (fare tekerleğiyle) tıklayarak spawnmenüden yere bir varlık (entity) olarak bir silah oluşturmaya çalıştığında çağrılır.

Bu hook, yalnızca oyuncunun zaten sahip olmadığı bir silah doğrudan kendisine verildiğinde çağrılan [SANDBOX:PlayerGiveSWEP](https://gmod.tr/wiki/SANDBOX:PlayerGiveSWEP) ile karıştırılmamalıdır.

Varlık oluşturma sonrası olayı için [SANDBOX:PlayerSpawnedSWEP](https://gmod.tr/wiki/SANDBOX:PlayerSpawnedSWEP) sayfasına bakın.

## Argümanlar

1. [Player](https://gmod.tr/wiki/Player) **ply**: Silahı oluşturmaya çalışan oyuncu.
2. [string](https://gmod.tr/wiki/string) **weapon**: Oyuncunun oluşturmaya çalıştığı silahın sınıf adı.
3. [table](https://gmod.tr/wiki/table) **swep**: Oyuncunun oluşturmaya çalıştığı silah hakkındaki bilgiler, bakınız [SWEP yapısı](https://gmod.tr/wiki/Structures/SWEP)

## Dönen Değer

1. [boolean](https://gmod.tr/wiki/boolean): SWEP'in oluşturulup oluşturulamayacağı

### Örnek

Admin olmayanların silah oluşturmasını engeller.

```lua
hook.Add( "PlayerSpawnSWEP", "SpawnBlockSWEP", function( ply, class, info )
	if ( not ply:IsAdmin() ) then
		return false
	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/SANDBOX:PlayerSpawnSWEP
